Support » Plugin: Site Reviews » Integrating Reviews with “My Profile” Page

  • Resolved pecondie

    (@pecondie)


    Hi all,

    For my current site, I’m attempting to link reviews written by users to their “my profile” page. Is there a way to do this with Site Reviews? Any advice would be helpful! Thanks!

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

    (@geminilabs)

    You can do something like this:

    /**
     * Restrict reviews to those created by a specific user
     * Paste this in your active theme's functions.php file.
     * @param array $query
     * @param array $shortcodeArgs
     * @return array
     */
    add_filter('site-reviews/get/reviews/query', function ($query, $shortcodeArgs) {
        $isUserPage = false; // <- Perform a check here to only run on the author page
        $userId = 0; // <- set the user ID here
        if ($isUserPage && $userId) {
            $query['author'] = $userId;
        }
        return $query;
    }, 10, 2);

    Note: It is not possible to do this with the summary.

    Plugin Author Gemini Labs

    (@geminilabs)

    Alternatively, you can do this instead: https://pastebin.com/hBs9zJWj

    This will automatically create a unique Site Reviews category for every user that submits a review. You can then use these categories to filter reviews by user.

    This method will also work for review summaries.

    Thanks! This helped integrate the account user name to the review and categorized reviews based on user, however, it is not visible on the person’s account profile page. I am using the “ultimate member” plugin for account profiles and it shows posts/comments, however, not categories or the reviews. Is there a way around this/a different account plugin you would recommend?

    Plugin Author Gemini Labs

    (@geminilabs)

    @pecondie @ultimatemember

    Please see this: https://docs.ultimatemember.com/article/69-how-do-i-add-my-extra-tabs-to-user-profiles

    And this: https://docs.ultimatemember.com/article/64-extending-ultimate-member-profile-menu-using-hooks

    To use the shortcodes with this method, you will need to use the do_shortcode function.

    For example:

    <?php
    
    $userCategorySlug = 'u_'.um_profile_id();
    $shortcode = sprintf('[site_reviews category=%s]', $userCategorySlug);
    echo do_shortcode($shortcode);
    
    

    Please contact the Ultimate Member team directly if you require further help with their plugin.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.