WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Check if User has entered Data in User Profile Form Field (2 posts)

  1. Erik Ford
    Member
    Posted 3 years ago #

    Here is something that has stumped me for some time and I am hoping someone can assist with a solution. I have added additional Contact fields, for Twitter & Facebook, using the add_filter method. From there, I have created an author.php template to serve up the current author's description, Twitter link, Facebook link and Website URL.

    This works perfectly with one hitch. If the user does not have a website URL in the $user_url field, the href URL that is passed through on the site defaults back to the Author archive. I would like to run a check to see if the given field has any data. Here is what I have tried unsuccessfully:

    <?php if ( $curauth->$user_url ) != '' { ?>
    <!-- do something -->
    <?php } ?>

    Any help is greatly appreciated.

  2. Erik Ford
    Member
    Posted 3 years ago #

    After posting this topic, and looking at my code, I quickly found my mistake. The conditional statement should read:

    <?php if ( ($curauth->user_url ) !='' ) { ?>
    <!-- do something -->
    <?php } ?>

Topic Closed

This topic has been closed to new replies.

About this Topic