Support

Account

Home Forums Front-end Issues Front End Form for user meta gallery field

Solved

Front End Form for user meta gallery field

  • I have placed fields on the user page. One of these fields is a gallery. I have a front end form that is suppose to allow the user to upload images for a photo gallery. I have created a custom login system and security is in place. I have used the following form code to place the gallery on the front end page.

    $fields = get_field_objects('user_'.get_current_user_id());
    $settings = array(
    	'id' => 'acf-form',
    	'post_id' => 'user_'.get_current_user_id(),
    	'fields' => array($fields['images']['ID']),
    	'form' => true
    );
    acf_form( $settings );

    The form is displayed and the gallery appears, however the images are not loaded in the gallery and the images do not save when added. I do have the permissions set to give the user upload permissions and the files are being stored. I cant quite figure out where I am going wrong.

  • OK… After a day of messing around and testing everything I found the fix. I dont quite understand why it works in this way but it does. With ID it would display the field with no entries but with key it displays both.

    I had to change
    $fields['images']['ID']
    to
    $fields['images']['key']

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

The topic ‘Front End Form for user meta gallery field’ is closed to new replies.