• mancostudios

    I would like to add some additional User Info Fields in the Profile window: UserPhone, UserStreetAddress. Before breaking a working WP installation with my minimal PHP knowledge, I thought I’d rather ask for some feedback;-)
    What I intended doing is to simply add those 2 rows (user_phone and user_street) manually into the table wp-users at the end of the table via myPHPadmin.
    Then, in profile.php I was going to add on line 97 the following 2 lines:
    $newuser_phone=addslashes(stripslashes($_POST['newuser_phone']));
    $newuser_street=addslashes(stripslashes($_POST['newuser_street']));
    And on line 98 within the $query I would add user_phone='$newuser_phone' and user_street='$newuser_street'.
    Then, after line 173 I would add:
    <?php _e('Phone:') ?> <?php echo $profiledata->user_phone ?>
    <?php _e('Street:') ?> <?php echo $profiledata->user_street ?>
    And then, after line 299 I would add:
    <tr>
    <th scope="row"><?php _e('Phone:') ?> </th>
    <td> <input type="text" name="newuser_phone" id="newuser_phone2" value="<?php echo $profiledata->user_phone ?>" /> </td>
    </tr>
    <tr>
    <th scope="row"><?php _e('Street:') ?> </th>
    <td> <input type="text" name="newuser_street" id="newuser_street2" value="<?php echo $profiledata->user_street ?>" /> </td>
    </tr>
    I think this is what I would need to do within the profile.php. Is this correct? Thanks for any input.

Viewing 9 replies - 1 through 9 (of 9 total)
  • herculean

    (@herculean)

    Funny, I just did the exact same steps and was looking for clarification. I’m no longer on a server with phpMyAdmin access to the DB’s, so its proving a little difficult to add to the tables. I was looking for a hack that did this type of thing, but haven’t had any luck.

    Did one of you manage to get those extra fields working? I did exactly the same for Jabber and Skype. The fields show up, can be written in but nothing gets saved. On the other hand, if i fill the tables manually their entries shows up after a reload of the page.

    So it seems to me, that there is a small problem in writing the entered date into the tables of the database…

    I just did this last week for work adding client record numbers, counselors & diagnosis info.

    The two pages that I changed were users.php & users-edit.php

    ** users.php

    ** top of page added in this way

    $user_working8 = wp_specialchars($_POST[‘user_working8’]);

    $result = $wpdb->query(user_working8)
    VALUES
    (‘$user_working8’)”);

    **in the display section as such

    $user_working8 = $user_data->user_working8;

    echo “\n<tr $style>
    <td align=’center’>$user_data->user_working8</td>

    **in in add new client section

    <tr>
    <th scope=”row”><?php _e(‘Working’) ?> </th>
    <td>
    <select name=”user_working8″>
    <option value=”Yes”>Yes</option>
    <option value=”No”>No</option>
    </select>
    </td>
    </tr>

    ** users-edit.php

    $new_working8 = wp_specialchars($_POST[‘new_working8’]);

    $result = $wpdb->query(user_working8 = ‘$new_working8′”);

    ** down below this section allows changing of value

    <tr><th scope=”row”><?php _e(‘question goes here:’) ?></th>
    <td>
    <select name=”new_working8″>

    <option value=”new_working8″<?php
    if ($edituser->user_working8 == ”)
    echo ‘ selected=”selected”‘; ?>><?php echo ‘Select’; ?></option>

    <option value=”No”<?php
    if ($edituser->user_working8==”No”)
    echo ‘ selected=”selected”‘; ?>><?php echo ‘No’; ?></option>

    <option value=”Yes”<?php
    if ($edituser->user_working8==”Yes”)
    echo ‘ selected=”selected”‘; ?>><?php echo ‘Yes’; ?></option>

    </select>
    </td>
    </tr>

    Thanx for your help, but it doesn’t do too much for me. I don’t want the info entered while registering, but afterwards, when a user changes and fills in values into his profile…

    m4c3w4n,

    Followed these instructions and it worked. My knowledge is minimal so I had to figure out that I needed to also add the field using phpMyAdmin. But I did it! This was actually quicker than the time I spent looking for a plugin. Thanks.

    Yes, I installed Userextra but I wanted everything on one page. I want users to fill in their profile information when they register. I couldn’t seem to make it happen with Userextra.

    Can someone explain how to do what m4c3w4n is greater detail, i.e

    ** top of page added in this way

    Where abouts do I add that, up the top of page? above the <?php stuff or what

    Also how do I add fields in phpmyadmin and which fields do I add.. Do I need to add a new field in each new thing I want.. ie age, fav song etc etc.

    thanks, I would really appreciate if someone could help me with this

    Can someone either make a good plugin for this.. I would pay $ for a good modifide profile page plugin.

    I am aware of usermeta/extra before anyone tells me..

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Add User Info Fields’ is closed to new replies.