Trying to assign default avatars for users and groups on new signups

I am posting under plugins section because I think that the reason this is not working is because now I am using membership plugin whereas before it was working but I stand corrected.

Here is my question

Is there a way I can automatically assign my own default avatar when a new user sign up on my site?
Also I will like to have my own default avatar assigned for new group creation. I could not find a plugin for this but I guess it's votes that counts.

My users are not liking the default avatars that are assigned by the system when they sign up for a new account and why I am hoping I can solve this problem for them. They can of course upload their own later but since they are slow in learning how to get this done, they will have to live with the ones they see until they are able to learn how to upload their own. I am really trying to avoid this from happening from the start and make them happy. Just trying to keep their business.

My google searches did not help.

I am using
WordpressMU 3.0.1
BuddyPress 1.2.5.2
Membership Plugin
The three musketeers I think that need to cooperate and make this work.

I am attaching my function file that made this work prior to installing the membership plugin.

I know that this is not necessarily a problem associated with the plugins here but it would be great if I can make it work.

Sorry that my post got added to the function.txt file. I had to copy it there and forgot to remove it prior to attaching but the code in question is on the bottom.

Thanks

  • drdave
    • The Crimson Coder

    Just curious if this is a step in that direction but I am not sure how to implement it. I know it gets added to wp-config but then what else do I do from there?

    define ( 'BP_AVATAR_DEFAULT', $img_url );
    define ( 'BP_AVATAR_DEFAULT_THUMB', $img_url );

    Actually I want to get rid of the user avatars completely that gets assigned to new signups so I can use my own custom avatars. That way each user get to use mine instead. At least until they are able to upload their own.

    Same for group avatars.

    Thanks for that link though I think it's great!

    Any further help appreciated if possible. If I can get this to work it will sure make my day.

  • drdave
    • The Crimson Coder

    Here is an example of one of the avatars they will see in their profile when they click on "View Your Profile" in Blogs-Mu theme once they sign in but I will like to use my own custom made ones instead until they are able to upload their own. Same for group avatars.

  • AltisonaMedia
    • Site Builder, Child of Zeus

    Did you have a look at the plugin drdave? It lets you define a new default logo to replace the mystery man - or the Monster ID avatars. I have used it on a previous wpmu site to help branding. When a new user signs up and they are automatically given this new default avatar. You can then choose to let your users upload their own or not.

    Not sure how well it would work across BP - but it is easy enough to set-up.

    regards
    aM

  • drdave
    • The Crimson Coder

    @AltisonaMedia

    The default avatar (a working URI) for users without Global or Local avatars. Used for trackbacks.

    Not quite clear to me but I assume you mean to enter the path where the image is located which I did
    http: //mysite.com/wp-content/themes/blogs-mu-child/_inc/images/user.jpg

    Put this code in your template files where you want avatars to appear:

    In functions.php I add
    <?php $avtr = get_avatar(id [, size [, default-image-url]]); echo $avtr; ?>

    Once uploaded I clicked on Users/Avatars to refresh the browser and I get error...

    Parse error: syntax error, unexpected '[' in /home2/topsite/public_html/siteused/wp-content/themes/blogs-mu-child/functions.php on line 1

    I also tried adding the code to bp-functions.php. A file I placed in plugins folder. This one did not give an error but did not work. I still see default avatars.

    Other than that I have not changed anything else in the configuration.

    My Settings/Discussion is set to mysteryman

    Any further help appreciated

  • AltisonaMedia
    • Site Builder, Child of Zeus

    You shouldn't need to add any code unless you are doing something unusual.

    If you have uploaded your new avatar default and referenced it correctly it should show up in your avatar options in the backend dashboard.

    I will install it and have a closer look as intend to use it on another site

  • drdave
    • The Crimson Coder

    Yeah I did look at the votes too and wondering if it's just us the users not configuring it properly or if it really don't work.

    The link you sent is where I started out initially and it does work but without the membership plugin installed.

    Whether there is a relationship between the two I have no idea. All I know is that when I got it to work using Sarah Gooding's post I did not have the membership plugin installed.

    Too bad for me because I do need membership plugin and I also really need that added function for my users.

    The default avatars for group and user in my opinion as well are really very distracting. It makes the site look like Halloween. Well we are not that far away now are we? :slight_smile:

    I already have my own custom made ones ready to go but it has caused me a big set back since I cannot get it to work.

    I do appreciate your time though.

  • Mason
    • DEV MAN’s Sidekick

    Hiya drdave,

    I'd honestly recommend the method I posted initially. It's way less complicated and since it's built into BuddyPress, it's not likely to break on future updates.

    Simply add the lines you mentioned to your wp-config file and replace the $img_url variable with the actual URL of your image.

    I'm sure this will work for default avatars for new users.

    Thanks!

  • drdave
    • The Crimson Coder

    Hey Masonjames

    I tried...

    define ( 'BP_AVATAR_DEFAULT', '/_inc/images/user.jpg' );
    define ( 'BP_AVATAR_DEFAULT_THUMB', '/_inc/images/user2.jpg' );

    and

    define ( 'BP_AVATAR_DEFAULT', 'mysite.com/wp-content/themes/blogs-mu-child/_inc/images/user.jpg' );
    define ( 'BP_AVATAR_DEFAULT_THUMB', 'mysite.com/wp-content/themes/blogs-mu-child/_inc/images/user2.jpg' );

    maybe?

    The lines were added just above...
    /* That's all, stop editing! Happy blogging. */

    But I could not get it to work.

  • Mason
    • DEV MAN’s Sidekick

    Hiya drdave,

    You need to use the absolute link. That means the entire thing from http all the way to the end. If you tried this and it's still not working, how do you have your avatars set in wp-admin? You'll want to make sure they're using the "default" mystery men setting.

    Thanks! :smiley:

  • drdave
    • The Crimson Coder

    Yeah I tried the full url too sorry for sending you that version it was misleading.

    And yes default mysterman is set.

    I know it should work if you say it should so I will try again tomorrow. Been at it all day. I am feeling beat up right now so I am off to bed.

    Thanks masonjames you are truly helpful.

  • drdave
    • The Crimson Coder

    @masonjames some of the parameters are working but $img_url has no effect whatsoever.

    I changed .. FULL_WIDTH, ORIGINAL_MAX_WIDTH ORIGINAL_MAX_FILESIZE, etc. and they are affecting the image size as expected.

    And on the Members/Profile/Avatar page while uploading a user Avatar after a new signup, I got a prompt that the image was too large so I increased the the $max_in_kb and the images were uploaded so apparently that parameter is also working for but I just can't get $img_url to work no matter what I do or where I place the images.

    define ( 'BP_AVATAR_THUMB_WIDTH', 50 );
    define ( 'BP_AVATAR_THUMB_HEIGHT', 50 );
    define ( 'BP_AVATAR_FULL_WIDTH', 150 ); Worked fine
    define ( 'BP_AVATAR_FULL_HEIGHT', 150 ); Worked fine
    define ( 'BP_AVATAR_ORIGINAL_MAX_WIDTH', 640 ); Worked fine
    define ( 'BP_AVATAR_ORIGINAL_MAX_FILESIZE', $max_in_kb ); Worked fine
    define ( 'BP_AVATAR_DEFAULT', $img_url ); Negative
    define ( 'BP_AVATAR_DEFAULT_THUMB', $img_url ); Negative

    Were you able to actually make this work?

  • Mason
    • DEV MAN’s Sidekick

    Hiya drdave,

    Sorry I missed this one earlier today.

    Were you able to actually make this work?

    Yes sir.

    My steps:
    Uploaded image using WordPress Media Uploader.
    Edited image to 150X150 and saved.
    Copied new URL
    Opened wp-config.php and entered:
    define('BP_AVATAR_DEFAULT', 'http://wordpress.mu/wp-content/uploads/2010/10/blue_tricycle-3264-e1286855360242.jpg');
    I put it right above all the bits for my multi-site install (around line 85 for me)
    Saved the file.

    All BuddyPress users with default image (formerly mystery man) were changed to my new image.

    I'm not sure what it could be. You're using single quotes right? No curly quotes issues right?

    Everything you've got above looks correct to me, I can't think of what else it could be that's causing the issue.

  • drdave
    • The Crimson Coder

    Thanks for been patient I really do appreciate it.

    I am attaching the images in this one. I followed your steps and could not get it to work. So to remove all doubt here is what I did.

    A completely new installation of WordPressMU 3.0.1 and BuddyPress 1.2.5.2 only (no themes no other plugins. This is on my test site. The database and dbuser was deleted, as well as all the files on the server. So I am talking clean install here.

    I uploaded an image via WP Media Uploader and it is pointing correctly. I still only get the default image for the new user signup as seen in the image.

    My image uploaded with the same exact name user-150.jpg as the one on my local hd. The image is 150x150 with a size of 5.85kb. The system did not change the name of my image after it was uploaded. Not sure if yours did and if that would make a difference.

    Let me know if you see anything unusual.

  • Mason
    • DEV MAN’s Sidekick

    Hiya drdave,

    Sorry this still hasn't worked for ya. Literally, I have my setup exactly the same and it's working fine on my install. The only difference I see is that your site is a subdiretory install and mine is a subdomain.

    I don't see how that would have any impact here. I'm truly stumped. :slight_frown:

    I'd say you'll have to take your issue over to the BuddyPress forums at this point. I have to think it's an issue with something on that end.

    If you are able to find the solution, please do report back here as I'd love to know what's going on as well.

    Thanks!

  • drdave
    • The Crimson Coder

    @Masonjames I hear you.

    Well I tried the same exact setup on a top level domain http://www.example.com but the results are the same.

    I really think there is something different going on on your server that's making this work. I am using a newly created from scratch Photoshop CS2 image with can easily be uploaded and work in WPMU otherwise.

    upload/2010/10 are all using 755 permissions, the image itself 644. Yet still something is breaking the image path.

    I will see if bp forums can possibly help and send you the results. Maybe this will help others having the same problem if I am able to solve this mystery.

    Your help is MORE than highly appreciated!

  • Mason
    • DEV MAN’s Sidekick

    Thanks drdave,

    I, like you, am truly stumped. Though I love a good mystery as much as anyone, I also love to see them solved. ;D

    I don't know of anything special to my setup and your permission settings are fine.

    Yet still something is breaking the image path.

    Can you load the image URL in the browser and see it though? As long as you can do this, your permissions and file structure, etc is all fine.

    One last thought would be to upload a new copy of BuddyPress. Maybe some bit of code has gotten fubar somehow? I dunno. Please do report any answer ya find though!

    Thanks!

  • AltisonaMedia
    • Site Builder, Child of Zeus

    I have gone through this Sarah Goodings functions.php update https://premium.wpmudev.org/blog/how-to-add-a-custom-default-avatar-for-buddypress-members-and-groups/

    and it has worked on group avatars to an extent. However there are still 2 issues which make this far from a full solution.
    1. when a user creates a group they are intially presented with the default group wavatars (not the new defined default)
    2. I am using BlugMU and call to fetch radnom groups still show the old group avatars.

    There is something more fundamental that need updating either in the config or the core.

    Anyone got ideas...?

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.