vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Need Help With Creating a Custom Birthday Notice (https://vborg.vbsupport.ru/showthread.php?t=324386)

vpcarrocci 02-06-2017 08:08 PM

Need Help With Creating a Custom Birthday Notice
 
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:

Code:

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 :

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!


All times are GMT. The time now is 11:53 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00950 seconds
  • Memory Usage 1,715KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete