Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

SOLVED: Quick help with specific user page redirect

SOLVED: Quick help with specific user page redirect

Joomla 2.5.20, MetaModPro 3.17
I need a specific user to be redirected to a page right after they log in. I used the recipe I found in the "HowTo" section but it creates an error.
Parse error: syntax error, unexpected '&' in .../modules/mod_metamod/helper.php(628) : eval()'d code on line 1

This is the code I am using:
$app = &JFactory::getApplication();
if ($user->username == "customusername")
    $app->redirect("http://www.example.com/alternative_page.html");

Any thoughts on how to fix this? It's got to be something simple. Or is there a better way to do this with JomGenius?

mirphi
Beginner Modder
ranks
useravatar
Offline
9 Posts
Administrator has disabled public posting

Re: SOLVED: Quick help with specific user page redirect

Anyone?

mirphi
Beginner Modder
ranks
useravatar
Offline
9 Posts
Administrator has disabled public posting

Re: SOLVED: Quick help with specific user page redirect

Here is what I did t solve the issue. I don't know why the above didn't work. Using the ID did work. Code below checks if a specific user is logged in. If they are, they are redirected to page A. Else, if any other user is logged in, they are taken to page B. If user is not logged in (id=0) then no redirect happens. This module is only placed on login page. otherwise it would keep redirecting the user and they wouldn't be able to navigate to the rest of the site.

$app = &JFactory::getApplication();
if ($user->id == "555") {
  $app->redirect ("index.php?option=com_content&Itemid=585...etc");
} elseif ($user->id != "0") {
     $app->redirect ("index.php?option=com_k2&Itemid=354...etc");
  }

mirphi
Beginner Modder
ranks
useravatar
Offline
9 Posts
Administrator has disabled public posting

Re: SOLVED: Quick help with specific user page redirect

Well done Mirphi, thanks for reporting back. Sorry it took a while to get back to you.

Owing to the original error, I wonder if there was an invisible character in your PHP that was causing a problem? It seemed to be breaking on this line:

$app = &JFactory::getApplication();

Perhaps the original way might work now that that line is not causing an error. But never mind I guess it's working now.

Best regards,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3328 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1679
Total Polls:
6
Total Posts:
5933
Posts this week:
3
User Info:
 
Total Users:
4397
Newest User:
tull687318
Members Online:
0
Guests Online:
220

Online: 
There are no members online

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked