vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   Mass Delete/Mass Email inactive users. (https://vborg.vbsupport.ru/showthread.php?t=500)

08-01-2000 05:14 AM

Ed:

A couple of things:

Shouldn't it be:

(joindate>=$datecut AND posts<=$joinpostsremove)

instead of:

(joindate<=$datecut AND posts<=$joinpostsremove)

if you are trying to remove those memberships that are older than the number of days that your wanting to take out?

I noticed that the } else { line doesn't work. If it takes out memberships it lists them like it should but if it doesn't find anything that matches the criteria it should give you the "No Members match....." line and it doesn't.

Also, the reason that I asked about the time stamp thing
is because my own joindate is listed as 867992400. I have been on our forum for 1122 days. If you multiply this by
the 86,400 you get 96940800. Shouldn't these be the same?

Don't you just love it when a newbie asks all kinds of questions like this?

Thanks,
Parker

08-02-2000 12:41 AM

Quote:

Shouldn't it be:

(joindate>=$datecut AND posts<=$joinpostsremove)

instead of:

(joindate<=$datecut AND posts<=$joinpostsremove)
No, the newer the registration, the larger the number. (Which, I just realized makes some code invalid. I'll get to that later)

Quote:

Also, the reason that I asked about the time stamp thing
is because my own joindate is listed as 867992400. I have been on our forum for 1122 days. If you multiply this by
the 86,400 you get 96940800. Shouldn't these be the same?
That timestamp is seconds from Jan 1, 1970, not how long it's on the board.

I did the math, but now that I look at it, it didn't generate that number. I think my unix timestamp info may be wrong. I guess it's not 1970.

Just trust me with what I'm saying here :D

Now, next post will update the code a little...

08-02-2000 12:45 AM

Actually, I just made a mistake in my math, so now it works (forgot to subtract 1122)

(365 * 30) + 212 - 1122 = 10040 days since Jan 1, 1970

10,040 * 86,400 = 867456000 seconds since Jan 1, 1970

867456000
867992400

The small difference is because I didn't take into account for leap years.

Ok, did that - not NEXT post will update code.

08-02-2000 12:53 AM

Untested, and I only changed one line of code, but I think it should work now :)

Please note that if you type in "0" in days and like "1000000" in posts, it will probably delete ALL your users - admins included. There is no error checking or usergroup checking! (Although that's pretty simple) If this works, let me know and I'll add the checks!

Code:

if ($action=="joindates") {

echo "<p>Remove by length of membership</p>\n";
echo doformheader("thread","doremovejoindate");
echo "<table border=0>";
echo makeinputcode("Delete accounts older than x days:","joindateremove","");
echo makeinputcode("Number of Posts:","joinpostsremove","");
echo doformfooter("Submit");

exit;

} #end joindates

if ($action=="doremovejoindate") {

echo "<p>Deleting...</p>";

//Bah - screw the checking :)

$datecut=time()-($joindateremove*86400); //<-- the fix
                                        // time() is NOW in unix timestamp, minus for older dates!
if($cuts=$DB_site->query("SELECT username,userid FROM user WHERE (joindate<=$datecut AND posts<=$joinpostsremove)")) {
        while($user=$DB_site->fetch_array($cuts)) {
                $DB_site->query("DELETE FROM user WHERE userid=$user[userid]");
                echo "$user[username] deleted...<BR>";
        }
        echo "<p>Accounts removed successfully! It is recommend that you <a href=\"misc.php\">update counters</a> now.</p>";
} else {
        echo "<p>No Members match this criteria. Click <a href=\"index.php\">here</a> to return to the admin index page.</p>";
}
 
} #end doremovejoindate


08-02-2000 04:16 AM

Ed:

I really appreciate all your hard work but it isn't working right.

I signed up today and it took me out because I had zero messages. And I set the number of days as 730 and the message count as zero.

Parker

08-02-2000 04:22 AM

Hmm... lemme go play around with this on my test board.

08-02-2000 04:29 AM

Ed:

Never mind. It worked. It took me out because I didn't have a sign up date.

Ok this working now how about those checks that you were talking about. Or is it a humbug? :)

Parker

08-02-2000 05:00 AM

Ok,

This is what I have so far.

In admin/index.php look for:

<p><b>Threads</b><br>
<a href="thread.php?action=prune">Prune</a><br>
<a href="thread.php?action=move">Move</a><br>

and below this add:

<a href="thread.php?action=remove">Remove</a><br>
<a href="thread.php?action=joindates">Join Date</a></p>

Then in thread.php

look for:

Code:

// ###################### Start move by user selected #######################
if ($action=="domoveuser") {
  echo "<p>Deleting...</p>";

  while (list($key,$val)=each($movethread)) {
    if ($val==1) {
      $DB_site->query("UPDATE thread SET forumid=$destforumid WHERE threadid=$key");
    }
  }

  echo "<p>Posts moved successfully! It is recommend that you <a href=\"misc.php\">update counters</a> now.</p>";
}

and below this put.

Code:

// ###################### Start Remove by Account Date #######################

  if ($action=="remove") {

  echo "<p>Remove members by number of posts</p>\n";
  echo doformheader("thread","doremoveposts");
  echo "<table border=0>";
  echo makeinputcode("Delete member by number of posts :","postsremove","");
  echo doformfooter("Submit");
 
  exit;

}
 
if ($action=="doremoveposts") {

  echo "<p>Deleting...</p>";
 
  if ($postsremove==0) {
  $DB_site->query("DELETE FROM user WHERE posts=0");
  }
  elseif ($postsremove>=1) {
  $DB_site->query("DELETE FROM user WHERE posts<=$postsremove");
  }


 echo "<p>Posts deleted successfully! It is recommend that you <a href=\"misc.php\">update counters</a> now.</p>";
}

// ###################### Start Remove by Join Date #######################
 
if ($action=="joindates") {

echo "<p>Remove by length of membership</p>\n";
echo doformheader("thread","doremovejoindate");
echo "<table border=0>";
echo makeinputcode("Delete accounts older than x days:","joindateremove","");
echo makeinputcode("Number of Posts:","joinpostsremove","");
echo doformfooter("Submit");

exit;

} #end joindates

if ($action=="doremovejoindate") {

echo "<p>Deleting...</p>";

$datecut=time()-($joindateremove*86400);
if($cuts=$DB_site->query("SELECT username,userid FROM user WHERE (joindate<=$datecut AND posts<=$joinpostsremove)")) {
        while($user=$DB_site->fetch_array($cuts)) {
                $DB_site->query("DELETE FROM user WHERE userid=$user[userid]");
                echo "$user[username] deleted...<BR>";
        }
        echo "<p>Accounts removed successfully! It is recommend that you <a href=\"misc.php\">update counters</a> now.</p>";
} else {
        echo "<p>No Members match this criteria. Click <a href=\"index.php\">here</a> to return to the admin index page.</p>";
}
 
} #end doremovejoindate

This will delete the member by the number of posts or by the time they have been a member and the number of posts they have.

Be sure to back up your original files before using this. I am really new at this stuff and I would use any of this with caution. It worked ok on my test board.

Ed:

If there is anything that you think should be added please feel free to add what you think is necessary.

Parker


[Edited by Parker Clack on 08-02-2000 at 02:02 AM]

01-06-2001 11:09 PM

Can you add a control panel options to delete all users that have not posted anything since X day (using the "last post" from their profile)

01-14-2001 09:34 PM

Thanks for this :-) it has saved me a lot of time


All times are GMT. The time now is 03:28 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.01105 seconds
  • Memory Usage 1,753KB
  • 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
  • (3)bbcode_code_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)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