Last active
December 8, 2017 00:33
-
-
Save hostz-frank/b89819cda9739fa3826dcce3267be019 to your computer and use it in GitHub Desktop.
Weist automatisch neue User in WordPress einem WP-Courseware-Kurs zu.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.