Skip to content

Doesnt support ACF pro #1

@drewjohnstone

Description

@drewjohnstone

Hi,
I'm using this on my site, however it didnt support ACF Pro so I just changed the code to check that instead of ACF.

Also, it wouldnt show any fields so I had to change the main code use the ACF get fields call:

` public static function get_options() {
// The fields that the user can pick as a custom user login field.
$field_options = [];

$field_groups = acf_get_field_groups();

if ( !empty($field_groups) ) {
    foreach ( $field_groups as $field_group ) {
        // Check if the field group's location is set to display on the user form
        if ( isset( $field_group['location'] ) ) {
            foreach ( $field_group['location'] as $location_rules ) {
                foreach ( $location_rules as $rule ) {
                    if ( $rule['param'] == 'user_form' ) {
                        // Now fetch the fields for this group
                        $fields = acf_get_fields( $field_group['key'] );

                        if ( !empty( $fields ) ) {
                            foreach ( $fields as $field ) {
                                $field_label = $field['label'];
                                $field_id = $field['name'];
                                $field_options[$field_id] = $field_label;
                            }
                        }
                    }
                }
            }
        }
    }
}

return $field_options;

}`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions