Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] Changing the default mystery man avatar

  • Avatar of Henry
    Henry
    Participant

    @henrywright-1

    I have read a million threads on how to change the default mystery man avatar but none of the solutions work.

    Is there a solution that works with the current version of BP (1.7.2)?

Viewing 13 replies - 1 through 13 (of 13 total)
  • Avatar of @modemlooper
    @modemlooper
    Moderator

    @modemlooper

    define ( 'BP_AVATAR_DEFAULT', $img_url );

    Avatar of Tbermudas
    Tbermudas
    Participant

    @tbermudas

    I use the “add new default avatar” plugin and workd.

    http://downloads.wordpress.org/plugin/add-new-default-avatar.1.3.1.zip

    Avatar of Henry
    Henry
    Participant

    @henrywright-1

    @modemlooper have you tested this recently? It used to work for me but not right now. Very puzzling!

    Avatar of Henry
    Henry
    Participant

    @henrywright-1

    @tbermudas thanks for the idea, i used to have it working (without the need for a plugin). Thinking using a plugin for this is like using a sledgehammer to crack a nut.

    Avatar of bp-help
    bp-help
    Participant

    @bphelp

    @henrywright-1
    I have to disagree, a plugin coded well is no different than a function in a themes functions.php if a plugin introduces bugs then that can be nut cracking. On the other hand if you introduce code with syntax errors, and clashing functions then you have essentially cracked your own nuts. No pun intended! :-)

    Avatar of Henry
    Henry
    Participant

    @henrywright-1

    @bphelp haha!

    you’re right i suppose, it does depend a lot on the plugin. After all, a plugin can be a few lines of code in a single file or a huge folder full of badly written buggy spaghetti code.

    I’m trying to get this to work purely for my own satisfaction now as I had it working at some point in the past.

    Avatar of @modemlooper
    @modemlooper
    Moderator

    @modemlooper

    it totally works.

    I used this:
    define ( 'BP_AVATAR_DEFAULT', 'http://www.petfinder.com/wp-content/uploads/2012/11/101418789-cat-panleukopenia-fact-sheet-632x475.jpg' );

    view it here:

    http://demo.taptappress.com/members

    Just plopped the code into bp-custom.php

    That plugin you link to takes a silly path using javascript to switch avatar.

    Avatar of Tbermudas
    Tbermudas
    Participant

    @tbermudas

    Thanks for the tip! I will try it!

    Avatar of bp-help
    bp-help
    Participant

    @bphelp

    @henrywright-1
    Hey thanks for being a good sport. Sorry I felt inclined to show my sense of humor but I could not pass up the opportunity. On a serious note though, and I am sure you know that plugins are just functions with hooks that has required commented info at the top of the php file. That is really the only difference between a plugin and a function. I try to keep my custom functions in one file that I can deploy in most situations. I of course comment all the functions in case of hook changes etc., and if a hook changes then I comment out the function until I narrow down what needs to be recoded in regards to a hook. Not saying you don’t know this already or practice it, but maybe it will benefit others as we all go about harnessing the power of WordPress and BuddyPress. :-)
    Cheers!

    Avatar of Henry
    Henry
    Participant

    @henrywright-1

    @modemlooper popping this into my bp-custom doesn’t work for me

    define ( 'BP_AVATAR_DEFAULT', 'http://www.petfinder.com/wp-content/uploads/2012/11/101418789-cat-panleukopenia-fact-sheet-632x475.jpg' );

    It could well be my install (i have heavily used functions.php). Mind you, i’ve not used many plugins. I’ll try on a fresh install and report back.

    @bphelp

    Sometimes a little humour is needed! especially as i’ve been pulling my hair out over the past 2 days trying to get this blasted code to work :}

    the way you comment your code sounds like good practice to me. That way you can write code once, reuse on new websites you’re working on, let people understand what you’ve written, easily go back to old code and so on.

    Avatar of Henry
    Henry
    Participant

    @henrywright-1

    I stripped my bp-custom.php down so that it is almost empty. @modemlooper‘s code works great now. Must have been something in there causing a conflict.

    Thanks guys

    @henrywright-1,

    Here is another way of doing it. In your setting >>> discussion >> default avatar them choose mystry man and the following code will go into functions.php

    //Custom avatar for no avatar user
    function myavatar_add_default_avatar( $url ){
    return get_stylesheet_directory_uri() .'/_inc/images/user-nopic2.png';
    }
    add_filter( 'bp_core_mysteryman_src', 'myavatar_add_default_avatar' );
    

    Naijaping

    Avatar of Henry
    Henry
    Participant

    @henrywright-1

    Thanks @naijaping

Viewing 13 replies - 1 through 13 (of 13 total)

You must be logged in to reply to this topic.