About this user

Marcia Kadanoff www.firewhite.com

« Newer Snippets
Older Snippets »
1 total  XML / RSS feed 

Redirect after login

// This code allows you to use the free-standing login page to redirect members who login to individual start pages based on their group membership. Its use is explained in greater detail here:

http://www.firewhite.com/weblog/redirectafterlogin

// <?php global $SESS, $DB;


        {
                $memid = $SESS->userdata['member_id'];
                $group_no = $DB->query("select group_id from exp_members where member_id='$memid'");
                $group_num = $group_no->row['group_id'];
$login_path = '';
                $group_name = '';
                if($group_num == 1) {
                        $group_name = 'consultants';
                } else if($group_num <= 4) {
                        $group_name = 'default';
                } else {
                        $group = $DB->query("select group_title from exp_member_groups where group_id='$group_num'");
                        $group_name = str_replace(" ", "", strtolower($group->row['group_title']));
                        $group_name = preg_replace("/(.*)_.*/", "\\1", $group_name);
                        $template = $DB->query("select group_name from exp_template_groups where group_name like '$group_name'");
                        if ($template->num_rows < 1)
                                $group_name = 'default';

                }
            
        };
header("location: http://www.firewhite.com/$group_name/start"); exit();?>
    

?>
« Newer Snippets
Older Snippets »
1 total  XML / RSS feed