Support

Account

Forum Replies Created

  • Oh I think I cracked it!

    the_field('state', 'user_'.$user->ID ) passes along the user ID properly for the correct user, and it prints the information properly.

    I still have no idea why $other_user_id won’t pass the ID correctly, and unfortunately I don’t think I know enough about php to determine why either. But hopefully this solution will help someone else looking to do something similar.

  • This is a fresh install running TwentyTwenty-one theme. I have 2 other plugins running, but even with those disabled I can’t get it to function in this sense.

    Basically I’m seeing 2 issues here. The first being that I can’t get any user ID to work when used in the_field('state', 'user_' . $other_user_id ); because when I echo $other_user_id, it does give me *a* user ID, though maybe not the one that I want. When used in the_field('state', 'user_' . $other_user_id ); there is no output. The second issue being I’m trying to produce the user ID not for the page/post author, but for each user in order in that particular role type. If I can get either of these resolved in some manner, it’s going to get me closer to a solution.

    Any idea regarding the_field('state', 'user_' . $other_user_id );? Is there an instance of a usage like this that works for you or has been known to work?

  • When using the code you provided, it shows information for the post author user.

    I can return the post author (and current user) ID just fine, but when it’s supposed to be appended like the_field('state', 'user_' . $other_user_id ); it doesn’t seem to work. If I change ‘user_’ to any user ID in use (i.e. ‘user_3’), it returns the right information in that field.

  • Yes, inside the standard post loop. Currently, I am using it inside of a shortcode, although I have tried it inside of a template page too and can’t get that to work either.

    Here’s what my shortcode looks like:

      function print_members( $atts ) {
        		$args = array(
        'role'    => 'pmpro_role_2',
        'orderby' => 'last_name',
        'order'   => 'ASC'
    );
    
    $users = get_users( $args );
    $other_user_id = get_the_author_meta('ID');
    
    echo '<div>';
    foreach ( $users as $user ) {
    	echo '<div><h3>' . esc_html( $user->first_name ) . ' ' . esc_html( $user->last_name ) . '</h3>';
    	echo '<p>Email: <a href="mailto:' . esc_html( $user->user_email ) . '">' . esc_html( $user->user_email ) . '</a></p>';
    	echo '<p>Mailing Address: ';
    	echo the_field('address_line_1', 'user_'. $other_user_id );
    	echo '<br>';
        echo the_field('address_line_2', 'user_' . $other_user_id );
    	echo '<br>';
    	echo the_field('city', 'user_'. $other_user_id );
    	echo ', ';
    	echo the_field('state', 'user_'. $other_user_id );
    	echo'<p></div>';
    }
    echo '</div>';
    }
    add_shortcode('member-list', 'print_members');
  • Same problem. I am using pro with unlimited licenses and it keeps giving me “update package not found”.

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