1
cutley
creating a registered user only page in module
  • 2005/11/27 18:09

  • cutley

  • Just popping in

  • Posts: 38

  • Since: 2005/11/27


I have created a module, which is accessable to everyone, but i want another page which is only accessable to registered users.
The link to the page changes depending if they are logged in or not but they can still open the page in their browser.
I don't want to have to create a whole other module with different assess rights.
So is there any code i can add to the file which will redirect them if they are sneeky and open the page.

Thanks
- - - - -
xoops FTW

2
zimmi88
Re: creating a registered user only page in module
  • 2005/11/27 18:17

  • zimmi88

  • Just popping in

  • Posts: 57

  • Since: 2005/3/9 1


First, check within the module's permissions to check and make sure the ability to limit access to pages isn't already there.

You could try something with the tag [{$xoops_isuser}] (with arrow symbols instead of brackets). If you have access to the template that represents the page you want to limit access to, try adding in a structure like...

<{if $xoops_isuser}>
DRAW OUT PAGE CONTENT
<{else}>
REDIRECT THE USER
<{/if}>


Good luck with your site!
-zimmi88 =)
"Need coffee, keep away..."

3
cutley
Re: creating a registered user only page in module
  • 2005/11/28 16:44

  • cutley

  • Just popping in

  • Posts: 38

  • Since: 2005/11/27


i forgot about the $xoopsisuser variable. I'll start writing it up now. Thanks
- - - - -
xoops FTW

4
cutley
Re: creating a registered user only page in module
  • 2005/11/29 21:26

  • cutley

  • Just popping in

  • Posts: 38

  • Since: 2005/11/27


i had a qwick go at it but had to go to college. I am really bust atm but would really like to get this module finished asap.

can anyone be really really kind and post the full working code for me? i will be forever in your debt

thanks
- - - - -
xoops FTW

5
OldFriend
Re: creating a registered user only page in module
  • 2005/12/1 16:22

  • OldFriend

  • Just popping in

  • Posts: 99

  • Since: 2005/10/28


if (!$xoopsUser) {
    
redirect_header(XOOPS_URL."/user.php",3,_Please_Login);
    exit();
}

// Rest of code to be run by logged in users goes after here


And then add to your language file (if its english)
define("_Please_Login","Please Login to access this page");

6
cutley
Re: creating a registered user only page in module
  • 2005/12/2 11:59

  • cutley

  • Just popping in

  • Posts: 38

  • Since: 2005/11/27


thanks OldFriend. You have saved me.


edit: added code- works fine!
- - - - -
xoops FTW

Login

Who's Online

194 user(s) are online (156 user(s) are browsing Support Forums)


Members: 0


Guests: 194


more...

Donat-O-Meter

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

Latest GitHub Commits