Topic-icon Modal login link for articles

Active Subscriptions:

None
9 years 5 months ago - 9 years 5 months ago #49473 by peforever
How can I place a text or image link in an article that will open the modal login panel?
I would also like to add a text or image link that can log out.
Last edit: 9 years 5 months ago by peforever.
The topic has been locked.
Support Specialist
9 years 5 months ago #49477 by mel
Replied by mel on topic Modal login link for articles
Please see the 'How can i open the SCLogin Modal Popup with a regular link?' question in our SCLogin Common Support Questions. Starting at the second paragraph, what you're looking for is described:
www.sourcecoast.com/sclogin/documentatio...n-support-questions/

-Melissa
The topic has been locked.
Active Subscriptions:

None
9 years 5 months ago - 9 years 5 months ago #49480 by peforever
Hi Mel,
That works great.
How can I add a Log out button to my article?
Last edit: 9 years 5 months ago by peforever.
The topic has been locked.
Support Specialist
9 years 5 months ago #49493 by alzander
Add the following code to your article, which will show the login buttons when the user is a guest and the logout button when they are logged in:
{JFBCLogin logout=true}
I hope that helps,
Alex
The topic has been locked.
Active Subscriptions:

None
9 years 5 months ago - 9 years 5 months ago #49496 by peforever
Alex,
I do not want the buttons. I need to add the Log out link to a line of text in an article.
Thanks!
Last edit: 9 years 5 months ago by peforever.
The topic has been locked.
Support Specialist
9 years 5 months ago #49500 by alzander
You can *try* the following:
{JFBCLogin provider= logout=true}
I'm honestly not sure if JFBConnect will show all buttons or no buttons with provider equal to nothing, but it's worth a shot.

Beyond that, we don't have anything that would do that then and you wouldn't need something special in JFBConnect. You just need a standard Joomla logout button. That can be done either with some HTML to create a form (but may have issues with the Joomla session token) or, more likely, there's some plugin out there that specifically lets you add a logout button wherever you want. I don't know of a plugin off-hand, but I've got to assume it already exists for Joomla somewhere.

I hope that helps,
Alex
The topic has been locked.
Active Subscriptions:

None
9 years 5 months ago #49503 by peforever
Earlier, I used this code (from: www.sourcecoast.com/sclogin/documentatio...n-support-questions/):
<a class="btn btn-primary" href="#login-modal" data-toggle="sc-modal">Log In</a>
Then I deleted the button class so I could have some text with the login link.
It worked fine.
What is the code I could use to do the same to Log out?
Thanks!
The topic has been locked.
Support Specialist
9 years 5 months ago #49506 by mel
Replied by mel on topic Modal login link for articles
The problem with just adding generic HTML calls like in the common support question is updating the social network and Joomla tokens properly. In addition, you'll also need to check whether the user visiting the page is a guest or logged into the site already. This is not as simple as you are thinking if you're not familiar with developing your own custom PHP modules, which is why Alex suggested on looking into other modules/plugins that are out there. If you do want to go down the route of doing it yourself, you will need to find a developer to do the following:

1. You will need to do PHP, so you'll need to create a custom PHP module and then load that module within your article content. Custom PHP modules are not standard with Joomla, so you'll have to find a module that can do this easily for you.

2. In your module, determine if the user is a guest and if so, display the logout link.

3. To create the logout link, here's the code that we use to build up the logout button in the {JFBCLogin} tag that Alex was referring to (located in /components/com_jfbconnect/libraries/widget/login.php around line 62):
$logoutUrl = base64_encode(JRoute::_($logoutUrl, false));
$logoutButtonId = $this->providerLoginInfo[$this->provider->name]->logoutButtonId;
$buttonHtml = '<input type="submit" name="Submit" id="' . $logoutButtonId . '" class="button btn btn-primary" value="'. JText::_('JLOGOUT') . "\" onclick=\"javascript:jfbc.login.logout('" . $logoutUrl . "')\" />";

4. You will have to modify the input tag to be a text link as desired (there should be tutorials/easily found on Google on how to do this).

If you aren't familiar with development, I would highly suggest perusing the JED first to see what's out there.

-Melissa
The topic has been locked.