× Joomla Facebook Connect support forum

Topic-icon Autologout to invite!

Active Subscriptions:

None
15 years 4 months ago #7392 by dagofee
Hello there,

Hopefully this wasn't time wasted
I wanted to develop an Invite page where actually every User of my community could be able to use your (amazing) JFBInvite functionality.
To do this I simply published {\ JFBCLogin } and {JFBCInvite} in my article.

The problem: almost every user of my community is already logged throught its own jomsocial account and accessing the invite-page JFBCLogin instead of the "Login with Facebook" button we read just "You have to log in with facebook to invite your friends".

The best thing (maybe you know how must be a line or 2 of code that I can't write) would be to get automatically disconnected WHEN the user is not connected throught facebook.
I managed just to display a message "You have to LOG OUT first"
If you click the log out you actually log out and get redirected to the same page instead of joomla or JFBC default that could be another for another reason like in my case.
Once the user clicks the log out text, the text disappear and the "Login with facebook" button appears right there.

I opened modules/mod_jfbcinvite/tmpl/default.php and added
$user =& JFactory::getUser();
        if($user->id) {
                echo '<script type="text/javascript">';
                $returnURL = base64_encode('http://www.xxx.com/invite.html');
                echo 'document.write(\'You have to <a href="index.php?option=com_user&task=logout&return='.$returnURL.'">Logout</a> first!\')';
                echo '</script>';
        }
you have to change www.xxx.com/invite.html

right after
if ($fbUserId == null)
{

and commenting the JFBC "You have to log in with facebook"
#       echo '<div class="jfbcinvite_desc">'.$params->get('nouser_intro')."</div>";
The topic has been locked.
Support Specialist
15 years 4 months ago #7418 by alzander
Replied by alzander on topic Autologout to invite!
Dagofee,
I'm not sure I'm understanding exactly what you're trying to do, so I have a few suggestions which may hopefully help.

Alright, so your goal is to let user's invite their friends from Facebook. I'm not sure why they need to log out though. One thing you can do is have them re-connect or map their Facebook accounts to their JomSocial/Joomla account. This can be done by just having them click the Login With Facebook button if they're already logged into your Joomla site. No need to logout first.
There's 2 caveats to this:
1) You'll have to add the { JFBCLogin} text to the template file of the Invite module. Just add it above where you're telling the user to logout, instead.
2) You'll want to make the changes to the JFBCLogin tag to make sure it appears even when a user is logged into Joomla. Just read from the post I link to on down, the rest is regarding a different issue:
www.sourcecoast.com/forums/topic?id=1618&p=2#p7399

With that, there's 2 bonuses: It should get more users to sync there accounts, and is less confusing. We're planning on implementing both of these changes in upcoming releases of the Invite module and component (for the JFBCLogin tag)

Finally, one thing I'm unsure about is before you moved to JFBConnect if you had a lot of users that were using the JomSocial Facebook Connect functionality. If so, and you need to migrate those connections over, make sure you read the section about importing from 3rd party connections in the config guide below:
www.sourcecoast.com/extensions/jfbconnec...ration-guide?start=9

Hope this all helps, and sorry to make you go around modifying our stuff! If you have any questions, let us know.. and thanks for letting us know how you're using the component. Always good to hear example usage cases as it helps us make things better in the future!
The topic has been locked.
Active Subscriptions:

None
15 years 4 months ago #7455 by dagofee
Replied by dagofee on topic Autologout to invite!

alzander wrote: 2) You'll want to make the changes to the JFBCLogin tag to make sure it appears even when a user is logged into Joomla. Just read from the post I link to on down, the rest is regarding a different issue:
www.sourcecoast.com/forums/topic?id=1618&p=2#p7399


THANKS
this was exactly what I needed
The topic has been locked.
Support Specialist
15 years 4 months ago #7462 by alzander
Replied by alzander on topic Autologout to invite!
No problem. Glad we could help you out. If you have any other questions, just let us know. And as I said above, we'll be adding more functionality to the JFBCLogin tag in the upcoming release to add a logout button (at least) for users who are logged in.

Good luck!
The topic has been locked.