Announcement

Collapse
No announcement yet.

Little help with If condition

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

  • Little help with If condition

    I am not that great with PHP coding and struggled with it for hours now but can't get it work.

    I have a plugin that created a variable for a Category in my classifieds plugin:$catid
    I want to show some text depending if the user is a member or not but only in a particular Category

    What I am trying to do
    If somebody looks up an item in
    Category 3 and he is a member (usergroup= 9) it should say "Buy this item"
    Category 3 and he is not a member (any usergroup besides 9) it should say "Members ONLY sale"

    Any other category and no matter member or not it should say "Buy this item"

    I tried this but didn't work

    <vb:if condition="$catid == 3">
    <vb:if condition="$vbulletin->userinfo[usergroupid] == 9">
    <font color="#FFFFFF"><b></a>Buy this item</b></font>
    <vb:if condition="$vbulletin->userinfo[usergroupid] <> 9">
    <font color="#FFFF00"><b></a>Member ONLY sale</b></font>
    </vb:if>
    </vb:if>
    </vb:if>

    <vb:if condition="$catid <> 3">
    <font color="#FFFFFF"><b></a>Buy this item</b></font>
    </vb:if>


    What am I doing wrong?
    Thanks for any help
    Michael

  • #2
    Instead of:
    HTML Code:
    <vb:if condition="$vbulletin->userinfo[usergroupid] == 9">
    use:
    HTML Code:
    <vb:if condition="is_member_of($bbuserinfo, 9)">
    And, you'll need to make sure $catid is preregistered for use in that template. Cellarius wrote a really good article that you may be interested in to help with that - [vB4] Rendering templates and registering variables - a short guide

    The best place to post for more help with modifying your site is over on vbulletin.org, the modification site.

    Please don't PM or VM me for support - I only help out in the threads.
    vBulletin Manual & vBulletin 4.0 Code Documentation (API)
    Want help modifying your vbulletin forum? Head on over to vbulletin.org
    If I post CSS and you don't know where it goes, throw it into the additional.css template.

    W3Schools &lt;- awesome site for html/css help

    Comment


    • #3
      Thanks Lynne
      Will look into this
      Michael

      Comment

      Related Topics

      Collapse

      Working...
      X