PDA

View Full Version : Greet Members' Xth posts via Email/PM/Thread automatically


Logician
06-13-2002, 10:00 PM
Hiyas,

Greeting your board's contributing members when they reached some special post numbers like 500, 1000, 2000, 5000 can be nice to motivate them and this is what this hack does: It automatically greets your members when their posts reach to certain numbers, by sending them:
* Private Messages
* Emails
* or both

You can configure the hack to create a thread to greet your member's Xth post either.

Features:
* The hack will send PMs, emails (or both) or you can choose to send them PM if he can receive PM or else send email.
* The hack can create special greeting threads for your users. (optional)
* Greeted post numbers are set by you and you can set different numbers for email/pm greetings and thread greetings. So for example you can send a thank you email/pm to members for their every 100th message and create a special greeting thread for their every 500th messages.
* Admin can choose to receive a report via Email or PM about the greetings the hack performed. (optional)
* Special usergroups can be excluded from greetings. (optional)
* Greetings messages are template driven and easily customizable.
* Compatible with ALL vbulletin versions I know.
* Easy to install and highly customizable.

Although this hack is supposed to be a "time consuming" to code hack, I already had a similar algorithm for automatic threads/emails/pms for my Automatic Birthday Greetings Hack (https://vborg.vbsupport.ru/showthread.php?s=&threadid=39663) and I made a quick adaptation in that hack's structure to form this one.

Although I didnt test this hack for a long time, I dont expect any problems since its structure which is inherited from "birthday greetings hack" proved to be quite robust, stable and tested for a long time. If you come across any bugs, holler and I'll fix it. Holler anyway if it runs ok too.. :)

One known issue: This version of the hack is not coded to detect their Xth posts if it is "moderated". So moderator approved posts may be missed. This also applies to thread's first message IF member choose to create a poll (technically vbulletin behaves these posts as if they are moderated). But all other posts will be detected by the hack wheather they are thread's first messages or reply messages and regardless of the board they are in. (public/private)

If you use it please click INSTALL (https://vborg.vbsupport.ru/misc.php?s=&action=install&threadid=39821) , thank you! Enjoy the hack..

Logician \\=^))

Logician
06-13-2002, 10:29 PM
Sample Screenshot:

The thread automatically created by the hack to greet a user who has recently posted his 1000th message in the board.

Brad
06-13-2002, 10:37 PM
/me clicks install button

w00t no more i got 1000 post post LOL

scsa20
06-14-2002, 12:46 AM
it'll be cool to have an add on that would turn on starting a thread in a forum(s) of your choice after getting the number of post set.....and if it's lower then the one that's set, they can't start a thread in the forum(s) of your choice, only post replys :D

Logician
06-14-2002, 06:14 AM
Originally posted by scsa20
it'll be cool to have an add on that would turn on starting a thread in a forum(s) of your choice after getting the number of post set.....and if it's lower then the one that's set, they can't start a thread in the forum(s) of your choice, only post replys :D
As far as I know this hack already exists. If you cant find it, holler and I'll give you the code. It's a very simple a few lines of modification. (1 line I guess?) But IMO the logic has nothing to do with this hack. :)

Smoothie
06-14-2002, 07:13 AM
One question, in the options:
// Icon ID of the PMs
$log_iconid=0;
What should that be set to?

Logician
06-14-2002, 08:48 AM
Originally posted by Smoothie
One question, in the options:
// Icon ID of the PMs
$log_iconid=0;
What should that be set to?
It's not an important setting. As you know, private messages can have "message icons" next to them and if you want the pms produced by the hack to have a message icon too, you can set its id there.

Leave it as 0, to have no icons..

Smoothie
06-14-2002, 02:06 PM
Ok, thanks.

Conroy
07-07-2002, 04:25 AM
I am having some trouble. Whenever I add alot of code to one of my files and then save it, it is all pushed to the top the next time I open that file. I am getting errors on my vB and I am pretty sure this is why. It has happened with other hacks besides this one too. Do you have any idea what could be wrong? It really doesn't make sense to me.

squawell
07-07-2002, 05:38 AM
* squawell like this hack.....

great hack Logician....:D:D:D

Logician
07-07-2002, 07:30 AM
Originally posted by Conroy
I am having some trouble. Whenever I add alot of code to one of my files and then save it, it is all pushed to the top the next time I open that file. I am getting errors on my vB and I am pretty sure this is why. It has happened with other hacks besides this one too. Do you have any idea what could be wrong? It really doesn't make sense to me.
@Conroy: What program are you using for editing your codes? Try Notepad, your should be fine then. More info here (https://vborg.vbsupport.ru/showthread.php?s=&threadid=39142)

@squawell: Thx..

Conroy
07-07-2002, 10:29 PM
I use notepad and wordpad. Sometimes this happens with notepad, but most of the time it happens with wordpad. A strange thing is, I just finished editing both the newreply and newthread files, I had to do the EXACT same thing to both of them, but for some reason on the newthread file, all the text was pushed up, but on the newreply file it was all ok. I used notepad for this one. Does any of this make sense?

Logician
07-08-2002, 04:29 PM
Originally posted by Conroy
I use notepad and wordpad. Sometimes this happens with notepad, but most of the time it happens with wordpad. A strange thing is, I just finished editing both the newreply and newthread files, I had to do the EXACT same thing to both of them, but for some reason on the newthread file, all the text was pushed up, but on the newreply file it was all ok. I used notepad for this one. Does any of this make sense?
No, definitely makes no sense.. Anyway if you cant insert it by yourself, send your unhacked file to me via PM and I can insert the code for you. Dont forget to mention the options you want to set..

Me2Be
07-09-2002, 01:48 AM
Wonderful hack AGAIN :)

Two questions --
1] Can you send it so the PM is able to be seen on our message tracking?
2] Can you modify it to create an ongoing thread for post accomplisments instead of a separate thread? (want to use it for my moderators instead of separate threads) :)

Logician
07-10-2002, 01:01 PM
Originally posted by Me2Be
1] Can you send it so the PM is able to be seen on our message tracking?

Sure.. Find:


$DB_site->query("INSERT INTO privatemessage (privatemessageid,userid,touserid,fromuserid,title ,message,dateline,showsignature,iconid,messageread ,folderid) VALUES (NULL,$bbuserinfo[userid],$bbuserinfo[userid],$greeter,'".addslashes(htmlspecialchars($title2))."','".addslashes($post_greeting_pm)."',".time().",1,'$log_iconid',0,0)");


And replace it as:


$DB_site->query("INSERT INTO privatemessage (privatemessageid,userid,touserid,fromuserid,title ,message,dateline,showsignature,iconid,messageread ,folderid, receipt) VALUES (NULL,$bbuserinfo[userid],$bbuserinfo[userid],$greeter,'".addslashes(htmlspecialchars($title2))."','".addslashes($post_greeting_pm)."',".time().",1,'$log_iconid',0,0,1)");



2] Can you modify it to create an ongoing thread for post accomplisments instead of a separate thread? (want to use it for my moderators instead of separate threads) :)

Find:


$DB_site->query("INSERT INTO thread (threadid,title,lastpost,forumid,open,replycount,p ostusername,postuserid,lastposter,dateline,iconid, visible,attach) VALUES(NULL,'".addslashes(htmlspecialchars($title3))."','".time()."','$greetings_forum','1','0','".addslashes($greeter_name)."','".addslashes($greeter)."','".addslashes($greeter_name)."','".time()."','0','1','0')");
$log_threadid=$DB_site->insert_id();


Replace it AS:


$log_threadid=XXXX;
$DB_site->query("UPDATE thread SET lastpost='".time()."',replycount=replycount+1,lastposter='".addslashes($greeter_name)."' WHERE threadid='$log_threadid'");


(Replace XXX with your thread id)

Dont forget to modify BOTH files (newthread.php & newreply.php)

That should work.. :)

Enjoy.
Logician

Dean C
07-10-2002, 05:20 PM
great hack...

Dynamic One
11-11-2002, 08:47 AM
Good hack Logician. Thank you for this.

!!!cyr0n_k0r
11-22-2002, 06:12 PM
here are my settings. I set my post count to 24 and made a new thread and I didnt get a PM or an e-mail. I even posted replies making my post count like 27.. and still no pm or e-mail.

//Logician Greet Users Xth post via Email/PM/Create Thread hack
###########################################
## OPTIONS ##
###########################################
// How to send the greeting to the user:
// 0 --> Neither PM nor Email (Disables PM/email Greeting)
// 1 --> PM Only (If he can receive pms)
// 2 --> Email Only
// 3 --> PM Only (Whether he can receive PMs or not)
// 4 --> BOTH PM and email
// 5 --> If he can receive send PM, if not send Email.
$greeting_type=5;

// Which post numbers will be greeted via email or PM?
// The hack will greet send greetings email/PM for every number of posts you specified here
// Usage Examples: To greet only 1000th post use: $greetpost_pm=array('1000');
// To greet only 1000th and 2000th post use: $greetpost_pm=array('1000','2000');
$greetpost_pm=array('25');

//if send pm, will he get a pop up alert? set to 1 for yes, 0 for no.
$pop_alert=1;

// Do you want the hack to automatically create a thread to greet his post?
// 1-- > Yes, 0 --> No
$thread_create=0;

// Which post numbers will be greeted via a greeting Thread?
// The hack will create a greeting threadfor every number of posts you specified here
// Usage Examples: To greet only 1000th post use: $greetpost_thread=array('1000');
// To greet only 1000th and 2000th post use: $greetpost_thread=array('1000', '2000');
$greetpost_thread=array('1000', '1500', '2000', '2500', '3000', '5000');

// If you choose to create a new thread in your board, enter the forum id:
$greetings_forum = 2;

// Greeter's user id, username, email:
// Who will celebrate the user?
// He will be sender of the PM's or emails sent to your member:
$greeter=1; //His User ID
$greeter_name="PaintballForums.net Administrator"; //His User Name
$greeter_email="admin@paintballforums.net"; //His Email

// Subject/Title of the Email or PM users get.
// use ??post?? variable to refer their post number
// use ??name?? variable to refer their username
$title2= "Your post number has reached ??post??!! ;)";

// Icon ID of the PMs
$log_iconid=0;

// If you choose to create a new thread in your board, what's Thread Title?
// use ??post?? variable to refer their post number
// use ??name?? variable to refer their username
$title3= "??name??'s ??post??th Messages!!";

// Excluded User groups. (That is Usergroup ID, NOT userid!)
// If you dont want to sent greetings for some usergroups enter their usergroups id:
// Usage Examples: To exlude user group 12 use: $excluded_usergroups=array('12');
// To exclude user group 12 AND 13 use: $excluded_usergroups=array('12', '13');
// To NOT to exclude any usergroups, set it to $excluded_usergroups=array('0');
$excluded_usergroups=array('0');

// Report to Admin: Notifies the admin daily about the greetings
// 0 -> Dont notify Admin
// 1 -> Notify Admin via PM
// 2 -> Notify Admin via Email
$admin_report=0;

// Admin email (to send the greeting report via email, if set)
$admin__email="admin@paintballforums.net";

// Admin userid (to send the greeting report via PM, if set)
$admin__userid=1;

########## END OF OPTIONS #################
$greeteduserid=$bbuserinfo[userid];
$greetedusername=$bbuserinfo[username];

$greeteduserposts=$bbuserinfo[posts]+1;
$greetedemailusername=unhtmlspecialchars($bbuserin fo['username']); //for email title

if ($bbuserinfo[userid]!=0 AND $foruminfo[countposts] AND (in_array($greeteduserposts, $greetpost_thread) OR in_array($greeteduserposts, $greetpost_pm)) AND ($greeting_type>0 OR $thread_create>0 OR $admin_report>0) AND !(in_array($bbuserinfo[usergroupid], $excluded_usergroups)))
{
$greeteduserpostsstring=(string)$greeteduserposts;
$title3=ereg_replace('??name??', $bbuserinfo[username], $title3);
$title3=ereg_replace('??post??', "$greeteduserpostsstring", $title3);
$title2=ereg_replace('??post??', "$greeteduserpostsstring", $title2);
$title2=ereg_replace('??name??', $bbuserinfo[username], $title2);

$admin_report_text="Your member $greetedusername posted his ".$greeteduserposts."th message at ".date("F j, Y, g:i a")." (Server Time)\n\nActions Taken by the hack (if any):\n\n";

##############################################
if (in_array($greeteduserposts, $greetpost_thread) AND $thread_create>0)
{ //Lets Create a Thread for this user

// Creating Thread
eval("\$post_greeting_thread = \"".gettemplate("post_greeting_thread",1,0)."\";");

$DB_site->query("INSERT INTO thread (threadid,title,lastpost,forumid,open,replycount,p ostusername,postuserid,lastposter,dateline,iconid, visible,attach) VALUES(NULL,'".addslashes(htmlspecialchars($title3))."','".time()."','$greetings_forum','1','0','".addslashes($greeter_name)."','".addslashes($greeter)."','".addslashes($greeter_name)."','".time()."','0','1','0')");
$log_threadid=$DB_site->insert_id();

// Creating Post
$DB_site->query("INSERT INTO post(postid,threadid,title,username,userid,datelin e,pagetext,allowsmilie,showsignature,ipaddress,ico nid,visible) VALUES (NULL,'$log_threadid','".addslashes(htmlspecialchars($title3))."','".addslashes($greeter_name)."','$greeter','".time()."','".addslashes($post_greeting_thread)."','1','0','127.0.0.1','0','1')");
$log_postid=$DB_site->insert_id();

// Updating Forum
$DB_site->query("UPDATE forum SET replycount=replycount+1,threadcount=threadcount+1, lastpost='".time()."',lastposter='".addslashes($greeter_name)."' WHERE forumid =$greetings_forum");

// Updating User's Post
$DB_site->query("UPDATE user SET posts=posts+1 WHERE userid=$greeter");

// Admin Report Text
$admin_report_text.=" Thread Created\n $bburl/showthread.php?threadid=".$log_threadid."\n\n";
}

##############################################
if ($greeting_type==3 OR $greeting_type==4 OR ($greeting_type==1 AND $bbuserinfo[receivepm]==1))
//Send PM
{
eval("\$post_greeting_pm = \"".gettemplate("post_greeting_pm",1,0)."\";");

$DB_site->query("INSERT INTO privatemessage (privatemessageid,userid,touserid,fromuserid,title ,message,dateline,showsignature,iconid,messageread ,folderid) VALUES (NULL,$bbuserinfo[userid],$bbuserinfo[userid],$greeter,'".addslashes(htmlspecialchars($title2))."','".addslashes($post_greeting_pm)."',".time().",1,'$log_iconid',0,0)");

$admin_report_text.=" PM Sent\n\n";

if ($pop_alert==1)
//pop up alert set, lets send pm popup alert..
{
if ($noshutdownfunc) {$DB_site->query("UPDATE user SET pmpopup=2 WHERE userid=$bbuserinfo[userid]");}
else {$shutdownqueries[]="UPDATE LOW_PRIORITY user SET pmpopup=2 WHERE userid=$bbuserinfo[userid]";}
}
} //send PM

##############################################
if ($greeting_type==2 OR $greeting_type==4 OR ($greeting_type==5 AND $bbuserinfo[receivepm]!=1))
//Send Email
{
eval("\$post_greeting_email = \"".gettemplate("post_greeting_email",1,0)."\";");
mail($bbuserinfo[email],$title2,$post_greeting_email,"From: \"$bbtitle \"<$webmasteremail>");
$admin_report_text.=" Email Sent";

}// Send Email

$admin_report_text.="\n\n << Greet Members Xth Post Hack by Logician >> \n";

#############################################
if ($admin_report==1)
// Sending Greetings Report to Admin By PM
{
$admin_pm_title= $greetedusername."'s ".$greeteduserposts."th post!";
$DB_site->query("INSERT INTO privatemessage (privatemessageid,userid,touserid,fromuserid,title ,message,dateline,showsignature,iconid,messageread ,folderid) VALUES(NULL,$admin__userid,$admin__userid,$admin__ userid,'".addslashes(htmlspecialchars($admin_pm_title))."','".addslashes($admin_report_text)."',".time().",1,'$log_iconid',0,0)");
}
if ($admin_report==2)
// Sending Greetings Report to Admin By Email
{
$admin_report_title = $greeteduserposts."th post of $greetedemailusername!";
mail($admin__email, $admin_report_title ,$admin_report_text,"From: \"$bbtitle \"<$webmasteremail>");
}

}

//exit;
//Logician Greet Users Xth post via Email/PM/Create Thread hack

Logician
11-22-2002, 06:44 PM
Originally posted by !!!cyr0n_k0r
here are my settings. I set my post count to 24 and made a new thread and I didnt get a PM or an e-mail. I even posted replies making my post count like 27.. and still no pm or e-mail.

1- Is "accept pm" settings in your user cp is ON?
2- Did you applied the hack code BOTH to newthread.php AND newreply.php?
3- Did your hack settings are exactly same in newthread.php and newreply.php?
4- Did you create templates correctly? (Check especially exact names)
5- If you have more than 1 style sets, did you create your templates in ALL stylesets?
6- Does hack work if you change the settings to "Send Email", "create a thread"?
7- Does hack send you an admin report mentioning that pm is sent, if you set admin notification ON? (Try it)
8- Set the first 2 settings as:

// How to send the greeting to the user:
// 0 --> Neither PM nor Email (Disables PM/email Greeting)
// 1 --> PM Only (If he can receive pms)
// 2 --> Email Only
// 3 --> PM Only (Whether he can receive PMs or not)
// 4 --> BOTH PM and email
// 5 --> If he can receive send PM, if not send Email.
$greeting_type=4;

// Which post numbers will be greeted via email or PM?
// The hack will greet send greetings email/PM for every number of posts you specified here
// Usage Examples: To greet only 1000th post use: $greetpost_pm=array('1000');
// To greet only 1000th and 2000th post use: $greetpost_pm=array('1000','2000');
$greetpost_pm=array('1','2','3','4','5','6','7','8 ');


Register as a new user (with post number 0) and try to send a few posts and see if the hack is working.

And make sure you dont choose "create a poll" option while you send your post or send the post into a "moderated" forum.

!!!cyr0n_k0r
11-22-2002, 08:30 PM
im not going to fill up my board with useless user names.
All my options are correct and your hack doesnt work.
accept it.

1-5 . YES

Erwin
11-22-2002, 08:47 PM
Logician's hack works beautifully. I installed it recently and it has been working flawlessly - my members love it. Thanks, mate. :)

legendarysk8er
04-08-2003, 02:25 AM
I tried opening the php file and it was just a bunch of symbols, was the file corupt or something?

EDIT: Nvm, I got it, nice hack .

midnightz
07-23-2003, 11:24 PM
Yummy hack ;)

midnightz
10-08-2003, 08:09 PM
Hi Logician :)

Is it possible somehow to have store points given to users to celebrate lets say a 2500th post?

Logician
10-08-2003, 08:37 PM
Hi Logician :)

Is it possible somehow to have store points given to users to celebrate lets say a 2500th post?

You can add:

$DB_site->query("UPDATE user SET storep=storep+100 WHERE userid='$bbuserinfo[userid]'");

Before hack line:
$greeteduserpostsstring=(string)$greeteduserposts;
and it will grant the poster "100" points everytime a user is greeted by the hack.

But please note that it is not a perfect solution because wise users might cheet: After they posted their X posts and get the point, they can delete any of their posts to lower their post count by 1, then repost and get another greeting thus point. ;)

Please do not ask for a fix for it as it is not possible without changing the hack's structure.. :)

midnightz
10-08-2003, 08:39 PM
Thank you :)

erikajune
02-08-2004, 04:29 PM
I'm having a problem... I installed everything, got no errors but nothing happens when a member reaches the desired post count.

Logician
02-08-2004, 05:10 PM
I'm having a problem... I installed everything, got no errors but nothing happens when a member reaches the desired post count.
Please double check you installed it correctly. If everything looks all right, make sure you created the hack templates in all your template sets if you have more than one. Also make sure template names are correct (including caps). It sounds like a template problem.