User registration problem in WordPress

Look at the code in wp-login.php (line 481 and following). There you can see how registration works. The names of your form – email, name – are probably overwritten by WordPress. Always use prefixed names in forms to avoid collisions, eg.: ma_email and ma_name. Prepare incoming data. Do not just write anything someone sends you … Read more

Best way to create multi-step form with data saved to user account for later updating?

If you are working on a custom theme, I believe it is easier to be done with a page template and WordPress’s wp_ajax function. The form can be included in the page using <?php get_template_part(‘form’,’0f-50-question’) ?>. Here is the pseudo code for the form <form id=”quite-a-long-form” action=”<?php echo admin_url(‘admin-ajax.php’); ?>” method=”post” class=”form” > $step = … Read more

using update_user_meta in form to set and get custom meta

You need to pull your meta_data from WP and fill that info into the form… like so: function my_form_function() { global $current_user; $low_price = get_user_meta( $current_user->ID, ‘_low_price’, true); $medium_price = get_user_meta( $current_user->ID, ‘_medium_price’, true); $high_price = get_user_meta( $current_user->ID, ‘_high_price’, true); ?> <form name=”setPrices” action=”” method=”POST”> <fieldset> <label for=”lowPrice”>Value 3:</label> <input type=”text” id=”lowPrice” name=”lowPrice” value=”<?php echo … Read more

How to get current url in contact form 7

See this example on how to create and parse the shortcode in the contact form 7 to use it add [current_url] add_action( ‘wpcf7_init’, ‘wpcf7_add_form_tag_current_url’ ); function wpcf7_add_form_tag_current_url() { // Add shortcode for the form [current_url] wpcf7_add_form_tag( ‘current_url’, ‘wpcf7_current_url_form_tag_handler’, array( ‘name-attr’ => true ) ); } // Parse the shortcode in the frontend function wpcf7_current_url_form_tag_handler( $tag … Read more

Add error message on password protected page

The latest entered password is stored as a secure hash in a cookie named ‘wp-postpass_’ . COOKIEHASH. When the password form is called, that cookie has been validated already by WordPress. So you just have to check if that cookie exists: If it does and the password form is displayed, the password was wrong. add_filter( … Read more

What is an easy way to display a front-end user registration form?

Jeff Starr wrote a great tutorial on front-end registration, login and password recovery taking the similar approach as suggested by onetrickpony. So take this as a follow up to his answer and as another resource that might help you get it done: http://digwp.com/2010/12/login-register-password-code/ Now you have two examples how to code this yourself and trust … Read more

How to handle form submission?

You should use the wp_ajax or the wp_ajax_nopriv function. First of all you should put the the admin ajax url as the action attribute value in the submission form. <form id=”” action=”<?php echo admin_url(‘admin-ajax.php’); ?>” method=”post” class=”form” > That way the the form will be submitted to the admin-ajax.php by default (without JavaScript). You can … Read more

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