Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • hi thank for reply Alimir..i think some people need a shortcode for this very good plugin..display user like..

    Hi, imborx . my post is just an example. for your shortcode that depend if you want only a basic list, or if you want a list with post thumbnail of post and pagination etc.. Also i think buddypress/wpulike use different user id that wordpress user. so need check how to get user id from buddypress. The way is the same but i not have a predefined answer for your shortcode.

    hi, Here is my “coding” way for get user liked post by user on author page.
    wpulike use a custom table that store the data. so i get an array of post_id liked by a specific user_id

    like that in my author.php :

    global $wpdb;
    $array_liked_post = $wpdb->get_results( “SELECT post_id
    FROM “.$wpdb->prefix.”ulike
    WHERE user_id = ‘$author_id’
    AND status = ‘like'”
    );
    // convert object result to an array of post_id
    $array_liked_post = array_map(function($oObject){
    $aConverted = get_object_vars($oObject);
    return $aConverted[‘post_id’];
    }, $array_liked_post);

    after you can make a wordpress query with ‘post__in’ => $array_liked_post
    That will give you the post liked by the user

    $args = array(
    ‘post_type’ => ‘post’,
    ‘post__in’ => $array_liked_post,
    ‘post_status’ => ‘publish’,
    );

    with that can make a shorcode or a function . Hope can help..

Viewing 3 replies - 1 through 3 (of 3 total)