FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » How To » Prune stale users?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Prune stale users? [message #36288 is a reply to message #36286] Tue, 13 March 2007 18:02 Go to previous messageGo to previous message
Marticus   United States
Messages: 272
Registered: June 2002
Karma:
Senior Member
I have the following code now and it fails at the deletion line:

require_once ( "GLOBALS.php" );
include_once ( $GLOBALS['DATA_DIR'] . "scripts/fudapi.inc.php" );
fud_use ( 'db.inc' );
define ( 'forum_debug', 1 );

$num_days = 60; /* Number of days to keep stale users */

$query = "SELECT * FROM " . $GLOBALS['DBHOST_TBL_PREFIX']
            . "users ORDER BY join_date ASC ";

$listing = _fud_simple_fetch_query( 0, $query );

$fh = fopen ( 'users.dump', 'w' );

foreach ( $listing as $user ) {
    if ( ( $user->posted_msg_count == 0 ) && ( $user->id != 1 )
            && ( time() - $user->join_date >= ( $num_days * 24 * 60 * 60 ) ) ) {
        print "Deleted ID: " . $user->id . " ";
        print "Login: " . $user->login . " ";
        print "Joined: " . date('m/d/Y',$user->join_date) . " ";
        print "Posts: " . $user->posted_msg_count . "\n";
        while ( list ( $key, $val ) = each ($user) )
            $vals[] = "'".$val."'";
        $sqlcode = 'INSERT INTO users VALUES ('.join(', ', $vals).');';
        fwrite ( $fh, $sqlcode."\n" );
        fud_delete_user ( $user->id );
    }
    $vals = "";
}

fclose ( $fh );


1054: Unknown column 'Object' in 'where clause'
Query: DELETE FROM fud26_mod WHERE user_id IN(Object)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message icon6.gif
Read Message
Previous Topic: Embedding audio via html
Next Topic: Problem sending e-mail from the forum
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 29 05:32:27 GMT 2024

Total time taken to generate the page: 0.03898 seconds