vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Quick Delete Avatar - Fairly easy I think (https://vborg.vbsupport.ru/showthread.php?t=45343)

Kuipo 11-03-2002 11:43 AM

Quick Delete Avatar - Fairly easy I think
 
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 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
PHP Code:

    // 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:
PHP Code:

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:
PHP Code:

// ############################### start mark all forums read ###############################
if ($action=="markread") {
  
$templatesused 'redirect_markread';
  include(
"./global.php");
  if (
$bbuserinfo[userid]!=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:
PHP Code:

// ############################### remove user avatar ###############################
if ($action=="removeava") {
  include(
"./global.php");
if (
$bbuserinfo[usergroupid]!=6show_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:
PHP Code:

if($bbuserinfo['usergroupid'] == 6) {
  
$removeavalink "<a href=\"member.php?action=removeava&userid=$post[userid]\">remove Avatar</a>";
} else {
  
$removeavalink "";


Add:
PHP Code:

if($post['field7'] != 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 ;)

PHP Code:

if($post['field7'] != AND $bbuserinfo['usergroupid'] == 6) { 

Should be

PHP Code:

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:

PHP Code:

// ############################### remove user avatar ############################### 
if ($action=="removeava") { 
  include(
"./global.php"); 
if (
$bbuserinfo[usergroupid]!=6show_nopermission();   
$DB_site->query("UPDATE userfield SET field7='' WHERE userid=$userid");   
eval(
"standardredirect(\"Avatar removed!\",\"index.php?s=$session[sessionhash]\");"); 


to

PHP Code:

// ############################### remove user avatar ############################### 
if ($action=="removeava") { 
  include(
"./global.php"); 
if (
$bbuserinfo[usergroupid]!=OR $bbuserinfo[usergroupid]!=OR $bbuserinfo[usergroupid]!=7show_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/foru...va&userid=5941
Referer: http://www.newcelica.org/forums/show...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


All times are GMT. The time now is 02:19 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01220 seconds
  • Memory Usage 1,773KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (10)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete