Giter VIP home page Giter VIP logo

wp2moodle-moodle's Introduction

this codebase has been archived and a new version of the plugin is now at https://github.com/frumbert/wp2moodle.

wp2moodle--moodle

This is the Moodle-end of a two-part plugin that allows users to authenticate within wordpress and open a Moodle site. To get the Wordpress-end plugin, check this git: https://github.com/frumbert/wp2moodle--wordpress-

Data is encrypted (using aes-256-cbc via openssl) at the Wordpress end and handed over a standard http GET request. Only the minimum required information is sent in order to create a Moodle user record. The user is automatically created if not present at the Moodle end, and then authenticated, and (optionally) enrolled in a Cohort, a Group, or both.

Requirements

Moodle 2.7 or above (tested up to 3.3) on this fork; see branches for older versions.

Demo

Go to my wordpress demo site and register yourself, then try the links on the course page. There's more documentation over there too.

http://wp2moodle.coursesuite.ninja/

How to install this plugin

Note, this plugin must exist in a folder named "wp2moodle" - rename the zip file or folder before you upload it (preferably use something like cd moodle/auth/ && git pull https://github.com/frumbert/wp2moodle-moodle wp2moodle if you have git tools on your server).

  1. Upload/extract this to your moodle/auth folder (should be called "~/auth/wp2moodle/", where ~ is your Moodle root)
  2. Activate the plugin in the administration / authentication section
  3. Click settings and enter the same shared secret that you enter for the wp2moodle settings in Wordpress. Generate that first, since it creates a secure key using openssl. Copy and paste it here.
  4. The logoff url will perform a Moodle logout, then redirect to this url. You can get it to log off in Wordpress as well by hitting the wordpress-end logout page too; typically this is http://<your-wordpress-url/wp-login.php?action=logout
  5. The link timeout is the number of minutes before the incoming link is thought to be invalid (to allow for variances in server times). This means links that were generated in the past can't be re-used, copied, bookmarked, etc.
  6. Disable any other authentication methods as required. You can still use as many as you like. Manual enrolments must be enabled on courses that use group enrolment.

Usage:

You can not use this plugin directly; it is launched by wp2moodle from within Wordpress.

Problems?

If you are having problems, try these first. If you raise an issue, let me know ALL the version numbers of your installations, what server platform they are running on, and any relevent error messages, otherwise I won't be able to help.

  1. Confirm that you have the requirement met to run the plugin (e.g. openssl must be installed and show up in phpinfo)
  2. Confirm that your course has the appropriate enrolment providers set up already (e.g. cohort based enrolment or manual enrolment)
  3. Confirm that your shortcode is working in Wordpress
  4. Confirm that you are using the text/string version of an identifier and NOT the numerical id of a course or cohort. the Id Number field is NOT set by default in moodle- you have to add something.
  5. Look in your sites php error log to see if you can see if the plugin is silently throwing an error that you are not seeing on the page.
  6. If you're trying one lookup type (e.g. group) then try switching to a different type (e.g. cohort). This may help me narrow down if it's a particular lookup type that is affected.

Licence:

GPL3, as per Moodle.

wp2moodle-moodle's People

Contributors

frumbert avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wp2moodle-moodle's Issues

Need to migrate admin settings from config.html to settings.php for Moodle 3.3+ compatibility

The admin settings need to migrated from config.html to settings.php in order to stay compatible with Moodle 3.3+.

From the Moodle 3.3 release notes:
"Authentication plugins have been migrated to use the admin settings API. Plugins should use a settings.php file to manage configurations rather than using the old config.html files. See how the helper function upgrade_fix_config_auth_plugin_names() can be used to convert the legacy settings to the new ones. Another helper function upgrade_fix_config_auth_plugin_defaults() can be used to populate the settings with default values so that they are not falsely reported as newly added ones."

All references to get_config('auth/wp2moodle') need changing to get_config('auth_wp2moodle') so they can still be read after the migration.

A database upgrade function also needs creating in db/upgrade.php to convert the existing settings into the new format so that existing settings aren't lost. The methods in the release notes can be used to convert the settings.

WP4.1.1 and Moodle2.8.1

I'm getting to my Moodle site from WP, but the logout URL does not redirect back to my WP site.
Both sites are in the same domain.
Moodle is in a sub-domain of my WP site.
In Moodle I'm using the Essential Theme.

Cannot process the script

Good day!
Please help to understand.
During the transition from the WP website to the MOODLE site shows the message error processing script.
When moving from WP website on the Moodle site shows the error message of the script. All settings are done on WP and MOODLE.
On the MOODLE server rights to the directory wp2moodle done.
The MOODLE server: Linux, Nginx, Php v 5.5.9, Php-fpm.

Link does not appear in WP3.5

Hi Tim

I have installed the plugins in both WP and Moodle but when I add the short code to a WP page it the link does not display when viewing the page.

Also the Wordpress toolbar across the top does not display on that page.

Any Ideas? I am using Wordpress 3.5

This is a link to the page in question if you view the source code there is no trace of the wp2moodle link in the content.

http://school.brisbanemarkets.com.au/moodle-link/

Cheers
Paul

Deleting first and last name in Moodle upon login + link-click through WordPress

Hey,

When I add a user through WordPress, all the are entered into the Moodle database. However, every time a user logs in to WordPress and clicks the 'go to moodle' link they have to set their first and last name before they are permitted to do anything.

Not sure if it's a problem with my setup, probably is, but some assistance would be awesome, thanks!

Tom

student is not enrolled to course

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!

token.php?

It seems that the plugin makes no use of the token.php file or i am missing something?

Login and Session time-out problems.

Hi,

I am using wp2moodle plugin for SSO. It is working great but I have some issues.
One is when an user(wp2user) changes his/her password in moodle through edit user setting, the plugin is not allowing that user to get into Moodle through WordPress.
Second one , WordPress session exists even though Moodle session expires, I want to logout of both WordPress and Moodle on Moodle session expiry.
on Moodle session expiry I want redirection to WordPress home page.
Please help me through the above issues.

Thanks in Advance.
Satheesha

Login to Moodle

Hello Frumbert,

I have a question regarding WP2moodle: After I set up the modules in wordpress as well as moodle, everything seems to be working just fine. The Wordpress user clicks a link and is then logged in to moodle (and a moodle user is created). The problem I have occurs after the user logs out of moodle, and then tries to log back in through the standard moodle login dialog. He gets logged in just by entering his username a clicking "log in". He does not have to provide a password. The password is not checked,..
I had a look at you demosite where everything works just perfect. If the user wants to log back into moodle(directly), he has to enter the full wordpress credentials(username AND password).
I just need to achieve the same effect.

Am I doing something wrong?
Thanks

Integration question

Tim,

I am new to Moodle and have a question on how the integration works. Its seems the user registers on the WP site, and then is automatically logged in to both the WP site and Moodle site. Is that correct? Can the user then login to either site with the same credentials, or must the login happen only on the WP site?

Secondly, if a user returns and registers for other courses, can the same account be used on the WP end, and the moodle end is automatically updated? (Or do I remember a cron job that sync these?)

My needs are really just to create a user from WP that can access Moodle without having to re-login.

Thanks.

Deprecation warning for future PHP versions

I got this message as a warning in moodle debugging mode: No need to fix the naming now, but ... :-)

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; auth_plugin_wp2moodle has a deprecated constructor in ~/moodle/auth/wp2moodle/auth.php on line 25

Security Issue: Moodle login page logs the user in without a password

On line: https://github.com/frumbert/wp2moodle-moodle/blob/master/auth.php#L44

The user_login function doesn't validate the password, so if a user tries logging in from the Moodle login page, they can get in with any password, this is a HUGE security issue. All they need to know is the username and boom they are in.

I tried this on your demo site and I was able to login to your moodle site as long as I have the username. Any password goes.

wp2moodle woocomerce integration.

Hi,

I have a multiple course on moodle and i want to sell from wordpress and read courses from moodle section,
I have a question if user purchase a course from wordpress then how system get that particular course purchase buy user and how enrollment will work.
Thanks

Error writing to database

Hello,

Thanks a lot for creating this! I really appreciate it! Let me give a little back story. I am currently using Wordpress 3.9.2 and Moodle 2.7+ and I had previously used the SSO authentication method described on this website: http://blog.giuseppeurso.net/moodle-and-wordpress-single-sign-on-in-20-minutes-part-1/ however I have now disabled that in the authentication list. I installed everything just like you had specified on your Wordpress website. I even used the example you give in the URL below, but I am getting an error when clicking on the hyperlink created using the virtual private trainer shortcode on Wordpress. It will not even allow me to use the same credentials for both wordpress and moodle. I would like to set it up in such a way that a user pays for a course receives a hyperlink through wordpress and is able to enroll into the course automatically. Any help would be greatly appreciated!

http://wordpress.frumbert.org/examples/

Page keeps loading when I open the post.

I really didn't understand how to do this.

I created a new post and clicked on the wp2moodle icon

and then I replace the code with this

[wp2moodle group='lms_group' target='_blank' authtext='Please log on']launch the course[/wp2moodle]

It should've shown me the post according to documentation, but the page keeps loading.

Please help me

How do you determine activity numerical index number

Where is says,

activity: (optional, number) the numerical index of an activity to open after enrolment. E.g. "2" will attempt to open the second activity in the destination course.

What Moodle database field does it use to determine the numerical index? In a course with a large number of activities, how do you find the index number as the number doesn't see to correlate with the position of the activity in the course?

Thanks, I love this pluggin!

Cohort Re-Authetication

Hey there, seems to be working great for me, however, one issue when re-authenticating after user has already been created, upon logging back in Moodle directs the user to edit profile page again instead of bypassing this and going straight course.. Any thoughts?

Open a direct Link to a moodle activity

Hello

Great plugin. Exactly what I was looking for.
Just one thing: Is it possible to open a link within the moodle site?
for example a specific activity?

Thanks for your help.

Greetings Daniel

Problem in Moodle 2.6

Hi and compliments for your fantastic work.
Today I update my Moodle 2.5.2 to 2.6 but the plugin doesn't work.
I've an error like this (it's in italian,my localization):
"E' stato rilevato un errore di programmazione, deve essere sistemato da un programmatore: moodle_strtolower() cannot be used any more. Please use core_text::strtolower() instead."
Someone has the same error? Thank you

Enrolment to course is not done.

First of all thank you for such a easy and nice plugin for wp-> moodle integration.

I have done all the steps and integrate the plugin with wp but I am facing one issue. Plugin able to registered a user to moodle but not able to enrol the user to the course.
Being new to wp and php, I am not able to identify the problem. Could you help me to solve this problem.

Thanks,
Vishal

Error writing to database - Error code: dmlwriteexception | Shared Host

Hi, I'm having an error authenticating a login between Wordpress and Moodle 3.5.

Info

  • Wordpress 4.9.8 (DB MySQL)
  • Moodle 3.5 (DB MySQL)
  • Shared Host (hostgator)
  • PHP 7

The error:

Error writing to database
Other information about this error

Debug info: Duplicate entry '1-12345678900' for key 'mdl_user_mneuse_uix'
INSERT INTO mdl_user (city,auth,policyagreed,idnumber,username,password,firstname,lastname,email,lang,confirmed,lastip,timecreated,timemodified,mnethostid) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
[array (
0 => '',
1 => 'wp2moodle',
2 => 1,
3 => '1584',
4 => '12345678900',
5 => 'a803bc70a48ce4568a9e85f7e1e30c58',
6 => 'Pedro',
7 => 'Marinelli',
8 => '[email protected]',
9 => 'pt_br',
10 => 1,
11 => '177.192.193.143',
12 => 1537303059,
13 => 1537303059,
14 => '1',
)]
Error code: dmlwriteexception

Stack trace:
line 489 of /lib/dml/moodle_database.php: dml_write_exception thrown
line 1329 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
line 1375 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()
line 232 of /auth/wp2moodle/login.php: call to mysqli_native_moodle_database->insert_record()


With some research I found solutions configuring the file my.cfg or binlog_format via phpmyadmin. But as I said my is a shared host and this is not an option at the moment.
Do you think some other solution is possible?

Thanks.

Wordpress Marketpress and Moodle integration

Hi Tim,

I have a WP multisite with Marketpress installed.

What would be the best way to link the Marketpress products (courses) with the courses within Moodle with the wp2moodle plugin?

You mentioned cohorts before, but does this mean a cohort should be created for each course?

I'd greatly appreciate any advice you can give me.
Thanks
Deon

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.