Page 1 of 1

User Profile - edit profile and profile page help

Posted: Sun Sep 16, 2012 6:46 am
by rabatos
I want to have some optional fields for the user profiles.

So what I want is for example:
On the edit profile page to be able to enter a phone number.
But for this to only be displayed on the profile page if there is a value in the database.
If its empty nothing should show.

And if there is a value then for both the phone number and a label 'phone' to show on the profile page.

What do I need for this?

Re: User Profile - edit profile and profile page help

Posted: Mon Sep 17, 2012 12:31 pm
by jacek
I would just do it as normal but then on the profile page add a check to see if there is a value.
if (!!empty($info['about_me'])){
    ?>
    <div>
        <h3>About Me</h3>
        <p><?php echo $info['about_me']; ?></p>
    </div>
    <?php
}
for example. You will also need to make sure you do not require the field to have a value on the edit page.

Re: User Profile - edit profile and profile page help

Posted: Tue Sep 18, 2012 10:30 am
by rabatos
Thanks. Got it working.