0

I have created a new checkbox field through the core module 'profiles' called Billing Terms. It is visible on the user registration form.

I'd simply like an asterisk * next to the users name on their profile page if the Billing Terms checkbox is ticked. Actually it doesn't have to be an * but rather anyway to signify that the Billing Terms checkbox was ticked.

Any help or helpful links would be greatly appreciated.

1

One way you can do this is if you have a custom template in your theme for user profiles. Creating a custom user profile template

Basically, you can overwrite the entire layout of the user profile this way. And then, you can output profile fields however you like by simply printing them. For instance:

<?php print $account->CHECKBOX_FIELD_NAME; ?>

This will allow anyone visiting the profile to view the results.

If you wish to display this to only users of a specific role, you would want to wrap the above code in an if and check what the viewing users role it. For example, something like this

// Check to see if $user has the administrator role. if (in_array('administrator', array_values($user->roles))) { CHECKBOX_FIELD_NAME; ?> } ?>

| improve this answer | |
  • Is there a way I can, as admin, view another users profile and see whether the checkbox was ticked? I believe the above solution would work for a logged in user viewing their own profile, correct? – winchendonsprings Sep 23 '11 at 18:08

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.