The Joomla! Forum ™





Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 131 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next
Author Message
PostPosted: Tue Sep 01, 2009 3:52 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Mon Jul 06, 2009 8:45 pm
Posts: 32
Thanks a lot. I have a small issue...When I login to the application through the Home page and when I log out I am not logged out of the main login. If I close the browser or click the back button, the user is still logged in and you have to click Log out twice to get back to the home page. Do you have any suggestion...Than you once again


Top
 Profile  
 
PostPosted: Tue Sep 01, 2009 5:05 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Tue Sep 01, 2009 8:05 am
Posts: 5
Hey sraj49!

I'm not experiencing the same problem that you are having. Do you need to upgrade your Joomla! system to the latest? I made some improvements to our little method however... Maybe this will help. I hope it does!

This is a compilation of work done by iamwaggle, sraj49, and Olaf:

~~~~Login Redirect Hack~~~~

1: create field for the url........For this you need to change the following codes:

a) admin/component/com_user/models/user.xml ...add this at the end....
Code:
<param name="url" type="text" default="" label="Front-end Login Redirect" description="URL redirect for a Front-end login" />
<param name="adminurl" type="text" default="" label="Back-end Login Redirect" description="URL redirect for a Back-end login" />


b) admin/components/com_user/models/registered.xml...add this at the end...
Code:
<param name="url" type="text" default="" label="Front-end Login Redirect" description="URL redirect for a Front-end login" />
<param name="adminurl" type="text" default="" label="Back-end Login Redirect" description="URL redirect for a Back-end login" />


2: After this go to components/com_user/controller.php...after line 146???

In the login function, change this:
Code:
if(!JError::isError($error)){
      
// Redirect if the return url is not registration or login
if ( ! $return ) {
$return= 'index.php?option=com_user';
}


To this:
Code:
if(!JError::isError($error))
{
$user =& JFactory::getUser();
$user->getParameters();
if (!$user->getParam('url') == ''){
$return = $user->getParam('url');
}

// Redirect if the return url is not registration or login
if ( ! $return ) {
$return = 'index.php?option=com_user';
}


3: /administrator/components/com_login/admin.login.php... after line 66???

In the login function, change this:
Code:
if (!JError::isError($result)) {
$mainframe->redirect('index.php');
}


To this:
Code:
$user =& JFactory::getUser();
$user->getParameters();
$return = $user->getParam('url');

if (!JError::isError($result) && ! $return) {
$mainframe->redirect('index.php');
}else if (!JError::isError($result)) {
$mainframe->redirect($return);
}



Now when you create a user using the User Manager, you can specify the Front-End and Back-end URLs. These can be edited at any time. When you make this change to a user's parameters, the login automatically redirects the user to the specific URL in the user profile.

Many thanks to Raj and Olaf for laying all the groundwork!
~iamwaggle


Top
 Profile  
 
PostPosted: Tue Sep 01, 2009 6:10 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Mon Jul 06, 2009 8:45 pm
Posts: 32
Thanks a lot and youy are welcome..


Top
 Profile  
 
PostPosted: Tue Sep 01, 2009 6:14 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Tue Sep 01, 2009 6:10 pm
Posts: 3
Raj - I added your code and it works when you create a new user (thank you!)

But when I go back in to EDIT the user, the URL field does not appear, so I can't change it, short of deleting and re-creating the user.

Any thoughts?
Thanks
Jason Green


Top
 Profile  
 
PostPosted: Tue Sep 01, 2009 6:17 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Mon Jul 06, 2009 8:45 pm
Posts: 32
When I go to the User Manager and try to create a New USer I do not fonr the fields for Front-end and Backend URL's


Top
 Profile  
 
PostPosted: Tue Sep 01, 2009 6:25 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Tue Sep 01, 2009 8:05 am
Posts: 5
The database doesn't have the new parameters for your users until you re-save. In the database under "users" the params field needs to have:

url=
adminurl=

Try creating a new user. Try editing an existing user and coming back. If those things don't work, go into your database and add

url=
adminurl=

to the 'params' part of the user entry in the jos_users table

Best,
iamwaggle


Top
 Profile  
 
PostPosted: Tue Sep 01, 2009 6:27 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Tue Sep 01, 2009 8:05 am
Posts: 5
I do get the Front-end/Back-end fields with a new user creation. I don't know why you wouldn't unless you didn't change the XML docs correctly. Maybe a cache thing?


Top
 Profile  
 
PostPosted: Tue Sep 01, 2009 10:35 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Mon Jul 06, 2009 8:45 pm
Posts: 32
I can email you the screen shot of the new user creation page....My wmail id is: sraj1949@comcast.net


Top
 Profile  
 
PostPosted: Tue Sep 08, 2009 2:02 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed May 13, 2009 6:38 pm
Posts: 9
sorry if im hijacking the thread a little, but pulling out hair is beginning to make me go bald, Im trying to get a user specific thing going too, but its not working.

I have managed to make a "redirect to" based on users.

But i want to add a menu item that pops up specific to that logged in user.

I.E. we look at the menu on our main page and it has items on it like: home, work, clients, latest news, about us, contact us and client login.
now i want an item to appear after client login once a user has logged in (just like if u set a menu items access level to "registered user") BUT i want that item to link to a page SPECIFIC TO THE CURRENT LOGGED IN USER.

Any help/ideas?
All help greatly appreciated


Top
 Profile  
 
PostPosted: Tue Sep 29, 2009 9:52 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sat Sep 05, 2009 4:14 pm
Posts: 15
Hello to all, i am using Joomla! 1.5.13.
I need to have 2 pages show up as home page, one for public and one for users that are logged in/registered. I have created them both and i made one Public and the other Registered (Access Level ). When i am not log in i see the public page ok. But when i log in i see the article for registered users...but also below that article the public one also appears. What am i doing wrong?
can you help me?
thank you


Top
 Profile  
 
PostPosted: Tue Sep 29, 2009 5:06 pm 
Joomla! Guru
Joomla! Guru

Joined: Thu Aug 18, 2005 10:51 pm
Posts: 692
Location: Austria
1. use the lates Joomla version (actual 1.5.14)!
2. this is how Joomla works: each higher ACL level can see all his items AND what is for lower levels (same for frontend as well for the backend)

_________________
http://www.joomx.com - custom extensions and development
http://www.joomlasupportdesk.com - support, migration, training and consulting
Member of the German Joomla Translation Team


Top
 Profile  
 
PostPosted: Fri Oct 09, 2009 5:30 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Fri Jun 02, 2006 5:37 am
Posts: 8
I am so glad I found this. Thank you iamwaggle, sraj49, and Olaf! And it works great.

However, my user information details do not show the url field when I return after saving. I double checked all the edits/hack. I have even made sure the "url=" was added to the param in the database (per your suggestion iamwaggle). I don't believe it is a cache issue either.

Does anyone have another suggestion why I cannot see the url (except for the very first time a new user is created)?

Thanks all


Top
 Profile  
 
PostPosted: Tue Oct 27, 2009 4:41 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Oct 22, 2009 4:34 pm
Posts: 18
How do I get my login page to bring up the specific page? Where do I "link" it?


Top
 Profile  
 
PostPosted: Tue Oct 27, 2009 9:33 am 
User avatar
Joomla! Master
Joomla! Master

Joined: Thu Jul 17, 2008 3:10 pm
Posts: 10948
Location: Ireland
Do you use the mod_login module?

Olaf

_________________
Olaf Offick - Global Moderator
http://learnskills.org


Top
 Profile  
 
PostPosted: Tue Oct 27, 2009 2:07 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Oct 22, 2009 4:34 pm
Posts: 18
Yes.


Top
 Profile  
 
PostPosted: Tue Oct 27, 2009 2:13 pm 
User avatar
Joomla! Master
Joomla! Master

Joined: Thu Jul 17, 2008 3:10 pm
Posts: 10948
Location: Ireland
Did you look into the module parameters? There is an option to add the login URL.

Olaf

_________________
Olaf Offick - Global Moderator
http://learnskills.org


Top
 Profile  
 
PostPosted: Tue Oct 27, 2009 2:26 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Oct 22, 2009 4:34 pm
Posts: 18
I guess I don't see that in the module. Also, when I try to login now, I'm getting this error message: "Fatal error: Unsupported operand types in /home1/stonewor/public_html/includes/router.php on line 148". Do you know what this means? I am extremely new to Joomly and website creation in general. Thanks in advance.


Top
 Profile  
 
PostPosted: Tue Oct 27, 2009 2:46 pm 
User avatar
Joomla! Master
Joomla! Master

Joined: Thu Jul 17, 2008 3:10 pm
Posts: 10948
Location: Ireland
My guess would be that the Menu Item which you selected doesn't exist, or that the article which linked from the menu item doesn't exists anymore.

Attachment:
capture#0140_2009-10-27.png


Olaf


You do not have the required permissions to view the files attached to this post.

_________________
Olaf Offick - Global Moderator
http://learnskills.org


Top
 Profile  
 
PostPosted: Tue Oct 27, 2009 2:50 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Oct 22, 2009 4:34 pm
Posts: 18
Why can't I see all of my articles under "Paremeters" in the mod_login, for "Login Redirection Page" and "Logout Redirection Page"? I'm trying to link these to a page that I created but they don't show up.


Top
 Profile  
 
PostPosted: Tue Oct 27, 2009 2:56 pm 
User avatar
Joomla! Master
Joomla! Master

Joined: Thu Jul 17, 2008 3:10 pm
Posts: 10948
Location: Ireland
You can only select a menu item? Do you will need to create a menu item first.

Olaf

_________________
Olaf Offick - Global Moderator
http://learnskills.org


Top
 Profile  
 
PostPosted: Tue Oct 27, 2009 3:01 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Oct 22, 2009 4:34 pm
Posts: 18
What if I don't want that page to show up in my menu on the frontend? (It's for certain level employees only.)


Top
 Profile  
 
PostPosted: Tue Oct 27, 2009 3:21 pm 
User avatar
Joomla! Master
Joomla! Master

Joined: Thu Jul 17, 2008 3:10 pm
Posts: 10948
Location: Ireland
Try to create a new menu, a new menu item, and don't link the menu with a module.

Olaf

_________________
Olaf Offick - Global Moderator
http://learnskills.org


Top
 Profile  
 
PostPosted: Thu Nov 05, 2009 11:20 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Jan 03, 2008 2:16 pm
Posts: 20
ok.... i have used the trick described in the first page. I now upgraded to 1.5.14 now when i create a new user and input a redirect url.... it doesn't redirect.

For some reason, the user that i did this trick with before the upgrade do redirect.

Can someone post their controller.php code or file plus their other modification to their other files (user.xml etc) to get this redirect working.

Thanks
~G


Top
 Profile  
 
PostPosted: Thu Nov 05, 2009 11:26 pm 
User avatar
Joomla! Master
Joomla! Master

Joined: Thu Jul 17, 2008 3:10 pm
Posts: 10948
Location: Ireland
Did you change all the files again?

Olaf

_________________
Olaf Offick - Global Moderator
http://learnskills.org


Top
 Profile  
 
PostPosted: Fri Nov 06, 2009 12:26 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Jan 03, 2008 2:16 pm
Posts: 20
no i didnt change the files again....

oooo i looked into the 1.5.7 to 1.5.14 update file and i see that controller.php gets replaced.

So im assuming i just modify controller.php with any of the hacks above?

Thanks,
~Greg


Top
 Profile  
 
PostPosted: Fri Nov 06, 2009 9:32 am 
User avatar
Joomla! Master
Joomla! Master

Joined: Thu Jul 17, 2008 3:10 pm
Posts: 10948
Location: Ireland
greg218 wrote:
So im assuming i just modify controller.php with any of the hacks above?


Yes, or any other file which might have been replaced.

Olaf

_________________
Olaf Offick - Global Moderator
http://learnskills.org


Top
 Profile  
 
PostPosted: Fri Nov 06, 2009 3:13 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Jan 03, 2008 2:16 pm
Posts: 20
The joomla 1.5.14 controller.php looks different and i can't find
Code:
if(!JError::isError($error)){
     
// Redirect if the return url is not registration or login
if ( ! $return ) {
$return= 'index.php?option=com_user';
}
this closest i found is
Code:
if (!$user->bind($post))
      {
         $mainframe->enqueueMessage(JText::_('CANNOT SAVE THE USER INFORMATION'), 'message');
         $mainframe->enqueueMessage($user->getError(), 'error');
         //$mainframe->redirect( 'index.php?option=com_users', $user->getError() );
         //return false;
         return $this->execute('edit');
      }


Can someone show how you would do this hack in joomla 1.5.14?

Thanks!
~Greg


Top
 Profile  
 
PostPosted: Fri Nov 06, 2009 3:32 pm 
User avatar
Joomla! Master
Joomla! Master

Joined: Thu Jul 17, 2008 3:10 pm
Posts: 10948
Location: Ireland
Hi Greg,

Please make sure you are looking in the /components/com_users/controller.php and not in the /administrator/components/com_users/controller.php file.

Try to find this:

Code:
      $credentials = array();
      $credentials['username'] = JRequest::getVar('username', '', 'method', 'username');
      $credentials['password'] = JRequest::getString('passwd', '', 'post', JREQUEST_ALLOWRAW);

      //preform the login action
      $error = $mainframe->login($credentials, $options);

      if(!JError::isError($error))
      {
         // Redirect if the return url is not registration or login
         if ( ! $return ) {
            $return   = 'index.php?option=com_user';
         }

         $mainframe->redirect( $return );
      }


and replace it with this:

Code:
      $credentials = array();
      $credentials['username'] = JRequest::getVar('username', '', 'method', 'username');
      $credentials['password'] = JRequest::getString('passwd', '', 'post', JREQUEST_ALLOWRAW);

      //preform the login action
      $error = $mainframe->login($credentials, $options);

      if(!JError::isError($error))
      {
         $user =& JFactory::getUser();
         $user->getParameters();
         if (!$user->getParam('url') == ''){
            $return = $user->getParam('url');
         }

      
         // Redirect if the return url is not registration or login
         if ( ! $return ) {
            $return   = 'index.php?option=com_user';
         }

         $mainframe->redirect( $return );
      }


Olaf

_________________
Olaf Offick - Global Moderator
http://learnskills.org


Top
 Profile  
 
PostPosted: Fri Nov 06, 2009 4:43 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Jan 03, 2008 2:16 pm
Posts: 20
Thanks Olaf, It worked!


Top
 Profile  
 
PostPosted: Wed Nov 11, 2009 9:22 pm 
Joomla! Intern
Joomla! Intern

Joined: Sun Jun 04, 2006 10:25 pm
Posts: 53
I wish to have some time, to create a generic plugin for this.
If anyone has already created one, please let me know.

_________________
Joomla Multi Sites Extension - http://codingmall.com/products-mainmenu-8/178-joomla-multi-sites-extension
Membership & Access Control - http://codingmall.com/products-mainmenu-8/170-joomla-membership-a-access-control


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 131 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next



Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group