• Resolved tyler53

    (@tyler53)


    Hi there,

    I’m using Sportspress Pro and the Marquee theme, and I am trying to code (in PHP) a system in which a player is created upon user registration. When the user registers, I want the function to take the data from the form and create a Sportspress player, function below:

    add_action( 'user_register', 'elev8_registration_save', 10, 1 );
     
    function elev8_registration_save( $user_id ) {
     
        if ( isset( $_POST ) ) {
    		$playerName = 'Name'; $playerNum = '00'; 
    		$playerPos = 'Position'; $playerTeam = 'Team';
    		if ( isset($_POST['field_1']) )
    			$playerName = $_POST['field_1'];
    		if ( isset($_POST['field_2']) )
    			$playerNum = $_POST['field_2'];
    		if ( isset($_POST['field_3']) )
    			$playerPos = $_POST['field_3'];
    		if ( isset($_POST['field_19']) )
    			$playerTeam = $_POST['field_19'];
    		
    		// HERE IS WHERE I NEED HELP WITH CREATING THE PLAYER
    	}
    }

    Can I just manually create the player in the database, or is there some function to do it safer/easier?

    Thanks in advance!

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Create Player From User Registration – PHP’ is closed to new replies.