Announcement

Collapse
No announcement yet.

a little bug in the notification-system ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • a little bug in the notification-system ?

    when making a new noticifation in the admin-module u can check some pre-defined conditions
    if the check condition is ok, the notification will be shown to the user

    i have a condition now that can't be (easily) made as a composition of those pre-defined conditions
    so a self-made condition (through some php-scripting) would be the solution

    when checking the code behind (/includes/functions_notice.php) i noticed there is a hook called "notices_check_criteria"

    default:
    {
    $abort = false;

    ($hook = vBulletinHook::fetch_hook('notices_check_criteria')) ? eval($hook) : false;

    if ($abort)
    {
    continue 3;
    }
    }

    so if i could put my code there, i would be saved on setting the $abort to true or false in the hook ?

    the 'default:'-code is only executed when there is NO condition checked on creation of the notification
    if u create a notification u must check AT LEAST ONE condition checked (see code in /admincp/notice.php) :

    if (!$have_criteria)
    {
    print_stop_message('no_notice_criteria_active');
    }

    is it right if i say this might be a little bug in the system ?
    or is there a way to make this work without changing the php-code in the "notice.php"-page ?

    thanks for your help guys !

  • #2
    vBulletin 3 is no longer being developed.

    Paul M
    Former Lead Developer
    vB.Com & vB.Org
    Paul M might be able shed some light on it from a code perspective, but there's nothing the support team can do.
    MARK.B | vBULLETIN SUPPORT

    TalkNewsUK - My vBulletin 5.6.4 Demo
    AdminAmmo - My Cloud Demo

    Comment


    • #3
      ok ... i solved it myself and i can confirm it is not a bug in the system
      the way to do this is like this :

      use the hook 'notices_list_criteria' and add there the following code :

      Code:
      $criteria_options['[COLOR=#FF0000][B]poll_vote[/B][/COLOR]'] = array();
      then add a new phrase with :
      - type : Notices
      - product : vBulletin
      - varname : poll_vote_criteria
      - text : your description
      - translations : the text to be shown in next to the checkbox when creating the notice

      you should see an extra checkbox now (at the bottom) in the list of possible criteria when creating or editing a notice

      use the hook 'notices_check_criteria' to code your own criteria for showing / not showing the notice to your users :
      (the code below is only for demonstrating purpose and the notice will only be shown to users with a username starting with a 'p')

      Code:
      if ( $criteriaid === '[COLOR=#FF0000][B]poll_vote[/B][/COLOR]' ) {
        if ( substr($vbulletin->userinfo['username'], 0, 1) === 'p' ) {
          $abort = false;
        } else {
          $abort = true;
        }
      }
      u can create multiple checkboxes / criteria by replacing the 'poll_vote' in the code above

      i hope this helps u out when u need this in your code
      if u do not succeed ... feel free to post it here

      Comment

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