Page 2 of 2

Re: show login form in the popup or lightbox

Posted: Sat Mar 05, 2011 6:58 pm
by Webdongle
Yes, Create it in an Article view code <> Then paste into the url of the menu item.

Re: show login form in the popup or lightbox

Posted: Tue Mar 08, 2011 12:30 pm
by gilles007
hey guys, still trying to use the "modal" version of the solution. Still no go.

Do I put the php line in my template's index.php?

PS. the class="modal" syntax generates an error, so it's still unclear as to the correct syntax for the url to make the login component modal.

any ideas?
G

Re: show login form in the popup or lightbox

Posted: Fri Mar 11, 2011 2:57 pm
by quazi_ahasan
hi, I tried and followed your way but how can I control the forms hight & width, I appreciate your help.... :)
gilles007 wrote:Hi Webdongle,

I put this in as an external URL link:

Code: Select all

http://www.mysite.com/index.php?option=com_user&view=login&tmpl=component" rel="width[400];height[500];" class="jcepopup 
I hope that makes sense.
G

Re: show login form in the popup or lightbox

Posted: Fri Mar 11, 2011 3:11 pm
by gilles007
did you try using the width/height as shown in the example?

by the way, I trashed this whole idea as it wasn't working properly for me and ended up using YOOlogin in a module position instead.
G

Re: show login form in the popup or lightbox

Posted: Sat Mar 12, 2011 7:23 am
by quazi_ahasan
Hi G, thanks for replying and for me to it seems not a good idea. because it does not pop-up, opens a new window, which can be done by any menuitem. what about your new idea, is it working well?

By the way I tryed the Hight and width measurement. Didn't worked.

Re: show login form in the popup or lightbox

Posted: Sat Mar 12, 2011 1:15 pm
by gilles007
yes quazi,

the yootools solution worked perfectly. I used the slim setting of the extension and positioned it near the bottom of the site. This way it's unobtrusive. Not a popup but does the job.

give it a try.
G

Re: show login form in the popup or lightbox

Posted: Mon May 23, 2011 8:09 am
by bigsky
MeeDNite wrote:Hi,
Use This:

Code: Select all

<?php JHTML::_('behavior.modal'); ?>
<a class="modal" href="index.php?option=com_user&view=login&tmpl=component">login</a>
Thanks Milad. This works almost flawlessly, much appreciated. I have one question. I placed the above code in the Footer of my site and it pops up the modal window as expected and I can login.

Do you or anyone else know how to code this so that when I successfully login, I have write code to dynamically change the "Login" text to "Logout" so that if I click on Logout it calls that function.

Right now, with the code you've given, I have only two ways of logging out. 1>Session expires or, 2>I have to place the login module somewhere, which is what we don't want. Defeats the purpose of what were trying to do.

I've been researching this and trying many things but I'm not knowledgeable in PHP. Any help is appreciated. Been researching MVC Framework and php coding but there's tons to learn. ;p
Not knowing what I'm doing I thought something like this, but I'm clueless. It's the idea that counts right now. I think maybe the book I have uses oldstyle Joomla coding techniques as well. Any ideas anyone?? The below code doesn't work but it's what looks like should work. Heh..

Code: Select all

	<?php JHTML::_('behavior.modal'); ?>
		<a class="modal" href="index.php?option=com_user&view=login&tmpl=component">
<?php
 		if ($user->guest) {
 			echo '<a href="index.php?option=com_user&view=login&tmpl=component">Login</a>';
 		} else {
 			$name = $user->get('username'); 
 			echo "Logged in as " . $name . ", ";
 			echo '<a href="index.php?option=com_user&view=login&tmpl=component">';
 			echo '	Logout';
 			echo '</a>';
 		}
?>
 		</a>
The following code atleast works but only 3/4 or the way IMO. The above code breaks the page. The code below atleast pops up the modal window and I login, but the link isn't changing.

Code: Select all

<?php JHTML::_('behavior.modal'); ?>
<a class="modal" style="color:#FFFFFF;" href="index.php?option=com_user&view=login&tmpl=component">
<?php echo ($user->guest) ? "Login" : "Logout" ?>
</a>
So the link always says "Logout" no matter what. But if I click on the logout link the Modal window will open where the "Logout" button is and I can logout. I'm assuming since I don't know much this is probably fairly insecure.. My uname and passwords are strong, it's the code that's bunk.. my code.. heh

Thanks,
Bigsky

Re: show login form in the popup or lightbox

Posted: Wed Jun 15, 2011 5:28 pm
by verticalgrain
I think this module (YJ Pop Login) would serve for this purpose as well and is very easy to use since you just have to install and enable it:

http://extensions.joomla.org/extensions ... ation/8646

Re: show login form in the popup or lightbox

Posted: Wed Jun 15, 2011 6:29 pm
by kurchania
@verticalgrain
YJ popup login is good but it conflict with jquery of you have any plugin

Re: show login form in the popup or lightbox

Posted: Wed Jun 15, 2011 9:44 pm
by bigsky
@verticalgrain
I appreciate your input and helpful hints. What I dislike doing with Joomla is consistently installing 3rd party plugins to solve problems that appear to be solvable through existing native/built-in code. Basically the less 3 party plugins the better IMO.

I've got the code working above but don't have the PHP know how to get it working correctly. Surely I'm missing something very simple that I don't understand with the php coding or javascript/jquery.

I hope someone can point out how to adust my code above to simply change the link title from login to logout once someone logs in. I'm thinking maybe this might be something I can do with jquery or javascript, but I'm new to those technologies as well. Oh well. I'll get it figured out and post back my findings if I ever get the time to do more research on the issue. I can't be the only one that could benefit from achieving this functionality via native methods without having to resort to yet another 3rd party plugin.

Re: show login form in the popup or lightbox

Posted: Tue Jun 21, 2011 5:31 pm
by bigsky
Here's the fix thanks to some friendly help from one of the PHP guru's on the Rochen Forums where I host.

Code: Select all

<p class="loginbox" style="color:#FFFFFF;text-align:center;">
<?php JHTML::_('behavior.modal');
$user =& JFactory::getUser();
 ?>

<a class="modal" href="index.php?option=com_user&view=login&tmpl=component">
<?php
      if ($user->guest) {
         echo '<a class="modal" style="color:#FFFFFF;"
		 href="index.php?option=com_user&view=login&tmpl=component">Login</a>';
      } else {
         echo '<a class="modal" style="color:#FFFFFF;" href="index.php?option=com_user&view=login&tmpl=component">';
         echo 'Logout';
         echo '</a>';
      }
?>
</a>
</p>
Works for me. Hope that helps others. No need for a 3rd party plugin.

Re: show login form in the popup or lightbox

Posted: Tue Jun 21, 2011 6:39 pm
by gilles007
Thanks for posting/sharing your solution bigsky.

Re: show login form in the popup or lightbox

Posted: Tue Jun 21, 2011 8:39 pm
by bigsky
No problem gilles007. Hope someone can put it to use.

Bigsky

Re: show login form in the popup or lightbox

Posted: Wed Jun 22, 2011 6:48 pm
by kurchania
@bigsky
thanx for your solution much appreciated
but i guess i already mention this thing before :laugh:

Re: show login form in the popup or lightbox

Posted: Wed Jun 22, 2011 8:37 pm
by bigsky
kurchania wrote:@bigsky
thanx for your solution much appreciated
but i guess i already mention this thing before :laugh:
Hi Kurchania,

I understand you offered some help and I'm thankful for that. As well as all the others that spent the time to comment in this thread. That got me started looking in the right direction. And that helped. But it was only half the solution for me.

I don't want to rely on 3 party plugins/modules when we can use the built-in native login code to achieve the same goal. Everywhere I looked for solutions, everyone was given the same answer. Poping open a modal window is half the solution IMO, and using 3rd party solutions to solve this task is silly. That's just my opinion and maybe the original thread opener was satisfied with a half baked solution that is stuffed with unneeded code from some 3rd party.

What My Code Offers and what I was trying to accomplish:
  • Use Joomla native login code with as few lines of code as possible.
  • Calling the Joomla login component via an anchor link, called "Login",(can be any anchor link you want) in the footer of the site that will open in a modal window.
  • Once the user authenticates, the "Login" link dynamically changes to say "Logout".
  • Once the user logs out, the anchor link dynamically changes back to say "Login".
Rationale:
  • We want a way for junior admins to login without dedicating a whole article/page just to login/logout.
  • Calling the login component via a modal window gives us the functionality above.
  • Placing the code in the footer of the templates index.php file, allows access to the login function, regardless of which page you are on.
  • Being that it pop's up in a modal window saves on screen real-estate.
  • Dynamically changing the link text from Login to Logout, when logged in. And from Logout to Login after logging out is a friendly and responsible way to remind our junior admins at a glance if they are still logged in or not. (For my task, once logged in, I was told to make the "Logout" Font Size 24px in red to help them remember to logout. Their company policy, not mine. :D
  • No need to spend ANY time worrying about updating/patching YET another 3rd party Extension. If time is money for you, then guess what? Your saving yourself some money. :P
So if someone is looking for a solution like I was, then it's all there. Ultra lean on code, and very flexible.

The most important part of the code that was missing for me was the need to refresh the USER OBJECT. IE..
$user =& JFactory::getUser();
Without the code above, my anchor links wouldn't dynamically change state as needed.

Code: Select all

<p class="loginbox" style="color:#FFFFFF;text-align:center;">
<?php JHTML::_('behavior.modal');
        $user =& JFactory::getUser();  // Gets and refreshes user object
?>

<a class="modal" href="index.php?option=com_user&view=login&tmpl=component">
<?php
      if ($user->guest) {
         echo '<a class="modal" style="color:#FFFFFF;"
       href="index.php?option=com_user&view=login&tmpl=component">Login</a>';
      } else {
         echo '<a class="modal" style="color:#FFFFFF;" href="index.php?option=com_user&view=login&tmpl=component">';
         echo 'Logout';
         echo '</a>';
      }
?>
</a>
</p>

Thanks Everyone,
Bigsky

Re: show login form in the popup or lightbox

Posted: Fri Jun 24, 2011 6:13 pm
by kurchania
@bigsky
thanx for your explanation

Re: show login form in the popup or lightbox

Posted: Fri Sep 16, 2011 9:59 am
by djoshi
<?php JHTML::_('behavior.modal'); ?>
<a class="modal" href="index.php?option=com_user&view=login&tmpl=component">login</a>

This code in not working on my local server. Instead of opening in popup, it is opening like <a href=""> without any effect.

Please help.

Re: show login form in the popup or lightbox

Posted: Sat Nov 26, 2011 6:16 am
by bigsky
djoshi wrote:<?php JHTML::_('behavior.modal'); ?>
<a class="modal" href="index.php?option=com_user&view=login&tmpl=component">login</a>

This code in not working on my local server. Instead of opening in popup, it is opening like <a href=""> without any effect.

Please help.
Hi djoshi,

On my localhost WAMP setup, I cut and pasted your code into the footer div of my templates index.php file and it opens in a modal window like it's supposed to. Not sure why this isn't working for you.

I'm using Joomla 1.5.x. I don't know how this code works in Joomla 1.6 or .7

You didn't specify where you were placing your code. Via an Article or via index.php file. If your placing this code via article manager then some code could be getting stripped by your editor or possibly your template makers code if your using a 3rd party template coded by someone else.

To be honest I really don't know WHY this isn't working for you. I'm just trying to help you get more specific so you can get some better help from someone else.

Good luck. You might even try opening your own thread at the same time. Get double exposure and possibly double the help in this thread and the new one. :D

Re: show login form in the popup or lightbox

Posted: Wed Jan 18, 2012 12:35 am
by Benixgo
...Hi guys...I have inserted this code in a module position ( <!--?php JHTML::_('behavior.modal'); ?--> <a class="modal" href="login">LOGIN</a> ) ...It's working but when you login, the page load in the light box itself...That's not good at all...

...The light box need's to close and then load the redirect page...How can I do that...?

...Thanks for the help...!

Ben

Re: show login form in the popup or lightbox

Posted: Tue Feb 21, 2012 8:50 pm
by webcreativeng
Hello, everyone. I just saw this post and like the login form.
But when I used it, I get a "An error has occurred" message.
Please help....
Thanks

Re: show login form in the popup or lightbox

Posted: Sun Jul 15, 2012 11:27 pm
by rokson
bigsky wrote:Here's the fix thanks to some friendly help from one of the PHP guru's on the Rochen Forums where I host.

Code: Select all

<p class="loginbox" style="color:#FFFFFF;text-align:center;">
<?php JHTML::_('behavior.modal');
$user =& JFactory::getUser();
 ?>

<a class="modal" href="index.php?option=com_user&view=login&tmpl=component">
<?php
      if ($user->guest) {
         echo '<a class="modal" style="color:#FFFFFF;"
		 href="index.php?option=com_user&view=login&tmpl=component">Login</a>';
      } else {
         echo '<a class="modal" style="color:#FFFFFF;" href="index.php?option=com_user&view=login&tmpl=component">';
         echo 'Logout';
         echo '</a>';
      }
?>
</a>
</p>
Works for me. Hope that helps others. No need for a 3rd party plugin.
Is possible to use this code in mod_hellome for Jomsocial login and how? I really need this :(

Re: show login form in the popup or lightbox

Posted: Tue Apr 16, 2013 3:50 pm
by schweiner
Hello, i have a problem.

-------
<?php JHTML::_('behavior.modal'); ?>
<a class="modal" href="index.php?option=com_user&view=login&tmpl=component">login</a>
-------

Why does when a user type key "X" the popup close ?

i have joomla 1.5. Thanks for any help.

Re: show login form in the popup or lightbox

Posted: Tue May 14, 2013 9:24 pm
by schweiner
No one ?
schweiner wrote:Hello, i have a problem.

-------
<?php JHTML::_('behavior.modal'); ?>
<a class="modal" href="index.php?option=com_user&view=login&tmpl=component">login</a>
-------

Why does when a user type key "X" the popup close ?

i have joomla 1.5. Thanks for any help.

Re: show login form in the popup or lightbox

Posted: Tue May 28, 2013 9:06 pm
by schweiner
Ok. look: media/system/js/modal.js and delete - case 'x': - bye.
schweiner wrote:No one ?
schweiner wrote:Hello, i have a problem.

-------
<?php JHTML::_('behavior.modal'); ?>
<a class="modal" href="index.php?option=com_user&view=login&tmpl=component">login</a>
-------

Why does when a user type key "X" the popup close ?

i have joomla 1.5. Thanks for any help.