Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest sNews - sNews 1.7 - with its own forums - for discussion and user mods.

Author Topic: [MOD] User List Permission  (Read 3282 times)

feiming

  • Newbie
  • *
  • Karma: 0
  • Posts: 4
    • My sNews Mods
[MOD] User List Permission
« on: May 24, 2008, 09:13:36 AM »

Description:In order to protect users list being available to registered members,it's not a good idea to allow every user to view users list.

Screenshot


Step 1
Backup

Step 2
Insert this into setting table
Quote
INSERT INTO `db_name`.`settings` (`id` ,`name` ,`value`)VALUES (NULL , 'user_list_permission', '4');

Step 3
find this line
Quote
   $l['mu_new_user_em'] = 'User e-mail';
Replace
Quote
   $l['mu_new_user_em'] = 'User e-mail';
   $l['mu_user_list_permission']='Minimum permission to view User List';

Step 4
Find this line
Quote
function users() {
   if ($_SESSION[db('website').'Logged_In'] == token()){
Replace
Quote
function users() {
   if (s('user_list_permission')>=1 && s('user_list_permission')<=4)$user_permission=s('user_list_permission');
   else $user_permission=4;
   if ($_SESSION[db('website').'Logged_In'] == token() && get_identity($_SESSION['id'], 'level') <= $user_permission){


Step 5
find this line
Quote
   echo html_input('text', 'length_password', 'maxpass', s('length_password'), l('mu_length_password'), '', '', '', '', '', '', '', '', '', '');
replace
Quote
   echo html_input('text', 'length_password', 'maxpass', s('length_password'), l('mu_length_password'), '', '', '', '', '', '', '', '', '', '');
   echo '<p><label for="ulp">'.l('mu_user_list_permission').':</label> <select name="user_list_permission" id="ulp">';
   echo '<option value="4"';
   if(s('user_list_permission') == 4 || s('user_list_permission')=="" || s('user_list_permission')==0)echo ' selected="selected"';
   echo '>'.l('mu_level_user').'</option>';
   echo '<option value="3"'.(s('user_list_permission') == 3 ? ' selected="selected"' : '').'>'.l('mu_level_editor').'</option>';
   echo '<option value="2"'.(s('user_list_permission') == 2 ? ' selected="selected"' : '').'>'.l('mu_level_supereditor').'</option>';
   echo '<option value="1"'.(s('user_list_permission') == 1 ? ' selected="selected"' : '').'>'.l('mu_level_admin').'</option>';
   echo '</select></p>';


Step 6
find this line
Quote
            $length_password = $_POST['length_password'];
replace
Quote
            $length_password = $_POST['length_password'];
            $user_list_permission = $_POST['user_list_permission'];

Step 7
find this and add the red line at the back of that line
Quote
            $ufield = array('website_title' => $website_title,'home_sef' => $home_sef,'website_description' => $website_description,'website_keywords' => $website_keywords,'website_email' => $website_email,'contact_subject' => $contact_subject,'language' => $language,'charset' => $charset,'date_format' => $date_format,'article_limit' => $article_limit,'rss_limit' => $rss_limit,'display_page' => $display_page,'comments_order' => $comments_order,'comment_limit' => $comment_limit,'word_filter_file' => $word_filter_file,'word_filter_change' => $word_filter_change,'display_new_on_home' => $display_new_on_home,'display_pagination' => $display_pagination,'num_categories' => $num_categories,'approve_comments' => $approve_comments,'word_filter_enable' => $word_filter_enable,'display_added_by' => $added_by,'comments_reg' => $comments_reg,'alert_register' => $alert_register,'alert_emailusr' => $alert_emailusr,'length_password' => $length_password,'registration_off' => $registration_off,'users_online' => $users_online,'user_list_permission' => $user_list_permission,);
« Last Edit: May 24, 2008, 09:42:59 PM by feiming »
Logged

webzub

  • Guest
Re: [MOD] User List Permission
« Reply #1 on: June 07, 2008, 01:46:33 PM »

Hi feiming,

I'd love to do this but I've seen there are a few INSERT INTO sections within the code. Would you please
point us out the exact place

I would really appreciate it!
Logged