Version: 1.5, by blogtorank
Developer Last Online: Mar 2008
Category: Add-On Releases -
Version: 3.6.8
Rating:
Released: 08-22-2007
Last Update: 08-25-2007
Installs: 31
Uses Plugins
Additional Files
No support by the author.
EPC PM Notifications "SUITE" with AJAX
Ok, you may have to ask, what would we want this for? Because we just fulfilled a member's request here in our other MOD: EPC vbMailer
Where this member asked in posts, 8, 18, and 34... So that being said we put the whole idea wrapped around his thoughts into a FREE mod here...
Description
Quote:
Basically the paid subscriptions in vbulletin when someone signs up and buys something from the forums/payments.php page there is no email/pm notification sent to them.
For people who use the paid subscriptions in vbulletin for one thing or another, it is quite often very useful to set up a email/pm notification to say thanks, or to let them know what they have to do next, or to let them know what features that now have access to etc.
So what he wanted we built , that's what you get when you support our by leaving us feedback!
Installation Guide
If you had our previous hack installed, from version 1.1 and prior, remove it totally!
Step 1) Upload the files in the 'upload' folder to your forums' root folder
Step 2) Import the 'product-sub_receipt.xml' file into your Product Manager (Add/Import Product)
Step 3) Enjoy and remember us in the future! Click INSTALL for updates!
Settings Documentation
General Settings --
Send PM Global - this is a switch to turn global PM sending on and off, allowing you to control every notification sender in EPC PM Notifications.
Send Email Global - same as above except pertaining to emails.
Admin Username - set this to the admin username of your forum. This is where admin PM notifications are sent and where user notifications are sent from.
Paid Subscription Settings --
Send PM - allows you to turn PM sending for Paid Subscription Notifications on or off.
PM CC Usernames - a comma-separated entry of usernames to send CC of the Paid Subscription Notification to.
PM Title - the title of every outgoing notification.
PM Message - the message of every outgoing notification. To display a user's username, enter '%1$s'. To display the subscription's name, enter '%2$s'. To display the subscription's cost, enter '%3$s'.
Send Email - allows you to turn Email sending for Paid Subscription Notifications on or off.
Email Subject - the subject of every outgoing notification email.
Email Body - the body of every outgoing notification email. To display a user's username, enter '%1$s'. To display the subscription's name, enter '%2$s'. To display the subscription's cost, enter '%3$s'.
Change Log
v1.1:
Ajaxified the whole backend for the admin
Added support for sending as e-mail also
v1.2:
Converted to a Suite with many more options and cool features
More secure than v1.1 due to a flag we just received last night about a possible SQL Injection possibility. So we corrected it all overnight
v1.5:
Renamed the whole project to EPC PM Notifications "Suite" you will see why when you install!
This call kills the datbase connection - which causes database errors for example in payment_gateway.php for Payment APIs that require feedback display - as there are queries being run after the call to build_user_subscription().
Also, why don't you just use phrases for the subject and body text?
Would make it a lot easier and language independant
$db->query_write("UPDATE " . TABLE_PREFIX . "datastore SET data='" . $db->escape_string(slw_serial($ds)) . "' WHERE title='pmnotify'");
You should never UPDATE table datastore directly, as the user might use a datastore cache - and thus your updated data will not be in the cache (until it gets cleared).
Use build_datastore() instead.
PHP Code:
$current_dt = strtotime("now");
The current timestamp is available as constant TIMENOW - seems unnecessary overhead to create it again.
$db->query_write("UPDATE " . TABLE_PREFIX . "datastore SET data='" . $db->escape_string(slw_serial($ds)) . "' WHERE title='pmnotify'");
You should never UPDATE table datastore directly, as the user might use a datastore cache - and thus your updated data will not be in the cache (until it gets cleared).
Use build_datastore() instead.
PHP Code:
$current_dt = strtotime("now");
The current timestamp is available as constant TIMENOW - seems unnecessary overhead to create it again.
Hey man, thanks for the suggestions and information!
Can you please elaborate on the v1.2 bug, I don't quite understand how to prevent what you're saying. Any help here would be appreciated.
Will be remembering this and implementing it in the next update.
Can you please elaborate on the v1.2 bug, I don't quite understand how to prevent what you're saying. Any help here would be appreciated.
It is still present in 1.5 ...
On hook paidsub_build you are defininig two functions - slw_serial() and slw_unserial().
Now, if method build_user_subscription() is being called several times within one script run, this will cause a fatal error as you the functions are already defined when the plugin is called the second time - which will halt script execution.
Also, I don't understand why you are using custom serialize functions anyway
Instead of $db->fetch_array($db->query_read()), $db->query_first is easier.
I also suggest to use phrases instead of the datastore item - this is the standard way to do such things (PM;/E-Mail Notifications).
Finally, having hardcoded text in PHP scripts is deprecated.
On hook paidsub_build you are defininig two functions - slw_serial() and slw_unserial().
Now, if method build_user_subscription() is being called several times within one script run, this will cause a fatal error as you the functions are already defined when the plugin is called the second time - which will halt script execution.
Also, I don't understand why you are using custom serialize functions anyway
Instead of $db->fetch_array($db->query_read()), $db->query_first is easier.
I also suggest to use phrases instead of the datastore item - this is the standard way to do such things (PM;/E-Mail Notifications).
Finally, having hardcoded text in PHP scripts is deprecated.
I gotcha now. So running an if(!function_exists()) would probably get that fixed.
About $db->query_first(), never knew what it did but now I do, so thanks =]
As for phrases, we wanted to offer the user a more personal and seamless experience, where they only have to use our control panel to change their settings. I understand that this isn't the standard way of doing things, but it seems to offer a better experience, which is what we're all about. Maybe I could code it to use phrases, create my own phrase group, and have a link pointed to that phrase group. I'll look into this, unless you have some suggestions.
Thanks again for the help, I'm still getting the hang of vB's system, and you've helped a lot!
EDIT The reason I'm using these functions, is because a serialize() or unserialize() fails if there is an apostrophe in the data. I don't know why, it's weird, because in our vbMailer mod, this doesn't occur. I don't have any idea why.