Signature Content Height Specific Member

Go down

Solved Signature Content Height Specific Member

Post by Castiel on 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
Castiel
Castiel
Forumember

Male Posts : 149
Reputation : 0
Language : English

Back to top Go down

Solved Re: Signature Content Height Specific Member

Post by APE on 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
APE
APE
Administrator
Administrator

Male Posts : 14521
Reputation : 1585
Language : fluent in dork / mumbojumbo & English haha

http://chatworld.forumotion.co.uk/

Back to top Go down

Solved Re: Signature Content Height Specific Member

Post by Flerex on 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 */
}
Flerex
Flerex
New Member

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

Back to top Go down

Solved Re: Signature Content Height Specific Member

Post by Castiel on 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.
Castiel
Castiel
Forumember

Male Posts : 149
Reputation : 0
Language : English

Back to top Go down

Solved Re: Signature Content Height Specific Member

Post by Flerex on 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.
Flerex
Flerex
New Member

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

Back to top Go down

Solved Re: Signature Content Height Specific Member

Post by Castiel on 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.
Castiel
Castiel
Forumember

Male Posts : 149
Reputation : 0
Language : English

Back to top Go down

Solved Re: Signature Content Height Specific Member

Post by Flerex on 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”.
Flerex
Flerex
New Member

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

Back to top Go down

Solved Re: Signature Content Height Specific Member

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

I've changed it to guests, but it still cuts off the signature at 200px.
Castiel
Castiel
Forumember

Male Posts : 149
Reputation : 0
Language : English

Back to top Go down

Solved Re: Signature Content Height Specific Member

Post by Flerex on 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] }`);
   });
});
Flerex
Flerex
New Member

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

Back to top Go down

Solved Re: Signature Content Height Specific Member

Post by SLGray on 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.
SLGray
SLGray
Administrator
Administrator

Male Posts : 45897
Reputation : 3239
Language : English
Location : United States

https://help.forumotion.com/

Back to top Go down

Solved Re: Signature Content Height Specific Member

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

Thanks, solved!
Castiel
Castiel
Forumember

Male Posts : 149
Reputation : 0
Language : English

Back to top Go down

Solved Re: Signature Content Height Specific Member

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

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


NEVER provide your founder's account or email
Please provide forum's URL when dealing with design and appearance issues
Don't forget to mark the topic as Signature Content Height Specific Member Solved11 when the issue is resolved. This helps the staff greatly.
PM Support is prohibited!
TOS | General Rules | FAQ | Tricks & Tips | Latest Updates | Introduce Yourself

Signature Content Height Specific Member Draxio14
Draxion
Draxion
Support Moderator
Support Moderator

Male Posts : 2327
Reputation : 298
Language : English
Location : USA

http://www.draxionsgameden.com/

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum