[buddypress-dev] List of users with avatar (now list of First and
Last names)
Andy Peatling
andypeatling at automattic.com
Wed Jul 16 16:51:12 GMT 2008
On 14-Jul-08, at 12:20 PM, Wessel van Rensburg wrote:
> How do I modify the code below to get a list of First and Last names?
If you get the latest version from SVN trunk you will see the first
and last names.
Andy
>
>> On 8-Jul-08, at 10:05 AM, Brian L. Brey wrote:
>
>> Anyone create code to display a list of members with their avatar
>> and name (or similar)?
>
> I'm working on the friends component right now, which will essentially
> do this.
>
> If you want to list members, you can just query the users table, and
> then get their avatar and link based on their id.
>
> <?php
> $users = $wpdb->get_results ( $wpdb->prepare( "SELECT id FROM
> wp_users" ) );
> for ( $i = 0; $i < count($users); $i++ ) {
> $bp_users[] = array(
> 'avatar' => xprofile_get_avatar( $users[$i]->id, 1 ),
> 'link' => bp_core_get_userlink( $users[$i]->id )
> );
> }
> ?>
>
> Then you can loop through and do whatever you want with $bp_users:
>
> <?php
> for ( $i = 0; $i < count($bp_users); $i++ ) {
> echo '<p>' . $bp_users[$i]['avatar'] . '</p>';
> echo '<p>' . $bp_users[$i]['link'] . '</p>';
> }
> ?>
>
> I haven't tested or even tried that code, but it should work if I
> haven't made any typos.
>
> Andy
>
> --
> *
>
> * Wessel van Rensburg
> ZuluZulu
>
> + 44 2071933026 (o)
> + 44 7530341889 (m)
> + 27 7658 71271
>
> * wessel at zuluzulu.net
> * Skype: wildebees
> * http://zuluzulu.net
> _______________________________________________
> buddypress-dev mailing list
> buddypress-dev at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/buddypress-dev
More information about the buddypress-dev
mailing list