/** * @param $account * @param $mapping_context * @return WP_User */ function memberful_wp_sync_member_account($account, $mapping_context) { $mapper = new Memberful_User_Map(); $user = $mapper->map($account->member, $mapping_context); if (!is_wp_error($user)) { Memberful_Wp_User_Downloads::sync($user->ID, $account->products); Memberful_Wp_User_Subscriptions::sync($user->ID, $account->subscriptions); Memberful_Wp_User_Role_Decision::ensure_user_role_is_correct($user); } else { memberful_wp_record_error(array('error' => $user->get_error_messages(), 'code' => $user->get_error_code(), 'data' => $user->get_error_data())); } return $user; }
public function map($member, $refresh_token) { $mapper = new Memberful_User_Map(); return $mapper->map($member, array('refresh_token' => $refresh_token)); }
function memberful_wp_hook_member_updated($data) { $mapper = new Memberful_User_Map(); $mapper->map($data->member); }