Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » MetaMod Pro
- » MetaMod Pro General Support
- » SOLVED: Quick help with specific user...
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?
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");
}
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
- Index
- » MetaMod Pro
- » MetaMod Pro General Support
- » SOLVED: Quick help with specific user...
Board Info
- Board Stats:
- Total Topics:
- 1699
- Total Polls:
- 6
- Total Posts:
- 5967
- Total Posts Today:
- 2
- User Info:
- Total Users:
- 8028
- Newest User:
- musial8334
- Members Online:
- 0
- Guests Online:
- 188
- 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