Jump to content
Old threads will finally start getting archived ×

DatJackal

New Members
  • Posts

    1
  • Joined

  • Last visited

Everything posted by DatJackal

  1. I agree with ginerjm, you should edit your post to include some punctuation, grammar and put your code in the proper code tags and explaining a little more on the issue.. From what i've been able to understand from your question, you are after the following A formula/way to list users who have liked a blog post.Doing this depends on how the data is stored, you would need to have an database query to get users who haved like a post (refer below) "SELECT * FROM blog_likes WHERE blog_id = 1" Replacing the blog_id with the specific blog_id, your function you supplied dictates that you can specify a post id, site id, seperator and anonymous.. To get those, you would need to add more to your select statement. I suggest you have a quick readover the mySQL documentation http://dev.mysql.com/doc/refman/5.7/en/select.html With your second function, it seems you are asking for the id of each user who has liked the blog post, to get that, you could do the following: foreach($the_users_who_favorited_post as $key=>$value){ $user = get_userdatabylogin($value->fk_user_id); if($user) echo $user->ID; } The above snippet would loop through your users list and get the user object and print the user id. Your last function, which seems to be asking on how to get the avatar, you would use the same thing as above but adding in the get_avatar function... foreach($the_users_who_favorited_post as $key=>$value){ $user = get_userdatabylogin($value->fk_user_id); if($user){ $user->user_avatar = get_avatar($user->ID,'100'); } } The above will set an index in the user object called "user_avatar" to contain the data returned from "get_avatar" using the users id you got from the user object... I hope this has helped.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.