View Full Version : Quick Delete Avatar - Fairly easy I think
Kuipo
11-03-2002, 11:43 AM
Ok, this seems like a wierd hack request at first, but it makes sence!
I would like a hack that puts a link under the avatar, that will remove that persons avatar.
I have an Off site avatar hack installed now. It makes it so i have a field# (field7 in my case) in the database be the avatar link.
This (https://vborg.vbsupport.ru/showthread.php?s=&threadid=39296&perpage=15&display=&pagenumber=1) is the off site avatar hack I have installed. It works awsome, and if you use the little addition MarkB made for it, (posted on 2nd page) if the field is blank it just doesnt display anything for an avatar.
So in short, I am not smart enough to know how to make a link that will clear a field for a userID. Then i can just put it in the postbit. I think it should be as easy as that. But i could be wrong.
Xenon
11-03-2002, 07:27 PM
hmm, you can clear userfields from within your acp,
but ok, here's how you'd do it:
open admin/functions.php
find // do posts from ignored users
if (($ignore[$post[userid]] and $post[userid] != 0)) {
eval("\$retval = \"".gettemplate("postbit_ignore")."\";");
} else {
eval("\$retval = \"".gettemplate("postbit")."\";");
}
return $retval;
before add:
if($bbuserinfo['usergroupid'] == 6) {
$removeavalink = "<a href=\"member.php?action=removeava&userid=$post[userid]\">remove Avatar</a>";
} else {
$removeavalink = "";
}
then you can add $removeavalink in your postbit template.
all you have to do now is to open member.php and put after this:// ############################### start mark all forums read ###############################
if ($action=="markread") {
$templatesused = 'redirect_markread';
include("./global.php");
if ($bbuserinfo[userid]!=0 and $bbuserinfo[userid]!=-1) {
$DB_site->query("UPDATE user SET lastactivity='".time()."',lastvisit='".time()."' WHERE userid='$bbuserinfo[userid]'");
} else {
vbsetcookie("bblastvisit",time());
}
eval("standardredirect(\"".gettemplate("redirect_markread")."\",\"index.php?s=$session[sessionhash]\");");
}
this:
// ############################### remove user avatar ###############################
if ($action=="removeava") {
include("./global.php");
if ($bbuserinfo[usergroupid]!=6) show_nopermission();
$DB_site->query("UPDATE userfield SET field7='' WHERE userid=$userid");
eval("standardredirect(\"Avatar removed!\",\"index.php?s=$session[sessionhash]\");");
}
that should work
Kuipo
11-04-2002, 01:12 AM
Thanks for the code, but it doesnt seem to be showing up in the postbit at all. I can't seem to find where the code has an error, or where i am setting it up incorrectly. I tried installing it... then i retried it, but still to no avail. I don't think it works 100% ^^
Any sugestions on why?
Wait!, i got it! Sry, my bad... It works great.
One small thing, can i have it check to see if the field is blank, somthing like
check[field7]='' dont show link
else showlink
haha, my l33t php coding skills at their best ;)
Also, just checking, but this DOES do a check to make sure that your an admin/mod correct?
Link14716
11-04-2002, 01:39 AM
Looking at his code, it does check.
For the "check if the field isn't empty, show link if it isn't, else don't show it" check, instead of adding:
if($bbuserinfo['usergroupid'] == 6) {
$removeavalink = "<a href=\"member.php?action=removeava&userid=$post[userid]\">remove Avatar</a>";
} else {
$removeavalink = "";
}
Add:
if($post['field7'] != 0 AND $bbuserinfo['usergroupid'] == 6) {
$removeavalink = "<a href=\"member.php?action=removeava&userid=$post[userid]\">remove Avatar</a>";
} else {
$removeavalink = "";
}
Kuipo
11-04-2002, 01:51 AM
you rock link!
but one small thing ;)
if($post['field7'] != 0 AND $bbuserinfo['usergroupid'] == 6) {
Should be
if($post['field7'] != '' AND $bbuserinfo['usergroupid'] == 6) {
I actually know somthing! Woo.. Thankx guys, you are awsome! :banana:
Xenon
11-04-2002, 03:39 PM
:)
you're welcome
Kuipo
06-03-2003, 08:07 AM
how would i make this avaliable to MOD's too?
i tried changing the code in members.php from:
// ############################### remove user avatar ###############################
if ($action=="removeava") {
include("./global.php");
if ($bbuserinfo[usergroupid]!=6) show_nopermission();
$DB_site->query("UPDATE userfield SET field7='' WHERE userid=$userid");
eval("standardredirect(\"Avatar removed!\",\"index.php?s=$session[sessionhash]\");");
}
to
// ############################### remove user avatar ###############################
if ($action=="removeava") {
include("./global.php");
if ($bbuserinfo[usergroupid]!=5 OR $bbuserinfo[usergroupid]!=6 OR $bbuserinfo[usergroupid]!=7) show_nopermission();
$DB_site->query("UPDATE userfield SET field7='' WHERE userid=$userid");
eval("standardredirect(\"Avatar removed!\",\"index.php?s=$session[sessionhash]\");");
}
But that didnt work. it now sais that i dont have permissions to access the page. But it says that for both admins AND mods.. i dont understand why, did i mess something up?
Xenon
06-03-2003, 09:26 AM
instead of the OR's you have to use AND's
larryd
07-12-2003, 07:13 AM
I don't mean to but into someone elses thread but Ive been trying to come up with a better way to delete Avatars on the site then going through one by one. I have installed the Avatar Gallery hack so I can see all the avatars that have been uploaded to the site and I know which ones I want to delete. I can manage to place the $removeavalink where I want it to go but when I run it I get an error stating
Database error in vBulletin 2.3.0:
Invalid SQL: UPDATE userfield SET field7='' WHERE userid=5941
mysql error: Unknown column 'field7' in 'field list'
mysql error number: 1054
Date: Saturday 12th of July 2003 01:09:54 AM
Script: http://www.newcelica.org/forums/forums/member.php?action=removeava&userid=5941
Referer: http://www.newcelica.org/forums/showthread.php?s=&threadid=89749
Xenon
07-12-2003, 08:50 AM
larry, you cannot use this thread's tips if you haven't installed the off site avatar hack, as it's directly based on this hack
larryd
07-12-2003, 08:17 PM
I think I can figure out what Im trying to do if someone can just tell me what the basic command is to turn a users avatar on or off.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.