Notifications
Clear all

Hook In under Member Name

2 Posts
1 Users
0 Reactions
1,248 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