Insert Extra fields added in the front end registration form to DB

Why the downvotes for using user meta? That’s how I do it, I store all the extra profile stuff in wp_usermeta table by utilizing update_user_meta. <?php // first validate all $_POST data $validated = $this->validate_and_sanitize(); $username = $validated[‘uname’]; $password = $validated[‘pass’]; $email = $validated[’email’]; $new_user_id = wp_create_user($username, $password, $email); if ( is_wp_error($new_user_id) && array_key_exists(‘existing_user_login’, $new_user_id->errors)) … Read more

Create a new page for each form selection

I can’t comment yet, so I’ll tell you here what you can change immediately: $countryinfo = $wpdb->get_row(“SELECT * FROM wp_num_countries WHERE countryID = “.$country_id); to $countryinfo = $wpdb->get_row($wpdb->prepare(“SELECT * FROM wp_num_countries WHERE countryID = %d”, $country_id)); because you directly use $_POST variable, so $wpdb->prepare will format and prepare your query string. But that code looks … Read more

Multi-part form and wp_redirect()

You have a form like <form action=”http://some/url/form_two.php” method=”POST”> <input type=”whatever” value=”nothing” /> <input type=”hidden” name=”form_one_displayed” value=”1″ /> <input type=”submit” value=”Send” /> </form> in e.g form_one.php In form_two.php you validate the data that was send (or not) <?php $result = do_some_validation_with( $_POST ); if ( false == $result ) wp_redirect( ‘form_one.php’ ); else display_form_two(); function do_some_validation_with( … Read more

Capturing POST data

It points to options.php because it uses the Settings API. Well, not completely, but that’s not the point now. You should not change that. What you can do, to add your own logic: hook into the save process for that option: add_filter( “sanitize_option_webweb-member-status-group”, “your_extra_handler” ); function your_extra_handler( $input ) { if ( isset ( $_POST[‘your_extra_post_field’] … Read more

prepopulate form from a hook within wordpress function.php file

You will need to declare the variable global before using it. function simple_form(){ global $firstname; $firstname=”Bob”; //Do something to populate the form field name <fname> with “Bob” } Your form should be able to do … global $firstname; echo $firstname; … to use the variable. However, I can’t help but think there is a better … Read more

Form fields based on custom fields

Our solution to this was to use Formidable Pro and the following setup. //************************************************** // Generate the contest form //************************************************** // Determin if radio or not add_filter(‘frm_field_type’, ‘change_my_field_type’, 10, 2); function change_my_field_type($type, $field){ global $post; if($field->id == 8){ if (get_post_meta($post->ID, ‘_cmeta_contest_q1_type’, true) !== ‘field’) { $type=”radio”; //change field to radio on multi-answer questions } else … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)