PDA

View Full Version : Need Help With Creating a Custom Birthday Notice


vpcarrocci
02-06-2017, 08:08 PM
I am running vB 4.2.3_PL2.

I would like to create a custom notice that appears to my Users when they visit the site on their birthday. I created custom fields for first and last name that Users have to fill in when they register on the site and would like to use the first name field in the birthday greeting instead of using the username field. The problem I am having is determining the correct code to use in the notice in place of {username}. I have identified the custom first name field to be "field5_title".

The particular line of code I currently have in the Notice HTML box is:

Happy Birthday {username}!


One of the Support Mods at vBulletin.com said that the custom field I want to reference isn't globally available and that I'll need a plugin in order make it work. Can anyone help with how to make that happen or point me to a mod/add-on that addresses this kind of need?

Thanks in advance for any help!

MarkFL
02-06-2017, 10:34 PM
Try this...

Create a plugin hooked at "notices_noticebit" with the Plugin PHP Code :

if (strpos($notice_html, 'Birthday') !== false)
{
$notice_html = str_replace($vbulletin->userinfo['username'], $vbulletin->userinfo['field5'], $notice_html);
}

Save it with "Plugin is Active" set to "Yes"...this should do the trick. ;)

vpcarrocci
02-07-2017, 04:44 AM
Thank you, Mark!

I tested it and it works!