Thanks, @simon!
Here’s what I’m doing now:
function add_user_to_discourse($data) {
do_action( 'my_mm_account_added', $data["username"], get_user_by('ID',$data["member_id"]) );
error_log ("Doing add_user");
}
add_action('mm_member_add', 'add_user_to_discourse');
Also, I have a handful of actions like
add_action('mm_member_membership_change', 'run_discourse_sync_based_on_mm_acct_change');
add_action('mm_member_status_change', 'run_discourse_sync_based_on_mm_acct_change');
add_action('mm_member_account_update', 'run_discourse_sync_based_on_mm_acct_change');
Should all of these call sync_sso_record? And what should go in $user when I call WPDiscourse\Utilities\Utilities::create_discourse_user( $user )? (I’m going to RTFC now, but perhaps your 2 minutes can save me an hour.
)
Edit: OK, should something like this work? I see that it’s getting called, but the user’s not getting created.
function add_user_to_discourse($data) {
$user['name'] = $data['first_name'] . " " . $data['last_name'];
$user['user_email'] = $data['email'];
error_log ("Calling create_discourse_user");
WPDiscourse\Utilities\Utilities::create_discourse_user( $user );
}