WordPress.org

Forums

WP Favorite Posts
[resolved] View favorite posts of an user (2 posts)

  1. wzshop
    Member
    Posted 2 years ago #

    Hi,
    First of all: great plugin. Almost exactly what I was looking for;) One request though; I would like to know if it is possible to list all favorites of a certain user. For instance by going to the author page.

    Any suggestions?
    Thanks a lot!

    http://wordpress.org/extend/plugins/wp-favorite-posts/

  2. wzshop
    Member
    Posted 2 years ago #

    Working code is:

    <?php
    $curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author)); ?>
    
    <?php $user_favs = wpfp_get_users_favorites($curauth->display_name); ?>
    <?php
    if(!$user_favs) { echo "No favorites yet."; } else{
    	?>
        <ul><?php
    foreach ($user_favs as $user_fav)
      {
    echo "<li><a href='".get_permalink($user_fav)."' title='". get_the_title($user_fav) ."'>" . get_the_title($user_fav) . "</a></li>";
      };?></ul><?php }?>

    Cheers.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP Favorite Posts
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic