Hello,
I need a little help, I would greatly appreciate if someone helped me with this.
I have 3 functions, and I want to make them work the following way:
Function 1:
This function gives me a list of users who liked a blog post. It gives me an HTML list. I want a formula which filters the output giving me ONLY the first value of the list. Or only the second value. Or only the third value.
the_users_who_favorited_post($post_id = null, $site_id = null, $separator = 'list', $include_anonymous = true, $anonymous_label = 'Anonymous Users', $anonymous_label_single = 'Anonymous User');
Example of output:
John
Albert
Mary
I want to filter the list and obtain only the first value:
John.
Or obtain only the second:
Albert
Function 2:
This function gives me the ID of the user. And I need to bring the value from the Function 1 and insert in this functon 2:
<?php
$user = get_userdatabylogin('value from function 1 here');
if($user){
echo $user->ID;
}
?>
The output from function 1 goes "value from function 1 here". And it will give me the ID.
Function 3:
This code will give me the user avatar, from the ID i obtain from function 2.
<?php echo get_avatar( ID goes here , '100' ); ?>
The output from function 2 goes "ID goes here". And it will give me the profile avatar picture.
I need to join these formulas together, and make them work.
Does anyone know how to do this?
Thanks.