Notifications
Clear all

Hook In under Member Name

2 Posts
1 Users
0 Likes
1,079 Views
 MM
(@millennium)
Member Customer
Joined: 6 years ago
Posts: 11
Topic starter  

Hi

Love the plugin however we are working on a bit of customisation.

We use Memberships plugin to control memberships and under peoples name in comments if they have an active membership we would like it to say "Active Member"

I can use something like this to test if they have an active membership

 

$memberships = wc_memberships_get_user_active_memberships( $user_id );

if ( ! empty( $memberships ) ) {
// do something for this active member
echo 'Active';

}

else {
echo 'Inactive';

}

 

Is there a hook to intercept where the commenters name etc is? any idea? would appreciate it!


   
Quote
 MM
(@millennium)
Member Customer
Joined: 6 years ago
Posts: 11
Topic starter  

Or actually is there a hook for under the avatar?

 

I think something like this should work but im not sure of the right hook

 

add_filter('wpdiscuz_after_label', 'wpdiscuz_mem_after_label_html', 110, 2);
function wpdiscuz_mem_after_label_html($afterLabelHtml, $comment) {
$memberships = wc_memberships_get_user_active_memberships( $user_id );

if ( ! empty( $memberships ) ) {
// do something for this active member
//echo 'Active';
$afterLabelHtml .= 'Mega Mystic Member';
}

else {
//echo 'Inactive';

}
return $afterLabelHtml;
}


   
ReplyQuote
Share:
Scroll to top