xProfile Custom Fields & Profile User Css Customization
-
Hello,
I’ll break this down into 2 parts.
xProfile Custom Fields
I’ve looked around and can’t seem to find the solution to my problem.Basically what I’m trying to do is display a Headline at the top of my users profile if they have filled out the custom profile field, if they haven’t filled it out yet then I wanted to display their fullname. Sounds easy right? Yeah but I can’t seem to get it right.. I can get it to display just the username but when it displays the headline it’s also displaying the username.
I’m also doing this outside of the profile_loop.php it’s inside the profile.php using a highly edited version of the cosmicbuddy template. If anyone could help me I’d greatly appreciate it!
Here is an example of what I want the page to display and what my code some-what looks like:
if bp_profile_field_data( ‘field=Headline’ ) is filled out (this is the line i’m having problems with)
bp_profile_field_data( ‘field=Headline’ ); display headline
else
bp_user_fullname(); display fullname
endif
Profile User Css Customization
With myspace and other popular social networks around users want to be able to customize their profile to be unique from other users. I find that this also makes them more active on their profile as well as the website.I’m trying to do the same thing with CSS by letting the user edit their profile page background using div style. I have it working and here is the code I used along with adding the appropriate xprofile custom fields:
<div style=”background-color:<?php bp_profile_field_data( ‘field=Background Color’ ); ?>”>
This is just a small snippet of what I want to achieve, I’ve also created background-image, background-repeat, etc. You would need to create an xprofile field called Background Color and the user would need to type either the color word or an HTML color such as #FF0000 which is Red. Then you would have to place the div into your template wherever you want them to change the background color then close the div.
I’m new to buddypress and I’d call myself a beginner in php so I’m sure there are much better ways to go about this, I simply want to share what I’ve thought up so far and see what others have to say about this.
Ideally I would like to display the background color if only they have entered anything into the field so it would look like..
<div style=”
if bp_profile_field_data( ‘field=Background Color’ ); is filled in
then display background-color: bp_profile_field_data( ‘field=Background Color’ );
endif
“>Another thing I’m trying to do is allow the user to display a banner above their profile if they specify the URL in the custom profile field. The problem I’m having is getting it to display a specific width and height without creating a blank banner space on another users profile that has no image. If i just put the profile field it doesn’t assign a width and height to the URL which means they could put any size of image.
It would have to look something like
if bp_profile_field_data( ‘field=Banner Image’ ); is filled in
then display <div style=”width: 600px; height: 100px;”> <img src=” bp_profile_field_data( ‘field=Banner Image’ ); “> </div>
endifSo hopefully someone can have some input on anything I’ve mentioned above ;
- The topic ‘xProfile Custom Fields & Profile User Css Customization’ is closed to new replies.