By hoangbien on
Hello everybody,
How to integration drupal 7 and moodle 2.x. I have a drupal site ex: acb.org and a moodle ex: acb.org/moodle. I want to create a user on drupal site, it will create user on moodle. So, I want to once log in for drupal and moodle.
How can do it?
Thank you very much,
Comments
Integration of Drupal7 with Moodle2.3
Hello,
Recently I have completed integration of Drupal 7 with Moodle 2.3, You login with Drupal, and automatically login in Moodle, and once you logout from moodle, it's also logout from Drupal.
https://github.com/cannod/moodle-drupalservices/wiki/Installation-Drupal...
https://github.com/cannod/moodle-drupalservices/wiki/Installation-Moodle...
Let me know if you need more help from my side.
Thanks,
Darshan
Thank you Darshan
I am very happy with your shared. I will try and hope your help.
Thank you again,
Create user views in drupal
Dear Darshan,
Could you help me detail about create the user views, please? I created the user views. However, only administrator user can see it. if i change access to Role for authenticated user and remote-service user then i log in with authenticated user. The user view display all user. How to display only user login?
Thank you very much,
Moodle link
Dear Darshan,
I create service in admin/structure/services and setup as your instruction. so, i setup drupal services on moodle. However, when i login on drupal then i open the moodle site. but it not login. Could you help me? what is the location insert the moodle link on drupal site.
Thank you very much,
Moodle link
Hello Bien Hoang,
You don't have need to set moodle url in drupal, you have just install "drupalservices" module package in /moodle/auth/drupalservices
From moodle side, login with admin, SiteAdministration->Plugins->Authentication->Manage Authentication, and enable drupalservices module, enter drupal url, and define user which you have created in drupal, and just set cron file.
Let me know if you need more information from my side.
Thanks,
Darshan(+91 9958834339)
Skype: shah.darshanv
Set cron file
Hello Darshan,
I setup module on drupal site and drupalservices. So, i configuration follow your help. However when i log in on drupal site then i go to moodle link. It doesn't log in.
I don't understand about you talk set cron file. Have you want set running auth_drupalservices_sync_users.php file when user login on drupal site? The cron file is set on hosting or rule module? Could you instruction for me?
Thank you very much,
Set Cron file
Hello Hoang,
First check created webservices in "drupalservices" it's working on not, you got array for http://localhost/Drupal/drupalservice/muser, if it's display all users then it's perfect from drupal side.
Now open file /moodle/auth/drupalservices/auth_drupalservices_sync_users.php and comment first line define('CLI_SCRIPT', true); and run manually for test purpose, if it's running perfect then set this file in cron hosting.
If you are not able to do this, then tell me I am able to do this work for you.
Thanks,
Darshan
Hello Darshan, I don't
Hello Darshan,
I don't understand why is http://localhsot/Drupal/drupalservice/muser. I go to http://localhost/nepinet/en/moodle-user?uid=6 it ok. In the /moodle/auth/drupalservices/auth_drupalservices_sync_users.php define('CLI_SCRIPT', true); it ok. so, i run cmd.exe. I run e:\xampp\htdocs\drupal\moodle\auth\drupalservices>php auth_drupalservices_sync_users.php but it message error.
!!!
Error: Database connection failed
It is possible that the database is overloaded or otherwise not running properly.
The site administrator should also check that the database details have been correctly specified in config.php!!!
what error? How to fix and run it?
Thank you very much,
Clean URL
Dear Darshan
As for me, drupalservices is not working for me like this URL. http://localhost/druplaservice/muser. And then i cannot do other step.
The problem is
i cannot enable Clean URL. (is this problem ?)
admin>structure>view has not Moodle users (muser) in drupal.
So, if i run command from moodle i got login error. right ?
Why i can't see admin>structure>view has not Moodle users (muser) in drupal.
How to configuration drupal services on hosting
Dear Darshan
Could you help me configuration drupal services on hosting?
I have domain name as mydomain.com. so i add subdomain elearning.mydomain.com.
The sub domain store moodle.
How to configuration drupal hostname and endpoint in drupal services of moodle.
Thank you very much,
Problem with Postal Address
Dear Darshan,
thanks for the workaround for drupal & moodle integration.
I followed all the steps you described but when trying to sync users between drupal and moodle I get
ERROR: Login error!I have sudo access and the only thing that didn't go 100% as you described in your guide is when creating the drupal user view. When I added Postal address in the view's fields list, it appears as a single field and not as 4 (first name, last name, city, country).
It would be great if you could guide me how to solve this.
Thanx,
lil_gusta
Single Address Field
Hi lil_gusta!
Eventhough it's been quite a while since your post, I'd like to share the solution I found to this problem you described:
"When I added Postal address in the view's fields list, it appears as a single field and not as 4 (first name, last name, city, country)."
This same thing happened to me at first, but then I discovered a pending unpdate of the module Address Field. I was able to see first name, last name, country and city as individual fields after running this update.
Issue on logout and register
Hello,
Thanks for very useful module for us .
I have two links
localhost/moodle/ for Moodle
http://localhost/moodle/lms for Drupal
Issue on logout .. it is not Logout from Drupal automatically .
Sign up on moodle is not working .
Waiting for reply. Please help us
I have integrated them
I have integrated them together. All works correctly. There is a small issue:
After I login Drupal, I have to click the link of moodle's login manually, then I could login in to Moodle.
My moodle version is 2.4, Drupal version is 7.17.
I do not know how to auto login to Moodle after I login to Drupal?
Chinese drupal tutorials Think in Drupal
Same problem
I've integrated Drupal 7.25 and Moodle 2.6.
It works too. However It has a same problem with login.
After I login Drupal, I have to click the login link or Home link manually.
In addition, If I logout the Drupal, moodle remains the login information not automatically logout.
So, I have to click the logout link too.
It's not working automactically.
Is there anyone fixed this?
Same problem, double login
Same problem here. It is not an automatic sso, when a user logs in Drupal and then goes to moodle he needs to click on the login link, which is confusing to them.
Any solution or ideas for this?
thank you in advance
Hello Darshan, Thanks for
Hello Darshan,
Thanks for Sharing this, I am trying to follow the steps on the Drupal side installation. The step which I am not able to follow is
Click on Edit resources for the newly created service - moodle.
Enable index for View: Moodle users (muser).
I dont have this option available and as a result If I try the link "http://localhost:8888/drupal7/drupalservice/muser" its coming as a blank.
Please suggest where I am going wrong.
Thanks a lot for your time and help...
drupal service
Hello Darshan
I am trying to integrate drupal 7 with Moodle 2.4 , I was glad to find your instruction and I followed it exactly moodle-drupalservices , I get drupal service to work
at localhost/school/drupalservice/muser I get json
[{"name":"rrr","uid":"1","firstname":"Rania","lastname":"hhh","country":"USA","email":"rrr@gmail.com","status":"1","City":"View"}]
but once I run this command : sudo php /Applications/mampstack-5.3.28-0/apache2/htdocs/moodle/auth/drupalservices/auth_drupalservices_sync_users.php
I got this error
RemoteAPI Object
(
[gateway] => http://localhost:8080/school
[endpoint] => /drupalservice
[status] => 1
[session] => SESS451390669235bb773ed6f1e3fb2dd775
[sessid] => KqpuX6jcrcX9xfCUsBdcrK48rT7fBq4wlC6K1TtsyGo
[CSRFToken] => uYzhsuxiDT88dRdye3JMf2SKOi_Qp3cjwjRwWwazNIY
)
User entries to update: 1
Updated user rania(1)
PHP Notice: Undefined property: stdClass::$city in /Applications/mampstack-5.3.28-0/apache2/htdocs/moodle/auth/drupalservices/auth.php on line 163
Notice: Undefined property: stdClass::$city in /Applications/mampstack-5.3.28-0/apache2/htdocs/moodle/auth/drupalservices/auth.php on line 163
!!! Error writing to database !!!
and no entry in the moodle database for drupal user , the drupal user I have it admin and remote-service privilege
SInce user registeration in drupal doesn't have lastname, firstname , city , country filed I used configuration/accountsetting/manag fields and I added
those filed , create the view and service .it is obvious in my drupalservice result ,
I noticed that those city and country field once I added them to the registeration fields , they are not added to drupal user table , they are added in new tables field_city , field_country , I wonder is that the reason , moodle when trying to get the user city it query only user database and not finding them and not query the other field database
I also tried to use the address field module as your instructions , but all fields failed including last name , first name , city , country
I would appreciate your solution , I would be so happy to see it working .
Thank you so much
Hello Rania Fekry,
Hello Rania Fekry,
City & Country fields are mandatory in moodle users table, you can manage thought settings when configure drupal & moodle Integration.
Just enable error ( In moodle development section) and run that path, you get the exact error in which field, so you get more idea how to resolve it.
I already accept your request on skype, so still if you face any issue, talk me there.
Thanks,
Darshan
Thank you so much for your
Thank you so much for your kind sharing.
I have tested the plugin and follow your instruction. However, i can do the final step of sso. I can't run the auth_drupalservices_sync_users.php successfully.
I have turned the debugging mode for Moodle to know about about the error message:
RemoteAPI Object ( [gateway] => http://demo.shopbar.hk [endpoint] => /drupalservice [status] => 1 [session] => SESS8c0542e19f1d5ac849c4c63c1130a4ec [sessid] => E78ZuHSZS3tM_PI6y4jURJSaveH4oN3T6IIjam_-JC4 ) User entries to update: 3 Updated user admin(1)
Warning: mysqli::real_escape_string() expects parameter 1 to be string, array given in
/home/mallbar/www/demo/moodle/lib/dml/mysqli_native_moodle_database.php on line 829
Warning: mysqli::real_escape_string() expects parameter 1 to be string, array given in /home/mallbar/www/demo/moodle/lib/dml/mysqli_native_moodle_database.php on line 829
Warning: mysqli::real_escape_string() expects parameter 1 to be string, array given in /home/mallbar/www/demo/moodle/lib/dml/mysqli_native_moodle_database.php on line 829
Warning: mysqli::real_escape_string() expects parameter 1 to be string, array given in /home/mallbar/www/demo/moodle/lib/dml/mysqli_native_moodle_database.php on line 829
How to fix it or do i miss something?
Thank you very much.
Same error
Hi Darshan,
I am also getting the same error as adamtong
Please suggest a solution for this.
Thanks in advance.
Solve Error
You have need to set this file auth_drupalservices_sync_users.php in cron, you don't have need to run manually.
Same error
Hi Darshan,
Is there any other way as I am not having shell access to my server??
Solve of the error
In your Drupal user list some user have no firstname , last name ,city and country so go on drupal user list and or block the user or give the these requirement then go Syn and run the cmd for syn user its working!
After integration of drupal and moodle
Hi Darshan
I integrated Drupal and Moodle successfully . But i want to know some Point like is that possible to user create in Moodle its also login in drupal after integration and when edit the profile of user in Moodle after syn its not editable !
Can you share with mi is that point are possible in drupal and moodle configuration .
Thank's in advance
ERROR: Login error!
Ok, so up to the point of testing the script in cmd everything works.
On Moodle side I have:
Hostname: http://www.mydomain.com
Endpoint: /drupalservice
Remote User: moodle remote username (not the name actually in use)
Remote user password: is correct
I have sudo permissions on the account I am logging into putty with. I then cd to the drupalservices directory and enter the following command: #sudo /usr/bin/php auth_drupalservices_sync_users.php then it waits a moment and gives the login error.
I've tried:
sudo /usr/bin/php /public_html/moodle/auth/drupalservices/auth_drupalservices_sync_users.php ...got 404 error
Being able to update without the cron job would really be preferable. As eljakeo says my customers want to enroll in Moodle directly after registering on Drupal. Is there any way to make that a viable option?
Thank-you for your help
Update Moodle user without cron
Hi hoangbien, thanks for your work on this. I am wanting to modify this module to update the Moodle user database as soon as a new user is created in Drupal, rather than syncing via cron run. Many of my customers want to begin a course as soon as they have established a new account, and I can't very well set up a cron run to go every 15 seconds or something to make this possible. My question is: What was your reasoning for making the syncs happen during a cron run instead of the way I am proposing? Was it just to fit your personal needs, or is there some kind of performance issue that would be raised? Or is it just not technologically possible? I appreciate your feedback.
Thanks again!
Quick (but not that good) fix
Just in case anyone else was wanting to do what I mentioned above and have new accounts be instantly added to Moodle rather than waiting for the next cron run, here is the method I used. It is awful in terms of performance and it would definitely be better if there was a method available to sync individual accounts rather than only having a single command available to sync the entire user database. I simply added the following to a custom Drupal module:
Of course, replace "hook" with your module name and the paths to PHP and to the auth_drupalservices_sync_users.php file with your own paths. The calls to watchdog can be taken out once it is working, but they definitely help with debugging your paths.
I still hope that a different method will be added to make this more acceptable performance-wise, but if you have a site with a relatively-small number of users and enough available server power, this works.
cross domain
How can i setup auto login for cross domain ? i m using this with Moodle course list.
command-not-found has crashed!
HI
I did everything but when I try to run the script I get:
Sorry, command-not-found has crashed! Please file a bug report at:
https://bugs.launchpad.net/command-not-found/+filebug
Please include the following information with the report:
command-not-found version: 0.2.44
Any help?
Thank you!
Please help me to integrate moodle with drupal
I did everything to integrate drupal with moodle but unsuccessful:(
=-=
you will need to elaborate for anyone to help you. Else write your own integration module for Moodle.