Web Monetization Community

loading...

Discussion on: A New Approach to Sharing Knowledge on Websites Enabled by Web Monetization — Final Grant Report #2

Collapse
consistentbenny profile image
Benny Author • Edited

Hi Erica!

1) As mentioned above, I am using the SSO login plugin for WordPress from miniOrange: wordpress.org/plugins/miniorange-l...

The free version of the plugin is enough to make the Coil user login flow working.

2) The plugin has a preset for Coil available, but it requires you to receive your own client ID and client secret. Follow the Coil documentation to receive those: help.coil.com/docs/dev/oauth-api

As a non-developer I used a software called Postman to do the required API call to receive these credentials: postman.com

Enter the credentials into the plugin settings once you got them.

3) As a next step, I created a group in LearnDash and defined in the settings that every user who is part of this group has access to my WordPress course.

4) Then, I added a code snippet to my WordPress theme's function.php file:

add_action( 'user_register', function ( $user_id = 0 ){
if ( !empty( $user_id ) ) {
$LD_GROUP_IDS = array( 746 );
learndash_set_users_group_ids( $user_id, $LD_GROUP_IDS );
}
});

This code snippet automatically adds every new user to my LearnDash group (it has the WordPress ID 746, as you can see in the code snippet above).

So now every new user who signs in with Coil for the first time, will automatically be added to the LearnDash group and — by being a member of the group — have access to the course.

If I add more courses in the future, I can simply give all group members access to that course as well and they will have immediate access to it too.

Hope that helps! 🤓