update field with code
-
I am using “ultimate member” for wordpress, and I have a field called agreement_signed. When a logged in user signs an agreement, I want to update the field to “YES”. After they sign, i direct them to: …. website .com/user/username/?sign=yes
I am not a php coder and I struggled with this for hours and came up with this, which works MOST of the time. For whatever reason, it fails about 25% of the time and I don’t know why. It’s ok if you laugh at my code ??
What am I doing wrong?
Thanks,
Tomfunction check_agreement_signed () {
$check = $_REQUEST[‘sign’];
$user_id = get_current_user_id() ;
$agreement = ‘YES’;
if(!empty($check) && $check==’yes’) {
$result = update_user_meta( $user_id, ‘agreement_signed’, $agreement);
echo “<h2><center>Thank you for signing your Adoption Agreement. A copy was emailed to you.</center></h2>”;
}
}
add_filter( ‘um_before_form’, ‘check_agreement_signed’, 1, 2 );The page I need help with: [log in to see the link]
- The topic ‘update field with code’ is closed to new replies.