vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Beta Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=5)
-   -   Find, Optionally Email and Optionally Delete Inactive Members (https://vborg.vbsupport.ru/showthread.php?t=48964)

amykhar 02-27-2003 01:33 PM

Exempt for the email or just the delete?

hypedave 02-28-2003 01:28 AM

Quote:

Originally posted by amykhar
Exempt for the email or just the delete?
Just the delete I suppose

amykhar 02-28-2003 01:19 PM

Quote:

Originally posted by hypedave


Just the delete I suppose

Here ya go:

in manageInactive.php Find:
Code:

$userArray=$DB_site->query("SELECT username,userid,email,adminemail,emailDate FROM user WHERE lastactivity<$cutoffdate and emailDate<$dateCut ORDER BY username");
Replace with:
Code:

$userArray=$DB_site->query("SELECT username,userid,email,posts,adminemail,emailDate FROM user WHERE lastactivity<$cutoffdate and emailDate<$dateCut ORDER BY username");

Find:
Code:

      // We are just going to delete the inactive users with no warning
      $DB_site->query("UPDATE post SET username='".addslashes($user[username])."',userid=0 WHERE userid='$user[userid]'");
      $DB_site->query("DELETE FROM user WHERE userid='$user[userid]'");
      $DB_site->query("DELETE FROM userfield WHERE userid='$user[userid]'");
      $DB_site->query("DELETE FROM access WHERE userid='$user[userid]'");
      $DB_site->query("DELETE FROM calendar_events WHERE userid='$user[userid]'");
      $DB_site->query("DELETE FROM customavatar WHERE userid='$user[userid]'");
      $DB_site->query("DELETE FROM moderator WHERE userid='$user[userid]'");
      $DB_site->query("DELETE FROM privatemessage WHERE userid='$user[userid]'");
      $DB_site->query("DELETE FROM subscribeforum WHERE userid='$user[userid]'");
      $DB_site->query("DELETE FROM subscribethread WHERE userid='$user[userid]'");
      $DB_site->query("DELETE FROM session WHERE userid='$user[userid]'");
        $countDelete++;
      $inactiveUsersDeleted .=$user[username]."\n";
      echo("Deleted ". $user[username]."<br>");

Replace with: (change X to be the number of posts you choose)
Code:

if($user[posts] < X) {
      // We are just going to delete the inactive users with no warning
      $DB_site->query("UPDATE post SET username='".addslashes($user[username])."',userid=0 WHERE userid='$user[userid]'");
      $DB_site->query("DELETE FROM user WHERE userid='$user[userid]'");
      $DB_site->query("DELETE FROM userfield WHERE userid='$user[userid]'");
      $DB_site->query("DELETE FROM access WHERE userid='$user[userid]'");
      $DB_site->query("DELETE FROM calendar_events WHERE userid='$user[userid]'");
      $DB_site->query("DELETE FROM customavatar WHERE userid='$user[userid]'");
      $DB_site->query("DELETE FROM moderator WHERE userid='$user[userid]'");
      $DB_site->query("DELETE FROM privatemessage WHERE userid='$user[userid]'");
      $DB_site->query("DELETE FROM subscribeforum WHERE userid='$user[userid]'");
      $DB_site->query("DELETE FROM subscribethread WHERE userid='$user[userid]'");
      $DB_site->query("DELETE FROM session WHERE userid='$user[userid]'");
        $countDelete++;
      $inactiveUsersDeleted .=$user[username]."\n";
      echo("Deleted ". $user[username]."<br>");
}


Find:
Code:

      if($user[emailDate]<$dateCut) {
      $DB_site->query("UPDATE post SET username='".addslashes($user[username])."',userid=0 WHERE userid='$user[userid]'");
      $DB_site->query("DELETE FROM user WHERE userid='$user[userid]'");
      $DB_site->query("DELETE FROM userfield WHERE userid='$user[userid]'");
      $DB_site->query("DELETE FROM access WHERE userid='$user[userid]'");
      $DB_site->query("DELETE FROM calendar_events WHERE userid='$user[userid]'");
      $DB_site->query("DELETE FROM customavatar WHERE userid='$user[userid]'");
      $DB_site->query("DELETE FROM moderator WHERE userid='$user[userid]'");
      $DB_site->query("DELETE FROM privatemessage WHERE userid='$user[userid]'");
      $DB_site->query("DELETE FROM subscribeforum WHERE userid='$user[userid]'");
      $DB_site->query("DELETE FROM subscribethread WHERE userid='$user[userid]'");
      $DB_site->query("DELETE FROM session WHERE userid='$user[userid]'");
        $countDelete++;
        $inactiveUsersDeleted .=$user[username]."\n";
      echo("Deleted ". $user[username]."<br>");

Replace With: (Change X as above)
Code:

if ($user[posts] < X) {
      if($user[emailDate]<$dateCut) {
      $DB_site->query("UPDATE post SET username='".addslashes($user[username])."',userid=0 WHERE userid='$user[userid]'");
      $DB_site->query("DELETE FROM user WHERE userid='$user[userid]'");
      $DB_site->query("DELETE FROM userfield WHERE userid='$user[userid]'");
      $DB_site->query("DELETE FROM access WHERE userid='$user[userid]'");
      $DB_site->query("DELETE FROM calendar_events WHERE userid='$user[userid]'");
      $DB_site->query("DELETE FROM customavatar WHERE userid='$user[userid]'");
      $DB_site->query("DELETE FROM moderator WHERE userid='$user[userid]'");
      $DB_site->query("DELETE FROM privatemessage WHERE userid='$user[userid]'");
      $DB_site->query("DELETE FROM subscribeforum WHERE userid='$user[userid]'");
      $DB_site->query("DELETE FROM subscribethread WHERE userid='$user[userid]'");
      $DB_site->query("DELETE FROM session WHERE userid='$user[userid]'");
        $countDelete++;
        $inactiveUsersDeleted .=$user[username]."\n";
      echo("Deleted ". $user[username]."<br>");
}


Limitter 03-01-2003 07:24 AM

Nice great hack !!

THX

afterlab 03-04-2003 11:40 AM

So far, this script is working good. I'll give you an update in 15 days. ;)

TheEDIGuy 03-05-2003 02:08 AM

Amykhar, thank you for a great hack! I'm installed.

One quick question, before I cron this. Let's say I want to e-mail users who haven't visited in 30 days. Would I cron this to run every 30 days, or is it safe to run every day? If I run it every day, would it re-email the same people again, or would it only e-mail people who've reached their 30 days since the last run?

Does that make any sense, or is it just too late at night for me to type coherently?

amykhar 03-05-2003 02:12 AM

You can run it every day. It won't email them again for another 30 days.

Amy

TheEDIGuy 03-05-2003 10:55 AM

Excellent. I was pretty sure that's how it worked, but wanted to make sure before I cron'ed it.

Thank you for an excellent hack!

Kmaster 03-05-2003 03:01 PM

possible change del user i/o move to banned group. cool hack....thx!!!

djr 03-07-2003 08:38 PM

Hi Amy,

It's me again.. in a few days (Tuesday, 11th of March) I'll be losing approx. 1750 users :( They are inactive for over a year (my setting), I know, but is it possible to adjust the hack so they will be getting one last e-mail warning a day before the actual pruning?

Thanks for considering and the great updates!

@ hypedave: nice idea, updated the hack!

- djr

amykhar 03-07-2003 09:55 PM

Quote:

Originally posted by djr
Hi Amy,

It's me again.. in a few days (Tuesday, 11th of March) I'll be losing approx. 1750 users :( They are inactive for over a year (my setting), I know, but is it possible to adjust the hack so they will be getting one last e-mail warning a day before the actual pruning?

Thanks for considering and the great updates!

@ hypedave: nice idea, updated the hack!

- djr

Here is how I would do it.

1. Create a new usergroup for those who are about to be deleted. Note the usergroupid.

2. In manageInactive.php Find:

Code:


?>

Add above:

Code:

      //Final Warning
      $finalWarning = time() - 1036800;
      $finalArray=$DB_site->query("SELECT username,userid,usergroupid,email,adminemail,emailDate FROM user WHERE lastactivity<$cutoffdate and    emailDate<$finalWarning ORDER BY username");
  while ($users=$DB_site->fetch_array($finalArray)) {
        if ($emailInactive AND $user[adminemail] AND $user[usergroupid]!=X ){
        eval("\$subject = \"".gettemplate("inactiveFinalWarningSubject")."\";");
        eval("\$message = \"".gettemplate("inactiveFinalMessage")."\";");
        mail ($user[email],$subject,$message,"From: \"$bbtitle Mailer\" <$webmasteremail>");
        $DB_site->query("UPDATE user set usergroupid=X WHERE userid='$user[userid]'");
        echo("Emailed ". $user[username]."<br>");
  }

(Change X in both places to the new usergroupid that you just created.)

3. Create two new templates:inactiveFinalWarningSubject and inactiveFinalMessage. Put whatever message and subject you choose in them.

Please note: THIS ADDON IS UNTESTED.

djr 03-07-2003 10:15 PM

You're AWESOME! Wow, that was REAL quick. I'll let you know how it goes!

When will you be moving this out of beta? The hack is superb as is, or are you waiting for the first user who's got his board pruned :D

- djr

amykhar 03-07-2003 10:28 PM

I am waiting for you to report sucess :D

Amy

TheEDIGuy 03-09-2003 04:54 PM

This has been working extremely well for me, Amy.

My only "complaint" is that the first time I ran it, I had (obviously) an extremely large group of people e-mailed. Now, every day I run it, I only have 8-10. But when it hits the 31st day since the first time I ran it, it's going to grab that huge list again, minus the people who actually came back.

Since I don't use the delete option...If you use it, you don't have that problem :)

It's too bad I didn't plan ahead, and slowly decrease the number of "inactive days" when I first ran it.

amykhar 03-09-2003 04:56 PM

Glad it's working for you :) The first delete one has me interested cause it's probably going to be rather query intensive. After the first one for larger boards though, I am not expecting any problems.

Amy

amykhar 03-14-2003 06:11 PM

Quote:

03-07-03 at 07:15 PM djr said this in Post #52
You're AWESOME! Wow, that was REAL quick. I'll let you know how it goes!

When will you be moving this out of beta? The hack is superb as is, or are you waiting for the first user who's got his board pruned :D

- djr

So, how did the first prune go? I'm dying of curiosity.

Amy

subu1 03-18-2003 05:21 PM

hi amy,

i have install your Hack and its work, but now i have a aktiv User there have gotten a email in 15 Days he is deleted.

why?

i dont want delete a aktiv user, he have 30 Postings and the last today

subu1

djr 03-18-2003 05:39 PM

Quote:

03-14-03 at 09:11 PM amykhar said this
So, how did the first prune go? I'm dying of curiosity.
Hi Amy,

Sorry, been away to CEBIT in Hannover to see new cool gadgets. The first prune went without any flaw at all, though I lost approx 1750 members. OUCH! Well, there's over 3000 left, and more joining day in day out.
I had problems with the Final Warning addon, so I removed that one again. I was getting parse errors, and due to being extremely busy didn't have the time to give it another try.

All in all I'm extremely happy with the hack. Tme to move it out of beta! :banana:

amykhar 03-18-2003 05:42 PM

Quote:

Today at 02:21 PM subu1 said this in Post #57
hi amy,

i have install your Hack and its work, but now i have a aktiv User there have gotten a email in 15 Days he is deleted.

why?

i dont want delete a aktiv user, he have 30 Postings and the last today

subu1

Look and see what the value for his last activity is. Also, how many days do you have it set for? If he becomes active again after the email is sent, he won't be deleted.

Amy

amykhar 03-18-2003 05:42 PM

Glad it worked for you djr :) Losing so many members must have been painful though.

Amy

djr 03-18-2003 06:08 PM

Quote:

Glad it worked for you djr :) Losing so many members must have been painful though.
Yeah, actually it was, but they weren't contributing anyway, so no real hard done.
I was wondering why you used lastactivity instead of lastvisit?

I have this user (which wasn't deleted):
Lastvisit: 2000-11-24 23:16:11
Lastactivity: 2003-02-24 18:05:25
Lastpost: 2000-11-24 23:11:56

I know I could easily replace lastactivity by lastvisit, but wanted to check with you first.

amykhar 03-18-2003 06:18 PM

What's the difference between the last activity and a last visit? I think I need to research that. Either would be fine though. You could even use lastpost if you wanted to kill off lurkers.

Amy

TheEDIGuy 03-18-2003 07:45 PM

I've found that lastactivity is more accurate. Lastvisit might not get updated if the user is visiting with cookies. I frequently have lastivits that are 2-3 days old, but the lastactivity is today, and I know they were on the site today.

What I'm more curious about - how many members did you originally e-mail about inactivity, and how many got deleted for not having visited? In other words, how many inactive members were convinced to come back because of the program?

amykhar 03-18-2003 08:52 PM

EDIGuy, I have a confession to make. The first time I tested this hack, I didn't have the templates installed on the style I use; so I sent blank emails to over a hundred users. The blank emails actually inspired them to come see what was going on :D

Amy

djr 03-18-2003 10:01 PM

If I recall well, about 150 users returned to the board out of the approx. 1750 users that were emailed. Most of the 1750 had non-working email adresses (I use a 365 year timespan)

- djr

TheEDIGuy 03-18-2003 10:13 PM

I hate non-working e-mails. I don't do the verification, because I find it turns off prospective members. So, I have the birthday hack and this hack, and if any e-mail bounces, the user's account is deleted immediately, no questions asked. I figure I only ask them for one thing, if they can't do that, too bad.

The hack is prompting some of my missing members to return, but unfortunately, seems to be bringing back members I was happy they'd gone as well. It's a double-edged sword.

But I still love it.

amykhar 03-19-2003 02:05 AM

EDIGuy, I was sneaky. I went and bumped the activity date of some members I would rather not see again before the emails were sent. :D

Amy

TheEDIGuy 03-19-2003 11:30 AM

Good idea. A while back, we ran off a large group of people we were happy to see go. I deleted the accounts of the worst offenders, but the rest of them got notices when I first ran it. A couple came back (but they were much more decent without their friends around).

I still haven't hit my 30-day mark when the big reminder goes out again, but it'll be interesting for me to compare it with last month's initial send, to see how many came back.

I think my initial e-mail was 468, and now is about 14 per day.

wolfe 03-19-2003 08:35 PM

with the other none active members list hack it only classes people as none active if they have not posted in 1 mounth can u add this to the hack please so you can have it not logged in for X days aand/or nopt posted for X days would make this hack the best around for what i does :D

amykhar 03-19-2003 09:15 PM

Wolfe, this addon will do what you want.

In manageInactive.php find:

PHP Code:


$countEmail 
0

Add above:

PHP Code:

$lastpostcut 2592000


Find:
PHP Code:

$userArray=$DB_site->query("SELECT username,userid,email,adminemail,emailDate FROM user WHERE  lastactivity<$cutoffdate and emailDate<$dateCut    ORDER BY username"); 

Replace with:
PHP Code:

$userArray=$DB_site->query("SELECT username,userid,email,adminemail,emailDate FROM user WHERE (lastpost < $lastpostcut or lastactivity<$cutoffdate) and emailDate<$dateCut    ORDER BY username"); 


That should do it for you. Tweak the $lastpostcut to be what you want. Currently it is set for 30 days.

Note: This addon is not tested. Use at your own risk.

wolfe 03-20-2003 08:26 PM

ok will test it out but will back up user table first lol

wolfe 03-22-2003 01:11 PM

why don't you intergrate this page into the AdminCP before it is a Full Release

amykhar 03-22-2003 01:35 PM

Because it is designed to run as a cron script and adding more code just adds more opportunities for installers to screw up.

If you really don't know how to do that on your own, I will post the code here as an addon.

Amy

TheEDIGuy 03-24-2003 12:16 AM

I have it cron'ed and it works perfectly. One of the best hacks I've got installed.

Thanks again, Amy!

amykhar 03-24-2003 01:01 AM

No problem :) Glad you like it.

Amy

hypedave 03-24-2003 07:16 PM

Hey Amy,
I have a couple of users on my forum, that will be going on a vacation and will be gone for a uncertain amount of time, so I was wondering if possible is there a way to have to hack exclude user certain user groups, like if a member is going a vacation I can drop her of her im a different user group, or put in an option where this hackl will exclude user id's ?

Thanks

amykhar 03-24-2003 07:25 PM

Hmmm, what about installing the "away" hack and then changing the query in manageInactive.php to

$userArray=$DB_site->query("SELECT username,userid,email,adminemail,emailDate FROM user WHERE lastactivity<$cutoffdate and emailDate<$dateCut and away==0 ORDER BY username");

This would exclude anybody who set themself as away.

Yuber 04-03-2003 11:07 PM

Great hack thanks.

SmartGnome 04-06-2003 09:53 AM

Hi Amy,

Great hack and it takes a lot of work out of my hands.

Djr didn't ask yet for a mod :D so I will do that.
We have a lot of leechers in the board (0-posters) so it should be nice to take them in the same sesion to warn them and delete or move them to a banned group. (I prefer the last).

Again thanks for the good work and install is clicked :banana:

Greetzz

iggy123 04-28-2003 05:35 PM

is there anyway of setting this hack up so that it does include people in a certain usergroup ie admins / moderators


All times are GMT. The time now is 01:02 AM.

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.01277 seconds
  • Memory Usage 1,854KB
  • 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
  • (8)bbcode_code_printable
  • (4)bbcode_php_printable
  • (7)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
  • (40)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