OK, I had thought of a couple ideas to try this morning, and things came together. Let me post my revised code. Essentially, I tried to follow the natural formatting to see if I could get everything to fall in line further along. I decided to convert the initial variable to an array, and that is what made everything else fall in line.
// get mentor & new mentee user arrays from the Match Metadata fields
$mentor = get_field(‘match_mentor’, $post_id);
$mentee = get_field(‘match_mentee’, $post_id);
//get ID from mentor array
$match_mentor_id = $mentor[‘ID’];
//get ID from mentee array
$match_mentee_id = $mentee[‘ID’];
//set up the mentor user_post_id
$mentor_post_id = “user_”.$match_mentor_id;
//get user array from mentor curent_users
$current_mentees = get_field(‘current_mentees’, $mentor_post_id, false);
// see if the current mentees is null or has a mentee already
if ($current_mentees == ”){
//put data in proper format
$current_mentees = array();
}
//combine old mentee(s) with new mentee
array_push( $current_mentees , $match_mentee_id);
//write new current mentees back to the Mentor User Meta fields
update_field(‘current_mentees’ , $current_mentees , $mentor_post_id);