sylargaf
sylargaf

Reputation: 522

Update ACF User Radio Button After Gravity Form Submit

having a issue with getting a ACF field associated with a user profile to update after a gravity form submission. As it stands, this logic currently does nothing :(. So i'm hoping someone can help out. Here is waht I have so far:

//changes studio status after those forms submit
function update_user_tour_status($entry, $form){
    $user_id = $entry['created_by'];
    $state = update_user_meta('user_'.$user_id, 'artist_tour_status', 'studio');
}
add_action('gform_after_submisson_7', 'update_user_tour_status', 10, 2);

So it should be pretty straight forward I would image, but it just seems to do nothing.

Upvotes: 0

Views: 364

Answers (2)

Bhautik
Bhautik

Reputation: 11282

Check update_user_meta()

//changes studio status after those forms submit
function update_user_tour_status( $entry, $form ){
    $user_id = $entry['created_by'];
    $state   = update_user_meta( $user_id, 'artist_tour_status', 'studio' );
}
add_action( 'gform_after_submisson_7', 'update_user_tour_status', 10, 2 );

Upvotes: 1

Kristófer
Kristófer

Reputation: 95

According to the update_user_meta(); reference, the first argument should only be the user's ID. user_ does not need to be appended, as the function expects an integer, not a string. Drop the user_ prefix, and it should work like a charm.

Upvotes: 1

Related Questions