Hi Johan,
I can provide code for disabling the commenting.I currently do not use Paid Membership Pro or Woo Subscription, so, you will need to get some sample code for them to check the membership.
Regards
BrajeshHi Johan,
Please give them your membership level/subscription and ask them how to check if a user has one of the given subscriptions.Regards
BrajeshThis is what they replied me. What do u think?
You are able to use the function pmpro_hasMembershipLevel or pmpro_getMembershipLevelForUser.
When you need the code of a level, do you need to get the level object?
A good place to start is to search the functions.php file for specifics – https://github.com/strangerstudios/paid-memberships-pro/blob/dev/includes/functions.php
Please let me know what information you specifically need for the level code
Thank you. I will post an exmaple today.
Regards
BrajeshHi Johan,
Thank you for the patience.Please update the allowed level with correct ids and you may use the following in your bp-custom.pp
add_filter( 'bp_activity_can_comment', function ( $can ) { $logged_id = bp_loggedin_user_id(); if ( ! function_exists( 'pmpro_getMembershipLevelForUser' ) || ! is_user_logged_in() || bp_get_activity_user_id() == $logged_id || is_super_admin() ) { return $can; } $level = pmpro_getMembershipLevelForUser( $logged_id ); if ( ! $level ) { return false; } $allowed_levels = array( 1, 2 ); if ( ! in_array( $level->id, $allowed_levels ) ) { $can = false; } return $can; } );
Regards
Brajesh
You must be logged in to reply to this topic.