Skip to content

Custom badges

Solved Customisation
103 4 25.6k 2
  • @cagatay Do you want the icon to show? Because of the size of the screen estate, I think it makes more sense to hide it?

  • @cagatay Do you want the icon to show? Because of the size of the screen estate, I think it makes more sense to hide it?

    @phenomlab i want to hide them.

  • @phenomlab i want to hide them.

    @cagatay Add this to your custom CSS

    @media (max-width: 767px) {
         .post-header a[href*="/groups/onaylı-üyeler"] {
             display: none;
        }
    }
    
    
  • @cagatay Add this to your custom CSS

    @media (max-width: 767px) {
         .post-header a[href*="/groups/onaylı-üyeler"] {
             display: none;
        }
    }
    
    

    @phenomlab same problem here 🙂

    972c895e-6e96-480c-9a65-dda57ac1c3d3-image.png

    PS: i’m using chrome

  • @phenomlab same problem here 🙂

    972c895e-6e96-480c-9a65-dda57ac1c3d3-image.png

    PS: i’m using chrome

    @cagatay Already fixed. Thanks.

    This seems to have become an issue in the most recent update from NodeBB.

  • hi @phenomlab , I have made some updates to the CSS elements, and right now it looks like a badge with a wavy edge…

    Screen Shot 2023-05-29 at 14.25.21.png

    
    .post-header a[href*="/forum/groups/verified"] {
        margin-right: 3px;
        margin-top: 1px;
        border-radius: 50%;
        line-height: 20px;
        display: inline-block;
        vertical-align: middle;
        overflow: hidden;
        position: relative;
    }
    
    .post-header a[href*="/forum/groups/verified"]::before {
        content: "\f00c";
        position: absolute;
        z-index: 1; /* Added z-index to bring it to the front */
        width: 20px;
        height: 20px;
        background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' stroke-width='1.5' viewBox='0 0 24 24' fill='%23085EAC'%3E%3Cpath d='M10.5213 2.62368C11.3147 1.75255 12.6853 1.75255 13.4787 2.62368L14.4989 3.74391C14.8998 4.18418 15.4761 4.42288 16.071 4.39508L17.5845 4.32435C18.7614 4.26934 19.7307 5.23857 19.6757 6.41554L19.6049 7.92905C19.5771 8.52388 19.8158 9.10016 20.2561 9.50111L21.3763 10.5213C22.2475 11.3147 22.2475 12.6853 21.3763 13.4787L20.2561 14.4989C19.8158 14.8998 19.5771 15.4761 19.6049 16.071L19.6757 17.5845C19.7307 18.7614 18.7614 19.7307 17.5845 19.6757L16.071 19.6049C15.4761 19.5771 14.8998 19.8158 14.4989 20.2561L13.4787 21.3763C12.6853 22.2475 11.3147 22.2475 10.5213 21.3763L9.50111 20.2561C9.10016 19.8158 8.52388 19.5771 7.92905 19.6049L6.41553 19.6757C5.23857 19.7307 4.26934 18.7614 4.32435 17.5845L4.39508 16.071C4.42288 15.4761 4.18418 14.8998 3.74391 14.4989L2.62368 13.4787C1.75255 12.6853 1.75255 11.3147 2.62368 10.5213L3.74391 9.50111C4.18418 9.10016 4.42288 8.52388 4.39508 7.92905L4.32435 6.41553C4.26934 5.23857 5.23857 4.26934 6.41554 4.32435L7.92905 4.39508C8.52388 4.42288 9.10016 4.18418 9.50111 3.74391L10.5213 2.62368Z' stroke='none'/%3E%3C/svg%3E");
        background-size: cover;
        color: #ffffff; /* Added to set the color of the checkmark */
        font-family: "Font Awesome 5 Free";
        font-weight: 900;
        font-size:8px;
        text-align: center;
        line-height: 20px;
    }
    small.label.group-label.inline-block i {
        margin-top: 1px;
        margin-left: 0px;
        vertical-align: middle;
        justify-content: center;
        display: flex;
    }
    .post-header a[href*="/forum/groups/verified"] .group-label {
        min-width: 20px;
        display: flex;
        justify-content: center;
        background-color: transparent !important;
    }
    .group-label {
        vertical-align: -6px;
    }
    
    

    This is achieved thanks to ChatGPT… the code specifically uses this “#085EAC” color… it can of course be changed…

  • hi @phenomlab , I have made some updates to the CSS elements, and right now it looks like a badge with a wavy edge…

    Screen Shot 2023-05-29 at 14.25.21.png

    
    .post-header a[href*="/forum/groups/verified"] {
        margin-right: 3px;
        margin-top: 1px;
        border-radius: 50%;
        line-height: 20px;
        display: inline-block;
        vertical-align: middle;
        overflow: hidden;
        position: relative;
    }
    
    .post-header a[href*="/forum/groups/verified"]::before {
        content: "\f00c";
        position: absolute;
        z-index: 1; /* Added z-index to bring it to the front */
        width: 20px;
        height: 20px;
        background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' stroke-width='1.5' viewBox='0 0 24 24' fill='%23085EAC'%3E%3Cpath d='M10.5213 2.62368C11.3147 1.75255 12.6853 1.75255 13.4787 2.62368L14.4989 3.74391C14.8998 4.18418 15.4761 4.42288 16.071 4.39508L17.5845 4.32435C18.7614 4.26934 19.7307 5.23857 19.6757 6.41554L19.6049 7.92905C19.5771 8.52388 19.8158 9.10016 20.2561 9.50111L21.3763 10.5213C22.2475 11.3147 22.2475 12.6853 21.3763 13.4787L20.2561 14.4989C19.8158 14.8998 19.5771 15.4761 19.6049 16.071L19.6757 17.5845C19.7307 18.7614 18.7614 19.7307 17.5845 19.6757L16.071 19.6049C15.4761 19.5771 14.8998 19.8158 14.4989 20.2561L13.4787 21.3763C12.6853 22.2475 11.3147 22.2475 10.5213 21.3763L9.50111 20.2561C9.10016 19.8158 8.52388 19.5771 7.92905 19.6049L6.41553 19.6757C5.23857 19.7307 4.26934 18.7614 4.32435 17.5845L4.39508 16.071C4.42288 15.4761 4.18418 14.8998 3.74391 14.4989L2.62368 13.4787C1.75255 12.6853 1.75255 11.3147 2.62368 10.5213L3.74391 9.50111C4.18418 9.10016 4.42288 8.52388 4.39508 7.92905L4.32435 6.41553C4.26934 5.23857 5.23857 4.26934 6.41554 4.32435L7.92905 4.39508C8.52388 4.42288 9.10016 4.18418 9.50111 3.74391L10.5213 2.62368Z' stroke='none'/%3E%3C/svg%3E");
        background-size: cover;
        color: #ffffff; /* Added to set the color of the checkmark */
        font-family: "Font Awesome 5 Free";
        font-weight: 900;
        font-size:8px;
        text-align: center;
        line-height: 20px;
    }
    small.label.group-label.inline-block i {
        margin-top: 1px;
        margin-left: 0px;
        vertical-align: middle;
        justify-content: center;
        display: flex;
    }
    .post-header a[href*="/forum/groups/verified"] .group-label {
        min-width: 20px;
        display: flex;
        justify-content: center;
        background-color: transparent !important;
    }
    .group-label {
        vertical-align: -6px;
    }
    
    

    This is achieved thanks to ChatGPT… the code specifically uses this “#085EAC” color… it can of course be changed…

    @crazycells oooohhhhh - I like!!!

  • @crazycells oooohhhhh - I like!!!

    @phenomlab I had to ask ChatGPT 30 times to get this 😄

    the codes will be more clear to you than to me 🙂 but I had to add a “transparent” background color, so that svg can be created with the color you want. otherwise svg is not visible.

    I had to remove “text-align” because it is ruining the position of the badge.

    And lastly, although there is a checkmark, unfortunately, it stays behind the SVG, so it had to add a checkmark using CSS codes to make it visible and changed its position using z-index. (or something like this 😄 )

  • @phenomlab I had to ask ChatGPT 30 times to get this 😄

    the codes will be more clear to you than to me 🙂 but I had to add a “transparent” background color, so that svg can be created with the color you want. otherwise svg is not visible.

    I had to remove “text-align” because it is ruining the position of the badge.

    And lastly, although there is a checkmark, unfortunately, it stays behind the SVG, so it had to add a checkmark using CSS codes to make it visible and changed its position using z-index. (or something like this 😄 )

    @crazycells it’s a lot of effort, but I really like the effect. I’m just wondering if it’s easier to use an actual image?

  • @crazycells oooohhhhh - I like!!!

    @phenomlab said in Custom badges:

    @crazycells oooohhhhh - I like!!!

    that background URL is universal, right? I mean it will always be available and not be deleted?

    I used this page to get that: https://fontawesomeicons.com/svg/icons/twitter-verified-badge#ex-tab1

  • @phenomlab said in Custom badges:

    @crazycells oooohhhhh - I like!!!

    that background URL is universal, right? I mean it will always be available and not be deleted?

    I used this page to get that: https://fontawesomeicons.com/svg/icons/twitter-verified-badge#ex-tab1

    @crazycells said in Custom badges:

    that background URL is universal, right? I mean it will always be available and not be deleted?

    Yes, correct.

  • @crazycells it’s a lot of effort, but I really like the effect. I’m just wondering if it’s easier to use an actual image?

    @phenomlab I prefer this way, because I would like to change the color of it depending on profession. In our forum, I am not planning to use it for “email verified” users, it will mainly be used for professional users that we host. I can easily edit this depending on the groups.

  • @phenomlab I prefer this way, because I would like to change the color of it depending on profession. In our forum, I am not planning to use it for “email verified” users, it will mainly be used for professional users that we host. I can easily edit this depending on the groups.

    @crazycells That makes sense.

  • good job @crazycells

    I wonder if we could do it for each badge without changing the color of course and keep the color of the original badges.

    Curious to see what it would look like 😉

  • good job @crazycells

    I wonder if we could do it for each badge without changing the color of course and keep the color of the original badges.

    Curious to see what it would look like 😉

    @DownPW said in Custom badges:

    good job @crazycells

    I wonder if we could do it for each badge without changing the color of course and keep the color of the original badges.

    Curious to see what it would look like 😉

    no, this does not work. the overlap of a wavy edge circle and a circle becomes a circle. so, you cannot detect any flower shape with this method. The way that I achieved this was by removing the background color (making it transparent by CSS although there is an assigned color for it in ACP) and then creating a new flower shape on top of it by CSS.

  • @DownPW said in Custom badges:

    good job @crazycells

    I wonder if we could do it for each badge without changing the color of course and keep the color of the original badges.

    Curious to see what it would look like 😉

    no, this does not work. the overlap of a wavy edge circle and a circle becomes a circle. so, you cannot detect any flower shape with this method. The way that I achieved this was by removing the background color (making it transparent by CSS although there is an assigned color for it in ACP) and then creating a new flower shape on top of it by CSS.

    @crazycells just thinking about this. Wouldn’t it be easier to just use font awesome?

    https://fontawesome.com/icons/badge-check?f=classic&s=solid

    Screenshot_2023-05-29-23-46-30-51_e4424258c8b8649f6e67d283a50a2cbc.jpg

  • @crazycells just thinking about this. Wouldn’t it be easier to just use font awesome?

    https://fontawesome.com/icons/badge-check?f=classic&s=solid

    Screenshot_2023-05-29-23-46-30-51_e4424258c8b8649f6e67d283a50a2cbc.jpg

    @phenomlab said in Custom badges:

    @crazycells just thinking about this. Wouldn’t it be easier to just use font awesome?

    https://fontawesome.com/icons/badge-check?f=classic&s=solid

    Screenshot_2023-05-29-23-46-30-51_e4424258c8b8649f6e67d283a50a2cbc.jpg

    as far as I remember, we discussed this before and you mentioned that that badge is not in the free tier.

  • @phenomlab said in Custom badges:

    @crazycells just thinking about this. Wouldn’t it be easier to just use font awesome?

    https://fontawesome.com/icons/badge-check?f=classic&s=solid

    Screenshot_2023-05-29-23-46-30-51_e4424258c8b8649f6e67d283a50a2cbc.jpg

    as far as I remember, we discussed this before and you mentioned that that badge is not in the free tier.

  • @phenomlab said in Custom badges:

    @crazycells just thinking about this. Wouldn’t it be easier to just use font awesome?

    https://fontawesome.com/icons/badge-check?f=classic&s=solid

    Screenshot_2023-05-29-23-46-30-51_e4424258c8b8649f6e67d283a50a2cbc.jpg

    as far as I remember, we discussed this before and you mentioned that that badge is not in the free tier.

    @crazycells This intrigued me somewhat, I won’t lie 🙂 I decided to take a stab at this myself.

    HTML

    <!DOCTYPE html>
    <html>
    <head>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/js/all.min.js" integrity="sha512-fD9DI5bZwQxOi7MhYWnnNPlvXdp/2Pj3XSTRrFs5FQa4mizyGLnJcN6tuvUS6LbmgN1ut+XGSABKvjN0H6Aoow==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" integrity="sha512-iecdLmaskl7CVkqkXNQ/ZH/XLlvWZOJyj7Yy7tcenmpD1ypASozpmT/E0iPtmFIB46ZmdtAc9eNBvH0H/ZpiBw==" crossorigin="anonymous" referrerpolicy="no-referrer" />
    <meta charset=utf-8 />
    <title>JS Bin</title>
    </head>
    <body>
      <div class="base"></div>
      <div class="inner"><i class="check fa-solid fa-check"></i></div>
    </body>
    </html>
    

    CSS

    .base {
      left: 100px;
      top: 100px;
      height: 80px;
      width: 80px;
      background: #067acc;
      position: absolute;
      border-radius: 10px;
    }
    .base:before {
      height: 80px;
      width: 80px;
      background: #067acc;
      content:"";
      position: absolute;
      transform: rotate(-30deg);
      border-radius: 10px;
    }
    .base:after {
      padding-top: 10px;
      text-align: center;
      vertical-align: middle;
      height: 70px;
      width: 80px;
      background: #067acc;
      content: "";
      position: absolute;
      transform: rotate(30deg);
      border-radius: 10px;
    }
    .inner {
      color: #000000;
      left: 95px;
      top: 95px;
      position: absolute;
      text-align:center;
      padding-top: 25px;
      width: 90px;
      height: 65px;
      background: #067acc;
      border-radius: 50px;
      background: #067acc; /* Old browsers */
    }
    .check {
      font-size: 36px;
      color: #ffffff;
    }
    

    Here’s the result

    https://codepen.io/sudonix/pen/qBJGMRL

  • @crazycells This intrigued me somewhat, I won’t lie 🙂 I decided to take a stab at this myself.

    HTML

    <!DOCTYPE html>
    <html>
    <head>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/js/all.min.js" integrity="sha512-fD9DI5bZwQxOi7MhYWnnNPlvXdp/2Pj3XSTRrFs5FQa4mizyGLnJcN6tuvUS6LbmgN1ut+XGSABKvjN0H6Aoow==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" integrity="sha512-iecdLmaskl7CVkqkXNQ/ZH/XLlvWZOJyj7Yy7tcenmpD1ypASozpmT/E0iPtmFIB46ZmdtAc9eNBvH0H/ZpiBw==" crossorigin="anonymous" referrerpolicy="no-referrer" />
    <meta charset=utf-8 />
    <title>JS Bin</title>
    </head>
    <body>
      <div class="base"></div>
      <div class="inner"><i class="check fa-solid fa-check"></i></div>
    </body>
    </html>
    

    CSS

    .base {
      left: 100px;
      top: 100px;
      height: 80px;
      width: 80px;
      background: #067acc;
      position: absolute;
      border-radius: 10px;
    }
    .base:before {
      height: 80px;
      width: 80px;
      background: #067acc;
      content:"";
      position: absolute;
      transform: rotate(-30deg);
      border-radius: 10px;
    }
    .base:after {
      padding-top: 10px;
      text-align: center;
      vertical-align: middle;
      height: 70px;
      width: 80px;
      background: #067acc;
      content: "";
      position: absolute;
      transform: rotate(30deg);
      border-radius: 10px;
    }
    .inner {
      color: #000000;
      left: 95px;
      top: 95px;
      position: absolute;
      text-align:center;
      padding-top: 25px;
      width: 90px;
      height: 65px;
      background: #067acc;
      border-radius: 50px;
      background: #067acc; /* Old browsers */
    }
    .check {
      font-size: 36px;
      color: #ffffff;
    }
    

    Here’s the result

    https://codepen.io/sudonix/pen/qBJGMRL

    @phenomlab is there a problem in the forum?

    Screen Shot 2023-05-30 at 11.30.13.png

    I refreshed several times, nothing changed…


Did this solution help you?
Did you find the suggested solution useful? Support 💗 Sudonix with a coffee
If your organisation needs deeper expertise around infrastructure, security, or technology leadership, learn more about Phenomlab Ltd. Many of the deeper technical guides behind Sudonix are published there.

Related Topics
  • Custom Page - nodebb

    Solved Customisation custom-pages nodebb
    13
    2
    5 Votes
    13 Posts
    139 Views
    I’m happy to see this
  • nodebb-plugin-custom-pages

    Solved Customisation plugin custom-pages
    5
    2
    3 Votes
    5 Posts
    3k Views
    @DownPW it’s possible, yes, but you may inadvertently end up targeting other elements using the same class which of course isn’t desired. Can you provide a link in DM for me to review?
  • Interesting Widget code, but can't fetch API

    Solved Customisation nodebb
    26
    2 Votes
    26 Posts
    6k Views
    @Panda said in Interesting Widget code, but can’t fetch API: How did you drop that widget into the post there? I hadnt seen this BSgenerator anywhere on sudonix site, do you use it somewhere already? Yes, here https://sudonix.org/topic/414/corporate-bullshit-generator?_=1687774393044 It’s not a “post” or “topic” in the common sense. It is actually a page in it’s own right and leverages nodebb-plugin-custom-pages. This in turn creates a new “route” which behaves like a page, meaning it is then exposed for widgets. @Panda said in Interesting Widget code, but can’t fetch API: Also can you explain more what you mean by calling the code externally. In my API call example, how would I go about doing that? By this, I mean create all the required code in an external JS file that is reachable by the NodeBB instance - so, in “public” for example - or in my case /public/js. The widget then “calls” that file and because it runs outside of the scope of NodeBB, you just need to return the values to the widget. Hope this makes sense?
  • Further Widgets question

    Solved Configure nodebb
    4
    1
    1 Votes
    4 Posts
    835 Views
    @Panda category is for a category in its own, so for example, “fruit” whereas categories is the page that contains all categories as a list.
  • 14 Votes
    69 Posts
    28k Views
    @phenomlab Seems to be better with some scaling fix for redis on redis.conf. I haven’t seen the message yet since the changes I made # I increase it to the value of /proc/sys/net/core/somaxconn tcp-backlog 4096 # I'm uncommenting because it can slow down Redis. Uncommented by default !!!!!!!!!!!!!!!!!!! #save 900 1 #save 300 10 #save 60 10000 If you have other Redis optimizations. I take all your advice https://severalnines.com/blog/performance-tuning-redis/
  • The best css to customize our logo?

    Solved Customisation css
    2
    1 Votes
    2 Posts
    1k Views
    @Sala This should look better .sidenav .navbar-brand { padding-top: 0.5rem; padding-bottom: 0.5rem; } [image: 1669026666905-e5cec20e-be36-4ee8-9129-fd11ad4656ac-image.png] You can increase the top and bottom padding by increasing the values above.
  • [NODEBB] Help for my custom CSS

    Solved Customisation nodebb css bugfix
    237
    49 Votes
    237 Posts
    80k Views
    @baris said: You should change your selectors so it doesn’t look at the entire document. You probably only want to apply fancybox to stuff inside the #content element which is what changes when the user navigates around the page. So use $('#content a').... for your selectors then the forum logo in the header won’t be selected. I modified the JS Fancybox code now and this code and it seem better // --------------------------------------------- // Fancybox Media Reader (Without Website Logo) // --------------------------------------------- if (top.location.pathname !== '/login') { $(window).on('action:posts.loaded', function(data) { console.log("Polling DOM for lazyLoaded images to apply Fancybox"); $(document).ready(function() { $('#content a').not('.forum-logo').not(".avatar").not(".emoji").not(".bmac-noanimate").each(function() { $('#content a[href*=".jpg"], #content a[href*=".jpeg"], #content a[href*=".png"], #content a[href*=".gif"], #content a[href*=".webp"]').addClass("noanimate"); }); }); }); } if (top.location.pathname !== '/login') { $(document).ready(function() { $(window).on('action:ajaxify.end', function(data) { $('#content a').not('.logo').not(".avatar").not(".emoji").not(".bmac-noanimate").each(function() { $('#content a[href*=".jpg"], #content a[href*=".jpeg"], #content a[href*=".png"], #content a[href*=".gif"], #content a[href*=".webp"]').addClass("noanimate"); data.preventDefault() // Strip out the images contained inside blockquotes as this looks nasty :) $('#content blockquote img').remove(); }); Fancybox.bind( '#content a[href*=".jpg"], #content a[href*=".jpeg"], #content a[href*=".png"], #content a[href*=".gif"], #content a[href*=".webp"]', { groupAll: true, } ); }); }); } // Chat fancybox - fires when chat module loaded and AJAX calls new chat $(document).ready(function() { $(window).on('action:chat.loaded', function(data) { // >>> Se limiter au contenu principal uniquement <<< $('#content img').not('.forum-logo').not(".avatar").not(".emoji").not(".bmac-noanimate").each(function() { var newHref = $(this).attr("src"); $(this).wrap("<a class='fancybox' href='" + newHref + "'/>"); $('#content a[href*=".jpg"], #content a[href*=".jpeg"], #content a[href*=".png"], #content a[href*=".gif"], #content a[href*=".webp"]').addClass("noanimate"); data.preventDefault(); // Strip out the images contained inside blockquotes as this looks nasty :) $('#content blockquote img').remove(); }); Fancybox.bind( '#content a[href*=".jpg"], #content a[href*=".jpeg"], #content a[href*=".png"], #content a[href*=".gif"], #content a[href*=".webp"]', { groupAll: true, } ); }); }); For the logo, I must use overflow: visible !important; on [component="brand/logo"] /* --- Logo --- */ [component="brand/logo"] { max-height: 50px; width: auto; height: auto; max-width: 100%; display: block; object-fit: contain; object-position: left center; overflow: visible !important; } Better result !!
  • [NodeBB] Import custom Font

    Solved Customisation custom fonts nodebb css
    12
    3 Votes
    12 Posts
    3k Views
    @cagatay you’ll need to define this in the body tag (or another element if you want greater or more granular targets) - for example body { font-family: "Poppins"; font-size: 16px; } Essentially, you use the font-size CSS directive.