Tagged: buddypress
Hello
I’m with a private group where monthly subscription will be required to see the content posted on it.
I would like to limit posts to the group administrator and its moderators.
This way the subscribers would not be able to be publishing within the group and also not be able to share the content to the public part they will have on the site
Sorry for replying from another account because you are not able to access the previous one
I have made the group private and am using paid memberships pro to charge memberships and unlock member access within the private group
However the subscribing members of the group have the freedom to be posting within the group
I would like to limit private group posts to group administrators only.
Therefore, the group’s subscribers can only view the content and make comments and could not publish within it.
Hello Robert,
Check the following code it will restrict non-admin users from posting content in the group.
add_action( 'wp_ajax_post_update', function() { $object = isset( $_POST['object'] ) ? sanitize_key( $_POST['object'] ) : ''; $item_id = isset( $_POST['item_id'] ) ? absint( $_POST['item_id'] ) : ''; if ( bp_is_group() ) { $item_id = bp_get_current_group_id(); $object = 'group'; } if ( 'group' != $object ) { return; } if ( ! groups_is_user_admin( get_current_user_id(), $item_id ) ) { wp_send_json_error( array( 'message' => __( 'You are not allowed to post.', 'buddypress' ), ) ); } }, 9 );
Regards
Ravi
You must be logged in to reply to this topic.