Profile field based cohort membership - not working for new fields

Profile field based cohort membership - not working for new fields

by Frank Burger -
Number of replies: 1

I've been successfully using this plugin for about a year, working with 3 custom profile fields that are populated by LDAP. I recently created a 4th custom field, but none of the cohort rules I create will work with it. 

I can create new rules to work with the old fields, but rules don't seem to work with the new field (which I've deleted and re-created every way I can think of). The only difference is that this new field is not populated by LDAP, it's manual entry. My CRON tasks are running as expected, but the cohort remains empty.

Any suggestions? Thanks in advance!


Moodle 3.6.3

Profile based cohort membership v3.6-r2

Average of ratings: -
In reply to Frank Burger

Re: Profile field based cohort membership - not working for new fields

by Frank Burger -

OK, I figured this out. So if anyone else runs into this, here's the deal...

When you create a new user profile field and pick a default value for it, the individual user profiles appear to include the new data, but this is misleading. The actual record in mdl_user_info_data is not added until you either manually type in the field, or it's updated from an external source. So any cohort rules you add won't be able to find the data.

I thought I had a handle on this last week - when I saw the cohort didn't update, I included records for whom the field was undefined. However, this exposes what I can only think is a bug... when you include undefined, it adds all users, including ones with the deleted flag set. Not a good sign when your cohort has more people than there are accounts. Since the deleted users aren't presented in the UI, I needed to drop back to a backup to get rid of them.

Average of ratings: Useful (1)