[SOLVED] kunenalatest module blocking FBC

13 years 11 months ago #131014 by tdk1nc
Already did that. No JS errors present. ;)

Instead, the problem manifests as the plugin's generated javascript not being inserted into the page (whenever Kunena_Latest is active). Here's an example of the missing code (with api keys edited out)
[code:1]<script type="text/javascript" src="www.clevelandswings.org/joomla/components/com_comprofiler/js/jquery-1.4.2/jquery-1.4.2.min.js">
<script type="text/javascript"><!--
jQuery(document).ready(function($){
if ( window.FB ) { FB.init( '<YOINK!>', 'www.clevelandswings.org/joomla/components/com_comprofiler/plugin/user/plug_cbfacebookconnect/xd_receiver.htm', { permsToRequestOnConnect : 'email' } ); }});
--></script>
<script type="text/javascript"><!--
jQuery(document).ready(function($){
$( '.cbfbc_link' ).click( function() {if ( window.FB ) {FB.Connect.requireSession(function() {window.location = 'index.php?option=com_comprofiler&task=pluginclass&plugin=cb.facebookconnect&return=YOINK!!=&Itemid=37';});} else {alert( 'facebook.com not reachable' );}});});
--></script>[/code:1]

If I manually copy the missing javascript into the page (using mod_blank), the button works semi-correctly. I say "semi," because it appears that the plugin generates slightly different JS code for whatever button is being rendered (login vs link vs unlink). The above code was for the link operation. Unlink doesn't work with it active.

My website is www.clevelandswings.org , though the Facebook feature is currently inactive. I have a sandbox environment where we can play/test this issue, but it needs a little updating before it can provide an environment similar to my live site. Let me know if you'd like to do this, and I'll PM you the necessary info this weekend.

-T

Post edited by: tdk1nc, at: 2010/04/22 20:31

Please Log in to join the conversation.

13 years 11 months ago #131942 by tdk1nc
I have a tentative, experimental, alpha-level, hackish, "may not work for you and probably breaks something else" fix for this issue.

I'm not sure why it works, or what the initial problem was in the first place. I'm hoping that someone on the CB team with some Kunena integration experience can shed some light on the actual issue. In the mean time, the following fix *APPEARS* to allow the FBC plugin to work alongside mod_kunenalatest

Open the following file:
JOOMLAROOT/modules/mod_kunenalatest/helper.php

Line 15 should be
[code:1]require_once(JPATH_SITE.DS.'components'.DS.'com_kunena'.DS.'class.kunena.php');[/code:1]

Comment it out, which means to add a // to the beginning of the line.

Starting at line 14 (which is a blank line), paste the following 3 lines.

[code:1]//hack for fbc
define("KUNENA_COMPONENT_ITEMID_SUFFIX", "&amp;Itemid=" . KUNENA_COMPONENT_ITEMID);
define('KUNENA_LIVEURLREL', 'index.php?option=com_kunena' . KUNENA_COMPONENT_ITEMID_SUFFIX);[/code:1]

Save.

Pray.

Reload your page and see what happens!

Please Log in to join the conversation.

13 years 11 months ago #131943 by brentwilliams2
Replied by brentwilliams2 on topic Re: kunenalatest module blocking FBC
tdk1nc,
Thanks for the help - I wish I could help test the solution, but I'm not going to pay for the CB subscription without knowing if it is going to ultimately work for my situation. I think I found your Kunena post, and maybe you should post this solution there, too - the mods over there are usually very good and hopefully give some guidance on whether your solution will cause problems with other areas.

www.kunena.com/forum/12-community-builder/44181-cb-facebook-connect-not-working

(I'm disappointed that this is released on a pay-for scenario when it doesn't work with one of the more popular modules out there. Glad I did my research - unfortunately, a lot of other people may not have...)

Please Log in to join the conversation.

13 years 11 months ago #131953 by krileon
Replied by krileon on topic Re: kunenalatest module blocking FBC
The reason this is happening is due to the improper usage of Kunenas code. The module is including ALL of Kunenas frontend from the Class file for approx. 2 definitions; this is not practical and a mis-use of Kunenas code.

Kunena fires two triggers that is used by the Simpleboard plugin which cleans up JS for Kunenas frontend. The trigger onEnd is NOT fired by the module but onStart IS. This is causing the problem. Either this trigger can be added to the module or the module can be repaired to not include Kunenas class.

At any rate the module is not properly using Kunenas code (as in current releases a API isn't officially provided to my knowledge).


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

13 years 11 months ago #131957 by tdk1nc
Replied by tdk1nc on topic Re: kunenalatest module blocking FBC
krileon,

Thanks! That's exactly the factoid that I need.

Both solutions have drawbacks. Copy/pasting the appropriate 2 definitions is the most light-weight approach, but I suspect that it makes it more likely that future Kunena revisions won't work correctly with the module. Correctly firing the appropriate events seems better from a longevity standpoint, but (as you observed) we're including an entire class for two definitions.

Since this really isn't my code (and I'm not familiar with any of these APIs in the first place), my next stop is the Kunena forum! Hopefully we can bring this issue to a conclusion.

-T

PS. Just to save me some time later, can you give me an example of firing the onStart and onEnd events, so I know what to look for?

Post edited by: tdk1nc, at: 2010/05/02 01:36

Post edited by: tdk1nc, at: 2010/05/02 01:37

Please Log in to join the conversation.

13 years 11 months ago #132049 by krileon
Replied by krileon on topic Re: kunenalatest module blocking FBC
In reality the module should not need to include ANY of Kunenas files. The entire module can be done with a simply query which checks permissions, etc.. everything necessary. Then of course some HTML to style the modules content. The module is poor by design and should be redone or not used at all. Please use at owns risk as including all of Kunenas code for a single module is not practical (Kunena will be providing an API in later releases).

If you wish to use it anyway you can trigger the onEnd trigger with the following. Please note you will need to check the locations of the modules returns as you can not simply add it before the last return in its display function as it may have a return before then which again would result in same issue happening.

[code:1]
global $_PLUGINS;
$_PLUGINS->trigger( 'onEnd', null );
[/code:1]


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.220 seconds

Facebook Twitter LinkedIn