× Joomla Facebook Connect support forum

Topic-icon Auto Connect when inside canvas

Active Subscriptions:

None
14 years 9 months ago #12959 by Ivan
Hi,

Is there a way or method using JFBConnect where once you send an invite via the JFBCInvite module that once the user clicks on the invite he is prompted for permssions then autoconnects with JFBconnect once inside the fb canvas?
The topic has been locked.
Support Specialist
14 years 9 months ago #12979 by alzander
That would have to be some special code, but we can help you to do it.

Mainly, in the Invite module, you'd want to set the Invitee Welcome URL to have a special parameter in it that will indicate it's for users that have just been invited.. so update it to something like:
mysite.com/index.php?jfbcinvited=1

Then, on your site, you could add the following code which should pop-up the Login box when it sees that parameter:
<?php if (JRequest::getVar('jfbcinvited', 0))
  echo '<script type="text/javascript">jfbc.login.login_custom();</script>';
?>

You could enter that code either directly into your template (not as flexible), or by using a module that lets you insert PHP code on a page, like Custom Code:
extensions.joomla.org/extensions/edition...code-in-modules/2861

Hope that helps get you started, but if you have any questions, just let us know!
Alex
The topic has been locked.
Active Subscriptions:

None
14 years 9 months ago #12980 by Ivan
Hi Alex,

I created the type of URL you stated i send as the invite. But it doesnt seem to do the trick. I also pasted sample code on my template and it didnt work either.


I also tried on both the template index.php and in modules/mod_jfbclogin/tmpl/default.php but that also didnt work
$fbinvitee = JRequest::getVar('jfbcinvite',0);
if($fbinvitee == 1){
    $js = 'window.addEvent(\'domready\',function(){fbc.login.login_button_click();});';
    $document =& JFactory::getDocument();
    $document->addScriptDeclaration($js);
    
   // echo '<script type="text/javascript">jfbc.login.login_button_click();</script>'; 
 
}
The topic has been locked.
Support Specialist
14 years 9 months ago #12988 by alzander
A couple of things:
* You can't use the addScriptDeclaration in the template file, since that's where the addScriptDeclaration is trying to put the code (it may work, but ordering will matter). It should work in the module file though.
* In your javascript, you're missing the 'j' in jfbc.login.login....
* When you click the invite, can you see the 'jfbcinvite' parameter? Also, just to make sure, the parameter I mentioned to tack onto the URL was 'jfbcinvited', and you're using 'jfbcinvite' in the JRequest check.

Hope those help, if not, let us know.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
14 years 9 months ago #13019 by Ivan
Im using this on top of the login module code: modules/mod_jfbclogin/tmpl/default.php
I buiild this type of url : apps.facebook.com/myapp/page/368/?invitee=1

The if statement executes with the aboce parameter invitee but not the Javasscript.
Do you think i might have to move this with the plugin?
$fbinvitee = JRequest::getVar('invitee',0);
    
if($fbinvitee == 1){
   
  //  $js = 'window.addEvent(\'domready\',function(){jfbc.login.login_button_click();});';
  //  $document =& JFactory::getDocument();
  //  $document->addScriptDeclaration($js);
    
    echo 'jfbc.login.login_button_click();'; 
}   
The topic has been locked.
Support Specialist
14 years 9 months ago #13043 by alzander
You won't have to do it in the plugin. Anywhere on the page should be fine. The problem I see with the above code is that you're not specifying it within a script tag. My guess is that the jfbc.login.login_button_click() text is simply being printed on the screen. You really should echo out something like:
echo '<script type="text/javascript">jfbc.login.login_button_click();</script>

Hope that helps, but if not, can you post a link to your page so we can check what's happening?

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
14 years 9 months ago #13069 by Ivan
hi alex. i just sent u the link via pm.
The topic has been locked.
Support Specialist
14 years 9 months ago #13079 by alzander
Ahh.. gotcha. Thanks for the link.

The problem is that the Facebook library wasn't initialized by the time that login call is being made. I'd recommend adding the jfbc.login.login_custom() call to the JFBC System plugin, right after the FB.Canvas.setSize() call. That will make sure that the library is properly initialized before trying to popup the login window.

Hope that helps, and good luck,
Alex
The topic has been locked.
Active Subscriptions:

None
14 years 9 months ago #13081 by Ivan
Hi Alex. Putting jfbc.login.login_button_click(); makes the page reload endlessly.....
The topic has been locked.
Active Subscriptions:

None
14 years 9 months ago #13216 by Ivan
Did you guys test this ? Could not get your solution to work
The topic has been locked.