The effects of alcohol on sustanon 250 leucine for – real weight loss & bodybuilding benefits?
Custom badge name a...
 
Share:
Notifications
Clear all

[Solved] Custom badge name assistance

5 Posts
2 Users
1 Reactions
7 Views
Posts: 7
Topic starter
(@astromono)
Active Member
Joined: 3 months ago

Hello

I’m trying to customize a badge name for a user role. I created this code snippet which is supposed to change the badge name for the "S2member level3" user role  to "Fundador":

add_filter( 'wpdiscuz_user_label', function( $label, $comment ) {
if ( empty( $comment->user_id ) ) {
return $label; // guests or unknown user
}

$user = get_userdata( (int) $comment->user_id );
if ( $user instanceof WP_User && in_array( 's2member_level3', (array) $user->roles, true ) ) {
return 'Fundador';
}

return $label;
}, 10, 2 );

The problem is the badge just says "Member" and it’s not changing the color according to my settings either.

Any assistance you can provide would be greatly appreciated.

Thanks,

Luis


4 Replies
Asti
Posts: 8180
 Asti
Support
(@asti)
Illustrious Member
Joined: 8 years ago

Hi,

Please go to Dashboard > wpDiscuz > Phrases, open the Comment tab, and update the relevant phrases accordingly.


Posts: 7
Topic starter
(@astromono)
Active Member
Joined: 3 months ago

Thank you very much, Asti!

On a side note, I see that my labels for commenters get cut off after a few characters. Is there a way to make the complete label name show up?

In my case, the label should read "Miembro Fundador", but in the website below you see it gets cut off at "Miembro…"

https://www.astromono.com/gta6-atrasado-a-noviembre-2026/#comments

I was able to change the color of the label using custom CSS.

Thanks!

Luis


1 Reply
Asti
 Asti
Support
(@asti)
Joined: 8 years ago

Illustrious Member
Posts: 8180

@astromono 

In this case, you should also use custom CSS code like this: 

#wpdcom .wpd-comment .wpd-comment-label span{
   white-space: wrap;
   overflow: visible;
}

Posts: 7
Topic starter
(@astromono)
Active Member
Joined: 3 months ago

Thank you so much Asti! It now looks great!!! I’ll keep tweaking the font sizes a bit, but you can mark this topic as SOLVED! Have a great week ahead!


Share: