Hi, can anyone assist with how to create a custom form with only email, current password and new password fields? I would like to use it in a custom user account Security Settings Page for security settings separate from the user_update form.
I tried to replicate the user_update form based on the Model_Form class and user controller files using a custom plugin but the field input data is not saved and the form is cleared up when the page is reloaded.
Unfortunately, there is no simple solution here, as this form should not require the current password, and the email cannot be edited without confirmation like a regular field. That is, to set this up correctly, you need a custom form, an action where the form will send the request, and you need to add the appropriate custom logic there. We recommend that you check out the GitHub to see how this form is made and the action itself: hivepress/includes/controllers/class-user.php at master · hivepress/hivepress · GitHub. Also, you can do this without necessarily using HivePress, as we use the WP Users API, so you can do it the way you want (through a third-party plugin or other custom implementation).
Hi, I managed to get it working. Just one more thing, is there a code to conditionally add an attribute to only one specific form? I’m using this filter: hivepress/v1/models/user/attributes
Unfortunately, there is no such possibility since there is only one editable function and those that inherit it. Please note that if you edit the theme files directly, any update from our side will delete all your changes, so I recommend using this doc: How to add custom code snippets - HivePress Help Center