Skip to content

Instantly share code, notes, and snippets.

@hostz-frank
Last active December 8, 2017 00:33
Show Gist options
  • Save hostz-frank/b89819cda9739fa3826dcce3267be019 to your computer and use it in GitHub Desktop.
Save hostz-frank/b89819cda9739fa3826dcce3267be019 to your computer and use it in GitHub Desktop.
Weist automatisch neue User in WordPress einem WP-Courseware-Kurs zu.
<?php
/*
Plugin name: WP Courseware frontend user sync
Description: Weist automatisch neue User in WordPress einem WP-Courseware-Kurs zu, die programmatisch erstellt werden.
*/
defined( 'ABSPATH' ) || die();
// Anpassen: Kurs-ID des WP-Courseware-Kurses || Assign your WPCW course ID here!
$wpc_course_id = 1;
add_action( 'user_register', 'my_WPCW_courses_syncUserAccess', 20 );
function my_WPCW_courses_syncUserAccess( $user_id ) {
global $wpc_course_id;
if( function_exists( 'WPCW_courses_syncUserAccess' ) ) {
WPCW_courses_syncUserAccess( $user_id, $wpc_course_id );
}
}
@hostz-frank
Copy link
Author

Fixes the situation when a membership plugin creates a new user who is NOT created in the WP backend. So it happens easily that a membership plugin creates a new WP user without syncing this user's access with WPCW. This can be probably considered a WPCW bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment