• Hello, I’ve made an automatic registration of members

    <?php
    include "autenticacao.php";
    require( dirname(__FILE__) . '/wp-load.php' );
    $situ_id = $_GET['situ_id'];
    $asnt_id = $_GET['asnt_id'];
    
      if($situ_id == 2 or 4 && $asnt_id > 363714) {
    
    function register_new_user( $user_login, $user_email ) {
    $errors = new WP_Error();
    	$sanitized_user_login = sanitize_user( $user_login );
    	$user_email = apply_filters( 'user_registration_email', $user_email );
    	do_action( 'register_post', $user_login, $user_email );
    
    	$user_pass = 'zztot4875';
    	$user_id = wp_create_user( $sanitized_user_login, $user_pass, $user_email );
    
    	update_user_option( $user_id, 'default_password_nag', true, true ); //Set up the Password change nag.
    
    	wp_new_user_notification( $user_id, $user_pass );
    
    	return $user_id;
    
    }
    	$user_login = '';
    	$user_email = '';
    $user_email = $_GET['asnt_email'];
    $user_login = $_GET['asnt_email'];
    $errors = register_new_user($user_login, $user_email);
     } else { header("HTTP/1.0 404 Not Found");
    }
    ?>

    and I need to add the role “s2member_level1” to the user in this process, how to do it?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Lucky-1

    (@lucky-1)

    and another fields

    Thread Starter Lucky-1

    (@lucky-1)

    Ive tried

    $auto_eot_time = '+1 month';
    	$s2m = 's2Member Level 1';
    
    //	update_user_option( $user_id, 'wp_capabilities', 'a:1:{s:15:"s2member_level1";s:1:"1";}', true );
    //	update_user_option( $user_id, 'wp_s2member_auto_eot_time', '+1 month', true );
    //	update_user_meta( $user_id, 'wp_capabilities', $s2m );
    //	update_user_meta( $user_id, 'wp_s2member_auto_eot_time', $auto_eot_time );
    
    update_user_option ($user_id, "s2member_auto_eot_time", $auto_eot_time);

    but nothing works

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to add another role to member on automatic registration’ is closed to new replies.