Topic: I have added fields to user profile how do I update them?

I use PunBB for our club message board.  I have it set  to not accept new registrations, and guests cannot view info.

We wanted to include address and phone numbers to the user profile.  I have successfully added the fields to the database and manually populated the field values using my webhost tools.  I have also modified profile.php and the language file  profile.php to include these new fields.

I have added  address, state, zipcode, phone, mobile, and workphone as fields.  I am using the location field as city (and changed it to display City in the language file).

I don't know any php I am just experimenting using trial and error.


I have the display portion working OK with the code mods below.


                            <dt><?php echo $lang_common['Username'] ?>: </dt>
                            <dd><?php echo pun_htmlspecialchars($user['username']) ?></dd>
                            <dt><?php echo $lang_common['Title'] ?>: </dt>
                            <dd><?php echo ($pun_config['o_censoring'] == '1') ? censor_words($user_title_field) : $user_title_field; ?></dd>
                            <dt><?php echo $lang_profile['Realname'] ?>: </dt>
                            <dd><?php echo ($user['realname'] !='') ? pun_htmlspecialchars(($pun_config['o_censoring'] == '1') ? censor_words($user['realname']) : $user['realname']) : $lang_profile['Unknown']; ?></dd>
                            <dt><?php echo $lang_profile['Address'] ?>: </dt>
                            <dd><?php echo ($user['address'] !='') ? pun_htmlspecialchars(($pun_config['o_censoring'] == '1') ? censor_words($user['address']) : $user['address']) : $lang_profile['Unknown']; ?></dd>
                            <dt><?php echo $lang_profile['Location'] ?>: </dt>
                            <dd><?php echo ($user['location'] !='') ? pun_htmlspecialchars(($pun_config['o_censoring'] == '1') ? censor_words($user['location']) : $user['location']) : $lang_profile['Unknown']; ?></dd>
                            <dt><?php echo $lang_profile['State'] ?>: </dt>
                            <dd><?php echo ($user['state'] !='') ? pun_htmlspecialchars(($pun_config['o_censoring'] == '1') ? censor_words($user['state']) : $user['state']) : $lang_profile['Unknown']; ?></dd>
                            <dt><?php echo $lang_profile['Zipcode'] ?>: </dt>
                            <dd><?php echo ($user['zipcode'] !='') ? pun_htmlspecialchars(($pun_config['o_censoring'] == '1') ? censor_words($user['zipcode']) : $user['zipcode']) : $lang_profile['Unknown']; ?></dd>
                            <dt><?php echo $lang_profile['Phone'] ?>: </dt>
                            <dd><?php echo ($user['phone'] !='') ? pun_htmlspecialchars(($pun_config['o_censoring'] == '1') ? censor_words($user['phone']) : $user['phone']) : $lang_profile['Unknown']; ?></dd>
                            <dt><?php echo $lang_profile['Mobile'] ?>: </dt>
                            <dd><?php echo ($user['mobile'] !='') ? pun_htmlspecialchars(($pun_config['o_censoring'] == '1') ? censor_words($user['mobile']) : $user['mobile']) : $lang_profile['Unknown']; ?></dd>
                            <dt><?php echo $lang_profile['Workphone'] ?>: </dt>
                            <dd><?php echo ($user['workphone'] !='') ? pun_htmlspecialchars(($pun_config['o_censoring'] == '1') ? censor_words($user['workphone']) : $user['workphone']) : $lang_profile['Unknown']; ?></dd>
              <dt><?php echo $lang_profile['Website'] ?>: </dt>
                            <dd><?php echo $url ?> </dd>
                            <dt><?php echo $lang_profile['Birthday'] ?>: </dt>
                <dd><?php echo $birthday?> </dd>
              <dt><?php echo $lang_common['E-mail'] ?>: </dt>
                            <dd><?php echo $email_field ?></dd>
                        </dl>

I can't get the update portion of the php file to work.  I have tried to change the portion of the file below. I have only experimented with the address field so far.


    <div class="blockform">
        <h2><span><?php echo pun_htmlspecialchars($user['username']).' - '.$lang_profile['Section personal'] ?></span></h2>
        <div class="box">
            <form id="profile2" method="post" action="profile.php?section=personal&id=<?php echo $id ?>">
                <div class="inform">
                    <fieldset>
                        <legend><?php echo $lang_profile['Personal details legend'] ?></legend>
                        <div class="infldset">
                            <input type="hidden" name="form_sent" value="1" />
                            <label><?php echo $lang_profile['Realname'] ?><br /><input type="text" name="form[realname]" value="<?php echo pun_htmlspecialchars($user['realname']) ?>" size="40" maxlength="40" /><br /></label>
<?php if (isset($title_field)): ?>                    <?php echo $title_field ?>
<?php endif; ?>
                            <label><?php echo $lang_profile['Address'] ?><br /><input type="text" name="form[address]" value="<?php echo pun_htmlspecialchars($user['address']) ?>" size="35" maxlength="35" /><br /></label>
              <label><?php echo $lang_profile['Location'] ?><br /><input type="text" name="form[location]" value="<?php echo pun_htmlspecialchars($user['location']) ?>" size="30" maxlength="30" /><br /></label>
                            <label><?php echo $lang_profile['Website'] ?><br /><input type="text" name="form[url]" value="<?php echo pun_htmlspecialchars($user['url']) ?>" size="50" maxlength="80" /><br /></label>

It displays the current value of the field, but will not update when submit button is pressed and it displays the previous value of the field.

What do I need to do to have these fields update? 


Thanks,

C's Daddy

2

Re: I have added fields to user profile how do I update them?

Find

case 'personal':{$form = extract_elements(array('blablabla'));

Replace with

case 'personal':{$form = extract_elements(array('username','realname','address','website','state','zipcode','phone','mobile','workpone','location','birthday','email'));
Hm... every pixel has it's own destiny

Re: I have added fields to user profile how do I update them?

Seva.

I thought that was what I needed to do.   I had an extra space in the field name when I tried it.  Its working now.

Thanks for your help.


C's Daddy

Re: I have added fields to user profile how do I update them?

Hi,

I'd actually like to get rid of the website field if I can't get censoring working on that one.
Which lines should be up for deletion?