I've asked the question on the moodle forum but I'd ask you lot anyway
New to Moodle so hopefully just my error somewhere.
Whenever I assign a user to the site course creator role, as soon as they have logged in and out moodle decides to remove them from that role.
It seems to stick when giving the creator role in a course, but that is no use when staff need to be able to create the course in the first place.
New Install - Currently using 1.7, with latest Php, apache & MySQL 0n a Win2k3 Box. LDAP authentication which works fine.
Any pointers would be useful - none of the roles have been edited in any way.
In your LDAP authentication configuration, is ldap_creators set to something?
It could be thatops:
At the moment it reads
cn=teachers,ou-Staff,o=scgsnet
does 'cn' need to read 'Course Creator' ?
*Edit* I just tried with cn=Course creator and the user is still kicked out after logging off![]()
Setting ldap_creators seems to override the manual assignment. Try removing it.
The way you have it set at the moment is that anyone in the 'teachers' group in the 'staff' OU in the dns domain 'scgsnet' will be a Course Creator. Anyone who isn't can not be a Course Creator and will have their Course Creator access removed, unless they are an Admin.
Is that what you intend?
I just did that and .............. no changeOriginally Posted by Irazmus
All the other roles seem to work fine. It's only the course creator that is causing the problem.
There's been patches to the roles stuff, try updating to the latest Stable snapshot.
That's right.Originally Posted by Geoff
Now the confessionops: I forgot to create the teachers group in the Staff OU
ops:
However - it's there now, and members addedIt's still kicking the member of staff out of the Course creator when logging off
I'll upgrade to the 1.8 beta - at the risk of killing everything- I'll post the result .
This thread might be relevant:
http://moodle.org/mod/forum/discuss.php?d=65306
Upgraded to 1.8 beta and the problem is still there.
Next option is to create a similar role to replace Course creator and see if that works.
@ Geoff - I saw that, but it made no difference.
Are you sure you've not got any legacy roles selected?
YepOriginally Posted by Geoff
Just created an identical role called Course-Admin - and that works perfectly. Even with legacy roles selected.
All I need to work out now is what I need to edit so when my course creators log in for the first time they are assigned the Course admin role instead of the Course creator role?
I can try and sort out the course creator role out when I have more time![]()
I just looked at the LDAP PHP. It works by finding the first role with the "moodle/legacy:coursecreator" role set. If you remove this role from your Course Creators role then the LDAP auth will skip it and pick up your new role instead.All I need to work out now is what I need to edit so when my course creators log in for the first time they are assigned the Course admin role instead of the Course creator role?
Here's the relevant chunk of code:
PHP Code:if ($creatorroles = get_roles_with_capability('moodle/legacy:coursecreator', CAP_ALLOW)) {
$creatorrole = array_shift($creatorroles); // We can only use one, let's use the first one
begin_sql();
$xcount=0; $maxxcount=100;
foreach ($users as $user) {
echo "updating user $user->username \n";
auth_ldap_update_user_record($user->username, $updatekeys);
// update course creators
if (!empty($CFG->ldap_creators) && !empty($CFG->ldap_memberattribute) ) {
if (auth_iscreator($user->username)) { // Following calls will not create duplicates
role_assign($creatorrole->id, $user->id, 0, $sitecontext->id, 0, 0, 0, 'ldap');
$xcount++;
} else {
role_unassign($creatorrole->id, $user->id, 0, $sitecontext->id);
$xcount++;
}
}
if ($xcount++ > $maxxcount) {
commit_sql();
begin_sql();
$xcount=0;
}
}
commit_sql();
unset($users); // free mem
}
I'm not sure what you mean by 'remove the course creator role.
Do you mean delete it from moodle via the admin >define roles page then edit the above code to read
You may have guessed that scripty things are not my strong pointPHP Code:if ($creatorroles = get_roles_with_capability('moodle/legacy:course_admin', CAP_ALLOW) ) {
![]()
Yes.Do you mean delete it from moodle via the admin >define roles page
no.edit the above code to read
There are currently 1 users browsing this thread. (0 members and 1 guests)