Hide medals under username to guests

Discussion in '[bd] Medal System' started by nrep, Mar 10, 2014.

  1. nrep

    nrep New Member

    #1 , Mar 10, 2014
    Last edited: Mar 11, 2014
    Hi,

    I've tried editing the "bdmedal_message_medals" template, so that I can stop the medals showing to non members. I've tried using the "<xen:if is="{$visitor.user_id}">" conditional, however it appears that {$visitor.user_id} isn't available. Am I doing something wrong or is there another way to do this?

    Cheers
     
  2. xfrocks

    xfrocks XenForo rocks!
    Staff Member

    When you add the conditional, it always hide itself? Also, which position did you configure it?
     
  3. nrep

    nrep New Member

    When I use it to replace all the template as below, it never shows anything for the guest or members:

    Code:
    <xen:if is="{$visitor.user_id}">
    $0
    </xen:if>
    Also, if I use "{xen:helper dump, $visitor}" it never shows anything other than "null". It seems as if I can't use the global visitor variables in this template for some reason. Is there a fix or a way around it?
     
  4. xfrocks

    xfrocks XenForo rocks!
    Staff Member

    Yeah, null means the variable is not available. You will need to edit the add-on file to get it.
     
  5. nrep

    nrep New Member

    Thanks for the quick reply :). Do you happen to know what I could add to the addon file to do this, as I'm not much of a coder :oops:.
     
  6. xfrocks

    xfrocks XenForo rocks!
    Staff Member

    You can do this in file library/bdMedal/Listener.php, find

    PHP:
    $positionInPost XenForo_Application::get('options')->get('bdMedal_positionInPost');
    Add below:
    PHP:
    $hookParams $template->getParams() + $hookParams;
     
    nrep likes this.
  7. nrep

    nrep New Member

    Fantastic! Thank you :)
     
Loading...