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: Mon May 24, 2010 9:41 pm 
User avatar
Joomla! Master
Joomla! Master

Joined: Thu Jul 17, 2008 3:10 pm
Posts: 10766
Location: Ireland
ok, and what happends when you login with the correct password?

Olaf

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


Top
 Profile  
 
PostPosted: Tue May 25, 2010 7:52 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed May 19, 2010 11:48 pm
Posts: 15
If you look at this link this will show you what happens when you logged in (I have attached a photo in the content so that you can see)

http://www.ips-photography.co.uk/index. ... e&Itemid=1


Top
 Profile  
 
PostPosted: Tue May 25, 2010 9:11 pm 
User avatar
Joomla! Master
Joomla! Master

Joined: Thu Jul 17, 2008 3:10 pm
Posts: 10766
Location: Ireland
ok, so that means that the parameter is not working:
Code:
$return = $user->getParam('url');


Try to hard code a URL to see if the other code is working.

Olaf

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


Top
 Profile  
 
PostPosted: Wed May 26, 2010 9:12 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed May 19, 2010 11:48 pm
Posts: 15
tried to hard code and it didn't make any difference. I have put it back now to how it was: -

$return = $user->getParam('url');


Top
 Profile  
 
PostPosted: Wed May 26, 2010 9:15 pm 
User avatar
Joomla! Master
Joomla! Master

Joined: Thu Jul 17, 2008 3:10 pm
Posts: 10766
Location: Ireland
well, then you probably changing the wrong file.

Olaf

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


Top
 Profile  
 
PostPosted: Wed May 26, 2010 9:38 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed May 19, 2010 11:48 pm
Posts: 15
I have just had a quick mess around and changed this bit: -

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

to

// Redirect if the return url is not registration or login
if ( ! $return ) {
$return = 'http://www.ips-photography.co.uk/index.php?option=com_content&view=article&id=2&Itemid=3';

and it worked


Top
 Profile  
 
PostPosted: Wed May 26, 2010 9:51 pm 
User avatar
Joomla! Master
Joomla! Master

Joined: Thu Jul 17, 2008 3:10 pm
Posts: 10766
Location: Ireland
I just tried this myself and that works as well:
Code:
      if(!JError::isError($error))
      {
         $return = "index.php?test";
         // Redirect if the return url is not registration or login
         if ( ! $return ) {
            $return   = 'index.php?option=com_user';
         }

         $mainframe->redirect( $return );
      }


So if your url parameter is not working then it is probably not saved in the user object.

Olaf

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


Top
 Profile  
 
PostPosted: Thu May 27, 2010 6:59 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed May 19, 2010 11:48 pm
Posts: 15
This is what is in the user.xml (I am hoping this is what you meant): -

<form>
<params>
<param name="admin_language" type="languages" client="administrator" default="" label="Back-end Language" description="paramAdminLanguage" />
<param name="language" type="languages" client="site" default="" label="Front-end Language" description="paramLanguage" />
<param name="editor" type="editors" default="" label="User Editor" description="WYSIWYG Editor for this User" />
<param name="helpsite" type="helpsites" default="" label="Help Site" description="Help Site for this User" />
<param name="timezone" type="timezones" default="" label="Time Zone" description="Time Zone for this User" />
<param name="login" type="menuitem" default="" label="Login Redirection URL" description="What page will the login redirect to after user login, if let blank will load module default" />
<param name="logout" type="menuitem" default="" label="Logout Redirection URL" description="What page will the login redirect to after user logout, if let blank will load module default" />
</params>
</form>


Top
 Profile  
 
PostPosted: Thu May 27, 2010 8:58 am 
User avatar
Joomla! Master
Joomla! Master

Joined: Thu Jul 17, 2008 3:10 pm
Posts: 10766
Location: Ireland
ok, I so you added two parameters login and logout, correct?

However, in your controller you are trying to access the parameter url, which doesn't exist.

Try to find this
Code:
getParam('url');
and replace it with this
Code:
getParam('login');


Olaf

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


Top
 Profile  
 
PostPosted: Thu May 27, 2010 9:47 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed May 19, 2010 11:48 pm
Posts: 15
Great stuff, its all working - many thanks for all your help on this, very appreciated.


Top
 Profile  
 
PostPosted: Tue Jun 08, 2010 2:30 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Mon Sep 05, 2005 1:26 am
Posts: 7
I didn't see this answered before.. So apologies if it was. I am running Joomla 1.5.18.

When a user registers on my site, I need them to enter some additional information. When they log into the site for the 1st time (or until such time as they have entered in the information) I want to redirect users one page (a form I have setup which prompts to collect additional user information). If they already entered the necessary information, I want them to be redirected to a different page upon subsequent logins.

Someone wrote me this piece of code that is supposed to check that the user entered the additional information, but I am not sure where I would put it to get the results I described above.

I am using the standard Login Module.

Code:
<?php
// check if in noc_users table
$database = &JFactory::getDBO();
$USER =& JFactory::getUser();
$uid = $USER->id;
$qrstring = "SELECT * FROM #__noc_users WHERE user_id = '$uid' ";
$database->setQuery($qrstring);
$dberr="";

if (!$database->query()) {
   $dberr = $database->getErrorMsg();
   echo($dberr."<br>");
   echo($func." : ".$uid."-- ".time());
}
$rows = $database->loadObjectList();
$num_rows = count($rows);
   if($num_rows == 0){
      $host = $_SERVER["HTTP_HOST"];
      header("Location: /index.php?option=com_nocform&func=doform");
}
?>


Thanks in advance.

Evan


Top
 Profile  
 
PostPosted: Tue Jul 13, 2010 2:45 am 
Joomla! Fledgling
Joomla! Fledgling

Joined: Sat Oct 04, 2008 8:20 pm
Posts: 2
Hi,

For those who faced to the same problem, here is the process for the Joomla! 1.5.17.
1) open the XML file: administrator/components/com_users/models/user.xml
and the parameters that will be available for EACH user:
Code:
<!-- Yoong Kim 13/07/2010: add custom redirection after logged -->
      <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) Open the PHP file:administrator/components/com_login/admin.login.php
and modify the line number 66 (well, around 66 of course!)
Code:
      // Yoong Kim 13/07/2010: add custom redirect
      $user =& JFactory::getUser();
      $user->getParameters();
      $returnAdminUrl = $user->getParam('adminurl');
      
      
      if (!JError::isError($result)) {
         // Yoong Kim 13/07/2010: add custom redirect
         $return = 'index.php';
         if ( !empty($returnAdminUrl) ) {
              $return = $returnAdminUrl;
         }
         $mainframe->redirect($return);
      }


3) if you want to configure a special url redirect for an user, go to the control panel, open the user manager. In the "Parameters" tab, you should see 2 ne parameters:
Front-end Login Redirect
Back-end Login Redirect

Fill the fields and save the user.

Yoong

PS: you can do the same thing for the frontend login.


Top
 Profile  
 
PostPosted: Sun Aug 15, 2010 3:38 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Sun Aug 15, 2010 3:35 pm
Posts: 1
Qwomg wrote:
Instructions for Joomla 1.5(.8 ) (with credit @barnett):

1. On the files
administrator/components/com_users/models/author.xml
administrator/components/com_users/models/registered.xml
administrator/components/com_users/models/user.xml
right before </params> add the following lines:
Code:
<param name="login" type="menuitem" default="" label="Login Redirection URL" description="What page will the login redirect to after user login, if let blank will load module default" />
<param name="logout" type="menuitem" default="" label="Logout Redirection URL" description="What page will the login redirect to after user logout, if let blank will load module default" />


2. Go to components/com_user/controller.php and after line ~134:
Code:
$error = $mainframe->login($credentials, $options);

add the following code:
Code:
$user =& JFactory::getUser();
$menu =& JSite::getMenu();
$userRedirect = $user->getParam('login');
if ($userRedirect) {
        $item = $menu->getItem($userRedirect);
   $url = $item->link;
        $return = $url;
}


3. One the same file (controller.php) after line ~160:
Code:
   function logout()
   {
      global $mainframe;

add:
Code:
$user =& JFactory::getUser();
$menu =& JSite::getMenu();
$userRedirect = $user->getParam('logout');
if ($userRedirect) {
        $item = $menu->getItem($userRedirect);
   $url = $item->link;
        $return = $url;
}

then a couple of lines later, after
Code:
      if(!JError::isError($error))
      {

add:
Code:
if (!$return)

one line before the next if.

4. Set up individual user login and logout redirections from the user manager.


This is absolutely amazing!! IT WORKS WITH COMMUNITY BUILDER with no additional codes!
Thanks so much!! :D


Top
 Profile  
 
PostPosted: Wed Sep 08, 2010 7:43 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Mon Oct 24, 2005 1:35 pm
Posts: 10
I succeeded in getting the redirect to work. So after a login the user ends up on his personal page. But now I would like a button to get him (or her) back to that page after he (os she) has been browsing the site. From what I read in this topic this seems to be a wish more people have. Anyone succeeded in getting this button to work?


Top
 Profile  
 
PostPosted: Wed Sep 08, 2010 8:15 am 
User avatar
Joomla! Master
Joomla! Master

Joined: Thu Jul 17, 2008 3:10 pm
Posts: 10766
Location: Ireland
Why don't you create a module, generate the URL and output that as a link or button?

Olaf

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


Top
 Profile  
 
PostPosted: Wed Sep 08, 2010 8:34 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Mon Oct 24, 2005 1:35 pm
Posts: 10
Olaf
simply because I don't know how ;-) If I would, I wouldn't have posted my question in the first place don't you think.

;-)
Good to know this topic is still alive.


Top
 Profile  
 
PostPosted: Wed Sep 08, 2010 8:43 am 
User avatar
Joomla! Master
Joomla! Master

Joined: Thu Jul 17, 2008 3:10 pm
Posts: 10766
Location: Ireland
You would will find a Tutorial on how to create a module here: http://docs.joomla.org/How_to_create_a_module

And instead of outputing Hello World, you will need to output the link , similar to the redirect you have done earlier.

Code:
<?php
$user =& JFactory::getUser();
$userRedirect = $user->getParam('YOUR_PARAMETER');
?>
<a href="<?php echo $userRedirect; ?>">YOUR_CLICK_HERE_TEXT</a>


You will need to change YOUR_CLICK_HERE_TEXT and YOUR_PARAMETER to whatever you need.

Olaf

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


Top
 Profile  
 
PostPosted: Wed Sep 08, 2010 9:02 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Mon Oct 24, 2005 1:35 pm
Posts: 10
Thanks Olaf
After I've finished trying to get Pages and Items fix my problem I'll have a look at your solution.

My problem is in fact quit simple. I need different users to have different access to documents. And NO DOCMAN is not a solution for me cause in Docman it is not possible to multi-select access-groups on a document. So every time users/groups/access changes I have to rearrange.

The idea is to get users (belonging to a certain group) to a page with weblinks to documents and to use the button to let them return to this page.

So far; http://www.pages-and-items.com/index.php looks promissing to me!

Thanks again!


Top
 Profile  
 
PostPosted: Thu Sep 09, 2010 11:40 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Mon Oct 24, 2005 1:35 pm
Posts: 10
Olaf
If I try rour example my test.php says;
Fatal error: Class 'JFactory' not found in /home/*****/domains/******/public_html/test.php on line 2

*** = censored ;-)


Top
 Profile  
 
PostPosted: Thu Sep 09, 2010 12:02 pm 
User avatar
Joomla! Master
Joomla! Master

Joined: Thu Jul 17, 2008 3:10 pm
Posts: 10766
Location: Ireland
yes, JFactory is a joomla class, so you will not be able to run it outside the joomla framework.
That's why I suggested to create a module with a link to the tutorial:
http://docs.joomla.org/How_to_create_a_module

Please note that you have to install the module in order to use the joomla framework.

Olaf

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


Top
 Profile  
 
PostPosted: Thu Sep 09, 2010 12:16 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Mon Oct 24, 2005 1:35 pm
Posts: 10
I've tried to create a module for golfscores on my website but got stuck. Since this is a whole new subject I'll leave that for what it is. Pages and Items does the trick for me. I've created several pages and can redirect users to the pages they need to see together with a nice link in a menu. Thank you all for your time and effort!


Top
 Profile  
 
PostPosted: Sun Oct 10, 2010 6:53 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed Sep 08, 2010 5:50 pm
Posts: 32
Location: Staffordshire, UK
hi folks,

Will this help me accomplish what I am trying to do in http://forum.joomla.org/viewtopic.php?f=470&t=554894??

_________________
Many Thanks
Rich

http://www.matecglobal.co.uk


Top
 Profile  
 
PostPosted: Sun Oct 10, 2010 7:00 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Mon Oct 24, 2005 1:35 pm
Posts: 10
I've you create a "special" page for each and everyone of your users you are correct. Simply redirect to the special page.


Top
 Profile  
 
PostPosted: Thu Oct 21, 2010 11:51 am 
Joomla! Fledgling
Joomla! Fledgling

Joined: Fri Jul 11, 2008 2:42 pm
Posts: 2
Quote:
PS: you can do the same thing for the frontend login.


HOW?


Top
 Profile  
 
PostPosted: Sat Nov 06, 2010 12:15 am 
Joomla! Fledgling
Joomla! Fledgling

Joined: Mon Aug 02, 2010 7:01 am
Posts: 4
Hi
I'm running 1.5.18, but I can't seem to make this work. When I make the changes to admin.login.php, attempts to login just loops back to the login page. Following is the code for my admin.login.php
Quote:
<?php
/**
* @version $Id: admin.login.php 14401 2010-01-26 14:10:00Z louis $
* @package Joomla
* @subpackage Joomla.Extensions
* @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/

// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

switch ( JRequest::getCmd('task'))
{
case 'login' :
LoginController::login();
break;

case 'logout' :
LoginController::logout();
break;

default :
LoginController::display();
break;
}


/**
* Static class to hold controller functions for the Login component
*
* @static
* @package Joomla
* @subpackage Login
* @since 1.5
*/
class LoginController
{
function display()
{
jimport('joomla.application.module.helper');
$module = & JModuleHelper::getModule('mod_login');
$module = JModuleHelper::renderModule($module, array('style' => 'rounded', 'id' => 'section-box'));
echo $module;
}

function login()
{
global $mainframe;

// Check for request forgeries
JRequest::checkToken('request') or jexit( 'Invalid Token' );

$credentials = array();

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

// Yoong Kim 13/07/2010: add custom redirect
$user =& JFactory::getUser();
$user->getParameters();
$returnAdminUrl = $user->getParam('adminurl');


if (!JError::isError($result)) {
// Yoong Kim 13/07/2010: add custom redirect
$return = 'index.php';
if ( !empty($returnAdminUrl) ) {
$return = $returnAdminUrl;
}
$mainframe->redirect($return);
}





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

LoginController::display();
}

function logout()
{
global $mainframe;

$result = $mainframe->logout();

if (!JError::isError($result)) {
$mainframe->redirect('index.php?option=com_login');
}

LoginController::display();
}
}


I'm new to this so be gentle with me. I'm wondering if it might be that I need to add the URL redirects for the login I'm using somewhere first, but I don't know where to do this.


Top
 Profile  
 
PostPosted: Thu Jan 13, 2011 9:14 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Jul 22, 2010 4:48 am
Posts: 9
hai i am using joomla 1.5.20 i dont see the codes in \administrator\components\com_users.So pls specify the code for joomla1.5.20 for different login redirect


Last edited by ooffick on Thu Jan 13, 2011 12:17 pm, edited 1 time in total.
Mod Note: Duplicate post deleted, please do not post your question multiple times. Please read the forum rules for details.


Top
 Profile  
 
PostPosted: Thu Jan 13, 2011 12:31 pm 
User avatar
Joomla! Master
Joomla! Master

Joined: Thu Jul 17, 2008 3:10 pm
Posts: 10766
Location: Ireland
Which "codes" can you not see, did you read all the posts in this topic?

Olaf

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


Top
 Profile  
 
PostPosted: Tue Jan 25, 2011 10:52 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Tue Jan 25, 2011 10:48 pm
Posts: 1
Can someone please post the complete instructions for this for Joomla! 1.5.22. I have tried several versions of the instructions in this thread, and none is working yet. I'm assuming it is because my version is newer than older sets of instructions.

Thank you in advance!


Top
 Profile  
 
PostPosted: Mon Feb 07, 2011 1:15 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Tue Mar 17, 2009 11:17 pm
Posts: 45
TboneMofo wrote:
Can someone please post the complete instructions for this for Joomla! 1.5.22. I have tried several versions of the instructions in this thread, and none is working yet. I'm assuming it is because my version is newer than older sets of instructions.

Thank you in advance!


I second TboneMofo's request....please


Top
 Profile  
 
PostPosted: Mon Feb 07, 2011 7:51 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Fri Feb 04, 2011 12:19 pm
Posts: 36
brergo wrote:
TboneMofo wrote:
Can someone please post the complete instructions for this for Joomla! 1.5.22. I have tried several versions of the instructions in this thread, and none is working yet. I'm assuming it is because my version is newer than older sets of instructions.

Thank you in advance!


I second TboneMofo's request....please


i think this stracture is general and its not related to joomla version

_________________
http://www.tomweb.ir
http://www.nicmehr.com


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 6 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:  
cron
Powered by phpBB® Forum Software © phpBB Group