Announcement

Collapse
No announcement yet.

Add "My Started Topics" Navigation Bar Menu Item

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

    Free Mod Add "My Started Topics" Navigation Bar Menu Item

    Add "My Started Topics" navigation bar menu item that will display search results containing all the started posts of the currently logged-in user.
    1. Login to your forum.
    2. Toggle Edit Site slider to ON.
    3. Click Navigation Bar.
    4. Click New Navigation Item button.
    5. Enter Navigation Item Name (e.g. My Started Topics)
    6. Enter this search JSON URL in the Target URL field.
      This search JSON URL contains the *username* placeholder which will be replaced with the currently logged-in username when the user clicks the navigation link.
      Code:
      search?searchJSON=%7B%22starter_only%22%3A1%2C%22author%22%3A%5B%22*username*%22%5D%2C%22channel%22%3A%5B%5D%2C%22sort%22%3A%7B%22created%22%3A%22desc%22%7D%2C%22view%22%3A%22%22%2C%22exclude_type%22%3A%5B%22vBForum_PrivateMessage%22%5D%7D
      This search JSON URL was generated from Advanced Search. See sample from the below screenshot. You can modify the search criteria according to your preferences but the most important thing is after you submit the search and the search JSON URL is generated in the address bar, you manually replace the username you used in the Members field to *username*

    7. Enter this Javascript code in the Link Attributes field.
      Code:
      onclick="this.href=this.href.replace('*username*', encodeURIComponent(pageData.username))" oncontextmenu="this.href=this.href.replace('*username*', encodeURIComponent(pageData.username))"
      When user clicks this navigation link, the above code is executed and it replaces the *username* placeholder in the search JSON URL with the currently logged-in username.
    8. Edit User Groups to specify which usergroups can view this navigation link. Since guests don't have any posts, it's recommended to uncheck "Guest Users" usergroup to hide this link to guests. You may also exclude other usergroups that you want to restrict this link to.
    9. [Optional[ Drag and drop item to re-order in the desired location.
    10. Click OK button.
    11. Click Save Changes.

    Demo:
    I've added "My Started Topics" link in the navigation bar on this site. Click on it to see your started posts. It also works if you right-click and choose Open link in new tab.
    Last edited by glennrocksvb; 03-07-2022, 10:37 AM. Reason: Updated Step 8
    Helpful? Donate. Thanks!
    Buy me a coffeePayPal QR Code
    Fast VPS Host for vBulletin:
    A2 Hosting & IONOS

    #2
    this mod added to my site thanks
    Attached Files

    Comment


    • glennrocksvb
      glennrocksvb commented
      Editing a comment
      You're welcome. Glad you found this mod useful for your site.

    #3
    This trick can be re-used in other author-specific searches not just the author's started topics. Just remember to replace the author name with *username* placeholder and then add the Javascript code in the Link Attributes field as stated in step 7.
    Helpful? Donate. Thanks!
    Buy me a coffeePayPal QR Code
    Fast VPS Host for vBulletin:
    A2 Hosting & IONOS

    Comment


      #4
      Thank you, thank you, thank you! I know that our members on our site will find this a very welcome addition. Your avatar name is so appropriate: Glenn V does ROCK!
      The Linux Community has given me much. I do what I can to return the favor!

      Comment


        #5
        For guest users, the placeholder will be replaced with "guest" and of course, guests don't have any posts. So it would be better to hide this navigation link to guests by editing the usergroups in the navigation menu options and unchecking "Guest Users" usergroup and other usergroups that you want to restrict this link to.
        Helpful? Donate. Thanks!
        Buy me a coffeePayPal QR Code
        Fast VPS Host for vBulletin:
        A2 Hosting & IONOS

        Comment


        • glennrocksvb
          glennrocksvb commented
          Editing a comment
          Updated Step 8 in the first post in regards to this.

        #6
        This doesn't work if you use the mouse wheel button, works great when you left click though.

        Comment


          #7
          It's using onclick that's why. On mouse wheel click or middle click, try duplicating the onclick code and then replace onclick with onauxclick.
          Helpful? Donate. Thanks!
          Buy me a coffeePayPal QR Code
          Fast VPS Host for vBulletin:
          A2 Hosting & IONOS

          Comment


            #8
            Originally posted by glennrocksvb View Post
            It's using onclick that's why. On mouse wheel click or middle click, try duplicating the onclick code and then replace onclick with onauxclick.
            That worked, thanks

            Comment


              #9
              thank you, it works

              Comment


                #10
                nice modification. thanks

                Comment


                  #11
                  I like this mod... the only quirk is that it keeps resetting the navigation bar tab to a different menu tab from the one it was called from.

                  This might be self-inflicted, as Articles are the site home vs. forums -- is there a way to tweak the JSON so that the response stays on the same tab as the submenu link?

                  Comment


                    #12
                    You might have checked the "Open in new window" checkbox when you created the nav item?
                    Helpful? Donate. Thanks!
                    Buy me a coffeePayPal QR Code
                    Fast VPS Host for vBulletin:
                    A2 Hosting & IONOS

                    Comment


                      #13
                      No, but I think I found a fix -- I added a submenu item that points to "search " and set the link attributes to style="font-size:0pt;" which hides the option....

                      What I've been noticing on all of my LocalAPI pages and anything else I add as a custom page, if a page isn't present in the navigation on a primary or submenu, it defaults the active tab to the Home menu.

                      It was a nuisance that turned into an annoyance during my migration from 4.2.5 to 5.7.5..... until I discovered the menu trick. I'd been adding it without permissions by workgroup, but it's a lot easier to do the font-size:0pt; trick.

                      Comment

                      Users Viewing This Page

                      Collapse

                      There is 1 user viewing this forum topic.

                      • Guest Guest

                      Latest Posts

                      Collapse

                      Working...
                      X
                      Searching...Please wait.
                      An unexpected error was returned: 'Your submission could not be processed because you have logged in since the previous page was loaded.

                      Please push the back button and reload the previous window.'
                      An unexpected error was returned: 'Your submission could not be processed because the token has expired.

                      Please push the back button and reload the previous window.'
                      An internal error has occurred and the module cannot be displayed.
                      There are no results that meet this criteria.
                      Search Result for "|||"