Hi guys,
i'm struggling to show the jReviews user avatar in the comments, basically i started this topic Cannot add php code in theme files – How-to and Troubleshooting – wpDiscuz Support Forum, since the plan was to add the php directly but as you explained i have to use custom shortcode with the php there.
So i've done that, but i cannot get the id of the user who is the poster of the comment, so i'm seeing specific avatars (from user id = 1) on all comments.
In the override for the avatar view i have:
<div class="{AVATAR_WRAPPER_CLASSES}">
[useravatar]
<div class="userinfo">
</div>
<div class="auth">{AUTHOR}</div>
</div>
And in functions.php i have:
function useravatar_link() {
ob_start();
require_once ABSPATH.'/wp-content/plugins/jreviews/jreviews/framework.php';
S2App::import('Component','userprofiles_profile','jreviews');
S2App::import('Model','everywhere_com_content','jreviews');
$profile = UserprofilesProfileComponent::getOneProfile($userId = "1");
echo '<img class="avatar avatar-64 photo" src="'.$profile['MainMedia']['media_info']['thumbnail']['65x65c']['url'].'">';
return ob_get_clean();
}
add_shortcode('useravatar', 'useravatar_link');
add_filter("wpdiscuz_comment_end", function ($commentOutput, $comment, $depth, $args) {
if ($depth > 2) {
$commentOutput .= "[useravatar]";
}
return $commentOutput;
}, 10, 4);
As you can see here in the line "$profile = UserprofilesProfileComponent::getOneProfile($userId = "1");" i need to put the user id of the comment poster instead of "1". So could you please let me know how can i get that?
Dear @baze,
Please note that we don't support any kinds of customizations. Just a bit hint.
$profile = UserprofilesProfileComponent::getOneProfile($userId = "1");
You'll need to paste the right value for the $userId. Don't add just 1.

