No announcement yet.

Variables unavailable in Custom Templates?

  • Filter
  • Time
  • Show
Clear All
new posts

  • Variables unavailable in Custom Templates?

    Hi, I created a custom template and inserted the Notification/Login code into it.

    The strange thing is that, if in the navbar (or any other) template, the: $notifications_total variable, does what it should. If I have 5 notifications, this number is 5 and the Notifications menu will show.

    If in my custom template, it is empty or NULL... so if I have 1 PM and 4 Visitor Messages, with the <if condition="$show['notifications']"> conditional, it goes to the <else /> and just goes to say "Private Messages: Unread 1, Total 277." If I further test just outputting the $notifications_total variable, it is NULL/blank.

    The plugin is hooked in at "parse_templates" with the following:
    eval('$MEMBER_INFO = "' . fetch_template('MEMBER_INFO') . '";');

    and I've also got a cached hook in "cache_templates":
    $globaltemplates = array_merge($globaltemplates, array('MEMBER_INFO'));

    Any ideas?

  • #2
    This would require custom programming to get the information you need. Arrays are usually cleared after vBulletin is done with them to make room in memory for other things. So you cannot expect variables to be available at all times.

    For help with custom modifications such as this, visit
    Translations provided by Google.

    Wayne Luke
    The Rabid Badger - a vBulletin Cloud demonstration site.
    vBulletin 5 API


    • #3
      Thanks I'll do that.


      widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.