Announcement

Collapse
No announcement yet.

userid's in templetes hooks?

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

  • [Forum] userid's in templetes hooks?

    Hi

    I'm trying to add some additional mod options when you click on username in postbit.

    First I made template postbit_modtools

    Code:
    <li class="left"><a  href="modcp/user.php?do=avatar&userid={vb:raw  memberinfo.userid}"><img src="{vb:stylevar  imgdir_siteicons}/settings.png" alt="" /> {vb:rawphrase  editavatar}</a></li>
    than I made plugin in postbit _display_start:

    PHP Code:
        if (THIS_SCRIPT == 'showthread')
            {
                    
    $templater vB_Template::Create('postbit_modtools');
                     
    $template_hook[memberaction_dropdown_items] .=  $templater->render();



            } 
    The problem is that userid's doesnt fetch in that way

    Any ideas?
    Latest Tech News in the World
    Кейс със снимка по поръчка

  • #2
    You need to register any variables for use in a template. Cellarius wrote a really good article that you may be interested in - [vB4] Rendering templates and registering variables - a short guide

    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
      Thx for reply Lynn
      I read and use this thread already.

      I know that memberinfo array should be registered but how to do it?
      Cant I just use already registered array in function construct_memberaction_dropdown?

      And if I should fetch again users' ids using this:

      PHP Code:
          $memberinfo = array('userid' => SOMETHING); 
      What should be this SOMETHING?
      Latest Tech News in the World
      Кейс със снимка по поръчка

      Comment


      • #4
        Any help?
        Latest Tech News in the World
        Кейс със снимка по поръчка

        Comment


        • #5
          You need to register memberinfo for use in *your* template.

          Code:
          [COLOR=#000000][COLOR=#007700][/COLOR][COLOR=#0000BB]$templater [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]vB_Template[/COLOR][COLOR=#007700]::[/COLOR][COLOR=#0000BB]Create[/COLOR][COLOR=#007700]([/COLOR][COLOR=#DD0000]'postbit_modtools'[/COLOR][COLOR=#007700]);
          [/COLOR][/COLOR] $[COLOR=#000000][COLOR=#0000BB]templater[/COLOR][/COLOR]->register('memberinfo',  $memberinfo);
          [COLOR=#000000][COLOR=#007700][/COLOR][COLOR=#0000BB]$template_hook[/COLOR][COLOR=#007700][[/COLOR][COLOR=#0000BB]memberaction_dropdown_items[/COLOR][COLOR=#007700]] .=  [/COLOR][COLOR=#0000BB]$templater[/COLOR][COLOR=#007700]->[/COLOR][COLOR=#0000BB]render[/COLOR][COLOR=#007700]();[/COLOR][/COLOR]

          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


          • #6
            Thx mate,

            This was the first thing that I did but doesnt works

            I've tried in this 2 plugin hook locations:
            postbit_display_complete
            postbit_display_start


            But no IDs

            Any help will be appreciated!
            Latest Tech News in the World
            Кейс със снимка по поръчка

            Comment


            • #7
              If you are using either of the postbit_display_* hooks, then the correct variable to use is $post, not $memberinfo.

              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


              • #8
                thx Lynn

                I was strayed from the memberaction_dropdown template.
                Now all is ok!

                Thx once again!
                Latest Tech News in the World
                Кейс със снимка по поръчка

                Comment


                • #9
                  Last thing

                  What var should I use in hook member_complete hook?

                  I've tried regiter almost every var bu without success:

                  PHP Code:
                  $templater vB_Template::Create('memberinfo_Modtools');
                   
                  $templater->register('memberinfo',  $memberinfo);
                    
                  $templater->register('prepared',  $prepared);
                   
                  $templater->register('userinfo',  $userinfo);
                   
                  $templater->register('member',  $member);

                   
                  $templater->register('post',  $post);
                  $template_hook[profile_sidebar_first] .=  $templater->render(); 
                  Latest Tech News in the World
                  Кейс със снимка по поръчка

                  Comment


                  • #10
                    I've handled it

                    thx!
                    Latest Tech News in the World
                    Кейс със снимка по поръчка

                    Comment

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