• Resolved samngel

    (@samngel)


    Hi everyone,

    I’m having an issue with displaying the correct average ratings from Site Reviews on the profile cards in the Ultimate Member directory. Here’s the situation:

    I’ve successfully implemented the shortcode from Site Reviews to display the average ratings on individual profile pages using this code:

    [site_reviews_summary assigned_users="user_id" hide="bars,summary,text,count"]

    This works perfectly on the profile pages, showing the correct average for each user. However, when I try to add the same shortcode to the profile cards in the member directory (using Ultimate Member), it doesn’t display the correct average for each member. Instead, it either shows the same rating for all users or the rating of the logged-in user (depending on the setup).

    I’m looking for guidance on how to ensure that each profile card in the directory shows the correct average rating specific to the user on that card, rather than a global or incorrect rating. Is there a way to modify the shortcode or my setup to achieve this?

    Any advice or suggestions would be greatly appreciated! Thank you in advance for your help.

    Best regards.

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

    (@geminilabs)

    Have you tried using profile_id?

    Thread Starter samngel

    (@samngel)

    Thank you for the suggestion to use profile_id.

    I tried using profile_id in the shortcode like this:

    [site_reviews_summary assigned_users="profile_id" hide="bars,summary,text,count"]

    However, the issue persists: all users in the Ultimate Member profile directory still show the same average rating. It seems that profile_id is not correctly retrieving the individual user’s reviews for each profile card, and instead, the same rating is applied to all users.

    Is there something specific I should check in how Ultimate Member passes the profile_id for each card in the members’ directory? Or could there be another approach to dynamically display the correct average rating for each user?

    Thanks again for your help! Any further guidance would be appreciated.

    Plugin Author Gemini Labs

    (@geminilabs)

    Site Reviews uses the Ultimate Member um_get_requested_user() function to get the profile ID.

    If that’s not working, you can use the following filter hook to modify it:

    add_filter('site-reviews/assigned_users/profile_id', function (int $profileId): int {
    // change the profile ID here
    return $profileId;
    });
    Thread Starter samngel

    (@samngel)

    Hello,

    Thank you for your previous suggestion regarding the hook filter site-reviews/assigned_users/profile_id. I implemented the code you shared, but unfortunately, the correct user-specific reviews are still not showing on the Ultimate Member profile cards. The reviews displayed appear to be the same across all users, rather than being tied to the individual profile.

    Here’s the code I used:

    add_filter('site-reviews/assigned_users/profile_id', function ($profileId) {
    return um_get_requested_user();
    });


    I also added the function to display the reviews using this shortcode:

    echo do_shortcode('[site_reviews_summary assigned_users="' . $user_id . '" hide="bars,summary"]');

    Even with this setup, the reviews don’t seem to be dynamically fetching the correct user-specific data. It always displays the same review summary regardless of the profile.

    Is there something I might be missing in terms of correctly linking the profile ID to the reviews on each individual card? Could you advise on a more detailed way to ensure that the reviews are correctly tied to each user’s profile?

    Thank you for your help.

    Plugin Author Gemini Labs

    (@geminilabs)

    What does this show in your profile cards?

    echo sprintf('User ID: %s', um_get_requested_user());

    And, have your reviews been assigned to your users?

    Thread Starter samngel

    (@samngel)

    Hello,

    I tried using the code you suggested to display the user ID with um_get_requested_user(), but it’s still not showing anything in my profile cards. Here’s what I tried:

    echo sprintf('User ID: %s', um_get_requested_user());

    However, the user ID does not display. I also tried another hook to retrieve the user ID from the profile cards, but with no success. The reviews are correctly assigned to the users in Site Reviews, but I still can’t get the average reviews to display properly for each user on their Ultimate Member profile cards.

    Do you have any other ideas on how to proceed or any suggestions to fix this?

    Thanks in advance for your help!

    Plugin Author Gemini Labs

    (@geminilabs)

    Site Reviews can only get the User ID from the profile_id option if the Ultimate Member um_get_requested_user() function is working.

    How are you displaying the profile cards, are you using some custom code or is that functionality baked into Ultimate Member plugin?

    Thread Starter samngel

    (@samngel)

    I have displayed the member directory in two different ways:

    1. Using the block added by the Kadence theme.
    2. Using the Ultimate Member directory shortcode.

    The link to the page is: https://biharmonie.com/membres/

    The form for leaving reviews on a profile uses this shortcode:

    [site_reviews_form assigned_users="profile_id" hide="content,email,images,name,terms,title"]

    And the average reviews are displayed on profiles with this shortcode:

    [site_reviews_summary assigned_users="profile_id" hide="bars,summary,text,count"]

    Plugin Author Gemini Labs

    (@geminilabs)

    And how are you adding the [site_reviews_summary] shortcode to the profile cards?

    Thread Starter samngel

    (@samngel)

    I have integrated the [site_reviews_summary] shortcode in two ways:

    1. By modifying the Ultimate Member profile cards template directly.
    2. Using the Code Snippets plugin to add the shortcode dynamically to the profile cards.

    Despite these attempts, the reviews are not displaying correctly. I’m not sure if it’s related to the interaction between Site Reviews and the um_get_requested_user() function or something else.

    Plugin Author Gemini Labs

    (@geminilabs)

    It’s not working for you because Ultimate Member gets the list of users with Ajax and it does not use The Loop in the template files.

    I will look into adding an integration for this which can be enabled in the settings.

    Thread Starter samngel

    (@samngel)

    Thank you for the explanation! It makes sense now that the issue is due to Ultimate Member using Ajax to load the user list instead of The Loop. I appreciate you looking into adding an integration for this, and I look forward to seeing this feature in the settings.

    Plugin Author Gemini Labs

    (@geminilabs)

    Coming in Site Reviews v7.2.0:

    Thread Starter samngel

    (@samngel)

    Thank you for the update! I’m glad to hear that an integration with Ultimate Member will be added in the next version of Site Reviews. This will certainly help with the current issue I’m facing. I’ll keep an eye out for the release and test it as soon as it’s available.

    Thanks again for your support!

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