Login to Moodle 2.2.3 from Wordpress Installation

Login to Moodle 2.2.3 from Wordpress Installation

Clark Sim -
回帖数:5

Hello,

Sorry if i'm posting this in the wrong place, but really hope someone can help.  We are trying to allow our users to login from a login form on our wordpress pages, but as the form is not a static page, so we cant use the alternative login url feature.

Basically we have a moodle install (version 2.2.3) http://xxxx.co.uk/moodle with our word press installation in the root folder http://xxxx.co.uk/ 

On the header of every wordpress page we want the user to be able to login to Moodle using there username and password. (we still need the option to register too)

I have seen this on many other sites, but cannot get this to work for us.  Any help at all here would be great.  A site that has this ability as an example is http://ftacademy.org which logs into http://campus.ftacademy.org

Thanks

C

回复Clark Sim

Re: Login to Moodle 2.2.3 from Wordpress Installation

G. M. -

Hi Clark,

Please check the following post for the basic code:

http://moodle.org/mod/forum/discuss.php?d=177053#p777260

At the ftacademy.org page you could also check the source code between the comments:

<!-- ## Login to the FTA Campus ## -->
<!-- ## End Login ## -->

回复G. M.

Re: Login to Moodle 2.2.3 from Wordpress Installation

Clark Sim -

Hi Guillermo,

Thanks for your reply, however this doesnt work for us, as we want to have the login form on each wordpress page, we cant tell Moodle the alternative URL as there are multiple, so we will always get the attached error message.

Is there anyway to disable this feature in Moodle so that it will process the login from any URL on the domain.

We have also tried using iframes but this doesnt work either.

c

回复Clark Sim

Re: Login to Moodle 2.2.3 from Wordpress Installation

Clark Sim -
回复Clark Sim

Re: Login to Moodle 2.2.3 from Wordpress Installation

G. M. -

I guess I'm not understanding something. From my point of view, every WP page can include the required code (added to the header template) and that code determines exactly the URL to be accessed through the action field of the form tag:

<form action="http://___.co.uk/moodle2" ...>

回复G. M.

Re: Login to Moodle 2.2.3 from Wordpress Installation

Clark Sim -

Hi Guillermo,

I'll explain a little more what i have tried, firstly I created a html file called login.php, and added this to the root directory, and all i placed in that file was the form you posted on the post you referred me to, with my details.  I tried it, it gave me the error as above.  I then i logged into moodle as the admin in the normal way, and in the administration added the alternativeloginurl as mysite.co.uk/login.php saved and tried again.  that worked fine.

so i went back in and removed the alternativeloginurl again, and tried adding the form to my wordpress template. again, the error i posted above appeared, this time tho, i have no alternative url to enter in moodle, as the form itself is displayed on every wordpress page. so the urls are given as the below for example.

 mysite.co.uk/home/

 mysite.co.uk/support/

 mysite.co.uk/contact/

etc.

So there lies my problem, so i am still a square one.

C