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.
The forum of the forums
4 posters

    Custom messages in posts based on number of likes

    كونان2000
    كونان2000
    Forumember


    Male Posts : 284
    Reputation : 120
    Language : Arabic

    Custom messages in posts based on number of likes Empty Custom messages in posts based on number of likes

    Post by ÙƒÙˆÙ†Ø§Ù†2000 September 14th 2024, 5:04 am

    Hello everyone,
    If you’re looking for a way to encourage members to interact with posts, you can use a simple code that combines JavaScript and CSS to add customized messages based on the number of likes a post receives.

    Custom messages in posts based on number of likes Ocia_a15
    ---------------------------------




    Bronze Message: Appears when a post receives between 3 and 7 likes.
    Custom messages in posts based on number of likes O8888813

    Silver Message: Appears when a post receives between 8 and 15 likes.
    Custom messages in posts based on number of likes O8888814

    Gold Message: When a member’s post receives between 16 and 70 likes, the message changes to the Gold Message. The Gold Message represents the highest level of appreciation,
    Custom messages in posts based on number of likes O8888815
    ---------------------------------------------------------------------------------



    CSS Code


    Admin Panel  Custom messages in posts based on number of likes 2924924668  Display Custom messages in posts based on number of likes 2924924668 Colors & CSS , CSS Stylesheet and paste the following code.
    Code:
    .like-Bronze {border-right: solid 5px #a34521 !important;padding: 5px;background: #cfc5c2c7;overflow: hidden;margin-top: 33px;margin-left: 7px; margin-right: 7px;}
    .like1-Bronze {position: relative;top: 7px;float: right;}
    .like2-Bronze {position: relative;top: 7px;float: left;}
    .like3-Bronze {width: fit-content;font-size: 32px;line-height: 1;text-align: center;color: #903915;text-shadow: 3px 3px 0 #fff;}
    .like-Silver {border-right: solid 5px #bababa !important;padding: 5px;background: #dfdfdf;overflow: hidden;margin-top: 33px;margin-left: 7px; margin-right: 7px;}
    .like1-Silver {position: relative;top: 7px;float: right;}
    .like2-Silver {position: relative;top: 7px;float: left;}
    .like3-Silver {width: fit-content;font-size: 32px;line-height: 1;text-align: center;color: #817e7e;text-shadow: 3px 3px 0 #fff;}
    .like-gold {border-right: solid 5px #dab275 !important;padding: 5px;background: #eed6a1;overflow: hidden;margin-top: 33px;margin-left: 7px; margin-right: 7px;}
    .like1-gold {position: relative;top: 7px;float: right;}
    .like2-gold {position: relative;top: 7px;float: left;}
    .like3-gold {width: fit-content;font-size: 32px;line-height: 1;text-align: center;color: #b17628;text-shadow: 3px 3px 0 #fff;}
    You can change the color's your self to make them fit your own forum theme.
    Don't forget to save



    JavaScript Code


    Administration panel Custom messages in posts based on number of likes 2924924668 Modules Custom messages in posts based on number of likes 2924924668 HTML & JAVASCRIPT - Javascript codes management
    and create a new script with the following settings.
    Title : as you wish
    Placement : In the topics
    Code:
    $(document).ready(function() {
     Â   var Likestopt_Likestopt = {
     Â       'phpBB2': '.postbody:first',
     Â       'phpBB3': '.postbody .content:first',
     Â       'PunBB': '.postbody:first',
     Â       'Invision': '.post-entry:first',
     Â       'ModernBB': '.postbody .content:first',
     Â       'AwesomeBB': '.post-content:first'
     Â   };
     Â   var currentServer = 'AwesomeBB';
     Â   var authorSelector = Likestopt_Likestopt[currentServer];

     Â   $(".post").each(function() {
     Â       var currentPost = $(this);
     Â       var repNbText = currentPost.find(".rep-nb:first").text();
     Â       var Likestopt = parseInt(repNbText, 10);
     Â       currentPost.find(".like-Bronze,.like-Silver,.like-gold").remove();      
     Â       var LikesHTML = '';
     Â       
     Â       if (Likestopt >= 16 && Likestopt <= 70) {
     Â           LikesHTML = '<div align="center">' +
     Â               '<div class="like-gold">' +
     Â               '<div class="like1-gold"><img width="50" height="50" src="https://i.servimg.com/u/f20/16/85/77/67/o8888812.png" /></div>' +
     Â               '<div class="like2-gold"><img width="100" height="50" src="https://i.servimg.com/u/f20/16/85/77/67/facebo10.png" /></div>' +
     Â               '<div class="like3-gold">gold Post<br />★★★★★</div>' +
     Â               '</div>' +
     Â               '</div>';
     Â       } else if (Likestopt >= 8 && Likestopt <= 15) {
     Â           LikesHTML = '<div align="center">' +
     Â               '<div class="like-Silver">' +
     Â               '<div class="like1-Silver"><img width="50" height="50" src="https://i.servimg.com/u/f20/16/85/77/67/o8888811.png" /></div>' +
     Â               '<div class="like2-Silver"><img width="100" height="50" src="https://i.servimg.com/u/f20/16/85/77/67/facebo10.png" /></div>' +
     Â               '<div class="like3-Silver">Silver Post<br />★★★</div>' +
     Â               '</div>' +
     Â               '</div>';
     Â       } else if (Likestopt >= 3 && Likestopt <= 7) {
     Â           LikesHTML = '<div align="center">' +
     Â               '<div class="like-Bronze">' +
     Â               '<div class="like1-Bronze"><img width="50" height="50" src="https://i.servimg.com/u/f20/16/85/77/67/o8888810.png" /></div>' +
     Â               '<div class="like2-Bronze"><img width="100" height="50" src="https://i.servimg.com/u/f20/16/85/77/67/facebo10.png" /></div>' +
     Â               '<div class="like3-Bronze">Bronze Post<br />★</div>' +
     Â               '</div>' +
     Â               '</div>';
     Â       }

     Â       if (LikesHTML) {
     Â           currentPost.find(authorSelector).after(LikesHTML);
     Â       }
     Â   });
    });
    Important!: To make it works you absolutely need to indicate the version of your forum
    By modifying the following part of the code
    Code:
    var currentServer = 'AwesomeBB';


    Replace
    Code:
    AwesomeBB
    with your forum version
    ---------------------------------------


    This customization is a great way to motivate members and encourage them to engage more with the content. Try out this code today and see how it enhances member interaction with your posts!, king


    hope this system will contribute to improving content quality and inspire everyone to present their best work.





    Last edited by كونان2000 on September 17th 2024, 5:34 am; edited 3 times in total

    invisible_fa, SarkZKalie, TonnyKamper, poesia-verses and Wizzard like this post

    Wizzard
    Wizzard
    Forumember


    Male Posts : 125
    Reputation : 23
    Language : English

    Custom messages in posts based on number of likes Empty Re: Custom messages in posts based on number of likes

    Post by Wizzard September 14th 2024, 8:02 am

    Great as always. Smile

    كونان2000 likes this post

    TonnyKamper
    TonnyKamper
    Active Poster


    Female Posts : 1094
    Reputation : 80
    Language : Dutch/English
    Location : DSF Admin

    Custom messages in posts based on number of likes Empty Re: Custom messages in posts based on number of likes

    Post by TonnyKamper September 14th 2024, 11:35 am

    كونان2000 likes this post

    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51554
    Reputation : 3523
    Language : English
    Location : United States

    Custom messages in posts based on number of likes Empty Re: Custom messages in posts based on number of likes

    Post by SLGray September 15th 2024, 2:57 am

    Just a reminder:  You still need to follow the rules and guidelines in this section.  That includes the global ones, too.



    Custom messages in posts based on number of likes Slgray10

    When your topic has been solved, ensure you mark the topic solved.
    Never post your email in public.
    كونان2000
    كونان2000
    Forumember


    Male Posts : 284
    Reputation : 120
    Language : Arabic

    Custom messages in posts based on number of likes Empty Re: Custom messages in posts based on number of likes

    Post by ÙƒÙˆÙ†Ø§Ù†2000 September 15th 2024, 6:04 am

    Wizzard :rose: and TonnyKamper :rose:
    Thanks to both of you. I’m glad both of you liked it. ^^


    SLGray wrote:Just a reminder:  You still need to follow the rules and guidelines in this section.  That includes the global ones, too.
    hi SLGray
    Could you please clarify what specific rules or guidelines I may have overlooked? I want to ensure that I adhere to all the requirements.

    TonnyKamper, poesia-verses and Wizzard like this post

    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51554
    Reputation : 3523
    Language : English
    Location : United States

    Custom messages in posts based on number of likes Empty Re: Custom messages in posts based on number of likes

    Post by SLGray September 16th 2024, 3:15 am

    The one that deals with font/text. like size and bold.



    Custom messages in posts based on number of likes Slgray10

    When your topic has been solved, ensure you mark the topic solved.
    Never post your email in public.
    كونان2000
    كونان2000
    Forumember


    Male Posts : 284
    Reputation : 120
    Language : Arabic

    Custom messages in posts based on number of likes Empty Re: Custom messages in posts based on number of likes

    Post by ÙƒÙˆÙ†Ø§Ù†2000 September 16th 2024, 6:02 am

    SLGray wrote:The one that deals with font/text. like size and bold.
    I think the rules here are a bit too strict,
    but my post has been edited. Very Happy

    Wizzard likes this post


      Current date/time is November 11th 2024, 8:38 pm