1
bluescreen
Please Help with Member Group type Module.
  • 2006/11/7 10:53

  • bluescreen

  • Just popping in

  • Posts: 10

  • Since: 2006/10/19


OK, I'm going to start with I have no clue how to write PHP. However, I've done a little here and there to understand a few things. I want to take the array that shows the usergroups of a user and at this point display an echo statement. I've got it ordered because as I understand it, once PHP finds an if statement that works it ignores the rest. I have also tried to string together a way to come up with the usergroups array, but have been unable to do so because of my lack of understanding PHP as well as XOOPS itself. This is very important to me, so please someone help me out with this one.

This is what I have created using the information I've found.

include("../../mainfile.php");
include(
XOOPS_ROOT_PATH."/header.php");
$xoopsOption['show_rblock'] = 1;


    if ( @
$xoopsUser && is_object($xoopsUser) ) {
        
$xoopsTpl->assign'xoops_usergroups'$xoopsUser->getGroups() );
    }


    if ( 
in_array("1"$xoops_usergroups) ) {

            echo 
"User is Admin";
            exit;
    }
    elseif ( 
in_array("4"$xoops_usergroups) ) {

            echo 
"User is SUBSCRIBED";
            exit;
    }

    elseif ( 
in_array("2"$xoops_usergroups) ) {

            echo 
"User is Registered";
            exit;
    }

    else {

            echo 
"User is Not Registered";
            exit;
    }
?>


Any Help would be greatly appreciated.

2
bluescreen
Re: Please Help with Member Group type Module.
  • 2006/11/9 8:40

  • bluescreen

  • Just popping in

  • Posts: 10

  • Since: 2006/10/19


Can anybody help me with this? I know I should know more PHP if I really want to write this, however i just don't have the time to sit down and learn it right now. Someone, please help me out with this.

3
bluescreen
Re: Please Help with Member Group type Module.
  • 2006/11/9 9:14

  • bluescreen

  • Just popping in

  • Posts: 10

  • Since: 2006/10/19


Nevermind... I got it!

include("../../mainfile.php");
include(
XOOPS_ROOT_PATH."/header.php");
$xoopsOption['show_rblock'] = 1;


     
$groups is_object($xoopsUser) ? $xoopsUser->getGroups() : array(XOOPS_GROUP_ANONYMOUS);
    
//ADMIN REDIRECT
    
if ( in_array("1"$groups) ) {

            
header('Location: http://www.consultsports.com/modules/cjaycontent/index.php?id=5');
            exit;
    }
//Subscribed REDIRECT
    
elseif ( in_array("4"$groups) ) {

            
header('Location: http://www.consultsports.com/modules/cjaycontent/index.php?id=6');
            exit;
    }
//Registered REDIRECT
    
elseif ( in_array("2"$groups) ) {

            
header('Location: http://www.consultsports.com/modules/cjaycontent/index.php?id=7');
            exit;
    }
//Anonymous REDIRECT
    
else {

            
header('Location: http://www.consultsports.com/modules/cjaycontent/index.php?id=8');
            exit;
    }

?>


Working like a charm. At least for Admin and Anon... testing the other two now.

Login

Who's Online

273 user(s) are online (73 user(s) are browsing Support Forums)


Members: 1


Guests: 272


chaoos,

more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Oct 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits