Hi all
I am a newbie to both Moodle and PHP, sorry but please excuse if I ask stupid questions.
In
short, a more complete and official approach to the problem : log in
Site A first, will automatically log in Moodle site (a sub folder) too
We have 2 sites, for example
1) Site A - http://mysite.com
A custom built PHP site A, not using any CMS like Joomla, host most of our website's functions.
2) Site B - http://mysite.com/moodle/
An
instance of Moodle added as sub directory after Site A was launched
because we want to make use of some functions from Moodle instead of
building them in the first site
Since Site A was built and currently in use, it is not possible to get rid of it and change to other CMS nor completely replaced by Moodle. Therefore we are looking for a way to achieve :
Step 1 : when our member logs in/out Site A, do so for the sub-folder Moodle site too automatically. The order MUST be log in Site A first, so redirecting user to Moodle's login.php using a FORM is not what we are looking for.
Step 2 : more advance feature is to sync user profile, IF Site A & B using its own user DB.
Tried to search here and Google, faced following problem
1. Either the post is too old, referring to Moodle 2 or even 1, but i am using Moodle 3.3.2
2.
Partial or too advance solution, really difficult for a newbie like me
to figure out the missing part nor asking to write a OAuth etc plugin...
3. External DB. Please correct me if I understand it incorrectly, this approach works if you let user login Moodle by checking the user's username/pwd from external DB, not quite what we need, log in/out Site A, simultaneously log in/out Moodle site.
4. Read something like using CURL to post to Moodle's login.php, then grab
cookie from its response header, copy it etc. Tried, not sure what
mistake I made, not working. In fact this is closer to what we need.
Many people asked same question and I believe existing solution somewhere out there but I failed to find it... can somebody help?
Sorry for a long post and Thanks a lot in advance.
Regards,
Gary