1
bluescreen
Redirection Module
  • 2006/10/30 8:37

  • bluescreen

  • Just popping in

  • Posts: 10

  • Since: 2006/10/19


This is kind of important to my site. I need a small tiny module that has one purpose. I would make it the default module for the "Home Page". It would then read the users User Group and redirect to a page within a content module I have installed. So basically, I have 3 Groups.

1. Anonymous
2. Subscribers
3. Registered


Therefore, I would want it to redirect as below. (Subscribers are ALWAYS Registered users as well)

If 1 then page 1
If 2 then page 2
If 3 then page 3

It obviously needs to ignore 3 if the person is also a 2. Does this make sense? I hope its something simple because I really need this. Maybe even a small php file I could make myself. Of course I really want an admin control to change the redirect but thats not all that necessary especially if this is a small file I can make myself. Any help on this would be GREATLY appreciated... Very Much appreciated to be honest. I wish I had the money to pay someone to do this unfortunately I don't so I'm asking that someone please help me out of the goodness of their heart. I just got my PHP book yesterday and haven't had the time to open it yet so I hope someone can help me out here.

2
DarinAllan
Re: Redirection Module

Is myhome anygood for you?

3
bluescreen
Re: Redirection Module
  • 2006/10/30 8:59

  • bluescreen

  • Just popping in

  • Posts: 10

  • Since: 2006/10/19


Nope. MyHome only allows redirect based on one group. The others go somewhere else. Plus its not working anyways on my xoops. I use MyHome currently for the custom HTML page. But I need one that will redirect between 3 different pages at least not just one.

4
bluescreen
Re: Redirection Module
  • 2006/10/30 9:16

  • bluescreen

  • Just popping in

  • Posts: 10

  • Since: 2006/10/19


Maybe I can do this myself with a small amount of help. Here's what I'm thinking. I can figure out the coding for a redirect with PHP. What I need to know is simply how to check the following.

if user=group then redirect to.

It should be as simple as detecting the user group then applying the redirect so it would look similar to this(obviously this isn't in php format or anything)

If User=Group 1 Then
redirect=("URL")
ElseIf User=Group 2 then
redirect=("URL")
ElseIf User=Group 3 then
redirect=("URL")
EndIf

Is that right or way off?

5
chippyash
Re: Redirection Module
  • 2006/10/30 14:51

  • chippyash

  • Friend of XOOPS

  • Posts: 501

  • Since: 2004/1/29


This may help you. You need to tap into the group permissions object. SEE HERE

If you use my XBS Modgen (available in downloads on this site but remember you also need the CDM module as well - read the docs that come with ModGen,) you can create a *very* simple module shell and then put your redirection code into the index.php file of the module between the two comments where it tells you to put your code.

Put your code in a switch statement so that it computes in the order that you want. Take a look at the php header() function rather than using redirect_header for a faster page switch.

Have fun

6
bluescreen
Re: Redirection Module
  • 2006/10/30 23:02

  • bluescreen

  • Just popping in

  • Posts: 10

  • Since: 2006/10/19


OK, can someone help me fix this so it will work?


function stuff() {
    global 
$xoopsDB$xoopsUser;

if (
$xoopsUser) {
    
$groups $xoopsUser->getGroups();
} else {
    
$groups XOOPS_GROUP_ANONYMOUS;
}

if(
$groups ['XOOPS_GROUP_ANONYMOUS']) {

print 
"User Group is, ANONYMOUS
"
;
} else {
    print 
"User Group is, USER";
}
}


Like I said before, I am a complete newbie to PHP and don't know alot about it. I can't figure out how to return the User Group IDs as a variable so that I can write a statement.

Login

Who's Online

159 user(s) are online (123 user(s) are browsing Support Forums)


Members: 0


Guests: 159


more...

Donat-O-Meter

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

Latest GitHub Commits