PDA

View Full Version : New Posting Features - Automatic PM on New Thread


Michael Biddle
07-01-2008, 10:00 PM
Automatic PM on New Thread
by: whitemike (http://www.white-projects.com/)


What this hack does?

This hack will allow the admin to setup a certain usergroup to receive an instant PM notification informing that usergroup that a new thread in the specified forum has been created.

How to install?
Import the Product
Template Edit: newthread
Find the following: <tr>
<if condition="$prefix_options">
Replace with: $sendpm

<tr>
<if condition="$prefix_options"> You will need to go into your vBulletin Admin Control Center and do the following.
On the left frame find: User Profile Fields
Then click on: Add New User Profile Field. Set with these properties
Single Selection Menu
Title and description you can set to how you want it
Options: Yes and No (Make sure you separate by a line break)
Set Default: Yes, But No First Blank Option
Field Required: No, but display at registration
Field Editable by User: Yes
Display Page: Other:Options
Note: You can change the other settings that I did not list to how you want it
Important: After it saves you will be taken back to the User Profile Field Manager, here you will see what field# you have, such as field5, remember that number for later use. Settings?
vBulletin Options:
Userid - Enter the userid that the PM will be sent from
Username - Enter the username that the PM will be sent from
Usergroupid's - Enter the usergroupid's (separated by a coma) to send the PM to.
Custom Profile Field - Enter the custom profile field number that you set up above.
Forum Manager
Enable/Disable Customize it for yourself?

You can go ahead and edit the six phrases to suite your needs with it. The variables are prefixed with autopm_.

Please click install (https://vborg.vbsupport.ru/vborg_miscactions.php?do=installhack&threadid=184123) if you use!

Suggestions are always welcomed!

Michael Biddle
07-02-2008, 02:06 AM
Reserved for future use

Lizard King
07-02-2008, 02:08 AM
great mod mike

Itworx4me
07-02-2008, 04:21 AM
Can you explain in detail as to what the custom profile field does and why it is needed. Do you have to do the custom profile field in order for this hack to work?

Thanks,
Itworx4me

Michael Biddle
07-02-2008, 04:44 AM
It gives the person in the usergroup (set by admin) a chance to opt on on being auto pmed.

xorex
07-02-2008, 06:53 AM
Error BD vBulletin 3.7.0:

Invalid SQL:

ALTER TABLE thread
ADD sendpm varchar(100) UNSIGNED NOT NULL;

Error MySQL : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNSIGNED NOT NULL' at line 2
number error : 1064
date : Wednesday, July 2nd 2008 @ 11:49:54 AM
error date : Wednesday, July 2nd 2008 @ 11:49:55 AM
script : /forums/admincp/plugin.php?do=productimport
referer : /forums/admincp/plugin.php?do=productadd
IP adress : localhost
Name User : admin
Name class : vB_Database
Version MySQL : 5.0.51a

ideas ?

sensimilla
07-02-2008, 08:12 AM
Great mod, would be usefull to send PM to users subscribed to certain vb social group.
for example BMX lovers about posts in Bikes forum... ect..

thanks great mod I might install it later

maroceve
07-02-2008, 08:29 AM
how would this work for large databases ?

if a usergroup has more than 30 000 people..Will it crash my server ? or does it send a certain amount of mail at a time ? etc ?

maroceve
07-02-2008, 08:32 AM
yes i get the same db error :

Database error in vBulletin 3.7.1:

Invalid SQL:

ALTER TABLE thread
ADD sendpm varchar(100) UNSIGNED NOT NULL;

MySQL Error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNSIGNED NOT NULL' at line 2
Error Number : 1064
Request Date : Wednesday, July 2nd 2008 @ 05:31:41 AM
Error Date : Wednesday, July 2nd 2008 @ 05:31:42 AM
Script : http://www.maroceve.com/forums/admincp/plugin.php?do=productimport
Referrer : http://www.maroceve.com/forums/admincp/plugin.php?do=productadd
IP Address : 41.251.65.88
Username : Ez
Classname : vB_Database
MySQL Version : 4.1.22-standard

Michael Biddle
07-02-2008, 06:49 PM
Updated. Should have the fix now.

xorex
07-03-2008, 12:25 AM
Updated. Should have the fix now.


Now mistake


Invalid SQL:

ALTER TABLE forum
ADD sendpm SMALLINT( 5 ) UNSIGNED DEFAULT '0' NOT NULL;

Error MySQL : Duplicate column name 'sendpm'

Michael Biddle
07-03-2008, 03:57 AM
That is because it was added in the first query. Go ahead and remove that field from the forum table, and then import again.

VB-STYLE
07-03-2008, 05:20 AM
great mod & install :)

If you can do some more things will be wonderful.

1- Automatic PM Title better to be with the thread title. Price quote requested for thread {1}.
2- If there is resend bottum when the thread be come importent and i need to sent it to the defined group.

chris1979
07-21-2008, 12:55 PM
I get this error:



Database error in vBulletin 3.7.0:

Invalid SQL:
SELECT gfpoforumoptions FROM forum WHERE forumid =;

MySQL Error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Error Number : 1064
Request Date : Monday, July 21st 2008 @ 01:51:52 PM
Error Date : Monday, July 21st 2008 @ 01:51:53 PM
Script : http://www.nlpconnections.com/newthread.php?do=postthread&f=75
Referrer : http://www.nlpconnections.com/newthread.php?do=newthread&f=75
IP Address : xxxxxxxxx
Username : chris_morris
Classname : vB_Database
MySQL Version : 5.0.45

rooban12
07-21-2008, 03:34 PM
good work

Michael Biddle
07-22-2008, 05:26 AM
I get this error:



Database error in vBulletin 3.7.0:

Invalid SQL:
SELECT gfpoforumoptions FROM forum WHERE forumid =;

MySQL Error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Error Number : 1064
Request Date : Monday, July 21st 2008 @ 01:51:52 PM
Error Date : Monday, July 21st 2008 @ 01:51:53 PM
Script : http://www.nlpconnections.com/newthread.php?do=postthread&f=75
Referrer : http://www.nlpconnections.com/newthread.php?do=newthread&f=75
IP Address : xxxxxxxxx
Username : chris_morris
Classname : vB_Database
MySQL Version : 5.0.45

This error has nothing to do with my modification.

yahoooh
07-22-2008, 06:11 AM
i suggest subscription if the user want to be e-mailed or pm if another user write a new thread
which is usefull

tk102
08-22-2008, 03:57 AM
Just installed. Good job, it was just what I was looking for.


Three things:

1) It'd be nice to have the recipient usergroups to be specified on a forum-by-forum basis rather than a single set of groups. Haven't looked at what this would require though.

2) I noticed that for members that have already registered, their new userfield value in the userfield table shows up as NULL rather than Yes or No, which is deceptive since it appears to be Yes in the User Options area of the UCP. There's plenty of workarounds to this including simply reversing the "Yes / No" options to "No / Yes" when creating the userfield during installation. This would cause the No to show up in the UCP by default which has the same behavior here as NULL.

3) I noticed that your "AutoPM Save Thread Info" hook only looks for users who have the recipient usergroup as their primary usergroup. I added the following to the code to search for users who have the recipient group as a secondary group (though there's probably a more efficient means to do this):

After this:
while ($name = $vbulletin->db->fetch_array($usernames))
{
$pm2users[] = $name['username'];
}

$vbulletin->db->free_result($usernames);

Insert this:
$autopm_groups=explode(',',$vbulletin->options['sendpm_usergroups']);
while ($autopm_group = array_shift($autopm_groups)) {
$usernames = $vbulletin->db->query_read("
SELECT username
FROM " . TABLE_PREFIX . "user
LEFT JOIN " . TABLE_PREFIX . "userfield AS userfield ON (user.userid = userfield.userid)
WHERE membergroupids REGEXP '(^|,| )".trim($autopm_group)."($|,| )'
AND field" . $vbulletin->options['sendpm_sendme'] . " = 'Yes'
ORDER BY username ASC
");
while ($name = $vbulletin->db->fetch_array($usernames))
{
$pm2users[] = $name['username'];
}
$vbulletin->db->free_result($usernames);
}


Thanks for the mod!

Videx
08-23-2008, 02:17 AM
Why should I use this instead of Instant New Thread Notification (https://vborg.vbsupport.ru/showthread.php?t=141280)? It seems to me this mod requires two steps to do what the other one does in one. Or am I missing something?

students_forum
09-09-2008, 11:17 AM
Why should I use this instead of Instant New Thread Notification (https://vborg.vbsupport.ru/showthread.php?t=141280)? It seems to me this mod requires two steps to do what the other one does in one. Or am I missing something?
1- it is a PM and not email
2- you have to subscribe to the forum ;)

SBlueman
11-04-2010, 05:55 AM
Is there a way to limit this to certain forums?

yotsume
12-09-2010, 11:25 PM
Any chance to get this to work on VB 3.6.4? I did not create the new profile field.

I go this error when I posted a new thread on my forum now:

Database error in vBulletin 3.6.4:

Invalid SQL:

SELECT username
FROM vb_user
LEFT JOIN vb_userfield AS userfield ON (user.userid = userfield.userid)
WHERE usergroupid IN (2,6,13) AND field5 = 'Yes'
ORDER BY username ASC;

MySQL Error : Unknown table 'user' in on clause
Error Number : 1109

Burley
03-01-2011, 10:20 PM
I was just wondering if this mod could be adjusted so that it would also work when a new event is posted in the calender?

thanks

ericholtman
03-26-2012, 09:27 PM
Is there any chance this mod will be made available for vB 4.x.x?