[2.0.21] Delete User MOD

All new MODs released in our MOD Database will be announced in here. All support for released MODs needs to take place in here. No new MODs will be accepted into the MOD Database for phpBB2
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
Post Reply

Rating:

Excellent!
31
76%
Very Good
5
12%
Good
2
5%
Fair
2
5%
Poor
1
2%
 
Total votes: 41

angelp1ay
Registered User
Posts: 175
Joined: Tue Dec 23, 2003 1:32 pm
Location: Bristol, UK
Contact:

Post by angelp1ay »

One of your tags is cutting off half way through before its attributes and they are being spewed out as text. Search for the code the is being displayed and check that code around that area is correct.
User avatar
Knotty_Log
Registered User
Posts: 72
Joined: Sat Sep 09, 2006 3:12 pm
Contact:

Post by Knotty_Log »

angelp1ay wrote: One of your tags is cutting off half way through before its attributes and they are being spewed out as text. Search for the code the is being displayed and check that code around that area is correct.


Search where?
_____________________
User avatar
Bob Hansen
Registered User
Posts: 1
Joined: Wed Sep 11, 2002 11:17 pm
Location: SALEM, NH USA
Contact:

Post by Bob Hansen »

Have not seen clear answer to these questions?

1. Can this be modified to allow Moderators to use this?
2. Can this be modified to prevent Admins from being deleted?
3. Can this be modified to delete all posts from the account being deleted?

If YES to any of the above, can you please provide the code we need to do that?

Thanks for listening.
rauz242
Registered User
Posts: 10
Joined: Sat Jan 20, 2007 1:17 am

Post by rauz242 »

The in-line descriptions always confuse me...

Code: Select all

#-----[ FIND ]------------------------------------------ 
#
		<td width="150" align="left" valign="top" class="{postrow.ROW_CLASS}"><span class="name"><a name="{postrow.U_POST_ID}"></a>
# 
#-----[ IN-LINE FIND ]------------------------------------------ 
#
class="{postrow.ROW_CLASS}">
# 
#-----[ IN-LINE AFTER, ADD ]------------------------------------------ 
#
{postrow.DELETE_USER_IMAGE}
Does that mean this should be the final result?

Code: Select all

<td width="150" align="left" valign="top" class="{postrow.ROW_CLASS}">{postrow.DELETE_USER_IMAGE}<span class="name"><a name="{postrow.U_POST_ID}">
ycl6
Translator
Posts: 5696
Joined: Sat Feb 15, 2003 10:35 am
Location: Taiwan
Contact:

Post by ycl6 »

rauz242 wrote: Does that mean this should be the final result?

Code: Select all

<td width="150" align="left" valign="top" class="{postrow.ROW_CLASS}">{postrow.DELETE_USER_IMAGE}<span class="name"><a name="{postrow.U_POST_ID}">

That's correct.

You only need to remember that IN-LINE actions means do the changes right after the code found in IN-LINE FIND.

~Mac
angelp1ay
Registered User
Posts: 175
Joined: Tue Dec 23, 2003 1:32 pm
Location: Bristol, UK
Contact:

Post by angelp1ay »

Bob Hansen wrote: Have not seen clear answer to these questions?

1. Can this be modified to allow Moderators to use this?
2. Can this be modified to prevent Admins from being deleted?
3. Can this be modified to delete all posts from the account being deleted?

If YES to any of the above, can you please provide the code we need to do that?

Thanks for listening.

Yes, yes and presumably yes although presumably this is a little more involved.

Unless these additions are included in the mod they won't go through the mod queue and be tested. I would be worried anything I posted would not be secure and infact since this is such a powerful mod I would be worried anything I coded would provide unexpected results eg. deleting the wrong users or something.

I might have a go at writing code for the first two of your suggestions this coming weekend and perhaps ycl6 can quickly skim through them to make sure I haven't made any obvious mistakes. I don't have a dev board to test them on though and I don't want to risk deleting admins off my main board... Perhaps once I've had a go someone could test the code on a dev board for me.
angelp1ay
Registered User
Posts: 175
Joined: Tue Dec 23, 2003 1:32 pm
Location: Bristol, UK
Contact:

Post by angelp1ay »

Just a thought...

When using this mod to delete a user, does the admin have to login to an admin session before deleting someone like they login again to view the ACP? Would it be sensible to require an admin session?
rauz242
Registered User
Posts: 10
Joined: Sat Jan 20, 2007 1:17 am

Post by rauz242 »

ycl6 wrote: That's correct.

You only need to remember that IN-LINE actions means do the changes right after the code found in IN-LINE FIND.

Ok thanks and thanks for the quick reply!

Confirmed working with phpBB 2.0.22
ycl6
Translator
Posts: 5696
Joined: Sat Feb 15, 2003 10:35 am
Location: Taiwan
Contact:

Post by ycl6 »

angelp1ay wrote: When using this mod to delete a user, does the admin have to login to an admin session before deleting someone like they login again to view the ACP? Would it be sensible to require an admin session?

No re-loging is required with this MOD.

~Mac
User avatar
Knotty_Log
Registered User
Posts: 72
Joined: Sat Sep 09, 2006 3:12 pm
Contact:

Post by Knotty_Log »

Knotty_Log wrote:
angelp1ay wrote:One of your tags is cutting off half way through before its attributes and they are being spewed out as text. Search for the code the is being displayed and check that code around that area is correct.


Search where?


Knot sure where to look here (memberlist.php :?: ) or what I am looking for :?:
_____________________
angelp1ay
Registered User
Posts: 175
Joined: Tue Dec 23, 2003 1:32 pm
Location: Bristol, UK
Contact:

Post by angelp1ay »

angelp1ay wrote:
Bob Hansen wrote:Have not seen clear answer to these questions?

2. Can this be modified to prevent Admins from being deleted?

I might have a go at writing code for the first two of your suggestions this coming weekend...

Ok, I've had a go at protecting admins.

This hasn't gone through the mod testers! Use at own risk!

Code: Select all

#
#-----[ OPEN ]------------------------------------------ 
#
delete_user.php
# 
#-----[ FIND ]------------------------------------------ 
#
//
// Start Delete (code borrowed from admin_users.php)
//
# 
#-----[ BEFORE, ADD ]------------------------------------------ 
#
# Think this bit can be shortened a little...
# Don't think I really need the 2nd if statement to wrap its contents
#
$sql = "SELECT user_level 
	FROM " . USERS_TABLE . "
	WHERE user_id = " . $user_id . "
	LIMIT 1";
if( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not query users', '', __LINE__, __FILE__, $sql);
}

if ( $row = $db->sql_fetchrow($result) )
{
$user_level = $row['user_level'];
$db->sql_freeresult($result);
}
# 
#-----[ FIND ]------------------------------------------ 
#
//
// Start Delete (code borrowed from admin_users.php)
//
if( $userdata['user_id'] != $user_id )
{
# 
#-----[ REPLACE WITH ]--------------------------------------------- 
# 
//
// Start Delete (code borrowed from admin_users.php)
//
if( $userdata['user_id'] != $user_id && $user_level != 1 )
# 
#-----[ FIND ]------------------------------------------ 
#
else
{
	message_die(GENERAL_ERROR, 'Cannot_delete_self');
}
# 
#-----[ REPLACE WITH ]--------------------------------------------- 
# 
elseif ($userdata['user_id'] == $user_id)
{
	message_die(GENERAL_ERROR, 'Cannot_delete_self');
}
elseif ($user_level == 1) // left in to be more explicit
{
	message_die(GENERAL_ERROR, 'Cannot_delete_admin');
}
else // left in as default
{
	message_die(GENERAL_ERROR, 'Cannot_delete_self');
}
#
#-----[ OPEN ]------------------------------------------ 
#
language/lang_english/lang_main.php
# 
#-----[ FIND ]------------------------------------------ 
#
$lang['Cannot_delete_self'] = 'Cannot delete yourself';
# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
$lang['Cannot_delete_admin'] = 'You cannot delete admin accounts using this function';
# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 
# EoM
I think this is fairly straight forward, and seems to give the desired results on my forum.

This hasn't gone through the mod testers! Use at own risk!

Perhaps someone else could just have a quick look through the code to make sure it isn't fundamental flawed, stupid, or dangerous.
angelp1ay
Registered User
Posts: 175
Joined: Tue Dec 23, 2003 1:32 pm
Location: Bristol, UK
Contact:

Post by angelp1ay »

Knotty_Log wrote:
Knotty_Log wrote:
angelp1ay wrote:One of your tags is cutting off half way through before its attributes and they are being spewed out as text. Search for the code the is being displayed and check that code around that area is correct.


Search where?


Knot sure where to look here (memberlist.php :?: ) or what I am looking for :?:

This creates the new memberlist code:

Code: Select all

# 
#-----[ OPEN ]------------------------------------------ 
#
memberlist.php
# 
#-----[ FIND ]------------------------------------------ 
#
		$search = '<a href="' . $temp_url . '">' . sprintf($lang['Search_user_posts'], $username) . '</a>';
# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
		// Delete User MOD
		if ( $userdata['user_level'] == ADMIN && $user_id != ANONYMOUS )
		{
			$temp_url = append_sid("delete_user.$phpEx?" . POST_USERS_URL . "=$user_id&file=memberlist&sid=" . $userdata['session_id']);
			$delete_user_img = '&nbsp;<a href="' . $temp_url . '"><img src="' . $images['icon_delpost'] . '" alt="' . sprintf($lang['Delete_user'], $username) . '" title="' . sprintf($lang['Delete_user'], $username) . '" border="0" /></a>';
			$delete_user = '&nbsp;<a href="' . $temp_url . '">' . sprintf($lang['Delete_user'], $username) . '</a>';
		}
		else
		{
			$delete_user_img = '';
			$delete_user = '';
		}
...but I reckon your error was in this change:

Code: Select all

# 
#-----[ OPEN ]------------------------------------------ 
#
templates/subSilver/memberlist_body.tpl
# 
#-----[ FIND ]------------------------------------------ 
#
	  <td class="{memberrow.ROW_CLASS}" align="center"><span class="gen"><a href="{memberrow.U_VIEWPROFILE}" class="gen">{memberrow.USERNAME}</a></span></td>
# 
#-----[ IN-LINE FIND ]------------------------------------------ 
#
{memberrow.USERNAME}</a></span>
# 
#-----[ IN-LINE AFTER, ADD ]------------------------------------------ 
#
{memberrow.DELETE_USER_IMAGE}
I reckon you inserted the {memberrow.DELETE_USER_IMAGE} bit in the wrong place.
angelp1ay
Registered User
Posts: 175
Joined: Tue Dec 23, 2003 1:32 pm
Location: Bristol, UK
Contact:

Post by angelp1ay »

angelp1ay wrote:
Bob Hansen wrote:Have not seen clear answer to these questions?

1. Can this be modified to allow Moderators to use this?

I might have a go at writing code for the first two of your suggestions this coming weekend...

Ok, I've done this one too...

Here is code to allow moderators to use this delete mod.

Again this hasn't gone through the mod testers. Use at your own risk!

Code: Select all

# 
#-----[ OPEN ]------------------------------------------ 
# 
delete_user.php
# 
#-----[ FIND ]------------------------------------------ 
# 
if ( $userdata['user_level'] != ADMIN )
# 
#-----[ REPLACE WITH ]--------------------------------------------- 
# 
if ( $userdata['user_level'] != ADMIN && $userdata['user_level'] != MOD )
# 
#-----[ OPEN ]------------------------------------------ 
# 
viewtopic.php
# 
#-----[ FIND ]------------------------------------------ 
# 
	// Delete User MOD
	if ( $userdata['user_level'] == ADMIN && $poster_id != ANONYMOUS )
# 
#-----[ REPLACE WITH ]--------------------------------------------- 
# 
	// Delete User MOD
	if (( $userdata['user_level'] == ADMIN || $userdata['user_level'] == MOD ) && $poster_id != ANONYMOUS )
# 
#-----[ OPEN ]------------------------------------------ 
#
memberlist.php
# 
#-----[ FIND ]------------------------------------------ 
#
		// Delete User MOD
		if ( $userdata['user_level'] == ADMIN && $user_id != ANONYMOUS )
# 
#-----[ REPLACE WITH ]--------------------------------------------- 
# 
		// Delete User MOD
		if (( $userdata['user_level'] == ADMIN || $userdata['user_level'] == MOD ) && $user_id != ANONYMOUS )
# 
#-----[ OPEN ]------------------------------------------ 
# 
includes/usercp_viewprofile.php
# 
#-----[ FIND ]------------------------------------------ 
# 
// Delete User MOD
if ( $userdata['user_level'] == ADMIN && $profiledata['user_id'] != ANONYMOUS )
# 
#-----[ REPLACE WITH ]--------------------------------------------- 
# 
// Delete User MOD
if (( $userdata['user_level'] == ADMIN || $userdata['user_level'] == MOD )&& $profiledata['user_id'] != ANONYMOUS )
# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 
# EoM
This hasn't gone through the mod testers. Use at your own risk!

I think this is all that needs doing to allow mods to delete users.

I'm not actually using this code and I only tested the view profile bit, but it's all the same on the other pages. Again if someone could have a quick look to make sure I haven't messed anything up that would be great!
etingwall
Registered User
Posts: 10
Joined: Fri Feb 16, 2007 7:25 pm

Post by etingwall »

I just upgraded to 2.0.22 without first uninstalling my mods. I'm real new at this and I'm a little lost with this error. Reinstalling the other mods went flawlessly.

Any suggestions?

Code: Select all

Critical Error

FIND FAILED: In file [templates/subSilver/viewtopic_body.tpl] could not find:

<td width="150" align="left" valign="top" class="{postrow.ROW_CLASS}"><span class="name"><a name="{postrow.U_POST_ID}"></a> 

MOD script line #154 
ycl6
Translator
Posts: 5696
Joined: Sat Feb 15, 2003 10:35 am
Location: Taiwan
Contact:

Post by ycl6 »

I just checked the default file from phpBB, I can find that line alright. The code look like:

Code: Select all

	<!-- BEGIN postrow -->
	<tr> 
		<td width="150" align="left" valign="top" class="{postrow.ROW_CLASS}"><span class="name"><a name="{postrow.U_POST_ID}"></a><b>{postrow.POSTER_NAME}</b></span><br /><span class="postdetails">{postrow.POSTER_RANK}<br />{postrow.RANK_IMAGE}{postrow.POSTER_AVATAR}<br /><br />{postrow.POSTER_JOINED}<br />{postrow.POSTER_POSTS}<br />{postrow.POSTER_FROM}</span><br /></td>
Can you do a manual check if the line is still there?

~Mac
Post Reply

Return to “[2.0.x] MOD Database Releases”