• Resolved jan

    (@sakado)


    Is it possible to get get an overview of the latest location of all users?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Florian Ziegler

    (@florianziegler)

    Hi!

    You could use something like this:

    function make_user_location_table() {
    	$users = get_users( array(
    		'fields'	=> array( 'id', 'display_name' ),
    		'meta_key'	=> 'whab_location_data'
    	));
    
    	$output = '<table><thead><tr><th>User</th><th>Location</th></tr></thead><tbody>';
    	
    	foreach ( $users as $user ) {
    		$output .= '<tr><td>' . $user->display_name . '</td>';
    		$location = get_user_meta( $user->id, 'whab_location_data', true );
    		$output .= '<td>' . $location['location_name'] . '</td></tr>';
    	}
    
    	$output .= '</tbody></table>';
    	
    	return $output;
    }
    add_shortcode( 'my_user_locations', 'make_user_location_table' );
    

    Put this code into your theme’s functions.php. Then use the shortcode my_user_locations to display a table of all users that have set their location using Whereabouts.

    Thread Starter jan

    (@sakado)

    thx !

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘overview’ is closed to new replies.