Enrolment key not working with paypal

Enrolment key not working with paypal

by Ray Jr -
Number of replies: 16

Hello,

I posted the following problem in "General Problems" forum. However, this might be a better location.

"One thing I have noticed with Moodle 1.4.2 (stable release) is that the enrolment key does not work when paypal enrolment is enabled. I experienced this when I tried to use  paypalenrolment for one course and an enrolment key for another course. The paypal course worked fine, but the course without a price and just an enrolment key would keep returning back to the enrolment key page instead of enroling you into the course.

Is anyone else experiencing this problem? Any comments would be appreciated.

This could be a bug. However, I would like to get some comments first before I add this to bug tracker."

Regards,

Ray

Average of ratings: -
In reply to Ray Jr

Re: Enrolment key not working with paypal

by Carlos Vargas -
Hi Ray,
Yes, I've had this problem exactly as you describe it, and I know that so has at least one other person. It's been several weeks since I detected it on my site, but I was unsure of adding it to the bug tracker. Especially, after Martin said he tested 1.4 or 1.4.1 for that same scenario and found no problem. I concluded something perhaps was wrong on my side. I haven't installed 1.4.2 yet. I'll do so next week.
cheers
In reply to Carlos Vargas

Re: Enrolment key not working with paypal

by Chardelle Busch -
Picture of Core developers

Hi Carlos and Ray,

At first I assumed you could have both paid for and password protected courses--but I also found out that this didn't work (I'm using 1.4.1+).  I ended up having to use two versions of Moodle--one for each type of course.  I'm surprised to hear that Martin was able to do so, Ray.  Do you have any more info about this?  And, who wants to add it to the bug tracker?

Thx,

Chardelle

In reply to Chardelle Busch

Re: Enrolment key not working with paypal

by Carlos Vargas -
Thanks for your reply, Chardelle. I've never added anything to the bug tracker, so I wouldn't mind doing it for the experience.
Here's when Martin said that 1.4 had worked for him. It's possible I wasn't very clear when I first wrote about it. I'm prone to confusing descriptions.
cheers
Carlos
In reply to Carlos Vargas

Re: Enrolment key not working with paypal

by Ray Jr -

Hello Chardelle and Carlos,

Thanks for replying and thanks Carlos for volunteering to add this problem to bug tracker!smile I believe this is a very important feature (paypal and enrolment keys working together), especially if you are using Moodle to sell online training.

Best regards,

Ray

In reply to Ray Jr

Re: Enrolment key not working with paypal

by Chardelle Busch -
Picture of Core developers

Okay!

Thanks for getting it in the bug tracker Carlos.  I just heard from a reliable sourcewink that this should be working in 1.4.3smile.  So, keep an eye out for that release.

In reply to Chardelle Busch

Re: Enrolment key not working with paypal

by Ray Jr -

Hi Chardelle,

I just tested 1.4.3 and the enrolment key still doesn't work when paypal is enabled. Maybe Martin didn't have time to include this fix in 1.4.3.

Have a Merry Christmas!

Ray

In reply to Ray Jr

Re: Enrolment key not working with paypal

by Chardelle Busch -
Picture of Core developers

Hi Ray,

Both PayPal, and enrollment key only are working for me now with 1.4.3.  What problems are you experiencing?  Do you have enrollment set to PayPal?

In reply to Chardelle Busch

Re: Enrolment key not working with paypal

by Ray Jr -

Hello Chardelle,

I'm running 1.4.3 (build 2004083130) and when I enable PayPal enrolment the enrolment key does not work. Which build of 1.4.3 are you running? Build 2004083130 or Build 2004083132?

Regards,

Ray

In reply to Ray Jr

Re: Enrolment key not working with paypal

by Chardelle Busch -
Picture of Core developers
Build 2004083130.  If I click on a course with an enrollment key, but no cost, it gives me the course enrol file (the file to add the key).  If I click on a course with an enrollment key (maybe you need this?) and a cost it gives me the course enrol paypal file (with the paypal button).  Sorry, I'm not sure what could be the problem. 
In reply to Chardelle Busch

Re: Enrolment key not working with paypal

by Ray Jr -

Yes. I get the course enrol file asking for an enrolment key, but when I enter the enrolment key it just returns to the enrolment key file. It never enrols you into the course.

Ray

In reply to Ray Jr

Re: Enrolment key not working with paypal

by Chardelle Busch -
Picture of Core developers

Hi Ray,

You're right, I thought I had tested this, but apparently not.  I tried today's latest build, and took a look at the code, but I can't figure out why the internal enrollment is going back to enrol.php rather than to the course view like it should.  I've added this to the bug tracker, and hopefully Martin will be able to take a look at it and get it sorted out.

Right now, I have presents to wrap and cookies to bake!!!!!tongueout

Chardelle

In reply to Chardelle Busch

Re: Enrolment key not working with paypal

by Chardelle Busch -
Picture of Core developers

Hi Ray,

Well, I just took another look at the enrollment code.  In the enrol/paypal/enrol.php file, line 56, there is an override function that seems to be overriding the enrollment function if a course has no cost.  Try deleting this line and see if things work for you:

function check_entry($form, $course) {
}      

Chardelle

In reply to Chardelle Busch

Re: Enrolment key not working with paypal

by Carlos Vargas -
Hi Chardelle,
I finished testing 1.4.3 a couple of days ago and noticed, as you and Ray have already pointed out, the enrolment key-paypal combination is still a problem. I also just tested your suggestion to delete line 56, and it seems to be doing the trick just fine. Thanks much for looking at the code.
In reply to Carlos Vargas

Re: Enrolment key not working with paypal

by Ray Jr -

Thanks Chardelle and Carlos.

I just tested chardelle's suggestion. It now takes you to the course view after entering the enrolment key. However, I'm getting an error message that states, "could not instantiate mail function". Additionally, I'm not getting an email confirming my enrolment into the course. Please let me know if you are getting the same errors.

Ray

In reply to Ray Jr

Re: Enrolment key not working with paypal

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Chardelle's fix for bug 2312 is the correct one (thanks!) and is now in MOODLE_14_STABLE.

The mail error you are seeing, Ray, is a separate error ... check your mail settings in Admin >> Config >> Variables
In reply to Martin Dougiamas

Re: Enrolment key not working with paypal

by Ray Jr -

Thanks Martin!

I fixed my email problem and now enrolment works great!

I have a 1.4.3 test site and 1.4.2 production site. I used the wrong email address in my 1.4.3 test site.

Best regards,

Ray