BuddyDev

Search

[Resolved] Need to set default BuddyPress avatar based on member type; please help!!

  • Participant
    Level: Initiated
    Posts: 12
    J W on #19057

    OH I think it works now….!! I am cautiously optimistic, as I’ll continue to check for bugs, but….OH MY GOODNESS, for now? It looks like it works!!

    I’m SO HAPPY!!!!! <3

    Thank you, Brajesh…this seems to be the solution I’ve been searching for. Many thanks and blessings to you! <3 <3 <3

    I’ll let you know if I find anything that isn’t working. I’ll also restore my site to an earlier version just in case there are any issues with it going wonky earlier that are hanging around. And I’ll reinstall the Member Type Generator plugin and re-upload the bp-custom file again.

    And if there are any issues that arise on the clean re-install, I’ll let you know! 😀

    Thank you, so very much. I’m very pleased.

    I hope you have a great day, Brajesh! 😀

  • Keymaster
    (BuddyDev Team)
    Posts: 24149
    Brajesh Singh on #19058

    Thank you.

    I am glad it is working 🙂
    Sure, if there is any issue future, Please do let me know.

    Have a great day to you too.

    Best Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 12
    J W on #19166

    oh hey Brajesh — sorry to ask another question, but how would you write code for more than two types plus an unknown type…? i want to have about 10 different member types plus an unknown type.

    so would i just duplicate the ‘elseif’ line for each new member type — use that line as written as a standard for every new type i add? or is there something i need to add that isn’t expressed here?

    also, because i have no idea if this is significant, but in the coding example, there’s a space between == and the word “male” but not between == and the word “female”…is that anything that matters, or is it insignificant?

    here’s what i’m talking about…from the example:

     
        if ( $type == 'male' ) {
            $avatar = 'https://sitenameprivate.com/wp-content/uploads/2018/11/male.png';// get_template_directory_uri() . 'male.png';
        } elseif( $type =='female' ) {
    
    

    thanks again for all your assistance!! this plugin is a true miracle for me. thank you once again for creating it. <3

    • This reply was modified 5 years, 3 months ago by J W.
  • Keymaster
    (BuddyDev Team)
    Posts: 24149
    Brajesh Singh on #19179

    Hi,
    Yes, you should duplicate the elseif as many times as you need them.

    About the space. It is insignificant, but keeping space will make code more readable and I recommend keeping it. I might have missed the space in one of the conditions.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 24149
    Brajesh Singh on #30748

    For anyone else looking for a solution, we released this as part of BuddyPress Member Types Pro a year ago.

    You can set default avatar/cover based on member type without touching any code.

    https://buddydev.com/plugins/buddypress-member-types-pro/

    Regards
    Brajesh

The topic ‘ [Resolved] Need to set default BuddyPress avatar based on member type; please help!!’ is closed to new replies.

This topic is: resolved