Announcement

Collapse
No announcement yet.

Unable to pass the variable userid to a hook.

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

  • Unable to pass the variable userid to a hook.

    I'm trying to enable a PM button in the 'conversation_footer' by placing a hook at 'conversation_footerleft'

    My a href is as follows:

    Code:
    <a href="{vb:raw baseurl}/privatemessage/new/{vb:raw conversation.userid}"
    I tried to pass the Hook Arguments by using these in the Hook config:

    conversation.userid=conversation.userid

    also tried:

    userid=userid

    And I tried a lot more.

    However, it seems that I do something wrong? It ends up with value 0.

    When I place my code directly in the 'conversation_footer' template it is all working fine. But I like the hook idea instead of modifying the template itself.

    Any thoughts what I'm missing?

  • #2
    I'm also trying to show a button when someone has filled out a website in his profile, but also here it doesn't seem to be able to get the variable of it:

    Code:
                        <vb:if condition="$userInfo['homepage']">
                            <a href="{vb:raw userInfo.homepage}" class="b-post-control b-post-control--responsive" >
                            <span class="b-icon b-icon__web b-post-control__icon"></span>
                            <span class="b-post-control__label">{vb:phrase web}</span></a>
                        </vb:if>
    How do I get the data there to check if the user has filled out his homepage?

    Comment


    • #3
      Nobody? Mark, Lynne, anyone?

      Comment


      • #4
        Try using
        Code:
        conversation=conversation
        in the hook config.
        www.Dragonbyte-tech.com

        Comment


        • #5
          Thanks for the tip, unfortunately it doesn't seem to work either.

          Comment


          • #6
            You are putting these lines directly into the conversation_footer template or are you creating a new template and using a hook to add them? If using a hook to add a template to add them, can we see exactly what you entered into the hook and exactly what is in the template (and the exact template name). Also, make sure your hooks are enabled (they are not by default).

            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


            • #7
              When I put this directly in the conversation_footer template, it works:

              Code:
              <li>
              <ul class="h-margin-top-m h-left">
              {vb:data canUsePmSystem, content_privatemessage, canUsePmSystem}
                                  <vb:if condition="$canUsePmSystem">
                                      <a href="{vb:raw baseurl}/privatemessage/new/{vb:raw conversation.userid}"class="b-post-control b-post-control--responsive" >
                                      <span class="b-icon b-icon__pm b-post-control__icon"></span>
                                      <span class="b-post-control__label">PM Message Test</span></a>
                                  </vb:if>
                          </ul>
              </li>
              When I try to use this as a hook, it doesn't work. It doesn't pass the userid and give it the value '0'

              The hook is enabled, because I see the icon, the label and so on.

              I've called the custom template for the hook: conversation_footer_pm

              Comment


              • #8
                It works just fine for me when I enter conversation=conversation into the Hook Arguments area.

                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


                • #9
                  Let me retry tomorrow, maybe because I bave the code active at this moment too in the footer template itself.

                  Comment


                  • #10
                    Errr, OMG. Typo... I'm sorry guys, it works! Many thanks!

                    I made a typo conversation=converstation

                    Now the option to show a WWW button when somebody has filled out his webadress in his/her profile.

                    And could anyone help me with the idea that the PM button disappears at your own posts? It wouldn't make sense to PM yourself.
                    Last edited by User0223423; Tue 1st Apr '14, 3:26am.

                    Comment


                    • #11
                      In the hook config, also set it up to pass "user"
                      Then add a condition around the template:
                      HTML Code:
                      <vb:if condition="$conversation['userid'] != $user['userid']">
                      all your stuff
                      </vb:if>
                      You really should be asking these questions regarding customizing over on vbulletin.org

                      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


                      • #12
                        That worked! Thanks again Lynne!

                        Comment

                        Related Topics

                        Collapse

                        Working...
                        X