Page 1 of 1

[Beta] Disable Profile

Posted: Sat Jul 13, 2002 3:54 pm
by Fubonis
Disable Profile
An admin can use the existing feature of modyfing a user to "disable" the use of their profile. The user who's profile is disabled cannot edit it until an admin re-enables it.

Download

Posted: Sun Jul 14, 2002 2:29 am
by Xerin
Edit again:
I hate being picky :? , but:

<select name="user_disable_profile">
<option value="0">{L_NO}</option>
<option value="1">{L_YES}</option>

Would be better since it would default NO instead of yes.

Edit:
BUG
You need to query the database with something like:
(not 100% sure this is the right way to do it, BUT thats how I did it)

Code: Select all

ALTER TABLE `phpbb_users` ADD `user_disabled_profile` TINYINT NOT NULL;

Code: Select all

#
#-----[ OPEN ]------------------------------------------
#

admin/users.php
Should be:

Code: Select all

#
#-----[ OPEN ]------------------------------------------
#

admin/admin_users.php
Also in the header, it would be easier prepareing to install the mod if you add in the folder directory
e.g.

admin_users.php, constants.php to

admin/admins_users.php
includes/constants.php

Posted: Sun Jul 14, 2002 2:36 pm
by Fubonis
Beta 1.0.1 now. I added your suggestions. The SQL query is in the author notes.

Posted: Sun Jul 14, 2002 11:00 pm
by Xerin

Code: Select all

<select name="user_disable_profile">
	<option value="1">{L_YES}</option>
	<option value="0">{L_NO}</option>
</select></td>
You really should switch them still O_o in your latest release.

Posted: Sun Jul 14, 2002 11:04 pm
by Fubonis
Gah! Totally forgot about that part.
Next release, though, I'll just have it default to the current setting. Thanks for that suggestion, though.

Posted: Mon Jul 15, 2002 1:36 am
by Fubonis
Beta 1.0.2. Did away with the select box--now just a single checkbox. If the profile is disabled, it's automatically checked, else it's left alone.

Posted: Mon Sep 16, 2002 5:13 pm
by MJ
Having some troubles with this MOD........

The checkbox won't show a tick if the user's profile has been disabled.......
I
I noticed this

Code: Select all

'DISABLE_CHECKED' => $user_profile_disable, // Disable Profile Mod
And in keeping with the MOD changed it to:

Code: Select all

'DISABLE_CHECKED' => $user_disable_profile, // Disable Profile Mod
But alas this didnt help.

So in the database it says that profile is disabled, so it originally saved the info when checked, but now when editing, unable to un-check the box as no tick shown!!!!

I was able to make this work with yes/no buttons

Posted: Sat Oct 19, 2002 4:50 pm
by MrStormyNights
I could not get the check box to work, but I made some changes to your instructions and added a couple of things I think you missed in order to get this to work with yes/no buttons. I will send you my updated instructions via PM and you can determine if you want to incorperate it or not.

Here is my updated code if anyone wants it. Works on 2.0.6!

Posted: Sat Oct 04, 2003 4:25 pm
by MrStormyNights

Code: Select all

##############################################################
## MOD Title: Disable Profile
## MOD Author: Fubonis < php@fubonis.com > (JW Frazier) http://www.fubonis.com
## MOD Description: Allows an administrator to disable a user's prpfile. The user cannot update their profile.
## MOD Version: Beta 1.0.2
##
## Installation Level: Moderate
## Installation Time: 10 Minutes
## Files To Edit: admin/admin_users.php, includes/constants.php, includes/usercp_register.php, language/lang_english/lang_admin.php, language/lang_english/lang_main.php, templates/subSilver/admin/user_edit_body.tpl
## Included Files: N/A
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/downloads/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/downloads/
##############################################################
## Author Notes:
## You need to run this SQL command.  Add your prefix if neccessary.
## ALTER TABLE users ADD user_disabled_profile TINYINT(1) UNSIGNED NOT NULL
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

#
#-----[ OPEN ]------------------------------------------
#

admin/admin_users.php


#
#-----[ FIND ]------------------------------------------
#

		$user_allowavatar = ( !empty($HTTP_POST_VARS['user_allowavatar']) ) ? intval( $HTTP_POST_VARS['user_allowavatar'] ) : 0;


#
#-----[ AFTER, ADD ]------------------------------------------
#

		$user_disabled_profile = ( !empty($HTTP_POST_VARS['user_disabled_profile']) ) ? intval( $HTTP_POST_VARS['user_disabled_profile'] ) : 0; // Disable Profile Mod


#
#-----[ FIND ]------------------------------------------
#

SET " . $username_sql . $passwd_sql . "user_email = '" . str_replace("\'", "''", $email) . "', user_icq = '" . str_replace("\'", "''", $icq) . "', user_website = '" . str_replace("\'", "''", $website) . "', user_occ = '" . str_replace("\'", "''", $occupation) . "', user_from = '" . str_replace("\'", "''", $location) . "', user_interests = '" . str_replace("\'", "''", $interests) . "', user_sig = '" . str_replace("\'", "''", $signature) . "', user_viewemail = $viewemail, user_aim = '" . str_replace("\'", "''", $aim) . "', user_yim = '" . str_replace("\'", "''", $yim) . "', user_msnm = '" . str_replace("\'", "''", $msn) . "', user_attachsig = $attachsig, user_sig_bbcode_uid = '$signature_bbcode_uid', user_allowsmile = $allowsmilies, user_allowhtml = $allowhtml, user_allowavatar = $user_allowavatar, user_allowbbcode = $allowbbcode, user_allow_viewonline = $allowviewonline, user_notify = $notifyreply, user_allow_pm = $user_allowpm 


#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#

, user_disabled_profile = $user_disabled_profile 

#
#----[ FIND ]------------------------------------------
#

		$user_allowavatar = $this_userdata['user_allowavatar'];
		$user_allowpm = $this_userdata['user_allow_pm'];

#
#-----[ AFTER, ADD ]------------------------------------------
#

		$user_disabled_profile = $this_userdata['user_disabled_profile'];

#
#----[ FIND ]------------------------------------------
#

			$s_hidden_fields .= '<input type="hidden" name="user_status" value="' . $user_status . '" />';
			$s_hidden_fields .= '<input type="hidden" name="user_allowpm" value="' . $user_allowpm . '" />';

#
#-----[ AFTER, ADD ]------------------------------------------
#

			$s_hidden_fields .= '<input type="hidden" name="user_disabled_profile" value="' . $user_disabled_profile . '" />';

#
#----[ FIND ]------------------------------------------
#

'S_FORM_ENCTYPE' => $form_enctype,


#
#-----[ AFTER, ADD ]------------------------------------------
#

			'L_DISABLE_PROFILE' => $lang['Disable_Profile'], // Disable Profile Mod
			'DISABLE_CHECKED_YES' => ($user_disabled_profile) ? 'checked="checked"' : '', // Disable Profile Mod
			'DISABLE_CHECKED_NO' => (!$user_disabled_profile) ? 'checked="checked"' : '', // Disable Profile Mod


#
#-----[ OPEN ]------------------------------------------
#

includes/constants.php


#
#----[ FIND ]------------------------------------------
#

define('VOTE_USERS_TABLE', $table_prefix.'vote_voters');


#
#-----[ AFTER, ADD ]------------------------------------------
#

define('PROFILE_DISABLED', 1); // Disable Profile Mod


#
#-----[ OPEN ]------------------------------------------
#

includes/usercp_register.php


#
#----[ FIND ]------------------------------------------
#

if ( $mode == 'register' && !isset($HTTP_POST_VARS['agreed']) && !isset($HTTP_GET_VARS['agreed']) )
{
	include($phpbb_root_path . 'includes/page_header.'.$phpEx);

	show_coppa();

	include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
}


#
#-----[ AFTER, ADD ]------------------------------------------
#

// Disable Profile Mod
if ( $mode == 'editprofile' && $userdata['user_disabled_profile'] == PROFILE_DISABLED )
{
	message_die(GENERAL_ERROR, $lang['Profile_Disable_Message']);
}


#
#----[ FIND ]------------------------------------------
#

//
// Did the user submit? In this case build a query to update the users profile in the DB
//
if ( isset($HTTP_POST_VARS['submit']) )
{
	include($phpbb_root_path . 'includes/usercp_avatar.'.$phpEx);

	$passwd_sql = '';
	if ( $mode == 'editprofile' )
	{


#
#-----[ AFTER, ADD ]------------------------------------------
#

// Disable Profile Mod
		if ( $userdata['user_disabled_profile'] == PROFILE_DISABLED )
		{
			message_die(GENERAL_ERROR, $lang['Profile_Disable_Message']);
		}


#
#-----[ OPEN ]------------------------------------------
#

language/lang_english/lang_admin.php


#
#----[ FIND ]------------------------------------------
#

//
// That's all Folks!
// -------------------------------------------------


#
#-----[ BEFORE, ADD ]------------------------------------------
#

// Disable Profile Mod
$lang['Disable_Profile'] = 'Disable Profile';


#
#-----[ OPEN ]------------------------------------------
#

language/lang_english/lang_main.php


#
#----[ FIND ]------------------------------------------
#

//
// That's all Folks!
// -------------------------------------------------


#
#-----[ BEFORE, ADD ]------------------------------------------
#

// Disable Profile Mod
$lang['Profile_Disable_Message'] = 'Your ability to edit your profile has been disabled by the administrator.';


#
#-----[ OPEN ]------------------------------------------
#

templates/subSilver/admin/user_edit_body.tpl


#
#----[ FIND ]------------------------------------------
#

	<tr> 
	  <td class="row1"><span class="gen">{L_DELETE_USER}?</span></td>
	  <td class="row2"> 
		<input type="checkbox" name="deleteuser">
		{L_DELETE_USER_EXPLAIN}</td>
	</tr>


#
#-----[ AFTER, ADD ]------------------------------------------
#

	<tr> 
	  <td class="row1"><span class="gen">{L_DISABLE_PROFILE}</span></td>
	  <td class="row2"> 
	  	<input type="radio" name="user_disabled_profile" value="1" {DISABLE_CHECKED_YES} />
		<span class="gen">{L_YES}</span>&&
	  	<input type="radio" name="user_disabled_profile" value="0" {DISABLE_CHECKED_NO} /> 
		<span class="gen">{L_NO}</span></td>
	</tr>



#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM

Re: [Beta] Disable Profile

Posted: Thu May 17, 2007 12:34 pm
by 45ish
Hi,
Does this automatically disable profiles for new registrations? Also, is it usable with current phpbb version 2022? Thank you for helping.