• Resolved user1010

    (@user1010)


    Hi there,

    is there any chance to show all reviews done by a certain user?
    I want to display every single review a user has done in his profile page.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Gemini Labs

    (@geminilabs)

    While this isn’t a feature of Site Reviews, it should be possible to do this.

    The code below checks if the current page is an author archive page, if it is, it adds the author ID to the WP_Query that returns the reviews.

    /**
     * Only show reviews submitted by author on their archive page
     * Paste this in your active theme's functions.php file.
     * @param \WP_Query $query
     * @return void
     */
    add_action( 'pre_get_posts', function( $query ) {
        if( $query->get( 'post_type' ) != 'site-review' || !is_author() )return;
        $query->set( 'author', get_the_author_meta( 'ID' ));
    });
    
    • This reply was modified 6 years, 8 months ago by Gemini Labs.
    • This reply was modified 6 years, 8 months ago by Gemini Labs.
    • This reply was modified 6 years, 8 months ago by Gemini Labs.
    • This reply was modified 6 years, 8 months ago by Gemini Labs.
    Plugin Author Gemini Labs

    (@geminilabs)

    I have not heard from you in over a week so I will mark this as resolved.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Show all reviews by user’ is closed to new replies.