How do I make users have a random avatar upon registration out of a group of avatars that the admin has predefined

for example say I have 50 predefined avatars, that users can choose from, is there a way of making the default avatar be random

----------

Or the other situation will be, out of the 50 above, 25 are female oriented and the other 25 are male oriented avatars. If after puting a mandatory profile field upon registration to select male/female

the code executes so that the male/female avatar is chosen according to the user's selected gender

----

This however should all be ignored if the user then posts his/her own avatar

THANKS

Comments

stella’s picture

Assigned: Unassigned » stella

Hi,

I don't think assigning avatars based on gender will work. It's not a standard profile field. I haven't played with adding custom fields to the profile, but I imagine there's no standard way of identifying which field is the gender.

Currently, using the standard drupal user picture config, it is possible to configure one image as the default avatars. I haven't looked into it yet, but it could be possible to set up a group of avatars available to anonymous users (which is what you are when registering) and then randomly assign an avatar out of those. I'll look into it and get back to you.

Cheers,
Stella

stella’s picture

Status: Active » Fixed

Hi,

Sorry for the delay in getting back to you. I've just checked in some code to CVS that will randomly assign an avatar to a user when they edit/register their account and haven't uploaded or selected an avatar from the list. If the account already exists with an avatar, then they will keep that one.

This will be included in the next release.

Cheers,
Stella

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

stella’s picture

Released in Avatar Selection 5.x-2.3.

Cheers,
Stella

underpressure’s picture

how bout this.

after Admin creates a set of profile fields he can then go over to Avatar selection and select a default avatar based on a profile field by selecting from a list of all profiles fields.

basically you have a drop down list of all profile fields that have a drop down list of admin created answers such as gender: male or female.

you slect an avatar based on the profiled fields answer

stella’s picture

Marked #224218 as a duplicate of this issue.

stella’s picture

underpressure: I looked into what you suggested. Unfortunately, there is no api provided by the profile module that returns a list of profile fields or a list of profile fields of a certain type. The nearest function to this requires advanced knowledge the profile category. I also couldn't find an api for getting the default list of values of a profile field. I've checked both 5.x and 6.x versions. So I'm afraid this won't be implemented any time soon.

Cheers,
Stella

joncup’s picture

you might want to look at how google adsense module handles this issue

stella’s picture

Status: Closed (fixed) » Postponed

Setting to postponed until I have time to look at the google adsense module (and so it appears in my issues list again!).

Cheers,
Stella

stella’s picture

joncup: I took a look at how the adsense module uses the profile fields. As I mentioned before, there is no API function that can return the list of profile fields or their default values. To overcome this the adsense module queries the database directly, which I am reluctant to do.

However if enough people request this feature (by adding their +1 s to this issue), then I might implement it despite my reluctance to directly query the db. It's not a small piece of work, so the availability of an API would really help.

Cheers,
Stella

Witch’s picture

i need this feature too.

subscribe

HS’s picture

+1

Looking for something for Drupal6 that can randomly assign an avatar to anonymous users not looking for for the gender option so much.

stella’s picture

Title: Random Avatar or Avatar by gender » Avatar by gender

The random avatar feature is already present. The only remaining requested feature not implemented is the avatar by gender option.

Cheers,
Stella

Leandros85’s picture

+1

andrewsuth’s picture

+1

Ivo.Radulovski’s picture

Status: Postponed » Active

+1

any help needed?

How about creating a small module or adding this to an existing - something like "CCK gender" and let the Avatar Selection module using it if installed?

Ivo.Radulovski’s picture

Have not seen that the discussion is for Drupal 5.x - should i change to Drupal 6.x or create an other issue?

stella’s picture

Version: 5.x-2.x-dev » 6.x-1.x-dev
stella’s picture

Status: Active » Postponed
Balbo’s picture

+1

Loikkk’s picture

A D7 port of this module would be nice :)

poli’s picture

+1

poli’s picture

+1

Miria’s picture

+1

rickbcwt’s picture

This is something I thought for sure would have a solution. I need this and would be intere$ted in contributing to development. +1