Signature Content Height Specific Member 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.
5 posters

    Signature Content Height Specific Member

    Castiel
    Castiel
    Forumember


    Male Posts : 155
    Reputation : 0
    Language : English

    Solved Signature Content Height Specific Member

    Post by Castiel February 2nd 2019, 8:40 pm

    Hello,

    Is it possible to target the signature height of specific users on PunBB? In general we have the max-height set on 200px with the overflow on hidden, but I'd like to grant some members a bigger max-height. I know it is possible to target specific usernames etc. with a href, so I was wondering if it was possible to do something like that also for the signature max-height content of specific users.

    tl;dr Everyone has a max-height of 200px, I want to give user X and Z a max-height of 300px.

    Regards,

    Cas


    Last edited by Castiel on February 10th 2019, 5:26 am; edited 1 time in total
    Ape
    Ape
    Administrator
    Administrator


    Male Posts : 19432
    Reputation : 2010
    Language : fluent in dork / mumbojumbo & English haha

    Solved Re: Signature Content Height Specific Member

    Post by Ape February 3rd 2019, 7:12 pm

    No sadly this can not be done sorry.



    Signature Content Height Specific Member Left1212Signature Content Height Specific Member Center11Signature Content Height Specific Member Right112
    Signature Content Height Specific Member Ape_b110
    Signature Content Height Specific Member Ape1010
    Flerex
    Flerex
    New Member


    Male Posts : 13
    Reputation : 2
    Language : Galician, Spanish, English, CSS, HTML, JS, PHP

    Solved Re: Signature Content Height Specific Member

    Post by Flerex February 4th 2019, 5:46 pm

    Add the following code and enable it only on the topics:

    Code:
    document.addEventListener('DOMContentLoaded', function() {
       document.querySelectorAll('.postbody > .user .username a[href^="/u"]').forEach(el => {
          el.closest('.post').classList.add(`user-${ el.getAttribute('href').match(/\d+/)[0] }`);
       });
    });

    Now you can target a specific's users topic by using selectors like
    Code:
    .post.user-USERID
    .

    Note: The previous code won't work if your templates are heavily modified. If that's the case, please modify the code to fit your template's special needs.

    As an example, let's assume we own this forum and that we want to target my topics specifically. We are also going to assume that this forum has the FM's punBB version. First, we would go to my profile so we can find what my ID is. My profile's URL is the following:

    Code:
    https://help.forumotion.com/u91789

    From that we can infer that my ID is
    Code:
    91789
    . Now we can target my posts' signatures by using the following selector:

    Code:
    .post.user-91789 .sig-content {
       /* do something to the signatures */
    }
    Castiel
    Castiel
    Forumember


    Male Posts : 155
    Reputation : 0
    Language : English

    Solved Re: Signature Content Height Specific Member

    Post by Castiel February 6th 2019, 3:46 pm

    Thanks for the response. I have added the code and enabled it in topics only. I have tried it out, but it doesn't work. The CSS I am using for all members is:

    .pun .sig-content {
    max-height: 200px;
    overflow: hidden;
    }

    Now I've added the following CSS which you provided to test out whether the signature of a single user could be extended:

    .post.user-1 .pun .sig-content {
    max-height: 400px;
    overflow: hidden;
    }

    Unfortunately, it stays at 200px. Could you perhaps tell me where I messed up? The templates are not really altered so I don't think the issue lies there.
    Flerex
    Flerex
    New Member


    Male Posts : 13
    Reputation : 2
    Language : Galician, Spanish, English, CSS, HTML, JS, PHP

    Solved Re: Signature Content Height Specific Member

    Post by Flerex February 6th 2019, 4:08 pm

    Class
    Code:
    .pun
    references the container of the whole forum (like
    Code:
    #wrap
    in FM's phpBB3). Posts are inside
    Code:
    .pun
    so you would have to put it first, like this:

    Code:
    .pun .post.user-1 .sig-content

    But, it's not necessary at all. As said in my previous answer, you only need the following:

    Code:
    .post.user-1 .sig-content

    If you still have trouble getting it to work I will need your forum's URL or I won't be able to help you.
    Castiel
    Castiel
    Forumember


    Male Posts : 155
    Reputation : 0
    Language : English

    Solved Re: Signature Content Height Specific Member

    Post by Castiel February 6th 2019, 11:28 pm

    Here you go, a topic in which it can be seen http://www.fairytailrp.com/t51052-testing#435571

    I added this to the CSS to test it out
    Code:
    .post.user-24283 .sig-content {
      max-height: 600px;
      overflow: hidden;
    }
    But the height is still 200px.
    Flerex
    Flerex
    New Member


    Male Posts : 13
    Reputation : 2
    Language : Galician, Spanish, English, CSS, HTML, JS, PHP

    Solved Re: Signature Content Height Specific Member

    Post by Flerex February 7th 2019, 1:01 am

    The code relies on the profile links to work correctly, thus, profiles need to be enabled if you want guests to be able to see the difference. As I am a guest in your forum, I cannot see the code working (because it can't). You need to go to
    Code:
    AP → Users & Groups → Special Rights → Special Rights
    and set the “View the profile” setting to “Guests”.
    Castiel
    Castiel
    Forumember


    Male Posts : 155
    Reputation : 0
    Language : English

    Solved Re: Signature Content Height Specific Member

    Post by Castiel February 7th 2019, 10:20 pm

    I've changed it to guests, but it still cuts off the signature at 200px.
    Flerex
    Flerex
    New Member


    Male Posts : 13
    Reputation : 2
    Language : Galician, Spanish, English, CSS, HTML, JS, PHP

    Solved Re: Signature Content Height Specific Member

    Post by Flerex February 7th 2019, 10:41 pm

    Yep, I'm afraid the problem is what I said in the note, if you have your templates edited you will have to modify the code accordingly.

    Here's what you should be using for your specific case:

    Code:
    document.addEventListener('DOMContentLoaded', function() {
       document.querySelectorAll('.cabezal .author a[href^="/u"]').forEach(el => {
          el.closest('.post').classList.add(`user-${ el.getAttribute('href').match(/\d+/)[0] }`);
       });
    });
    SLGray
    SLGray
    Administrator
    Administrator


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

    Solved Re: Signature Content Height Specific Member

    Post by SLGray February 7th 2019, 10:42 pm

    Please use the code tags when posting codes.



    Signature Content Height Specific Member Slgray10

    When your topic has been solved, ensure you mark the topic solved.
    Never post your email in public.
    Castiel
    Castiel
    Forumember


    Male Posts : 155
    Reputation : 0
    Language : English

    Solved Re: Signature Content Height Specific Member

    Post by Castiel February 10th 2019, 5:26 am

    Thanks, solved!
    Draxion
    Draxion
    Helper
    Helper


    Male Posts : 2518
    Reputation : 321
    Language : English
    Location : USA

    Solved Re: Signature Content Height Specific Member

    Post by Draxion February 10th 2019, 6:30 am

    Problem solved & topic archived.
    Please read our forum rules: ESF General Rules