title: ACF update_field associated with a User
body: <p>I've created some custom fields on the user profile page in WordPress. </p>
  
  <p>I've managed to build a front end editor for the user to change some e-mail preferences:</p>
  
  <pre><code>&lt;?php if( isset($_POST['preferences']) ) :
  
      update_field('planner-reminders', $_POST['planner-reminders'], 'user_'.$user_id.'');
      update_field('event-suggestions', $_POST['event-suggestions'], 'user_'.$user_id.'');
      update_field('woa-updates', $_POST['woa-updates'], 'user_'.$user_id.'');
  
      echo '&lt;p class="success"&gt;E-Mail Prefereneces Updated&lt;p&gt;';
  
  endif; ?&gt;
  
  &lt;form action="&lt;?php the_permalink(); ?&gt;" method="POST" class="user-email-settings"&gt;
  
      &lt;!-- planner reminders --&gt;
      &lt;?php 
          $field = get_field('planner-reminders', 'user_'.$user_id.'');
          if( $field == true ) {
              $field = '1';
              $checked = true;
          }
      ?&gt;
      &lt;input type="checkbox" id="planner-reminders" name="planner-reminders" class="pref"
      value="&lt;?php echo $field; ?&gt;" &lt;?php if($checked) :?&gt; checked &lt;?php endif;?&gt; /&gt;
      &lt;label for="planner-reminders"&gt;I don't want to revieve reminders about events I've added to my planner.&lt;/label&gt;
      &lt;?php $checked = false; ?&gt;
  
  
      &lt;!-- event suggestions from WOA --&gt;
      &lt;?php 
          $field = get_field('event-suggestions', 'user_'.$user_id.'');
          if( $field == true ) {
              $field = '1';
              $checked = true;
          }
      ?&gt;
      &lt;input type="checkbox" id="event-suggestions" name="event-suggestions" class="pref"
      value="&lt;?php echo $field; ?&gt;" &lt;?php if($checked) :?&gt; checked &lt;?php endif;?&gt; /&gt;
      &lt;label for="event-suggestions"&gt;I don't want to recieve suggestions about events I may be interested in.&lt;/label&gt;
      &lt;?php $checked = false; ?&gt;
  
  
  
      &lt;!-- updates from WOA --&gt;
      &lt;?php 
          $field = get_field('woa-updates', 'user_'.$user_id.'');
          if( $field == true ) {
              $field = '1';
              $checked = true;
          }
      ?&gt;
      &lt;input type="checkbox" id="woa-updates" name="woa-updates" class="pref"
      value="&lt;?php echo $field; ?&gt;" &lt;?php if($checked) :?&gt; checked &lt;?php endif;?&gt; /&gt;
      &lt;label for="woa-updates"&gt;I don't want to recieve e-mail updates from What's On Advisor.&lt;/label&gt;
      &lt;?php $checked = false; ?&gt;
  
      &lt;input type="submit" value="Save Preferences" name="preferences" id="preferences" /&gt;
  
  &lt;/form&gt;
  </code></pre>
  
  <p>Now, this actually seems to work. If I update a checkbox it shows and checked/unchecked as it should, and it shows correctly in the front end and the back end.</p>
  
  <p>But, when I try to query this setting with a <code>wp_query</code> to actually send the e-mails to those who haven't opted out, it bug out a little.</p>
  
  <p>If the user opts out, then opts back in, the wp_query doens't pick them up. It only picks them up when I go into the wp-admin area and update their user profile. I don't actually have to change anything, just open the user up and click update.</p>
  
  <p>Here's the wp_query just incase:</p>
  
  <pre><code>&lt;?php $args = array(
      'role' =&gt; 'Subscriber',
      'meta_key' =&gt; 'planner-reminders',
      'meta_value' =&gt; '0',
      'meta_compare' =&gt; '=='
  ); ?&gt;
  
  &lt;?php $user_query = new WP_User_Query( $args ); ?&gt;
  
  &lt;?php if ( ! empty( $user_query-&gt;results ) ) : ?&gt;
  </code></pre>
  
  <p><code>etc.</code> <code>etc.</code></p>
  
  <p>Any ideas how I can get this working properly? Is there a function to fake a click on the 'Update User' button in wp-admin?</p>
  
  <p>Thanks.</p>