Support

Account

Home Forums Front-end Issues No Documentation for Displaying User Data Reply To: No Documentation for Displaying User Data

  • Here’s what I ended up doing, feedback is welcome though:

    echo "<ul>";
    
    	$args = array(
    		 'orderby' => 'asc',
    		 'post_type' => 'recap',
    	);
    	$recaps = get_posts( $args );
    	$user_ID = get_current_user_id();
    	
    	foreach ( $recaps as $recap ) : setup_postdata( $recap );
    						
    		// Get the User selected as Customer.
    		$field_key = "field_546162f4a416d";
    		$post_id = $recap->ID;
    		$field = get_field_object($field_key, $post_id);
    		$values = $field['value'];
    			
    		if ( in_array( 898, $values ) ) {
    			echo '<li><h3><a href="' . get_permalink($recap->ID) . '">' . $recap->post_title . '</a></h3></li>';
    		} else {
    			echo "<h4>You do not currently have any Recaps.</h4>";
    		}
    	
    	endforeach;