3

I use the Avatar Selection Module to provide a list avatars my users can choose from. I don't want to make choosing an avatar required, but I'd like to have a persistent reminder for users who have not picked an avatar for themselves.

How can I identify users who have NOT chosen an avatar and use Context (or something else) to conditionally display a message in a block like, "Hey you haven't chosen an avatar yet. GO HERE (User Form) to choose one."?

  • Did you try my answer? – No Sssweat Jan 26 '16 at 9:40
1

Profile Complete Percent helps to guilt users into filling their profile details. This isn't avatar specific, but you can configure the PCP block to only use a single field for its percentage calculation.

1

The following only works if you created your own image field. Ex: I added an image field called avatar to my users fields and disabled the default picture field over at /admin/config/people/accounts

Going off memory here.

You can do this using Rules

Add a new rule:

React on event >> After user has logged in

Add Condition >> Data is Empty >> account:field-avatar

Action >> [under system] Show message >> Hello [account:name] you have not selected an avatar yet, please go <a href="/user/[account:nid]/edit">here</a> to add an avatar. >>

Repeat message: True.


If you're using the Drupal default picture, take a look at the answer to this:

How to check with Rules if users have a custom picture

  • 2
    The fields for "account:field-avatar" and "account:picture" don't appear on my list of Data Selectors. When I try to type them in I get the message, "Data selector account:picture for parameter data is invalid." What am I missing? – Aaron Thain Feb 1 '16 at 15:27
  • @AaronThain Sorry, since I use my custom picture field, I assumed the account:picture field would be available. To my shock and disbelief it is not. Funny how it is available for sending e-mail but not for stuff like this... Anyways, I have updated my answer. – No Sssweat Feb 1 '16 at 22:57
  • Interesting (tough) case to get it to work with the Rules module in case you use the default picture. It was a bit too challenging to NOT add another answer to that drupal.stackexchange.com/questions/101220 (which does not require a custom module ...). – Pierre.Vriens Feb 16 '16 at 11:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.