Skip to:
Content
Pages
Categories
Search
Top
Bottom

Conditional Avatars

  • @inhouse

    Member

    Hello, how can I get rid of the mystery man option for member profiles. I’d like avatars to display only if the user has uploaded one. If not, there should be nothing. No mystery man, no Gravatar, etc. Currently I have it set up so no Gravatars are used but I can’t get rid of the mystery man. I even changed mystery-man.jpg to a 1px jpg but the inline styling stretches it to size.

    Is there a way to modify the code in “member-header.php” so that the avatar only shows if they have one uploaded?

Viewing 5 replies - 1 through 5 (of 5 total)
  • @inhouse

    Member

    Is there a filter I can add to bp-customs.php that will skip the mystery man?
    `add_filter( ‘bp_core_default_avatar_no_grav’, ‘__return_true’ );`

    I’m already using the one that skips the Gravatar.
    `add_filter( ‘bp_core_fetch_avatar_no_grav’, ‘__return_true’ );`

    Any ideas? My last resort would be to hack bp-core-avatars.php but I don’t want to do anything preventing upgrading of course.

    @inhouse

    Member

    `define ( ‘BP_AVATAR_DEFAULT’, BP_PLUGIN_URL . ” );`

    This doesn’t seem to work in bp-custom.php either. I thought for sure I had a solution. I tried to alter the path of the default avatar to be used in hopes of using a 1px invisible image but this doesn’t seem to work.

    I also tried to set the width of the default avatar to no avail.
    `define ( ‘BP_AVATAR_DEFAULT_WIDTH’, 1 );`

    Could I assign a custom class to the mystery man so I can hide with CSS? Currently there is only a user ID assigned and nothing specific to mystery man. Anyone able to help with that?

    @inhouse

    Member

    Ha, I can’t even hack bp-core-avatars.php correctly. I thought I could just remove the default avatar check but that’s not working either. All I can manage to do is break the URL which of course looks ugly and is not ideal. I imagine adding a class to the default mystery man image would be easy for some. Would anyone mind lending a hand? I fail.

    @r-a-y

    Keymaster

    Since you’re using:
    `add_filter( ‘bp_core_fetch_avatar_no_grav’, ‘__return_true’ );`

    You can also define your mystery man image with:
    http://pastebin.com/AST92STz

    For LINKTOYOURIMAGE.gif, try making it a transparent GIF. That’s probably the best you can do at the moment.

    Also, a ticket was just brought up to add CSS classes to avatars:
    https://buddypress.trac.wordpress.org/ticket/3922

    Keep an eye on that one.

    @inhouse

    Member

    @r-a-y thanks for the advice. This works but unfortunately the image size is still in place. I now have a 1 pixel x 1 pixel image stretched to 650px by 250px when a user doesn’t upload an avtar. This is still further than I was but not a very elegant solution.

    Seems like there should be a way to write it so the avatar is only displayed if there was one uploaded. If not, nothing is displayed just like the extended profile field data “if bp_field_has_data”. Again, thanks for the help!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Conditional Avatars’ is closed to new replies.
Skip to toolbar