diff --git a/composer.json b/composer.json index 685ed19..7cd4d7b 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "version": "1.1.2", + "version": "1.1.3", "name": "zngly/wp-graphql-acf-mutations", "description": "ACF Mutations for WP GraphQL", "homepage": "https://github.com/zngly/wp-graphql-acf-mutations", diff --git a/package.json b/package.json index 6c679f5..f200153 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wp-graphql-acf-mutations", - "version": "1.1.2", + "version": "1.1.3", "description": "wp-graphql-acf-mutations", "homepage": "https://github.com/zngly/wp-graphql-acf-mutations#readme", "author": "Vlad-Anton Medves", diff --git a/src/mutations/mutations.php b/src/mutations/mutations.php index c85aff4..f5fff22 100644 --- a/src/mutations/mutations.php +++ b/src/mutations/mutations.php @@ -5,15 +5,9 @@ use Zngly\ACFM\Mutations\PostObject; use Zngly\ACFM\Mutations\MediaItem; use Zngly\ACFM\Mutations\Taxonomy; - +use Zngly\ACFM\Mutations\UserObject; use Zngly\ACFM\Utils as ACFMUtils; -// add_action('graphql_post_object_mutation_update_additional_data', function ($post_id, $input, $post_type_object) { -// if ($post_type_object->name === "my_post_type") { -// if (isset($input['customInput'])) update_post_meta($post_id, 'custom_input', $input['customInput']); -// } -// }, 10, 3); - /** * Mutations class. * Maps the above comment to acf fields @@ -25,6 +19,7 @@ public static function registerMutations() { new MediaItem(); new PostObject(); + new UserObject(); new Taxonomy(); } @@ -144,6 +139,9 @@ public static function update_single_field($id, $value, $field_name, $field_type if (self::should_update($value)) update_field($field_name, $value, $post_id); else delete_field($field_name, $post_id); + } else if ($type_name === 'User') { + if (self::should_update($value)) update_user_meta($id, $field_name, $value); + else delete_user_meta($id, $field_name); } else { if (self::should_update($value)) update_field($field_name, $value, $id); else delete_field($field_name, $id); diff --git a/src/mutations/userObject.php b/src/mutations/userObject.php new file mode 100644 index 0000000..c9ca690 --- /dev/null +++ b/src/mutations/userObject.php @@ -0,0 +1,15 @@ +