Skip Navigation

[Resolved] Visibility of user field groups in admin add/edit user forms

This thread is resolved. Here is a description of the problem and solution.

Problem:
Required custom user field message being triggered even in user role that this field shouldn't appear.

Solution:
While the issue is not fixed we have a workaround which consists in hiding the custom user fields from User Add New screen. Add the code below in functions.php of the current theme:

add_action( 'init', 'remove_types_fields_new_user' );
function remove_types_fields_new_user(){
    remove_action( 'load-user-new.php', 'wpcf_usermeta_add_user_screen' );
}
This support ticket is created 8 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 8:00 – 17:00 8:00 – 17:00 8:00 – 17:00 8:00 – 17:00 8:00 – 17:00 -
- - - - - - -

Supporter timezone: America/Sao_Paulo (GMT-03:00)

This topic contains 8 replies, has 3 voices.

Last updated by Adriano 8 years ago.

Assisted by: Adriano.

Author
Posts
#374715

This is a feature request for the Types User fields.

When I create an "User field group" I would like to have the ability to decide if it has to be displayed on the add user form and/or edit form. That would be an ideal completion of the current "display by role" feature.

My need is the following: I have a user field group specific for a role, with some required fields. When I create a new user from the WP admin, I am forced to insert all the required fields, even if I am creating an user of a different role, which doesn't need these fields at all.

Thank you.

#374851

Dear Francesco,

Thanks for the feedback, as you can see, when you setup a custom user field, there is a meesage:
Conditional display is not supported for User fields.

And I put it into our to-do list as a feature request, our developers will take care of it, but there isn't any ETA for it.

#374885

Hi there,
thanks for your reply. Please note however that I was not talking about conditional user fields as currently available for custom post fields (these are conditions to decide whether a field should be displayed based on value(s) of other field(s)). I was talking about the ability to decide if the fields have to be displayed in the "new user" form and/or in the "edit user" form. This is a feature that could be useful also for custom post types (as far as I know it's not currently available), but it's particular important for users field groups, because Types actually prevents the ability to perform some operations that are normally available in native WordPress (create users with no custom fields). In these terms I think this is in between from a feature request and a bug report.
Thanks.

#375295

Thanks for the details, I add your comment into our to-do list.

#378820

Thank you.

In the meantime please could you provide a code snippet to prevent the user custom fields from being displayed/processed in the "new user" admin screen (by removing hooked functions)?

#379064

Sorry for the misunderstand, I can duplicate same problem, and I checked the source codes of Types plugin, there isn't related action/filter hooks we can use in your case, so I escalated to this thread to our 2nd tier supporters, hope they can find any workaround.

#379215

I've advised our development team on this, meanwhile you can use the hook below to fit your needs:

add_action( 'init', 'remove_types_fields_new_user' );
function remove_types_fields_new_user(){
	remove_action( 'load-user-new.php', 'wpcf_usermeta_add_user_screen' );
}
#379226

Thank you! The snippet worked like a charm.

#379231

You are welcome.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.