frumbert / wp2moodle-moodle

Moodle end of a Wordpress to Moodle Single Sign On auth plugin
28 stars 29 forks source link

Cohort Re-Authetication #8

Closed groovetemple closed 9 years ago

groovetemple commented 10 years ago

Hey there, seems to be working great for me, however, one issue when re-authenticating after user has already been created, upon logging back in Moodle directs the user to edit profile page again instead of bypassing this and going straight course.. Any thoughts?

frumbert commented 10 years ago

If the user in wordpress does not have a first name and last name, and moodle updates the user record, moodle will then redirect to the profile page in order for the user to enter that required information. This is moodle's expected behaviour, so the plugin won't change that. You need to ensure that the user in Wordpress is a complete user with a first name and last name specified.

I've yet to append some code that prevents the plguin from re-modifying the user record, thus (hopefully) bypassing this redirect condition.

groovetemple commented 10 years ago

Thanks for the prompt response!! That makes complete sense. That worked, however, the redirection is not taking user to their first course but to a different course they don't have access to.. I can disable the feature but would be nice to have working properly. Not sure why it's not sending them to their course.

frumbert commented 10 years ago

are you using cohort or course ids? are you sure you are using the identity field (not the name) for the type you are using?

groovetemple commented 10 years ago

Using just cohort ID.

Sent from my iPhone

On Apr 16, 2014, at 2:47 AM, "TIm St.Clair" notifications@github.com wrote:

are you using cohort or course ids? are you sure you are using the identity field (not the name) for the type you are using?

— Reply to this email directly or view it on GitHubhttps://github.com/frumbert/wp2moodle-moodle/issues/8#issuecomment-40581419 .

groovetemple commented 10 years ago

So, Tim, thanks for your help.. I added the class attribute in the shortcode and it's working as it should now. Great plugin. How can I help support the future development of your work?

groovetemple commented 10 years ago

Hey Tim, so upon creating a second course and using a new shortcode for that course, it seems, that the redirection issue has come back.. Shortcode below..

[wp2moodle class='VPTML' cohort='CF-VPT-ML']Virtual Private Trainer w/ Michelle LeMay[/wp2moodle]

class attribute is course shortname, cohort is cohort ID .. Not sure if this proper link or not. I have a previous link formatted this way and seems it's redirecting to course properly. Although now I can't tell if it's redirecting to the same course each time and is why my first link redirects proper and second doesn't. How can I get this link to send user to course properly when clicked? Am I missing something?

groovetemple commented 10 years ago

Just verified.. I created yet another new course created my link with shortcode and user is being redirected to the same first course I first created instead of directing them to the course that the cohort is enrolled in.. I also had created a new cohort for this new course.

frumbert commented 10 years ago

Hmm, that does sound strange, particularly when you say you are using the "class" attribute for the course name - it sets the 'class' attribute on the generated hyperlink and doesn't affect the Moodle-end. The steps at http://wordpress.frumbert.org/examples/ show the basic cohort setup.

The code inside moodle performs these basic steps:

groovetemple commented 10 years ago

Ok thanks for the clarification. I have a better understanding now. It sounds like what I'm missing is 'auto open'. My question is where is that configured? If that's the setting in wp2moodle settings area under authentication, I've set that to go to course and it redirects to a course that the cohort is not a member of. In fact, any new cohort tries to open to the same course even tho that member is not enrolled.. So I'm not sure what's happening.. Maybe you can shed some more light on that? Thanks Tim,

Luis

Sent from my iPhone

On May 5, 2014, at 4:57 PM, "TIm St.Clair" notifications@github.com wrote:

Hmm, that does sound strange, particularly when you say you are using the "class" attribute for the course name - it sets the 'class' attribute on the generated hyperlink and doesn't affect the Moodle-end. The steps at http://wordpress.frumbert.org/examples/ show the basic cohort setup.

The code inside moodle performs these basic steps:

— Reply to this email directly or view it on GitHubhttps://github.com/frumbert/wp2moodle-moodle/issues/8#issuecomment-42254852 .

frumbert commented 9 years ago

Not sure what the issue is here - it's working on my installations. The code is taking the courseid directly from the related record; in case of cohorts, this is:

if ($enrolrow = $DB->get_record('enrol', array('enrol'=>'cohort','customint1'=>$cohortrow->id,'status'=>0))) {
    $SESSION->wantsurl = new moodle_url('/course/view.php', array('id'=>$enrolrow->courseid));
}

However it then repeats the code for groups. If you have specified both group and cohort, then it will take the groups' course in preference (because of the order of the code). This is the only scenario I can come up with that might cause the issue.

Since I can't create the problem myself, I'm closing the issue for now.