0

I have found this register form on http://www.sutanaryan.com/2011/12/wordpress-custom-registration-without-using-a-plugin/ but in this case it is registering into wordpress own user table. What i would like to do is to insert into my own table for userclients

THIS IS WHAT I'VE FOUND ONLINE:

global $wpdb, $PasswordHash, $current_user, $user_ID;

$user_id = wp_insert_user( array (
'first_name' => apply_filters('pre_user_first_name', $first_name), 
'last_name' => apply_filters('pre_user_last_name', $last_name), 
'user_pass' => apply_filters('pre_user_user_pass', $pwd1), 
'user_login' => apply_filters('pre_user_user_login', $username), 
'user_email' => apply_filters('pre_user_user_email', $email)
) 
);
        if( is_wp_error($user_id) ) {
            $err = 'Error on user creation.';
        } else {
            do_action('user_register', $user_id);

            $success = 'You\'re successfully register';
        }

THIS IS WHAT I HAVE TRIED:

global $wpdb, $PasswordHash, $current_user, $user_ID;

$user_id = wpdb->INSERT INTO( 'wp_fisker' array 
(
'fisker_fornavn' => apply_filters('pre_user_first_name', $fisker_fornavn),
'fisker_efternavn' => apply_filters('pre_user_last_name',$fisker_efternavn),
'password' => apply_filters('pre_user_user_pass', $password),
'telefon' => apply_filters('pre_user_telefon', $telefon),
'zip' => apply_filters('pre_user_zip', $zip),
'by_navn' => apply_filters('pre_user_by_navn', $by_navn),
'email' => apply_filters('pre_user_user_email', $email), 
'role' => 'subscriber' 
) 
        );
        if( is_wp_error($user_id) ) {
            $err = 'Error on user creation.';
        } else {
            do_action('user_register', $user_id);

            $success = 'You\'re successfully register';
        }

I'm getting an error of a unexpected T_OBJECT_OPERATOR

I hope you can help me figure this out.

1 Answer 1

0

I figured it out myself I needed $wpdb and a , after the db_name Here is the result.

        $user_id = $wpdb->INSERT( 
            'wp_fisker',
            array (
            'fisker_fornavn' => apply_filters('pre_user_first_name', $fisker_fornavn),
            'fisker_efternavn' => apply_filters('pre_user_last_name', $fisker_efternavn),
            'password' => apply_filters('pre_user_user_pass', $password),
            'telefon' => apply_filters('pre_user_telefon', $telefon),
            'zip' => apply_filters('pre_user_zip', $zip),
            'by_navn' => apply_filters('pre_user_by_navn', $by_navn),
            'email' => apply_filters('pre_user_user_email', $email) 
            )
        );
        if( is_wp_error($user_id) ) {
            $err = 'Error on user creation.';
        } else {
            do_action('user_register', $user_id);

            $success = 'You\'re successfully register';
        }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.