Home › Forums › WPLMS AddOns › WPLMS Batches › member restrictions
- This topic has 9 replies, 2 voices, and was last updated 1 year, 2 months ago by Anshuman Sahu.
-
AuthorPosts
-
August 18, 2023 at 7:22 pm #388898MLP LMSParticipant
how can i restrict member from doing certain things.
below here inst Zaman is instructor as member type and instructor role in the system.
- but in batch he is moderator
- he is still able to remove batch admin (how come)
- he can edit courses
- he can change / give marks status and remaks of students.
i have changed his role to editor and author but still no change.
how can i control member rights, restrict a certain member from doing certain things in batch, students, quizes etc.
August 19, 2023 at 8:10 pm #388916Anshuman SahuKeymasterif you want all mods should not be able to add members to all groups then we can do this using custom code .
add this code in your wplms-customizer.php file in wplms customizer plugin :
add_filter('vibebp_groups_api_can_add_members',function($x,$group_id,$user_id){
$admins = groups_get_group_admins($group_id);
if(!empty($admins)){
foreach ($admins as $key => $mod) {
if($mod->user_id==$user_id){
break;
return true;
}
}
}
return false;
},10,3);
August 23, 2023 at 12:40 pm #389051MLP LMSParticipantcan you guide the route for the file wherein this code is to be embeded.
August 23, 2023 at 8:25 pm #389073Anshuman SahuKeymasterPlease download and install this plugin : https://wplms.io/support/wp-content/uploads/2023/08/wplms-customizer.zip
then in wp-admin -> plugins ->plugins editor -> select wplms customizer plugin to edit -> in the wplms-customizer.php file add the code in the end and update the changes.
August 24, 2023 at 6:11 pm #389106MLP LMSParticipantthank you this code works
further how can i enable / disbale option for moderator
1- to create groups
2- as well as to invite members well.
August 25, 2023 at 9:51 pm #389147Anshuman SahuKeymasterPlease goto wp-admin -> settings -> buddypress-> options > " Group Creation " disable this option .
add this code in your wplms-customizer.php file in wplms customizer plugin :
add_filter('vibebp_groups_api_can_invite',function($x,$group_id,$user_id){
$admins = groups_get_group_admins($group_id);
if(!empty($admins)){
foreach ($admins as $key => $mod) {
if($mod->user_id==$user_id){
break;
return true;
}
}
}
return false;
},10,3);
August 28, 2023 at 1:06 pm #389211MLP LMSParticipantHi
i have tried this code this doesnt work for a an instructor who is also moderator of in some group.
but if i have changed a group moderator default role from instructor to parents then it does work.
response is awaited
August 29, 2023 at 7:24 pm #389243Anshuman SahuKeymasterHi this code allows only admin of the group to invite the user and it excludes moderator and its working fine at my end.
or the group creation part .
did you : goto wp-admin -> settings -> buddypress-> options > ” Group Creation ” disable this option ?
please share site url , instructor creds , admin creds to check these at your end.
August 31, 2023 at 3:03 pm #389301MLP LMSParticipantAugust 31, 2023 at 9:20 pm #389321Anshuman SahuKeymasterI tested this and the code I provided is working fine .
-
AuthorPosts
- You must be logged in to reply to this topic.