× Joomla Facebook Connect support forum

Topic-icon Add FB logout to cblogin module

Active Subscriptions:

None
15 years 10 months ago #4102 by fb_583797808
I did some searching on this board and there was no real definitive answer. I would like to use the CB login module, use your connector with the login form disabled to avoid the double logout button and add some code to the cblogin mod to also log the user out of facebook when they click logout. Is this possible?
The topic has been locked.
Support Specialist
15 years 10 months ago #4110 by alzander
Generally, it's not an easy change to add the FB button to other modules. We're working on methods to make it a few lines of code though, as we see the value of doing this. Right now, you should be able to disable most stuff in the JFBCLogin module, like the registration form and links and stuff and use it's logout button. Let me know if this causes you any problems and we can probably help you come up with some other ideas before we have a more fully-featured solution in an upcoming release.

Out of curiosity, what's in the CB Login module that makes you want to use it?
The topic has been locked.
Active Subscriptions:

None
15 years 10 months ago #4122 by fb_583797808
Well I have figured out how to hide everything including the logout button but I don't feel comfortable having peoples facebook remain logged in due to security reasons.

If you could help me out integrating the logout into the CBlogin module that would be great! I'm using it because it only required some CSS to modify the look. I didn't have to go into the code and add divs or spans so that I could style it.

Also on another note, I was one of the people asking for Agora Forum integration. I found a work around, if I install CB which is nice to have anyway, I just use the CB profiles with Agora, and import info from your plugin into CB. So in effect its all linked together. May not be the best way, but if the site uses CB & Agora it works.
The topic has been locked.
Support Specialist
15 years 10 months ago - 15 years 10 months ago #4146 by alzander
Try the following snippet of code:
<?php
require_once(JPATH_SITE.DS.'modules'.DS.'mod_jfbclogin'.DS.'helper.php');
modJFBCLoginHelper::insertJavascript();
?>
<input type="submit" name="Submit" class="button" value="<?php echo JText::_('Logout') ?>" onclick="javascript:logout_button_click()" />

The lowest line is what should be included in your logout section of code. Likely, you'll just need to update what is already there (in the CB module) and add the onclick="..." value in the logout button input.

We didn't test this code directly, but copied bits and pieces from the JFBCLogin module. It should work, but there might be a coding error or something. Let us know what happens and if you run into issues.

Good luck!

Edit: Some of the code was incorrect.
Last edit: 15 years 10 months ago by alzander.
The topic has been locked.
Active Subscriptions:

None
15 years 10 months ago #4152 by fb_583797808
So far so good, you are the man! For reference I added:

<?php
require_once(JPATH_SITE.DS.'modules'.DS.'mod_jfbclogin'.DS.'helper.php');
modJFBCLoginHelper::insertJavascript();
?>

To the top of the mod_cblogin.php

And then added onclick="javascript:logout_button_click() to line 492 from the same file:

echo '<div class="logout_btn'.$class_sfx.'"><span class="lgn_btn"><input type="submit" name="Submit" class="button'.$class_sfx.'" value="' . $buttonValue . '"' . $buttonStyle . ' onclick="javascript:logout_button_click()"/></span></div>';

Thanks again!
The topic has been locked.
Support Specialist
15 years 10 months ago #4153 by alzander
Yeah, guess I could have been more specific where to add the top portion (answer: pretty much anywhere). We recently updated the login module to let you call the insertJavascript function from other modules.. so that benefits you :)

Just so you know, the logout link will go wherever the JFBCLogin modules logout link is set for.. even though you're not directly using that module. It may be confusing, but that was our work around.

Let us know how it goes, and glad it's going well so far!
The topic has been locked.
Active Subscriptions:

None
15 years 3 months ago #8162 by fb_644061421
hello,

many thx for sharing this info!

one question though: does this also work with the settings "Auto Login Facebook Users" YES (and "Log Out Of Joomla Only" NO) (in the configuration - login/logout redirections tab). i really like the autologin feature and wouldnot want to miss it...it seems though when Autologin is turned on, its not working and when one clicks on the (CB) logout button, the user stays logged in (resp. the message "Automatically logging you in with your Facebook credentials") comes up.

cheers
The topic has been locked.
Support Specialist
15 years 2 months ago - 15 years 2 months ago #8172 by alzander
Oh boy! For starters, probably don't listen to what's in the post above! It's from July and from the 2.x branch of JFBConnect.

I know I mentioned to you the [JFBCLogin] tag. What you may want to do is make the minor change in the post below which will show a logout button whenever the user is logged in. This is compatible with the AutoLogin/Logout of Joomla Only options. An option for the JFBCLogin tag for adding the logout button will also be a part of 3.2, later this month:
www.sourcecoast.com/forums/topic?id=1618&p=2#p7399

Hope that post is self-explanatory.. it's buried in a long thread, which isn't relevant, but may make it confusing. If not, I'd recommend creating a new (quick) post and I can give more detailed instructions there..

Good luck.. I've added a task for us to lock really old threads. I know they come up in searches, so it's easy to not realize that the content is pretty old.. sorry about that!

Edit: Changed the link, was going to the wrong post in the right thread
Last edit: 15 years 2 months ago by alzander.
The topic has been locked.