Step Purpose
The Update User Step provides a way to update the profile of any user on your WordPress site including any meta fields defined on it. As this also includes potentially changing access levels via roles and personally identifiable information, care must be taken to design workflows that ensure only authorised users perform updates to user profiles. We recommend adding an approval step before any Update User step.
Note that adding or updating a User Update step requires the edit_users WordPress capability. In multisite installations, the user will only be updated if it belongs to the current site.
An Update User step type can define the following settings in addition to the common step settings all step types have.
Step Settings
User
There are 4 radio buttons which let you select which user profile should be updated.
Form Submitter (“Created By” field)
Useful when you want to allow users to modify certain parts of their own profile without giving them access to the entire WP Dashboard interface.
Current User
Whichever user is logged in to the site when the step is processed. This option is useful if you have approval/user input steps preceding the update user step and want to modify the assignee that completed the previous step. Note that this option should be avoided if you have steps with an expiration setting preceding this update user step. The results could vary either because no user gets updated (when the expiration is triggered via WP cron processing during a non-registered user page view), or that an unintended but authenticated user triggered the cron processing event.
Select User Field
If your form has one or more user fields, an additional ‘User Field’ setting will display allowing you to select it. This option is most useful when you have Person A submitting the form for/on behalf of Person B such as HR/Finance processes or recognition programs.
Lookup User by Email field
If your form has one or more email fields, an additional ‘Email Field’ setting will display allowing you to select it. This option is similar to the user field, but can be perceived as a better user experience if you have thousands of users; presenting an email field instead of a very large drop-down.
Profile Data
Each of the settings that follow User setting present a dropdown with a list of the fields in your form. If you change it from the ‘Preserve current …’ value, when the step is executed the field value will replace that part of the users WordPress profile data.
- First Name
- Last Name
- Nickname
- Display Name
- Email Address
Roles
This setting allows you to select if or how the user’s roles should be updated. Either:
- Add to existing roles
- Replace current roles
In both cases, an additional ‘Select Roles’ dropdown setting will be displayed that lets you pick one (or more) roles. One area where this setting would be particularly useful is when you need to keep a historical record of member/role changes that are not tracked by default when a WordPress administrator directly modifies the user profile.
User Meta
Perhaps the most flexible part of the Update User step is that you can modify any user meta values. Whether the meta key(s) are defined via a plugin like Gravity Flow Vacation Request extension, a framework oriented plugin like Advanced Custom Fields or code you have written in a plugin, this setting presents a table that you can add as many rows as needed. Each row contains two columns:
- Meta Key
What user meta field should be modified. The drop down presents any meta keys that are properly registered via the proper WP core user meta functions. You can also select ‘Add Custom Meta’ if you wish to create a new meta key or know the key exists in your site but is not present in the dropdown. - Meta Value
What value should be stored into the selected user meta key. The drop down presents any field in your form for selection, several standard Gravity Forms / Flow values or an ‘Add Custom Value’ selection. In the latter case, you can also use merge tags to build a dynamic value based out of multiple field values.
Example Use Cases
While the number of settings in the update user step might be smaller than other interactive step types, that doesn’t mean that the variety of use cases it can address is.
Role Change Report
You can use a form/workflow to provide traceable history on role changes to users instead of using the WordPress admin dashboard directly.
- Setup WordPress roles that you dynamically populate into a field on the form along with fields to match user email, name, etc.
- Create an approval step to first verify that the role change is appropriate. This could be assigned to a manager, an internal IT department that would have been doing the change prior to automating the task.
- The Update User step, with conditional based role(s) selected would use the ‘Replace current roles’ roles setting.
Guest author biography self-management
Let potential guest authors provide just enough user info when submitting the potential blog post. After the blog post is confirmed that it will get published, they can amend their bio with additional info.
- Install and configure the Gravity Forms Advanced Post Creation (APC) add-on and User Registration add-ons for guest posts.
- The initial form submission would focus on just enough details to create the WordPress user account along with whatever is needed for the potential blog post.
- Create an Approval step and conditionally configure an APC step to create the post
- Create a User Input step assigned to the now created user that has additional editable fields related to biography, photos, website and social media handles.
- The Update User step can then modify the incremental information.
What you are hopefully starting to appreciate about Gravity Flow is that individual step types can enable you to do wonderful things. But where the plugin really demonstrates its power is in the flexibility you have to combine the different step types to automate or standardize so many different business processes.