vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   If member of X, delete custom avatar (https://vborg.vbsupport.ru/showthread.php?t=157842)

mixylplik3 09-14-2007 06:16 PM

If member of X, delete custom avatar
 
Members who pay for an upgraded account are allowed to have avatars. Those that do not pay do not get avatars. I originally set up the subscriptions to change the primary usergroup as opposed to adding them to a secondary group. This has broken the functionality that removes the custom avatar when their account expires.

There was a script for an older version of vB that would delete the custom avatar if the user was in the regular registered user group. It no longer works.

I'm looking for a script that will delete the custom avatar if the user is in a specific group.

Thanks.

WhaLberg 09-14-2007 06:49 PM

Save it as a php file and upload to your forum home directory and run after uploading.

PHP Code:

<?php
// we need global.php..
require_once('global.php');
// set the usergroupid for the users who are in.. 
$removeugid 6;
// start..
$finduser $db->query_read("SELECT userid FROM " TABLE_PREFIX "customavatar");
while (
$print $db->fetch_array($finduser)) 
{
    
$userid $print['userid'];
    
$fugid $db->query_read("SELECT username,usergroupid FROM " TABLE_PREFIX "user WHERE userid='$userid'");
    while (
$show $db->fetch_array($fugid)) 
    {
        
$user $show['username'];
        
$usergroupid $show['usergroupid'];
        if (
$usergroupid == $removeugid
        {
            
$removeavatar $db->query_read("DELETE FROM " TABLE_PREFIX "customavatar WHERE userid='$userid'");
            if (
$removeavatar
            {
                echo 
"Avatar of $user has been removed.<br />";
            }
            else 
            {
                echo 
mysql_error();
            }
        }
    }
}

?>

Do NOT forget to set the $removeugid..

mixylplik3 09-14-2007 07:06 PM

Fantastic. Thank you!


All times are GMT. The time now is 01:48 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.01005 seconds
  • Memory Usage 1,722KB
  • 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
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete