Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.6 > vBulletin 3.6 Add-ons

Reply
 
Thread Tools
EPC PM Notifications "SUITE" with AJAX Details »»
EPC PM Notifications "SUITE" with AJAX
Version: 1.5, by blogtorank blogtorank is offline
Developer Last Online: Mar 2008 Show Printable Version Email this Page

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!
  • Security fixes
  • Optimized code

Supporters / CoAuthors

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #32  
Old 08-25-2007, 04:52 AM
chewbacca chewbacca is offline
 
Join Date: Oct 2004
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Very nice, thanks for this mod.
Reply With Quote
  #33  
Old 08-25-2007, 05:11 AM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This modification has a major Bug:
PHP Code:
exec_shut_down(); 
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
Reply With Quote
  #34  
Old 08-25-2007, 04:14 PM
blogtorank's Avatar
blogtorank blogtorank is offline
 
Join Date: Jan 2006
Posts: 450
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Update and Security fix:

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
Reply With Quote
  #35  
Old 08-25-2007, 04:15 PM
AzzidReign's Avatar
AzzidReign AzzidReign is offline
 
Join Date: Apr 2006
Posts: 497
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Awesome! Great work!! Thanks for the fix.
Reply With Quote
  #36  
Old 08-25-2007, 04:29 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

New Bug: Version 1.2 will cause a fatal PHP error if build_user_subscription() is called more then due to redefined functions.

A few suggestions
PHP Code:
    foreach($_POST as $key => $value){
            
$ds[$key] = $value;
        }
        
$vbulletin->input->clean_array($ds, array(
            
'send_pm_global' => TYPE_NOHTML,
            
'send_em_global' => TYPE_NOHTML,
            
'pm_from_global' => TYPE_NOHTML,
            
'send_pm_paidsub' => TYPE_NOHTML,
            
'pm_title_paidsub' => TYPE_NOHTML,
            
'pm_message_paidsub' => TYPE_NOHTML,
            
'send_em_paidsub' => TYPE_NOHTML,
            
'em_subject_paidsub' => TYPE_NOHTML,
            
'em_body_paidsub' => TYPE_NOHTML
        
)); 
Why not just
PHP Code:
$vbulletin->input->clean_array_gpc('p', array(
    
'send_pm_global' => TYPE_NOHTML,
    
'send_em_global' => TYPE_NOHTML,
    
'pm_from_global' => TYPE_NOHTML,
    
'send_pm_paidsub' => TYPE_NOHTML,
    
'pm_title_paidsub' => TYPE_NOHTML,
    
'pm_message_paidsub' => TYPE_NOHTML,
    
'send_em_paidsub' => TYPE_NOHTML,
    
'em_subject_paidsub' => TYPE_NOHTML,
    
'em_body_paidsub' => TYPE_NOHTML
)); 
PHP Code:
$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.
Reply With Quote
  #37  
Old 08-26-2007, 03:44 AM
Inkybro Inkybro is offline
 
Join Date: Aug 2007
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Andreas View Post
New Bug: Version 1.2 will cause a fatal PHP error if build_user_subscription() is called more then due to redefined functions.

A few suggestions
PHP Code:
    foreach($_POST as $key => $value){
            
$ds[$key] = $value;
        }
        
$vbulletin->input->clean_array($ds, array(
            
'send_pm_global' => TYPE_NOHTML,
            
'send_em_global' => TYPE_NOHTML,
            
'pm_from_global' => TYPE_NOHTML,
            
'send_pm_paidsub' => TYPE_NOHTML,
            
'pm_title_paidsub' => TYPE_NOHTML,
            
'pm_message_paidsub' => TYPE_NOHTML,
            
'send_em_paidsub' => TYPE_NOHTML,
            
'em_subject_paidsub' => TYPE_NOHTML,
            
'em_body_paidsub' => TYPE_NOHTML
        
)); 
Why not just
PHP Code:
$vbulletin->input->clean_array_gpc('p', array(
    
'send_pm_global' => TYPE_NOHTML,
    
'send_em_global' => TYPE_NOHTML,
    
'pm_from_global' => TYPE_NOHTML,
    
'send_pm_paidsub' => TYPE_NOHTML,
    
'pm_title_paidsub' => TYPE_NOHTML,
    
'pm_message_paidsub' => TYPE_NOHTML,
    
'send_em_paidsub' => TYPE_NOHTML,
    
'em_subject_paidsub' => TYPE_NOHTML,
    
'em_body_paidsub' => TYPE_NOHTML
)); 
PHP Code:
$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.

Once again, tons of thanks =]
Reply With Quote
  #38  
Old 08-26-2007, 04:29 AM
blogtorank's Avatar
blogtorank blogtorank is offline
 
Join Date: Jan 2006
Posts: 450
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Update is coming, so hang loose!
Reply With Quote
  #39  
Old 08-26-2007, 04:39 AM
blogtorank's Avatar
blogtorank blogtorank is offline
 
Join Date: Jan 2006
Posts: 450
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

v1.5:
  • Renamed the whole project to EPC PM Notifications "Suite" you will see why when you install!
  • Security fixes
  • Optimized code
Reply With Quote
  #40  
Old 08-26-2007, 04:11 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Inkybro View Post
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.
Reply With Quote
  #41  
Old 08-26-2007, 05:02 PM
Inkybro Inkybro is offline
 
Join Date: Aug 2007
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Andreas View Post
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.
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.
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:40 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.10380 seconds
  • Memory Usage 2,352KB
  • Queries Executed 26 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (9)bbcode_php
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete