× Joomla Facebook Connect support forum

Topic-icon Logout link instead of button

Active Subscriptions:

None
Hello,

I've downloaded the latest version 3.1.2. It works fine.

Question:
I want to replace the Logout button in the module with a link. So I've just replaced in the default.php the line with the button code.

BUTTON:
<input type="submit" name="Submit" id="jfbcLogoutButton" class="button" value="<?php echo JText::_('Logout') ?>" onclick="javascript:jfbc.login.logout_button_click()" />

works!

LINK
<a href="" onclick="javascript:jfbc.login.logout_button_click()"><?php echo JText::_('Logout') ?></a>

Doesn't work. Doesn't seem to call the logout properly. any ideas on how to get rid of the ugly button?
Solution 1: Able to have a link instead of button in the module.
Solution 2: And the perfect solution would work outside the module, s.t. I can use the link anywhere with module potentially disabled. I think you mentioned in earlier reply it should work. so maybe if I get link working we can use it already anywhere.


Rgds
Lars
The topic has been locked.
Support Specialist
15 years 4 months ago #6999 by alzander
Try setting the href="javascript:void(0);" That will prevent the link from automatically being followed and ensure the Javascript to logout of both Facebook and the site are called. Hopefully that will fix you up, but please report your results!

Good luck!
The topic has been locked.
Active Subscriptions:

None
15 years 4 months ago #7013 by fb_100000501858606
Yes, that worked. Thanks

As reference for others here is my code:

<?php
$user =& JFactory::getUser();
if ($user->guest) {
echo '<div>{JFBCLogin} &nbsp&nbsp or &nbsp<a href="http://mydomain/login">Login
';
} else {
$name = $user->get('username');
echo "<div>Logged in as " . $name . ", ";
?>
<a href="javascript:void(0)" onclick="javascript:jfbc.login.logout_button_click()"><?php echo JText::_('Logout') ?></a>
<?php
}
?>
The topic has been locked.
Support Specialist
15 years 4 months ago #7025 by alzander
Thanks for posting what worked for you, and glad to hear it worked. I can see adding this as an option for the {} JFBCLogin tag when we add the logout parameter. Always good to have verification of functionality first!

Thanks again for your feedback, and let us know if there's anything else we can help with.
The topic has been locked.