Ready to get started?Download WordPress


Woocommerce and Moodle 2.5 (12 posts)

  1. simonives
    Posted 1 year ago #

    Hi all.

    I'm after a few pointers on where WooCommerce stores certain items in WordPress's database. I would like to sell some Moodle 2.5 based courses through WordPress using WooCommerce and have Moodle authenticate course access using data created by WooCommerce.

    To authenticate using an external database from within Moodle 2.5 is simple. Using the stock Authentication plugin within Moodle allows you to point to an external database for authentication. You just need to match the user fields within the two databases. The fields that need to be matched are:

    1. Table
    2. Username field
    3. Password field
    4. Password format

    Optional fields are (of course, not all pulled from WooCommerce but perhaps some?):

    1. First name
    2. Surname
    3. Email address
    4. City/town
    5. Country
    6. Language
    7. Description
    8. Web page
    9. ID Number
    10. Institution
    11. Department
    12. Phone 1
    13. Phone 2
    14. Address

    So question one, where does WooCommerce store user data that would be useful for authentication purposes?

    Moodle's stock enrolment plugin is similar to the above, it queries an external database to match product codes with course codes. Moodle then allows access only to those courses that the authenticated user has purchased.

    The fields required for the enrolment plugin are:

    1. Table
    2. Course field
    3. User field

    So question two, where does WooCommerce store each customer's sales records so that I can map the data required by Moodle 2.5?

    I'm new to WooCommerce but would love to get this working. It's not a problem using products like Magento so I can't imagine it would be too much trouble to set up in WordPress with WooCommerce.

    Thanks in advance.

  2. wisedave
    Posted 1 year ago #

    I am interested in this as well! Did you find anything on this?

  3. simonives
    Posted 1 year ago #

    I've got a test system up and running. I'll post a follow-up on here later in the week but it's still a test so I'm not sure how robust my workflow is yet.


  4. wisedave
    Posted 1 year ago #

    Thanks Simonives.....it would be great if you could come back with an update. I am struggling with a solution!



  5. simonives
    Posted 1 year ago #

    Hi Wisedave.

    Sorry for my slow reply. We haven't run any of our scheduled test cases against this yet but the there is a blog post online where we got our inspiration from -> http://blog.giuseppeurso.net/moodle-and-wordpress-single-sign-on-in-20-minutes-part-1/index.html.

    I've been able to create a dummy account and purchase a dummy course via WordPress/Woocommerce and have Moodle authenticate the dummy user and allow access to the dummy course with this setup.

    Once we complete our testing I'll do a write-up on the steps etc.


  6. wisedave
    Posted 1 year ago #

    Nice.....if you can be bothered, keep me posted!



  7. danharding
    Posted 11 months ago #

    Love to hear anything about this in the future.

  8. simonives
    Posted 10 months ago #

    Just a note that I've put this on the back burner and have moved to a solution selling courses through Moodle itself. It's no where near as elegant a solution as using the WooCommerce plugin would be; I just couldn't justify the time as I wanted to release any code changes back to the Moodle community.

    Within WordPress I have a page for each course and each page links to the associated purchase/enrol page within Moodle.

    If anyone's really keen I'd be happy to link up with another developer to write a Moodle plugin (probably based on the External Database plugin) allowing easy access to the WordPress database. I'd like to see something like the External Database plugin for Moodle but one that includes WordPress as an option and has class-phpass.php embedded in order to handle WordPress's passwords (along with a few other details).

    I'd love to implement this as a Moodle plugin for ease of use for the wider community but I simply haven't got the time at the moment to do it all on my own.

  9. Phil C
    Posted 9 months ago #

    I'd also be very interested in this!

    Hopefully someone can help out one day

  10. esmi
    Forum Moderator
    Posted 9 months ago #

    As per the Forum Welcome, please post your own topic.

  11. Phil C
    Posted 9 months ago #

    ...I'm going to assume that was automated

  12. esmi
    Forum Moderator
    Posted 9 months ago #

    It wasn't. These forums have rules. Please read them.

    As you will see, one of these rules - entitled Where toPost - specifically states:

    Unless you are using the same version of WordPress on the same physical server hosted by the same hosts with the same plugins, theme & configurations as the original poster, do not post in someone else's thread. Start your own topic.

    Please abide by this and do not argue when you are asked to post your own topic.

Topic Closed

This topic has been closed to new replies.

About this Topic