paulholden / moodle-local_cohortrole

Moodle local plugin to synchronize cohorts with system roles
https://moodle.org/plugins/view/local_cohortrole
5 stars 11 forks source link

No users synchronized #11

Open VOOM108 opened 1 year ago

VOOM108 commented 1 year ago

In a Moodle 3.10 instance with the most recent plugin-version the cohort-role-sync does nothing. I use the plugin successfully on other sites and in this case I am out of ideas. The cron task is set to run every Minute, and the cron runs every 5 Minutes. I can see it in the log, but the sync never applies new roles to new users in the resp. cohort. The cohort is created by autocohort for all users with auth_email. The new users are in the cohort, but not in the role...

Any ideas what else I could try? This is really crucial, as the role defines, what course categories can be seen etc. So ATM new users run into errormessages trying to enter anything...

hribeir0 commented 1 year ago

Same behaviour on a fresh 4.2 install.

hribeir0 commented 1 year ago

So the problem seems to be when I'm also using moodle-local_profilecohort If used alone it works

CosmosUC commented 1 year ago

Hi, I think this is also realted to this: https://github.com/paulholden/moodle-local_cohortrole/issues/10

My problem was that I was adding a new user to the cohort and the new user was not added to the system role . I am using "Profile field based cohort membership" to add the users to the cohort.

What worked for me was to modify the local_cohortrole plugin by commenting the next line... //core_user: :require_active_user ($user);

VOOM108 commented 1 year ago

I do not use local_profilecohort, but local_autocohort to apply the users to the cohorts. The issue you are referring to makes sense though, too: wherever else we use the plugin, there is no self-registration, an in the case, where it is not working, this applies exactly to the cohort Auth_email auto-generated for all users registering themselves.

hribeir0 commented 1 year ago

Amazing community! That was it. Thank you! I wonder if it makes sense to add a setting to require or not the user to be active

sherig commented 5 months ago

I too am having issues with cohort role synchronization not assigning roles to cohorts while using profile field based cohort registration. When I had existing users in the cohorts the roles assigned perfectly. However new users to the site are getting placed in cohorts, but not getting the role assigned. My purpose is also to have the certain course categories show to certain roles.

I would like to try the suggestion above to modify the local_cohort role and I do know how to comment out code...if I can find it. Where do I go to find where to try this suggested solution?

What worked for me was to modify the local_cohortrole plugin by commenting the next line... //core_user: :require_active_user ($user);

sherig commented 4 months ago

I found it, and commented out this line in the locallib.php //core_user::require_active_user($user); but it still doesn't work. It's running, everything is as it should be as I can tell, but no users are getting the system roles they are supposed to be getting.

Execute scheduled task: Sync cohort role assignments (tool_cohortroles\task\cohort_role_sync) ... started 18:38:01. Current memory use 21.9 MB. Sync cohort roles... Added 0 Removed 0 ... used 9 dbqueries ... used 0.028059005737305 seconds Scheduled task complete: Sync cohort role assignments (tool_cohortroles\task\cohort_role_sync)

Any tips?

michael-milette commented 2 months ago

Has any progress been made on this issue?

sherig commented 2 months ago

No I’m still having issues and it only synchronizes if I delete the instance and a new one: then it works that once but not when new people enrol.

Thank you I’m fairly novice in moodle management but read lots. I have a dev server and a production one to try things out as admin but I don’t have back end server access.

Sheri Gunville

Sent from SheriG’s iPhone

On Jul 11, 2024, at 12:41 AM, Michael Milette @.***> wrote:

 You don't often get email from @.*** Learn why this is importanthttps://aka.ms/LearnAboutSenderIdentification Caution: External Email : Do not click any links or open attachments unless you trust the sender and know the content is safe.

Has any progress been made on this issue?

— Reply to this email directly, view it on GitHubhttps://github.com/paulholden/moodle-local_cohortrole/issues/11#issuecomment-2222151836, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAZ76PUPGJKX5P7YUIBLRP3ZLYSK7AVCNFSM6AAAAAAX3JVKNGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRSGE2TCOBTGY. You are receiving this because you commented.Message ID: @.***>

samumist commented 1 month ago

I'd like to share my experience with automatically adding users to a cohort and synchronizing them to a system role using these two great plugins: Dynamic Cohorts and Cohort Role.

First, I configured Dynamic Cohorts to automatically assign users to cohorts based on a user profile field. Then, I used Cohort Role to sync the members of this cohort to a system role.

A key point to remember when setting up rules for Dynamic Cohorts is to not enable the 'Bulk processing' option. As the plugin author noted, "using this option will suppress triggering events when users are added or removed from cohorts."

That’s a lesson I learned after many unsuccessful attempts at adding and deleting rules, manually running the scheduled tasks, etc. Again, I am very grateful to the authors of these plugins for their fantastic work.