Hi sorry for my bad english.

I have added extra fields to user profile and I have exposed this fields on user registration form.

Some required "Text field" and "List (text) checkbox/radio buttons" field is dependent on a "List (text) Select list" Dependees.

I have the necessity of bypass this required field if the user have the "administer users" permission.

For now I have created a custom module (I'm newbie..) and works well for field that isn't hidden by conditional_fields... but I need an "hint" for remove required "options" for fields processed by conditional_fields

Attached there is my (dirty) module

Can someone show me the light?



HLopes’s picture

1.99 KB

I have the same need you did, so i've revamped your module a bit, please try it and see if it fits your needs..

If i recall it correctly, it just doesn't work with date fields.

Don't forget to try it first on a copy of your site, DO NOT try it in production sites.

Bartezz’s picture

#1 seems to work alright, no bugs so far... been working with it for a couple of hours only though! Thanx for sharing!
Scratch that, doesn't work with term reference fields either :( Will see if I can come up with a fix!

Scratch that too :) I had problems with using this module in conjunction with 'complete profile' module, but as it turns out, the module in #1 is not at fault there. I did edit the code and I think it should work for date and possible every form API form field now, also think this is a faster method;

function bypass_required_field_form_alter(&$form, &$form_state, $form_id) {
	if (user_access('bypass required fields')) {
		$form = unserialize(str_replace('s:9:"#required";b:1;', 's:9:"#required";b:0;', serialize($form)));

function bypass_required_field_after_build($element, &$form_state) {
	if (user_access('bypass required fields')) {
		$element = unserialize(str_replace('s:9:"#required";b:1;', 's:9:"#required";b:0;', serialize($element)));
  return $element;


peterpoe’s picture

Issue summary:View changes
Status:Active» Fixed

Closing ancient support requests.

Status:Fixed» Closed (fixed)

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