PDA

View Full Version : Redirect usergroup at logon from mainpage


org
03-04-2005, 03:41 PM
How can I redirect a certain usergroup at logon to a private section of the forum?

I have the forums and permissions set up. Its the automatic redirect depending on usergroup I dont understand? :ermm:

sabret00the
03-04-2005, 03:56 PM
try the login.php

org
03-04-2005, 04:45 PM
Ok thankyou, have checked that. What would be a proper syntax for this?
I found a small script that supposedly redirects users: (where xx is the id nr)

if($bbuserinfo[userid] == xx){
header ("Location: http://www.yahoo.com");
}

If I change it to that below, does that make any sence?

if($bbuserinfo[usergroupid] == xx){
header ("Location: http://mysite.com/forums/forumdisplay.php?f=11");
}

I dont have any coding experience Im afraid. :nervous:

Marco van Herwaarden
03-04-2005, 05:54 PM
in login.php, find:
if ($url == 'login.php' OR $url == "$vboptions[forumhome].php" OR strpos($url, 'do=logout') !== false)
{
$url = "$vboptions[forumhome].php?$surl";
}

and replace with:
if ($url == 'login.php' OR $url == "$vboptions[forumhome].php" OR strpos($url, 'do=logout') !== false)
{
if ($bbuserinfo['usergroupid'] == xx)
{
$url = "forumdisplay.php?f=11$surl";
}
else
{
$url = "$vboptions[forumhome].php?$surl";
}
}


Not tested, but think this would do the trick

org
03-04-2005, 06:55 PM
I pasted the code in the wrong place. Since I use CMPS i had to paste it in the start-up template for that. So far so good.

The redirect works if I have permission to see both the startpage and the redirectpage. It bumps off and lands beautifully where it should. :classic:

However, if I dont have permission to see the startpage, it halts there. And the redirect does not take affect.

Any suggestions to work around this? I could create a blank "bounce-off-page" where everyone has access, but maybe there is a cleaner way of achieving the same thing? Either way Im happy. :p

I think this is a really neat way of directing users to different parts of the forum, and still maintain a clean cut forum, thank you sabret00th and MarcoH64 for helping me achieve this!

*****UPDATE LAST POST BELOW*****

Now it works 100%. I use CMPS so I pasted this code in my home-template:

<if condition="is_member_of($bbuserinfo, xx)">
<META HTTP-EQUIV="Refresh" CONTENT="0; URL=forumdisplay.php?$session[sessionurl]f=yy">
</if>

Where xx is your usergroupid and yy is the redirect page. Works.

Its a neat way of redirecting users (from one easy-to-remember entrance point) to separate - and if needed - isolated parts of the forum, and still have a clean-cut design. I made my startpage blank with just redirection-codes for different usergroups.

I hope this helps someone else. :classic: