Skip to:

How to assign custom user avatar based on groups_is_user_member

  • Profile photo of joshkadis


    I’m working on a site where each user will be randomly joined to one of two existing groups during registration. Let’s call the groups Red Team and Blue Team. I’d like to create a default avatar for each group instead of the Mystery Man, so Red Team members get the red avatar and Blue Team members get the blue avatar. If it permanently sets the avatar for each user (i.e. can’t be overwritten by Gravatar), that’s ok with me.

    So I’m trying to figure out where to put a statement along the lines of:

    `if (groups_is_user_member($user_id,$red_team_id)) {
    [set avatar to red-team-avatar.jpg]
    } else {
    [set avatar to blue-team-avatar.jpg]

    Note that every user will be a member of one team or the other, but not both. Any ideas? Thanks!

  • The topic ‘How to assign custom user avatar based on groups_is_user_member’ is closed to new replies.
Skip to toolbar