No announcement yet.

Forum Block conditionals

  • Filter
  • Time
  • Show
Clear All
new posts

  • [vB4] Forum Block conditionals


    I am trying to use conditionals on forum blocks.

    I have created a forum block, set it to PHP and have the following conditional:

    <vb:if condition="is_member_of($bbuserinfo, 19,14)">
    <vb:elseif condition="is_member_of($bbuserinfo, 2)" />
    <vb:elseif condition="is_member_of($bbuserinfo, 1,3,4)" />
    Unfortunately the block doesn't even appear on the screen. I have of course flushed the cache thinking that that might have been the problem.

    When I change the content type to HTML it shows just fine (all of it) so the conditionals are ignored.

    Basically I want to display different messages to different members of my boards.

    Is the above feasible?

    Thank you in advance for any pointers.

  • #2
    If you choose the html option then the block can only contain [real] html, not template syntax.

    If you choose the php option then the contents must be actual php code (like a plugin), with the desired output assigned to the variable $output.

    To do what you want, would require the php option, with the relevant code to render a custom template.
    Baby, I was born this way


    • #3
      Hello Paul. Thank you for your reply.

      I tried using

      $o = 'hello';
      return $o;
      and it works fine.

      Now to access the usergroup IDs that the user belongs, do I need to use the:


      object? Is this correct and if yes, does that return an array? Will is_member_of() work with it i.e. does the forum block have access to the functions.php methods?

      Thanks in advance.


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