Ning Developer Docs

Does anyone know how to change the default gray head avatar photo? I have the code and there are many graphics--even a default avatar for groups--but none for members. I'm worried this is buried in the content store and impossible for us to change.

We'd also like to change the avatar image based on profile questions if someone decides not to upload an image. Any help is appreciated. Thanks!

Views: 12

Replies to This Discussion

I am also looking into this... and have not found any solution. It seems that every time a user is created they get a copied default image into the content store. (or is it one file.) Looking at the source from the website, it seems that everything that has a default image has a unique ID. Also checking into where the thumbnails are defined, there is no condition to see if a user thumbnail is defined or to use the default. which leads me to believe my theory above. Maybe if there was a consistent way to see what was a default thumbnail... like tagging it with a "_default" in the file name. We could check the string for the occurance and use our own image.
Yes, I think the default image is in the content store. Since there is an interface to upload an image from the user, presumably one could substitute a default image during the sign-up process before the user even sees the avatar. Perhaps you're onto something with the "default" suffix. I'll post something here when I find something useful.

Are you a new to Ning? What are you developing? I'm also still looking for more extensive documentation. For example, a database map of information stored by the Ning network application per user, etc. There's no entity map that I can find. A little disconcerting having to reverse engineer the Ning code to make progress...!
www.socialcigar.com check it out.
i guess no one has a response...
It's on my list of todos. But I'm sure there is a way to substitute the default avatar in the sign up pages. I just haven't gotten around to figuring out which file(s) are affected. We want to assign a random image. Totally doable I'm sure.
Well, you got me sleuthing now. You might look in widgets/index/controllers/AuthorizationController.php for newProfile() and createProfile() functions. This is where the default photo is presented to the new user during sign up. Then check out line 15 of widgets/index/authorization/profileInfoForm.php. This is where the default avatar appears to be rendered.

Now look at line 209 of lib/XG_UserHelper.php in function getThumbnailUrl(). I think this is the default avatar photo. You could substitute an image there perhaps. However, you could trace back and check out line 437 of AuthorizationController in action_createProfile() where the fresh new user object is created (I think) for a sign up. My guess is Ning must supply a default thumbnail avatar in that call to User::loadOrCreate(). I delved into User.php to see if I could find where the default thumbnail ID or URL is set, but I'm getting tired. Maybe you can take it from here and report back? I hope so... Maybe together we'll figure this out.
Yeah man... i went down that path as well... it just sucks that all the images are made with the profile is created, with no string that identifies it as a default image. If that where the case.... you could check the string in the content store and change all of user's default images for the ones that had already been created. And then set the default image code on the profile creation.

Doing it now on new signups would make some people have the new default image while others would have the old one.

I wonder what the problem is using a default image for everyone... is it to much strain on that one image? they could have at least created a separate default image when a network is created. that way you can change that one instance and it would be specific for your network.
Well guys, I think I figured out how to do this. It was quite a hunt. Unfortunately, I've only found a way for developers to change the default avatar photo who have their own source code to modify. I have not found a way to coerce Ning's system to change it for non-developers.

When a new user signs up via the last of two form pages, the system calls method action_createProfile() in /widgets/index/controllers/AuthorizationController.php. Descending the call tree, I found that the following method is called when the user does not specify an image to upload. You can change the default photo to use for all new users right here by pulling the rug out of using Ning's default and replacing it with yours. I've only done rudimentary testing, so I’m not sure how robust this is or whether is works in edge cases. But if I find any, I’ll certainly post any fixed here later. The image should be square.

Make this change in /lib/XG_UserHelper.php:

public static function setThumbnailFromProfileProper($profile, $user) {
//$thumbnailurl = $profile->thumbnailUrl(50, 50);
$thumbnailurl = "http://mynetworkname.ning.com/new_avatar_image.jpg";
$url = XG_HttpHelper::addParameters($thumbnailurl, array('width' => null, 'height' => null, 'size' => null));


Good luck, I hope this works for everyone. Of course, you can change the file if you want to randomize the avatar image. You could even look at profile answers to affect the image you use, like gender, age, location... One can go wild.
but you'll have all the new users with new photos and the old users with default... gonna look weird.
That's true. But you can also easily write an 'admin' script in say /widgets/admin/controllers/Index_Controller.php that loops through all users, checks their my->thumbnailUrl against the default URL image and then change it there as well. I tried this too and it works. The default URL string is "https://api.ning.com/files/WN6fyIjTzRhrFx48iq1N5FcIav3Obrh-F-hyWFqct-E_/11853240.bin". I haven't written this specific script per se, but can post it when I get around to it if desired.
Hi, have you written that code ? for changing the default picture . Could you post it here ? thank you
Sorry, I'm in the middle of a massive merge and my code changes may conflict with the latest release. The latest release appears to allow you to change the default avatar. Our code just make this random for new users from a pool of avatars.

RSS

© 2026   Created by Ning Developer Admin.   Powered by

Badges  |  Report an Issue  |  Terms of Service