1
turnerrw
Setting Permissions on userinfo.php
  • 2006/10/7 1:28

  • turnerrw

  • Just popping in

  • Posts: 68

  • Since: 2003/12/1


I am building a site using XOOPS 2.0.14. This site is in the genre of "social networking" sites like Facebook.com. The site owners want to restrict the ability to view member profiles to only registered users.

So, for instance, if I see a post in a Forum on a Comment in a News Article, I would be able to click the link to the user's profile page (/userinfo.php?uid=x) only if I'm a registerd user. If I'm not registered, I get a gentle message telling me that I must register to view this page.

I see two ways of doing this:
1. Edit the news and forum templates so that usernames are hyperlinked for registered users only.

2. Change the permissions (somehow) on userinfo.php (and other files I imagine) so that anonymous users cannot access member profiles.

QUESTIONS:
A. Are there other solutions to this problem that I'm not thinking of?

B. Is there already a solution to this that I don't know of?

C. Given the use case, what is the preferred method, or best practice for implementing this functionality?

-Robert

2
JamesSAEP
Re: Setting Permissions on userinfo.php
  • 2006/10/7 3:47

  • JamesSAEP

  • Just can't stay away

  • Posts: 732

  • Since: 2005/2/28


Search this site and you'll see solutions. Look HERE

3
turnerrw
Re: Setting Permissions on userinfo.php
  • 2006/10/7 11:35

  • turnerrw

  • Just popping in

  • Posts: 68

  • Since: 2003/12/1


Thanks James - I did search the site before posting my query; not sure why I didn't see that thread.

Here is the code to add to userinfo.php - add it to the top of the script after line 32

$uid intval($_GET['uid']);
if (
$uid <= 0) {
    
redirect_header('index.php'3_US_SELECTNG);
    exit();
}

if (!
is_object($xoopsUser)) {
redirect_header('index.php',3,_NOPERM);
exit();
}
$gperm_handler = & xoops_gethandler'groupperm' );
$groups is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;


Works like a charm with XOOPS v2.0.14. Thanks again James.

Login

Who's Online

309 user(s) are online (247 user(s) are browsing Support Forums)


Members: 0


Guests: 309


more...

Donat-O-Meter

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

Latest GitHub Commits