Results 1 to 2 of 2

Thread: how to add more fields in User profile?

  1. #1
    Thread Starter
    chanchalhada's Avatar
    Join Date
    Apr 2014
    Location
    India
    Posts
    54
    Thanks
    10
    Thanked 0 Times in 0 Posts

    how to add more fields in User profile?

    Hi Team,

    I want to add more fields, to edit profile page like phone number and City, sex make or female. I have tried it by editing in PHP file, it is showing the field but when add my phone number and clicking on update it is not saving it. please help me on this. please see the screen shot and code highlighted n red which I added in it.


    Capture.JPG

    CODE

    <?php
    /*
    * Template Name: Edit Profile
    *
    * This template must be assigned to a page
    * in order for it to work correctly
    *
    */

    $current_user = wp_get_current_user(); // grabs the user info and puts into vars

    $show_password_fields = apply_filters( 'show_password_fields', true );
    ?>

    <div id="main">

    <?php do_action( 'appthemes_notices' ); ?>

    <div class="section-head">
    <h1><?php _e( 'Update Your Profile', APP_TD ); ?></h1>
    </div>

    <form name="profile" id="login-form" action="" method="post" enctype="multipart/form-data">
    <?php wp_nonce_field( 'app-edit-profile' ); ?>

    <input type="hidden" name="from" value="profile" />
    <input type="hidden" name="checkuser_id" value="<?php echo $user_ID; ?>" />

    <fieldset>
    <div class="form-field">
    <label>
    <?php _e( 'Username:', APP_TD ); ?>
    <input type="text" name="user_login" class="text regular-text" id="user_login" value="<?php echo $current_user->user_login; ?>" maxlength="100" disabled />
    </label>
    </div>
    <div class="form-field">
    <label>
    <?php _e( 'Display Name:', APP_TD ); ?>
    <input type="text" name="display_name" class="text regular-text" id="display_name" value="<?php echo $current_user->display_name; ?>" maxlength="100" />
    </label>
    </div>
    <div class="form-field">
    <label>
    <?php _e( 'Email:', APP_TD ); ?>
    <input type="text" name="email" class="text regular-text" id="email" value="<?php echo $current_user->user_email; ?>" maxlength="100" />
    </label>
    <label><?php _e( 'Make Public?:', APP_TD ); ?><input type="checkbox" <?php checked( $current_user->email_public ); ?> name="email_public" /></label>
    </div>
    <div class="form-field">
    <label>
    <?php _e( 'Phone:', APP_TD ); ?>
    <input type="text" name="Phone" class="text regular-text" id="Phone" value="<?php echo $current_user->user_Phone; ?>" maxlength="100" />
    </label>
    <label><?php _e( 'Make Public?:', APP_TD ); ?><input type="checkbox" <?php checked( $current_user->Phone_public ); ?> name="Phone_public" /></label>
    </div>

    <?php foreach ( _wp_get_user_contactmethods( $current_user ) as $name => $desc ) : ?>
    <div class="form-field">
    <label for="<?php echo $name; ?>"><?php echo apply_filters( 'user_'.$name.'_label', $desc ); ?>:</label>
    <input type="text" name="<?php echo $name; ?>" id="<?php echo $name; ?>" value="<?php echo esc_attr( $current_user->$name ); ?>" class="regular-text" />
    </div>
    <?php endforeach; ?>

    <div class="form-field">
    <label>
    <?php _e( 'Website:', APP_TD ); ?>
    <input type="text" name="url" class="text regular-text" id="url" value="<?php echo $current_user->user_url; ?>" maxlength="100" />
    </label>
    </div>
    <div class="form-field">
    <label>
    <?php _e( 'About Me:', APP_TD ); ?>
    <textarea name="description" class="text regular-text" id="description" rows="10" cols="50"><?php echo $current_user->description; ?></textarea>
    </label>
    </div>

    <?php if ( $show_password_fields ) : ?>

    <div class="form-field">
    <label for="pass1">
    <?php _e( 'New Password:', APP_TD ); ?> <span class="description"><?php _e( 'Leave this field blank unless you would like to change your password.', APP_TD ); ?></span>
    <input type="password" name="pass1" class="text regular-text" id="pass1" maxlength="50" value="" />
    </label>
    </div>
    <div class="form-field">
    <label for="pass2">
    <?php _e( 'Password Again:', APP_TD ); ?> <span class="description"><?php _e( 'Type your new password again.', APP_TD ); ?></span>
    <input type="password" name="pass2" class="text regular-text" id="pass2" maxlength="50" value="" />
    </label>
    </div>
    <div class="form-field">
    <label>
    <span class="description"><?php _e( 'Your password should be at least seven characters long.', APP_TD ); ?></span>
    <div id="pass-strength-result"><?php _e( 'Strength indicator', APP_TD ); ?></div>
    </label>
    </div>

    <?php endif; ?>
    <?php do_action( 'show_user_profile', $current_user ); ?>
    <div class="form-field">
    <input type="submit" value="<?php _e( 'Update Profile', APP_TD ); ?>">
    </div>

    </fieldset>

    <input type="hidden" name="action" value="app-edit-profile" />
    <input type="hidden" name="user_id" id="user_id" value="<?php echo $user_ID; ?>" />
    </form>

    </div><!-- /#main -->

    <div id="sidebar">
    <?php get_sidebar( app_template_base() ); ?>
    </div>

  2. #2
    spartac's Avatar
    Join Date
    May 2011
    Posts
    7,171
    Thanks
    75
    Thanked 830 Times in 808 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!
    Do you need high-quality content for your Website? For a significantly reduced price? Try aicontently.com






    We answer the questions in threads as fast as the private messages, So do not send support questions via private message. Use the forum instead and open a new thread for every issue.
    Before you send any PM , Please read These rules .

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Remove fields from user profile
    By suzmat in forum ClassiPress General Discussion
    Replies: 3
    Last Post: February 8th, 2015, 12:45 AM
  2. Dimitris Is there a way to add fields to user profile?
    By freelancing in forum Help Using HireBee
    Replies: 4
    Last Post: September 3rd, 2014, 04:58 AM
  3. Datepicker in User Profile fields
    By joeventures in forum ClassiPress General Discussion
    Replies: 1
    Last Post: February 2nd, 2012, 07:39 PM
  4. Adding fields to user profile
    By rtibbs4 in forum ClassiPress General Discussion
    Replies: 1
    Last Post: April 18th, 2010, 11:01 PM