Adding icon to latest post by "specific rank"
#1
Hey there,

I was wondering if it was possible to add icons to specific ranks who posted on a thread?
<span class="forum-stat forum-stat--latest with-post">{$lastpost_date} </br > By {$lastpost_profilelink} </span>

this bit shows the users name
{$lastpost_profilelink}

Is there a way to check if that users is lets say an admin and then add an icon next to its name?
Now i know a fair bit of css and i know i can just add styling to:
.with-post a { } // or with an other class, etc..

but that would add the icon to every last user that posted, and I want to be able to have diffrent icons depending on their ranks.

This is the idea, but then depending on their ranks instead of hardcoded for all latest posts


Thanks in advance!

Tom van Lierop
Reply
#2
I don't believe a user's group information is available at that spot (Someone please correct me if I'm wrong). I'll provide this hackish way around it, in case you're interested. This is by no means the best solution, you'd want to use some sort of plugin to bring this information forward.

You can target these by user ID (For each staff member) and style them accordingly.

/* Admins */
.last-post a[href~=user-5435] { /* Joe */
    color: orange;
}

/* Super Mods */
.last-post a[href~=user-2543] { /* Jim */
    color: orange;
}

You can also combine it with font-awesome and use a pseudo element to place the icon there. Hope it helps and good luck. Smile
Reply
#3
Alright i will try that out!

thanks Big Grin
Reply
#4
Alright, So I tried it out and didnt have any luck with it. Sad

I do like the idea, because I am not too big of a fan using too much plugins..

But

/* post-author here is ".last-post and user-1 since my user ID is 1?" */

.post-author a[href~=user-1]:before {
/* styling */
}

my apologies for the - sign i wont show as the curled sign in the reply...


Is there anything i am doing wrong?

Looking at your post it seems the 1 isnt the right number, but i am pretty sure thats my user ID...


Thanks in advance.

kind regards

Tom.
Reply
#5
Are you using SEF urls (or ones by provided by Google SEO) ? If you are using sef urls (forumurl.com/user-1.html) try with this code

.post-author a[href*="user-1"]:before {
/* styling */
}

If you aren't using SEF urls (forumurl.com/member.php?action=profile&uid=1) then use


.post-author a[href*="uid=1"]:before {
/* styling */
}
Reply
#6
Thank you both!!

it works now Smile


Cheers,

Tom
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)