vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Mass Delete User Albums (https://vborg.vbsupport.ru/showthread.php?t=261054)

Chadi 03-28-2011 11:07 AM

Mass Delete User Albums
 
<blockquote> How do I mass delete all user albums in 3.8? </blockquote>

Chadi 04-09-2011 11:00 AM

Can someone please help?

CRDeveloper 04-10-2011 09:19 PM

I need to do it on vb 4 too!

Chadi 04-18-2011 05:37 PM

Anyone? Thanks

kh99 04-18-2011 08:01 PM

Warning: try this at your own risk - back up your database first. There is no "are you sure you want to do this message". You have been warned.

I only did one test to see if this worked at all (on vb 3.8.3 - I have no idea if this will work for vb4), but here it is: make a plugin using hook location admin_maintenance and this code:

Code:

if ($_REQUEST['do'] == 'deleteallalbums')
{
    require_once(DIR . '/includes/functions_album.php');
    print_dots_start("Deleting all albums ");
    do
    {
        $albuminfo = $vbulletin->db->query_first("
                SELECT album.*, user.username
                FROM " . TABLE_PREFIX . "album AS album
                LEFT JOIN " . TABLE_PREFIX . "user AS user ON (album.userid = user.userid)"
            );
        if (!$albuminfo)
        {
              break;
        }
        $albumdata =& datamanager_init('Album', $vbulletin, ERRTYPE_STANDARD);
        $albumdata->set_existing($albuminfo);
        $albumdata->delete();
    } while (1);
        print_dots_stop();
        print_cp_message("Done.",
                defined('CP_REDIRECT') ? CP_REDIRECT : NULL,
                1,
                defined('CP_BACKURL') ? CP_BACKURL : NULL,
                defined('CP_CONTINUE') ? true : false
        );
}


Then when you're sure you're ready to try it, type in the url [your forum]/admincp/misc.php?do=deleteallalbums .

You probably now want to delete or at least disable that plugin.

ETA: for anyone who feels like confirming it's legit - I used the code from the file album.php, the "do == killalbum" section that gets called when a user deletes an album. The first query I got from fetch_albuminfo() in includes/functions_album.php (but I removed the WHERE for the userid).

Chadi 04-18-2011 08:59 PM

Thanks for your help. Can any coder here confirm this plugin looks legit?

paulgee 10-12-2013 01:51 PM

there is an easier way?

if you don't want albums at all just switch them off i.e.
in vboptions > user profile options > enabled profile features

then back up your database............

to remove all existing albums use phpmyadmin, locate usually VB# albums and select it then click empty on you phpadmin panel.

you can do this with album images as well. :D

doing this saved me tons of space in my database and stopped spammers using the albums area as a spamming tool.

Regards
Paul

yotsume 08-29-2015 03:45 PM

In VB 37x I need a way to delete orphaned albums of users that were deleted who had created albums. When these users were deleted their albums remain and can NOT be accessed but their thumbnails show up.

I would rather keep albums of current members...

UPDATE: Silly me! The solution is way too simple. Just use phpmyadmin and delete the tables in vb_album related to the orphaned User IDs. PROBLEM SOLVED!


All times are GMT. The time now is 10:52 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.00966 seconds
  • Memory Usage 1,723KB
  • 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_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)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