frumbert / wp2moodle-moodle

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

student is not enrolled to course #19

Closed andresadanmx closed 8 years ago

andresadanmx commented 9 years ago

Thanks a lot for creating this I really appreciate it!

I am currently using Wordpress 4.3 and Moodle 2.6.11. Apparently it is not working properly with these versions.

When I press the link from wordpress it redirects and login to Moodle correctly, but it does not enroll the student in the course.

I have set in the shortcode the number ID´s from Moodle: [wp2moodle group='1' cohort='2' course='3' authtext='Please log on']launch the course[/wp2moodle]

See this screenshot: http://prntscr.com/8ahp7w

Other issue is that redirection to external url after log out is not working: wordpress-url/wp-login.php?action=logout

Some help with this I appreciate so much.

Thanks again!

frumbert commented 9 years ago

Did you pull the wp2moodle from the moodle26 branch?

The system doesn’t work on numeric ids, it works on the idnumber column. When you edit a course, you enter things like “short name”, “full name” and so on. One of these is the “course id number” which is badly named, but represents a string that you can use to uniquely identify a course (if you copy the course to a second server, the number of the course might change, but the idnumber won’t). This is the code that you put into the shortcodes.

You don’t need to specify all items. You can specify a cohort, if you have made a system cohort that is an enrolment provider for one or more courses. You can use a group since it’s already associated with a course. Or you can use a course.

If the user isn’t created by the plugin in the Moodle database, the logout url won’t work for that user. This is because Moodle uses the login provider plugin that authenticated a user to log them out again (if that plugin implements its own hook, as wp2moodle does). Hopefully once you’ve sorted out using the correct values in the shortcode, the logoff should also work.

Any relevant logs would be helpful if you still run into problems.

Cheers, Tim

On 30 Aug 2015, at 3:00 pm, Andres Adan notifications@github.com wrote:

Thanks a lot for creating this I really appreciate it!

I am currently using Wordpress 4.3 and Moodle 2.6.11. Apparently it is not working properly with these versions.

When I press the link from wordpress it redirects and login to Moodle correctly, but it does not enroll the student in the course.

I have set in the shortcode the number ID´s from Moodle: [wp2moodle group='1' cohort='2' course='3' authtext='Please log on']launch the course[/wp2moodle]

See this screenshot: http://prntscr.com/8ahp7w http://prntscr.com/8ahp7w Other issue is that redirection to external url after log out is not working: wordpress-url/wp-login.php?action=logout

Some help with this I appreciate so much.

Thanks again!

— Reply to this email directly or view it on GitHub https://github.com/frumbert/wp2moodle-moodle/issues/19.

andresadanmx commented 9 years ago

Thank you very much for your time.

You're absolutely right, In Moodle I have set a "course id number" in the appropiate cell and now works well, the student is enrolled to the course!

The only thing that I can not run is the redirection after logoff. I tested in Moodle 2.2 and works well, but does not work in Moodle 2.6* - 2.7* - 2.8* - 2.9*

Thanks again!

frumbert commented 9 years ago

Hmm, what server environment are you using? Do you have a proxy of some sort? It's just doing a normal permanent redirect, I rely on logoff redirection in 2.7+

andresadanmx commented 9 years ago

I am using Linux (cPanel), no proxy, I will do some tests on different servers.

I will tell you the results.

Regards.

frumbert commented 8 years ago

The page should redirect after logoff. In the logoutpage_hook, I do a header 301 redirect, and unfortunately "it works for me". I've put a change up which cleans the output buffer if it's set and exits after the header is set, so see if that helps.