Support

Account

Home Forums Front-end Issues Display field data based on logged in user

Solving

Display field data based on logged in user

  • I have a repeater field, wherein the other admins can select a user and then enter a link that is specifically for that user.

    Any advice on how I can then display that link on the frontend, but only to that specific logged in user? Is it even possible to do so?

  • 
    if (is_user_logged_in()) {
      if (have_rows('repeater-field-name')) {
        $user_id = get_current_user_id();
        while (have_rows('repeater-field-name')) {
          the_row();
          if (get_sub_field('user_id') != $user_id) {
            // skip
            continue;
          } // end if not for current user
          // display row content here
        } // end while have rows
      } // end if have rows
    } // end if user logged in
    
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.