Support

Account

Home Forums General Issues Get ACF fields for Live Edit plugin (by Elliot)

Solved

Get ACF fields for Live Edit plugin (by Elliot)

  • So I’m wanting to use Elliot’s LiveEdit plugin https://wordpress.org/plugins/live-edit/ to allow users to update their profile information. Similar to the method here http://support.advancedcustomfields.com/forums/topic/front-end-and-custom-user-meta/ where you pass in the user ID of the logged in user. LiveEdit works if I pass in the ACF field names, but not for anything in the users table.

    For example:
    <?php if(function_exists("live_edit")){ live_edit(array('avatar_upload','user_nicename'), 'user_'.$current_user->ID); }?>
    will give me the ACF field called ‘avatar_upload’ but not the user_nicename from the wp_users database table. I can live with this by adding new custom fields for name, description, etc. However, it would be nice to be able to access them regardless.

    So my next question that goes along with this, is how can I loop through a field group and get all the names of the fields. In the wp_posts table, ACF stores the field-groups as posts. So I can get all the acf-field post types with a post parent of the field group, but I don’t know all the SQL stuff to return those names to an array to send to LiveEdit.

    In the end I would like to run something like:
    live_edit($field_names, 'user_'.$current_user->ID); where $field_names is an array of all the fields from a specific group regardless of if they have a value or not. ACFs function get_fields(); will only return fields with values assigned to them, but users won’t necessarily fill out all their profile fields at once.

    Thanks!

  • “I had some free time and decided to take a stab at recreating a standalone function similar to the one used to get all the fields from a group in the acf_form(); function. You can view a gist of it at https://gist.github.com/Daronspence/4ec625d1e371543dfa93

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Get ACF fields for Live Edit plugin (by Elliot)’ is closed to new replies.