1
gravies
Hide parts of profile from anonymous users?
  • 2004/8/18 21:05

  • gravies

  • Not too shy to talk

  • Posts: 119

  • Since: 2004/8/18


Is it possible to prevent anonymous users from viewing member profiles? More specifically I would like to block anonymous users from seeing the member's private information (email address, ICQ etc) but allow them to see their name and previous posts.

I am currently able to do this in geeklog and would like to see this feature in xoops.

Thanks
Graham

2
Dave_L
Re: Hide parts of profile from anonymous users?
  • 2004/8/18 21:27

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


You can prevent anonymous users from viewing profiles with a simple hack to userinfo.php:

include 'mainfile.php';
include_once 
XOOPS_ROOT_PATH.'/class/module.textsanitizer.php';

[
color=ff0000]$xoopsUser or redirect_header('index.php'3_NOPERM); #*#NOVIEW_USER_PROFILE#[/color]

$uid intval($_GET['uid']);


If you want to suppress only certain fields, you could use the same concept:

[color=ff0000]if ($xoopsUser) {[/color]
   
$xoopsTpl->assign('user_icq'$thisUser->getVar('user_icq'));
[
color=ff0000]} else {
   
$xoopsTpl->assign('user_icq''(not available)');
}[/
color]


3
gravies
Re: Hide parts of profile from anonymous users?
  • 2004/8/18 22:24

  • gravies

  • Not too shy to talk

  • Posts: 119

  • Since: 2004/8/18


Very nice! Thanks.

4
peterr
Re: Hide parts of profile from anonymous users?
  • 2004/9/3 7:05

  • peterr

  • Just can't stay away

  • Posts: 518

  • Since: 2004/8/5 9


Hi,

What Dave posted will _nearly_ answer my question (and concerns).

I would like to stop _anyone_ from doing this:

http://example.com/userinfo.php?uid=1

except of course if the user doing it was the 'webmaster'.

Having just installed an XOOPS for someone (#2 install, wooppee) , I setup the 'webmaster' person, and added a news article, only to see that then any anonymous user would be able to see _that_ username. :(

In general, I would like a method to be able to control the user levels to a degree where something like this happens.

1. No one at all could view user id=1 , unless they were that user, or a user on the same level.

2. Only 'webmaster' level users can view other 'webmaster' user info.

3. In general, users cannot view either user info, or posts by other users, unless they were at _least_ on that user level. That is, webmaster can do all, next level down (registered) can only view registered or anonymous,etc.

My objectives mostly are to protect the login username of any 'webmaster' level person. That would include a post anywhere (news, sections, forums,etc) by a webmaster, only another webmaster would be able to view the posts, or the persons info.

Hope I have made sense. For now, I have disabled just about everything on the website, even the news section, because the article was posted by a 'webmaster' type person.

Thanks,

Peter

5
peterr
Re: Hide parts of profile from anonymous users?
  • 2004/9/3 10:05

  • peterr

  • Just can't stay away

  • Posts: 518

  • Since: 2004/8/5 9


Hi,

It looks like this thread:

https://xoops.org/modules/newbb/viewtopic.php?viewmode=flat&topic_id=17838&forum=20

might help a lot, as it discusses using the 'rank' which is basically what I want to do right throughout XOOPS.

If the rank is equal or lower, allow display of user info, otherwise no display allowed.

Peter

6
Dave_L
Re: Hide parts of profile from anonymous users?
  • 2004/9/3 10:22

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


In userinfo.php, after $uid has been defined:

// (not tested)

$current_user_is_webmaster is_object($xoopsUser) && in_array(XOOPS_GROUP_ADMIN$xoopsUser->getGroups());

$member_handler =& xoops_gethandler('member');
$selected_user_is_webmaster in_array(XOOPS_GROUP_ADMIN$member_handler->getGroupsByUser($uid));

$selected_user_is_webmaster and !$current_user_is_webmaster and redirect_header('index.php'3_NOPERM);


Re: allowing only webmasters to see content (in any module) posted by webmasters - I don't know if that's achievable without extensive changes. If your only objective to protect the login names of webmasters, the best solution is probably to avoid using webmaster logins for any posting; each webmaster can create a secondary, normal user account for posting. This is getting away from the topic of this thread, and you might want to start a new thread to discuss this.

----
Edit

Made minor correction to above code.

7
peterr
Re: Hide parts of profile from anonymous users?
  • 2004/9/3 11:04

  • peterr

  • Just can't stay away

  • Posts: 518

  • Since: 2004/8/5 9


Hi,

Thanks Dave, I'll try that code out tomorrow.

Yes, I agree about trying to allow only webmasters to see content (in any module) may be very hard without extensive changes, and the sensible solution would be to apply our own 'rules', and not have webmasters post.

Thanks,

Peter

Login

Who's Online

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


Members: 0


Guests: 210


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