Announcement

Collapse
No announcement yet.

Visitor Messages Tab

Collapse
X
Collapse
First Prev Next Last
  • Filter
  • Time
  • Show
Clear All
new posts

    Visitor Messages Tab

    Hi Glenn,

    I came across this post on the vBulletin Community and - although it was a quite old post - decided to try the hook on my forums. It does display the Visitor Messages Tab, but when you click on the tab, you'll get an invalid page.

    Do you think you can update this hook to get it working? Will it display ALL Visitor Messages or does it the same when you filter on Only Visitor Messages and select All Times?

    Thanks,
    Rob

    #2
    I will look into it.

    Comment


    • Fleiding
      Fleiding commented
      Editing a comment
      Thanks, I appreciate it.

    #3
    I used the code on a fresh vB 5.3.1 install and it works for me. The Visitor Messages tab doesn't look like active or selected, though. But I can see just the visitor messages listed. I'll tweak it to fix the active tab style issue.

    Comment


      #4
      Strange, but it's working now as it should.

      Comment


      • glennrocksvb
        glennrocksvb commented
        Editing a comment
        Glad it works for you now. Does the Visitor Messages tab look selected when active?

      • Fleiding
        Fleiding commented
        Editing a comment
        Not yet, but I'm trying to fix that.

      • glennrocksvb
        glennrocksvb commented
        Editing a comment
        Fixing the active tab issue is not straightforward. I'm fixing it.

      #5
      Hi Glenn,

      Did you already had the time to look at the active tab issue?

      Thanks,
      Rob

      Comment


        #6
        Try using this hook template code:
        Code:
        <li id="custom-vm-tab">
        
            {vb:set background_active, {vb:customstylevar profcustom_navbar_background_active.color, {vb:var userid}}}
            <vb:if condition="empty($background)">
                {vb:set background_active, '#fff'}
            </vb:if>
            {vb:set background_default, {vb:customstylevar profcustom_navbar_background.color, {vb:var userid}}}
            <vb:if condition="empty($background)">
                {vb:set background_default, 'transparent'}
            </vb:if>
            <style>
               .custom-vm-tab-active.profileTabs .widget-tabs-nav li.ui-tabs-selected a { background: transparent; }
               .custom-vm-tab-active #activities-tab { visibility: hidden; }
                .profileTabs li[aria-controls="activities-tab"][aria-selected="true"] a {
                    background: {vb:raw background_active};
                }
                .custom-vm-tab-active.profileTabs li[aria-controls="activities-tab"][aria-selected="true"] a {
                    background: {vb:raw background_default};
                }
            </style>
        
            <a href="#vm-tab" data-href="{vb:raw baseurl}/member/{vb:raw userInfo['userid']}?filter_source=source_vm&filter_time=time_all&vm=1" onclick="location.href=this.getAttribute('data-href');return false;">Visitor Messages</a>
        
            <script>
              !function(){if(-1!=location.href.indexOf("?filter_source=source_vm&filter_time=time_all&vm=1")){document.querySelector(".profileTabs").className+=" custom-vm-tab-active",window.addEventListener("load",function(){for(var e=document.querySelectorAll(".profile-tabs-nav li"),t=document.getElementById("activities-tab"),a=0;a<e.length-1;a++)if(e[a].querySelector('a[data-url-path="activities"]')){e[a].className="ui-state-default ui-corner-top";break}document.getElementById("custom-vm-tab").className="ui-state-default ui-corner-top ui-tabs-selected ui-state-active ui-tabs-active",t.querySelector(".conversation-toolbar-wrapper").style.display="none",t.style.visibility="visible"}),document.querySelector('a[href="#activities-tab"]').onclick=function(){for(var e=document.getElementById("activities-tab"),t=e.querySelectorAll(".conversation-list li"),a=document.querySelector(".profileTabs"),l=0;l<t.length;l++)t[l].style.visibility="hidden";e.querySelector(".clear-all").click(),e.querySelector(".conversation-toolbar-wrapper").style.display="",a.className=a.className.replace(/\bcustom-vm-tab-active\b/,"")};for(var e=document.querySelectorAll(".profile-tabs-nav li:not(#custom-vm-tab)"),t=0;t<e.length;t++)e[t].onclick=function(){var e=document.getElementById("custom-vm-tab");e.className=e.className.replace(/\bui-tabs-active\b/,"")}}}();
            </script>
        
        </li>

        Comment


          #7
          Awesome, you rock!

          Comment


            #8
            Hello,
            THank you for answer me on my topic, but i want to ask you where i need to add this template code?
            I'm new in editing this and i don't know.
            THank you !

            Edit: I found it, thank you !

            Comment


            • TheLordACS
              TheLordACS commented
              Editing a comment
              Yes work perfectly. I can make it the default tab to open on profiles? I change it from site builder but after i save it automaticaly a new blank tab are created wich is the default and the visitor tab going next to it.
              Look at image: https://i.imgur.com/xVJLdHs.png

            • glennrocksvb
              glennrocksvb commented
              Editing a comment
              Sorry you can't make it the default tab. Don't know why there's a blank tab. Are you using the code from this thread?

            • TheLordACS
              TheLordACS commented
              Editing a comment
              Like Feiding say , i fixed it , first disabled the visitor message tab , after edit the profile module and uncheck the blank tab.
              The blank tab apear when you make the "Visitor messages" tab default . But if this don't work it's okay
              Thank you !

            #9
            TheLordACS I had the same issue with the blank tab that was created. I fixed this by editing the Profile Module and switching off the blank tab.

            Comment


              #10
              What template do I edit to make this work?

              Comment


                #11
                No existing template to edit.

                1. You need to add a hook in AdminCP > Products & Hooks > Manage Template Hooks > Add New Hook.

                2. Enter the following.

                Hook Location: profile_tabs_1
                Template Name: hook_visitor_message
                Hook Argument: userInfo=userInfo

                3. Create a new template in Styles > Style Manager under the target theme.

                4. Use the template name used in Step 2.

                5. Copy and paste the code from post #6.

                6. Repeat Steps 3-5 for other target themes/styles.

                Comment

                Working...
                X