Trying to change "inbox" to "new PM!" in custom navbar when user gets a message Hitskin_logo Hitskin.com

This is a Hitskin.com skin preview
Install the skinReturn to the skin page

The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.
2 posters

    Trying to change "inbox" to "new PM!" in custom navbar when user gets a message

    Kreftropod
    Kreftropod
    New Member


    Posts : 22
    Reputation : 1
    Language : English, Swedish
    Location : Sweden

    Trying to change "inbox" to "new PM!" in custom navbar when user gets a message Empty Trying to change "inbox" to "new PM!" in custom navbar when user gets a message

    Post by Kreftropod April 16th 2021, 11:21 am

    Hello again!

    I'm working on a custom navbar, and have mostly gotten it to work the way I want. However, there's one last bit I can't figure out, so here I am. Again.

    I want to change the text of (or add an icon to) the "inbox" part whenever a user gets a new PM.

    This is the full navbar code. You can see it working here: https://ryya.swedishforum.se/
    Code:
    <!-- BEGIN switch_user_logged_in -->

    <div class="topnav" id="myTopnav">
        <a href="/portal">Hem</a>
        <a href="/forum">Forum</a>
        <a href="/privmsg?folder=inbox">Inbox</a>
      <div class="dropdown">
        <button class="dropbtn">Konto
          <i class="fa fa-caret-down"></i>
        </button>
        <div class="dropdown-content hidden">
          <a href="" class="simple-profile">Profil</a>
          <a href="/profile?mode=editprofile">Inställningar</a>
          <a href="/search?search_id=watchsearch">Mina Rollspel</a>
        </div>
      </div>
        <a href="/h1-regler-samlingssida">Regler</a>
      <div class="dropdown">
        <button class="dropbtn">Om (Sida)
          <i class="fa fa-caret-down"></i>
        </button>
        <div class="dropdown-content">
          <a href="/h4-raser">Raser</a>
          <a href="https://numoori.fandom.com/wiki/Krafter_i_Numoori" target="_blank">Krafter</a>
          <a href="/h9-sprak">Språk</a>
          <a href="/h6-historia">Historia</a>
          <a href="/h7-religion">Religion</a>
          <a href="https://numoori.fandom.com/wiki/Main_Page" target="_blank">Wiki</a>
        </div>
      </div>
      <div class="dropdown">
        <button class="dropbtn">Kartor
          <i class="fa fa-caret-down"></i>
        </button>
        <div class="dropdown-content">
          <a href="/h12-lightbox-test">Områden</a>
          <a href="/h12-lightbox-test">Flockar</a>
        </div>
      </div>
      <div class="dropdown">
        <button class="dropbtn">Medlemmar
          <i class="fa fa-caret-down"></i>
        </button>
        <div class="dropdown-content">
          <a href="/memberlist">Medlemslista</a>
          <a href="/h10-dodslista">Dödslista</a>
          <a href="/h10-dodslista">Register</a>
        </div>
      </div>
      <div class="dropdown">
        <button class="dropbtn">Hjälp
          <i class="fa fa-caret-down"></i>
        </button>
        <div class="dropdown-content">
          <a href="/h13-kom-igang">Guide: Kom igång</a>
          <a href="/h17-guide-sida">Guide: Karaktärer och Rollspel</a>
          <a href="/faq">FAQ: Vanliga frågor</a>
          <a href="/search">Sök</a>
        </div>
      </div>
        <a href="{U_LOGIN_LOGOUT}">{L_LOGIN_LOGOUT}</a>
    </div>

    <!-- END switch_user_logged_in -->

    <!-- BEGIN switch_user_logged_out -->

    <div class="topnav" id="myTopnav">
        <a href="/portal">Hem</a>
        <a href="/forum">Forum</a>
        <a href="/h1-regler-samlingssida">Regler</a>
      <div class="dropdown">
        <button class="dropbtn">Om (Sida)
          <i class="fa fa-caret-down"></i>
        </button>
        <div class="dropdown-content">
          <a href="/h4-raser">Raser</a>
          <a href="https://numoori.fandom.com/wiki/Krafter_i_Numoori" target="_blank">Krafter</a>
          <a href="/h9-sprak">Språk</a>
          <a href="/h6-historia">Historia</a>
          <a href="/h7-religion">Religion</a>
          <a href="https://numoori.fandom.com/wiki/Main_Page" target="_blank">Wiki</a>
        </div>
      </div>
      <div class="dropdown">
        <button class="dropbtn">Kartor
          <i class="fa fa-caret-down"></i>
        </button>
        <div class="dropdown-content">
          <a href="/h12-lightbox-test">Områden</a>
          <a href="/h12-lightbox-test">Flockar</a>
        </div>
      </div>
      <div class="dropdown">
        <button class="dropbtn">Medlemmar
          <i class="fa fa-caret-down"></i>
        </button>
        <div class="dropdown-content">
          <a href="/memberlist">Medlemslista</a>
          <a href="/h10-dodslista">Dödslista</a>
          <a href="/h10-dodslista">Register</a>
        </div>
      </div>
      <div class="dropdown">
        <button class="dropbtn">Hjälp
          <i class="fa fa-caret-down"></i>
        </button>
        <div class="dropdown-content">
          <a href="/h13-kom-igang">Guide: Kom igång</a>
          <a href="/h17-guide-sida">Guide: Karaktärer och Rollspel</a>
          <a href="/faq">FAQ: Vanliga frågor</a>
          <a href="/search">Sök</a>
        </div>
      </div>
        <a href="{U_LOGIN_LOGOUT}">{L_LOGIN_LOGOUT}</a>
    </div>

    <!-- END switch_user_logged_out -->

    I want this part:
    Code:
    <a href="/privmsg?folder=inbox">Inbox</a>
    to either change to "New PM!", or have an icon added above it to notify users that they've gotten a new message.

    I've managed to find that the global phpbb variable { S_NEW_PM } should return "true" if there's a new message. However, I don't know how to translate that into code that does anything.

    After a lot of googling the other day, I tried adding an if/else like this:
    Code:
    <!-- IF S_NEW_PM -->
    X
    <!-- ELSE -->
    Y
    <!-- ENDIF -->
    but couldn't get the "overall_header" template to do anything with it, no matter what I added as X or Y.


    Any ideas on how to change "inbox" when a user gets a message?

    As always incredibly thankful for your help! :rose:


    (Edit: Sorry! I should probably have added this to "Forum Design & Appearance Help", not "Other Problems". Is it possible to move it?)
    Ape
    Ape
    Administrator
    Administrator


    Male Posts : 19325
    Reputation : 2005
    Language : fluent in dork / mumbojumbo & English haha

    Trying to change "inbox" to "new PM!" in custom navbar when user gets a message Empty Re: Trying to change "inbox" to "new PM!" in custom navbar when user gets a message

    Post by Ape April 16th 2021, 7:10 pm

    The topic was posted in the wrong section, so I have moved it to the correct section.
    Please read our forum rules: ESF General Rules



    Trying to change "inbox" to "new PM!" in custom navbar when user gets a message Left1212Trying to change "inbox" to "new PM!" in custom navbar when user gets a message Center11Trying to change "inbox" to "new PM!" in custom navbar when user gets a message Right112
    Trying to change "inbox" to "new PM!" in custom navbar when user gets a message Ape_b110
    Trying to change "inbox" to "new PM!" in custom navbar when user gets a message Ape1010
    Kreftropod
    Kreftropod
    New Member


    Posts : 22
    Reputation : 1
    Language : English, Swedish
    Location : Sweden

    Trying to change "inbox" to "new PM!" in custom navbar when user gets a message Empty Re: Trying to change "inbox" to "new PM!" in custom navbar when user gets a message

    Post by Kreftropod April 16th 2021, 7:22 pm

    Thanks for moving it! Very Happy

    Ape likes this post

    Ape
    Ape
    Administrator
    Administrator


    Male Posts : 19325
    Reputation : 2005
    Language : fluent in dork / mumbojumbo & English haha

    Trying to change "inbox" to "new PM!" in custom navbar when user gets a message Empty Re: Trying to change "inbox" to "new PM!" in custom navbar when user gets a message

    Post by Ape April 16th 2021, 7:25 pm

    Do you mean this part here ?
    Trying to change "inbox" to "new PM!" in custom navbar when user gets a message Captu343



    Trying to change "inbox" to "new PM!" in custom navbar when user gets a message Left1212Trying to change "inbox" to "new PM!" in custom navbar when user gets a message Center11Trying to change "inbox" to "new PM!" in custom navbar when user gets a message Right112
    Trying to change "inbox" to "new PM!" in custom navbar when user gets a message Ape_b110
    Trying to change "inbox" to "new PM!" in custom navbar when user gets a message Ape1010
    Kreftropod
    Kreftropod
    New Member


    Posts : 22
    Reputation : 1
    Language : English, Swedish
    Location : Sweden

    Trying to change "inbox" to "new PM!" in custom navbar when user gets a message Empty Re: Trying to change "inbox" to "new PM!" in custom navbar when user gets a message

    Post by Kreftropod April 16th 2021, 8:01 pm

    It's the "Inbox" part of the navbar, at the top of the forum, that I'm trying to change when there's a new message. This part here:
    Trying to change "inbox" to "new PM!" in custom navbar when user gets a message Unknown
    Larger image


    So that when a user gets a message the text changes from "inbox" to "new pm", or adds an icon on top to indicate there's a message waiting.
    Ape
    Ape
    Administrator
    Administrator


    Male Posts : 19325
    Reputation : 2005
    Language : fluent in dork / mumbojumbo & English haha

    Trying to change "inbox" to "new PM!" in custom navbar when user gets a message Empty Re: Trying to change "inbox" to "new PM!" in custom navbar when user gets a message

    Post by Ape April 16th 2021, 11:06 pm

    oh right most forums have that has Messages Not inbox on the toolbar / Navbar

    I don't think it can be changed in the templates as it would need to change when you get a PM or unread PM and the only way to do this would to make a image but it would not count the number of PM's with a image.



    Trying to change "inbox" to "new PM!" in custom navbar when user gets a message Left1212Trying to change "inbox" to "new PM!" in custom navbar when user gets a message Center11Trying to change "inbox" to "new PM!" in custom navbar when user gets a message Right112
    Trying to change "inbox" to "new PM!" in custom navbar when user gets a message Ape_b110
    Trying to change "inbox" to "new PM!" in custom navbar when user gets a message Ape1010
    Kreftropod
    Kreftropod
    New Member


    Posts : 22
    Reputation : 1
    Language : English, Swedish
    Location : Sweden

    Trying to change "inbox" to "new PM!" in custom navbar when user gets a message Empty Re: Trying to change "inbox" to "new PM!" in custom navbar when user gets a message

    Post by Kreftropod April 26th 2021, 3:38 pm

    I'm a little late to reply, thanks for being patient.
    I know that it's possible to change the image with the regular/standard navbar.

    I've made a custom one (code in my first post) so it doesn't use the standard navbar or images. I've managed to add dropdowns, and got help a little while back with adding a link to users simple profile (here). Stuff that the standard navbar doesn't include or can't do, so that's why I'm working on a custom one.

    There are phpbb variables which return true if there's a new PM, such as the previously mentioned { S_NEW_PM }, or that count how many new messages a user has, { S_USER_NEW_PRIVMSG }. These variables need to get that information somewhere, so I'm thinking it should be possible to make something that uses that same, sorry I forget the words, English isn't my first language, the same source? Function? That, when there's a new PM, changes a bit of custom text to something else. But I don't know How to do that. I've been looking at different java- and php-scripts, but I have no coding education, and don't really understand any of it, so here I am haha
    Ape
    Ape
    Administrator
    Administrator


    Male Posts : 19325
    Reputation : 2005
    Language : fluent in dork / mumbojumbo & English haha

    Trying to change "inbox" to "new PM!" in custom navbar when user gets a message Empty Re: Trying to change "inbox" to "new PM!" in custom navbar when user gets a message

    Post by Ape April 26th 2021, 6:14 pm

    The problem is most of that data is saved server side and it can't be changed that easy and any change made server side would change this for everyone who has a forum in your Language.

    Using JavaScripts to change this will only slow your forum down if you have a lot of them running in the background.



    Trying to change "inbox" to "new PM!" in custom navbar when user gets a message Left1212Trying to change "inbox" to "new PM!" in custom navbar when user gets a message Center11Trying to change "inbox" to "new PM!" in custom navbar when user gets a message Right112
    Trying to change "inbox" to "new PM!" in custom navbar when user gets a message Ape_b110
    Trying to change "inbox" to "new PM!" in custom navbar when user gets a message Ape1010