user area accessible or not by different type of users (Design/Themes)

by chengtr, Wednesday, November 10, 2010, 07:01 (4888 days ago)

the forum can only set
User area(Is the user area (user list, profiles) accessible public?)
by two options, that's,
1.public accessible
2.accessible by registered users only

I think it is not good for user to visit Admin or Moderator's profile
For Admin, he can visit anything but for the user whose user_type <2,
I think they can only see those whose user_type <2.
so I made a change in the file includes/user.inc.php

just after

<?php
if(!defined('IN_INDEX'))
{
header('Location: ../index.php');
exit;
}

I add in:
------------------------------------------------------------
//add by chengtr for user area's visit attribution

if(isset($_SESSION[$settings['session_prefix'].'user_type'])
&&($_SESSION[$settings['session_prefix'].'user_type']==2))

$level_above=3;

else $level_above=2;

------------------------------------------------------------
and then in this file, in every sql sentences which inlude ".$db_settings['userdata_table']."

I add in:
------------------------------
user_type < ".$level_above."
------------------------------
in the 'where' conditions of the query sentences.
(remember AND before or behind this)

after these 2 changes, any user can not see the Admin's information.

user area accessible or not by different type of users

by Vinayy ⌂ @, Monday, November 29, 2010, 09:30 (4868 days ago) @ chengtr

I am using version 2.1.1 and I would like to allow only the 'admin' and 'moderators' to be able to view the users list .. instead of the current 2 options Public & Registered.

Any help would be greatly appreciated.

user area accessible or not by different type of users

by Vinayy ⌂ @, Monday, November 29, 2010, 16:41 (4868 days ago) @ Vinayy

Okay, here is what I have managed to do in templates_c/....user.tpl.nc.php

  • I removed <?php if ($this->_tpl_vars['mod'] || $this->_tpl_vars['admin']): ?>
  • and its corresponding <?php endif; ?> from 2 locations,
  • and put it before the "table" and its endif at the table which displays the user-list

This made the user-list disappear for the users and is only visible to the "admin" and mods.

I am sure there might be a better solution because I would have to do this modification again if I upgrade / modify my MLF installation.

RSS Feed of thread