Support

Account

Home Forums General Issues Querying user ID

Solved

Querying user ID

  • I’m trying to query a user field value. Basically I want to use an if statement based on whether the current user ID matches the custom field ID value in order to show user specific content. I’ve had a few goes with some code snippets but I can’t seem to get anything working.

    Looking through the forums it doesn’t look like anyone else has run into the same issue or wanted to do the same thing.

    Any help is mega appreciated!

  • I’ve looked briefly into comparison operators and tried to get the below code to work with no success. New to PHP so be gentle :/

    <?php $client_id = get_currentuserinfo($user_ID); if ($client_id == get_field('user_select')) : ?>
    <p>Working</p>
    <?php else : ?>
    <p>Not Working</p>
    <?php endif; ?>
  • Hi @higgypop

    Seems like you have created a duplicate thread:
    http://support.advancedcustomfields.com/forums/topic/user-field-user-id/

    Answer is in that thread

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Querying user ID’ is closed to new replies.