Skip Navigation

[Resolved] Cred form edit existing users

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.

This topic contains 2 replies, has 2 voices.

Last updated by franzG-4 1 year, 10 months ago.

Author
Posts
#2538419
Cred-form edit users.png

Tell us what you are trying to do?

We have created a user form, where users can edit their own information. When editing the form, we have to tick all user roles which are allowed to use this form. We have defined a lot of roles, and we have very often new roles, so we would be forced each time, when a new role is defined, to edit the form and to add the new role (see screenshot).

So is there no way to override this role selection scheme and to allow just to ALL USERS to fill out this form? This would make life much easier for the maintenance of our website.

Is there any documentation that you are following?
courses and documentation Toolset

Is there a similar example that we can see?
no, the form is only for logged-in users

What is the link to your site?
hidden link

#2538607

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi there

That's not a scenario we've encountered before, and I can confirm that there is no way to select all roles in the UI, and that there is no API filter that can be used to dynamically modify which roles can use the form.

So we don't have anything like an official solution to propose, but if you want to try and craft a solution yourself, I suggest you check how the form settings are stored.

The form itself is stored in wp_posts, and in the corresponding entries in wp_postmeta you will find an entry for "_cred_form_settings".

If you get this hidden custom field (with get_post_meta) it will be an object, in this format (I used an unserialize tool having retrieved this value directly from the database of my own test site):

stdClass Object
(
    [form] => Array
        (
            [hide_comments] => 0
            [has_media_button] => 0
            [has_toolset_buttons] => 0
            [has_media_manager] => 0
            [action_message] => Edited
            [autogenerate_username_scaffold] => 0
            [autogenerate_nickname_scaffold] => 0
            [autogenerate_password_scaffold] => 0
            [type] => edit
            [user_role] => ["administrator","editor","author","contributor","subscriber"]
            [action] => message
            [action_post] => 
            [action_user] => 
            [redirect_delay] => 0
        )

    [post] => Array
        (
        )

)

So when new roles are added you could in principle dynamically update that hidden settings field with the full list of roles.

If that's not something you can do yourself you could try a Toolset contractor: https://toolset.com/contractors/

#2538609

Many thanks Nigel, I will try it out. My issue is resolved now. Thank you!