The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Best practices recommendations for including conditionals in e-mail notification text
Hi,
I'm turning to the community for recommendations on how to best proceed with using vBulletin's (3.5) plugin system and existing hooks in order to conditionally include $pagetext in the new reply e-mail notification. Currently, the e-mail text is stored as a phrase in vBulletin. Unfortunately, vBulletin does not support conditionals in phrases and therefore a simple is_member_of() call wouldn't work to only supply the actual text of the reply in the notification based on usergroup (the intended goal). To illustrate: Usergroups X should receive e-mail notifications that include the body of the latest post as is the default in a new vBulletin installation. Usergroups Y, however, should receive the traditional e-mail notification used in vB 2 that does not contain the text of the message, but merely a link back to the thread. There appear to be two relevent hooks: newpost_notification_start and newpost_notification_message. There aren't any hooks in the while loop that actually processes the variables in the phrases, nor are there hooks in the replace_template_variables() function that does the dirty work. My only thought at this time would be to use newpost_notification_message and do a regex search and replace after the variables have been processed before the e-mails are actually passed off to be sent, searching for $pagetext and replacing it with '' should the usergroup in $touser not match a predefined list (as defined by Usergroups X). This seems less than elegant and perhaps I'm missing something, so I'm calling out to those who might be more experienced overcoming the placement of hooks in the code for some creative suggestions and pointers on how to accomplish this end goal. Thanks for the assistance in advance! Paul Closer inspection of the code reveals a nasty fact. $message isn't evaluated until after the newpost_notification_message hook is called, rendering any changes to $message prior to the e-mail being sent out useless. I fail to see a way to implement this, unless there's a bit of PHP code that will tell the script to skip the next eval statement. |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|