Skip to:
Content
Pages
Categories
Search
Top
Bottom

Hiding empty xProfile fields in member-header.php

  • @bowromir

    Participant

    Hi guys,

    I’m using the following snippet to display certain xprofile fields in my member-header.php:

    `

    Occupation:

    `

    This works fine, but it also shows when the profile field is empty. So I would like to hide them when empty, but I can’t figure out how to do this. I’m pretty sure @DJPaul made a snippet once, but I could not find it again. I imagine it must have been something like:

    if xprofile field “Country” has data
    Country: United States
    else
    *blank*

    Ofcourse this needs to be proper php (which I can’t write :D). If someone has this working, or could help me figure this out, it would be pretty awesome!

Viewing 7 replies - 1 through 7 (of 7 total)
  • @boonebgorges

    Keymaster

    Probably the most efficient way is to do something like this (not beautiful to put in a template file, but functional and lean):

    `

    Occupation:

    `

    @bowromir

    Participant

    Works absolutely perfect Boone.. I’ll put it up on BP-Tricks as well.. this is useful stuff! Thanks!

    @boonebgorges

    Keymaster

    Sweet!

    @bowromir

    Participant

    @hnla

    Participant

    A search of the forum would have thrown up a few posts on this subject that have this and alternative examples.

    @bowromir

    Participant

    hnl: Yep.. I did that.. but they where all old and did not use the BP 1.2 method of displaying the profile fields and seemed to add a a lot of extra unneeded parameters to the snippet. Hopefully it’ll be easier for php noobs to find and implement now :)

    @hnla

    Participant

    *puzzled* I contributed to some and have used various approaches of my own all post dating 1.1 or the transition to the 1.2 stream, but yes guess some are a little complicated but then BP isn’t that simple a thing to code for requiring as it does a little more than basic knowledge.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Hiding empty xProfile fields in member-header.php’ is closed to new replies.
Skip to toolbar