Loading User Profile Fields
-
Hi Konrad, me again! (you must think I’m stupid)
When creating a for to allow users to edit their prifile details, in the Load tab, I’ve set it to load the values, but am not sure what to set the individual fields to, e.g. Email, there’s no fields displayed in the drop-down.
I cannot find documentation about the individual fields.
Many thanks
Pete
-
Hello,
Thanks for the feedback!
In order to be able to use Fields in your Form Action, you first need to select a Field Group in the “Field Groups” setting of your Form. Then you’ll be able to use fields in your Actions Save/Load settings, such as the “User Action: Email”. It’s the same logic as your other form.
Please note, if you updated your ACF version to the latest ACF 6.3.2 update released yesterday, be advised you might have some issues to select a Field Group or a Field in the Form UI. See this announcement:
PSA: The latest ACF 6.3.2 update released yesterday evening includes quite some changes to the ajax verification logic, and I wasn’t aware of the update until it was released.
Recent reports shows this patch cause issues with the Clone Field with ACF Extended (you can’t select any Field to clone in the ACF Field Group UI), and the Form UI which cannot find Field Groups/Fields.
I’m currently working on a compatibility patch. In the meantime, you can either downgrade to the ACF 6.3.1.2 version to fix the issue. Or, if you want to stay on the latest version, as it includes security fixes, here are quickfixes you can add to your
functions.php
file:// ACFE 0.9.0.5: Fix compatibility with clone on ACF 6.3.2
add_action('acf/init', 'my_acfe_fix_clone', 100);
function my_acfe_fix_clone(){
$instance = acf_get_instance('acfe_field_clone');
remove_action('wp_ajax_acf/fields/clone/query', array($instance, 'ajax_query'), 5);
}
// ACFE 0.9.0.5: Fix compatibility with fields on ACF 6.3.2
add_action('acf/input/admin_print_footer_scripts', 'my_acfe_fix_form_fields');
function my_acfe_fix_form_fields(){
?>
<script>
(function($){
if(typeof acf === 'undefined' || typeof acfe === 'undefined'){
return;
}
new acf.Model({
filters: {
'select2_ajax_data/action=acfe/form/map_field_groups_ajax': 'ajaxData',
'select2_ajax_data/action=acfe/form/map_field_ajax': 'ajaxData',
'select2_ajax_data/action=acf/fields/acfe_taxonomy_terms/query': 'ajaxData',
},
ajaxData: function(ajaxData, data, $el, field, select){
ajaxData.nonce = acf.get('nonce');
return ajaxData;
},
});
})(jQuery);
</script>
<?php
}Please note there might be other ajax related issues until the full compatibility patch is up. I can’t list them all here at the moment.
Also as a side note, the security fixes added in latest ACF patch are really minor issues, but I can understand you would want to keep using the latest version.
Thanks!
Regards.
Thanks, so I need a field group that matches the fields in the Profile ?
Thanks for the advice about the recent update, I haven’t noticed any problems so far,
Regards
Pete
I’ve created a FG and mapped the fields, but neither the profile or FG fields gets updated, I’m assuming there is some code I need to actually update the profile.
Here’s the form
Hello,
Your Form export shows that you’re trying to update the “currently logged user”. Are values correctly displayed in the fields? If yes, then it should update the same user.
Note the “User Action” updates the WP User object. You can see the list of all WP Users and their profile in the “Users” WP admin menu. Please check this menu to see if the user that been updated.
Thanks!
Regards.
Yes the site will allow users to update their profile. The fields seem to show on the form, but nothing is updated. see this short recording
Profile-?-The-Harrisons-Website-—-WordPress.mp4
Regards Pete
Hello,
I just tested with a form similar to yours, and it works in my end. Here is the video of my test.
Please try to import My Form + My Field Group via the “ACF > Tools” menu, and try to display my form with
[acfe_form name="my-form"]
, see if you get the same result.The form in your video looks different from the form export you shared earlier. Can you please export your Form Json + your Field Group json, like I did, see if everything is in order?
Also, are sure you don’t have any PHP hook which could break the form submission?
Thanks.
Regards.
when I try and import the form, I get a critical error! I’m able to import the field group, which is assigned o a page? My FG is assigned to all forms.
Here’s the error
PHP Fatal
| Jun 25, 2024, 22:12:57
Uncaught Error: Class name must be a valid object or a string
Stack trace:
#0 /wp-content/plugins/advanced-custom-fields-pro/includes/acf-internal-post-type-functions.php(25): acf_get_instance(Array)
#1 /wp-content/plugins/advanced-custom-fields-pro/includes/acf-internal-post-type-functions.php(74): acf_get_internal_post_type_instance(false)
#2 /wp-content/plugins/advanced-custom-fields-pro/includes/admin/tools/class-acf-admin-tool-import.php(187): acf_get_internal_post_type_post(NULL, false)
#3 /wp-content/plugins/advanced-custom-fields-pro/includes/admin/admin-tools.php(199): ACF_Admin_Tool_Import->submit()
#4 /wp-content/plugins/ad in /wp-content/plugins/advanced-custom-fields-pro/includes/acf-utility-functions.php on line 38
Plugin:?Advanced Custom Fields PRO
File:?/wp-content/plugins/advanced-custom-fields-pro/includes/acf-utility-functions.php
Line: 38
PHP Warning
| Jun 25, 2024, 22:12:57
Illegal offset type in isset or empty
Plugin:?Advanced Custom Fields PRO
File:?/wp-content/plugins/advanced-custom-fields-pro/includes/acf-utility-functions.php
Line: 37
PHP Notice
| Jun 25, 2024, 22:12:57
Undefined index: key
Plugin:?Advanced Custom Fields PRO
File:?/wp-content/plugins/advanced-custom-fields-pro/includes/admin/tools/class-acf-admin-tool-import.php
Line: 186I’m not sure why, but it’s too late now to think, I’ll have another look in the morning.
Cheers
Pete
Hello,
Please note that you have to import ACF Field Groups in the “ACF > Tools > Import tool”, and ACFE Forms in the “ACF > Tools > Import Forms tool” (which down the ACF Tools page).
Note that it is not important if the field group is assigned to a page. What is important is to test it on the front-end. Also there is no “Field Group location = All Forms”, this is probably coming from another plugin.
Also, please export your Form Json + your Field Group json, like I did, see if everything is in order.
Thanks.
Regards.
Sorry, it was late and I shouldn’t have been trying this when tired.
I think I’ve found the problem. I’ll do some more checking and get back to you.
Regards
Pete
-
This reply was modified 8 months, 2 weeks ago by
pzh20.
Hello,
As you can see on my demo video it should work. Additionally, there is no bug report about such issue, so there is most likely something going on your installation.
In order to isolate the issue, I would recommend clone your website on a development / staging environment using Duplicator, or with your hosting backup solution. Then try to disable all your plugins one-by-one (at the exception of ACF Pro & ACF Extended) until you find which one cause the issue.
If the problem persists, try switch to the native WP Twenty Twenty Two theme, to make sure you don’t have any custom code in your theme which would break the feature.
In all cases you should be able to confirm it works like I did, by setting up a clean WP install with ACF Pro + ACF Extended only.
Let me know if you found something.
Regards.
It’s working, there was a snippet in the child theme that I hadn’t moved to me snippets plugin that I’d forgotten.
I’ve extended the User Profile with a couple of fields, one for a profile picture, another for their middle names. whiich I’ll need to add to the form, but I also want them to be able to change their password, and ACF offers a ‘confirm_password’ field, but this isn’t showing as it’s only for the form and validation. How do I add this please?Pete
Konrad,
On the form/fg you sent me you have a field called login, I cannot see how that is mapped to the username in the profile.
Also, when using the Render tab, is there any ‘logic’ e.g. if the field is empyt don’t render it?
Regards
Pete
-
This reply was modified 8 months, 2 weeks ago by
pzh20.
Hello,
There is no “Password Confirm” mechanics provided by ACF. If you want to implement this logic, you can simply add a second Password Field into your Field Group. You can then validate its value is identical to the first Password Field using the
acfe/form/validate_user
hook (see documentation). You’ll find a usage example there.Regarding the “Login Field” mapped as “Username”, well it is mapped like all other fields, from the “Load” tab. You can see it on my video demo at 00:05, and it is set at 00:14.
When you select a field in the “Load” tab, it automatically force the same field in the same setting in the “Save” tab. If you don’t use “Load Values”, then you can directly select it in the “Save” tab.
I’m closing this ticket as the original request is resolved now.
Please open another ticket if you need further assistance.
Thanks.
Regards.
-
This reply was modified 8 months, 2 weeks ago by
- The topic ‘Loading User Profile Fields’ is closed to new replies.