1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

I need thread tools to show

Discussion in 'XenForo Development Discussions' started by Matthew Hawley, Jun 14, 2013.

  1. Matthew Hawley

    Matthew Hawley Well-Known Member

    So the addon I'm developing has a link in the thread tools menu, and the thread tools menu doesn't display to regular members. How do I get this to display?
     
  2. Nobita.Kun

    Nobita.Kun Well-Known Member

    Did you use hook:thread_view_tools_links?
     
  3. Matthew Hawley

    Matthew Hawley Well-Known Member

    Yes. It shows for me, because I'm the administrator. But I need the thread tools drop to show for registered members.
     
  4. Nobita.Kun

    Nobita.Kun Well-Known Member

    Do you use permission for that? Or what your code?
     
  5. Matthew Hawley

    Matthew Hawley Well-Known Member

    I dont have permissions for the addon. I just want the thread tools drop down to show for regular members with the link i put in it.
     
  6. Nobita.Kun

    Nobita.Kun Well-Known Member

    So what is your code to do? *Its mean code html
    I was read your resources.
    If you used:
    Code:
    <xen:if is="{$canWatchThread}">
    <a href="{xen:link 'threads/watch-confirm', $thread}" class="OverlayTrigger" data-cacheOverlay="false">{xen:if $thread.thread_is_watched, '{xen:phrase unwatch_thread}', '{xen:phrase watch_thread}'}</a>
    <label><a href="{xen:link search/search, '', 'type=post', 'thread_id={$thread.thread_id}', 'users={$visitor.username}'}">Your Posts</a></label>
    </xen:if>
    Change to:
    Code:
    <xen:if is="{$canWatchThread}">
    <a href="{xen:link 'threads/watch-confirm', $thread}" class="OverlayTrigger" data-cacheOverlay="false">{xen:if $thread.thread_is_watched, '{xen:phrase unwatch_thread}', '{xen:phrase watch_thread}'}</a>
    
    </xen:if>
    <a href="{xen:link search/search, '', 'type=post', 'thread_id={$thread.thread_id}', 'users={$visitor.username}'}">Your Posts</a>
     
  7. Nobita.Kun

    Nobita.Kun Well-Known Member

    Try to
    PHP:
    if ($hookName == 'thread_view_tools_links')
            {
                
    $contents .= $template->create('find_posts_in_thread_view'$template->getParams());
            }
    Code:
    if ($hookName == 'thread_view_tools_links')
            {
                $params = $template->getParams();
    $params += $hookParams;
    $contents .= $template->create('find_posts_in_thread_view', $params);
            }
     
  8. Matthew Hawley

    Matthew Hawley Well-Known Member

  9. Nobita.Kun

    Nobita.Kun Well-Known Member

    I downloaded and try to:
     
  10. Matthew Hawley

    Matthew Hawley Well-Known Member

    try to what? What does that tell you?

    This is code in the template. I used a template hook to insert it into the thread tools menu.

    Code:
    <xen:foreach loop="$posts" value="$post">
          <xen:if is="{$post.user_id} == {$visitor.user_id}">
                <xen:set var="$hasPosted">1</xen:set>
          </xen:if>
    </xen:foreach>
    <xen:if is="{$hasPosted}">
          <li><a href="{xen:link search/search, '', 'type=post', 'thread_id={$thread.thread_id}', 'users={$visitor.username}'}">Your Posts</a></li>
    </xen:if>
    But i dont think this is a problem with my addon. I think its the fact that the thread tools menu is not visible to members.
     
  11. Nobita.Kun

    Nobita.Kun Well-Known Member

    In your Listener.php
    Code:
    if ($hookName == 'thread_view_tools_links')
            {
                $contents .= $template->create('find_posts_in_thread_view', $template->getParams());
            }
    Change to:
    Code:
    if ($hookName == 'thread_view_tools_links')
            {
                $params = $template->getParams();
    $params += $hookParams;
    $contents .= $template->create('find_posts_in_thread_view', $params);
            }
    Sorry my english not good :oops:
     
  12. Matthew Hawley

    Matthew Hawley Well-Known Member

    Lol nvm. I didn't post in the thread as the demo user I was logged in as. its not supposed to show if the user has not posted in thread. LOL Silly me.
     

Share This Page