Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 11-03-2002, 11:43 AM
Kuipo's Avatar
Kuipo Kuipo is offline
 
Join Date: Oct 2002
Location: WA
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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.
Reply With Quote
  #2  
Old 11-03-2002, 07:27 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #3  
Old 11-04-2002, 01:12 AM
Kuipo's Avatar
Kuipo Kuipo is offline
 
Join Date: Oct 2002
Location: WA
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #4  
Old 11-04-2002, 01:39 AM
Link14716's Avatar
Link14716 Link14716 is offline
 
Join Date: Jun 2002
Location: Georgia, USA
Posts: 2,519
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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 "";

Reply With Quote
  #5  
Old 11-04-2002, 01:51 AM
Kuipo's Avatar
Kuipo Kuipo is offline
 
Join Date: Oct 2002
Location: WA
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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:
Reply With Quote
  #6  
Old 11-04-2002, 03:39 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default



you're welcome
Reply With Quote
  #7  
Old 06-03-2003, 08:07 AM
Kuipo's Avatar
Kuipo Kuipo is offline
 
Join Date: Oct 2002
Location: WA
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #8  
Old 06-03-2003, 09:26 AM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

instead of the OR's you have to use AND's
Reply With Quote
  #9  
Old 07-12-2003, 07:13 AM
larryd larryd is offline
 
Join Date: Nov 2001
Location: Newark, DE
Posts: 93
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #10  
Old 07-12-2003, 08:50 AM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:12 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04365 seconds
  • Memory Usage 2,292KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (10)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete