Hi Brajesh,
please help me with a little hack. I’m using the following code to show xprofile field data in the members list:function my_directory() { if ( bp_is_active( 'xprofile' ) ) if ( $memberbio = xprofile_get_field_data( 'Kurzbiografie', bp_get_member_user_id() ) ) : echo '<br/>'; echo $memberbio; echo '</div>'; endif; if ( $memberurl = xprofile_get_field_data( 'URL', bp_get_member_user_id() ) ) : echo $field_value = str_replace('rel="nofollow"', 'rel="nofollow" target="_blank"', $memberurl); echo '</div>'; endif; } add_filter ( 'bp_directory_members_item', 'my_directory' );
It’s working, but if memberbio is empty (no data) the code should retour a space/nbsp to make sure that memberurl does show up correctly.
Yes, it does show up, but it’s not at the place in the UI where I would like to have it (different position and font style).
Yes, only cosmetics but would be really nice to have a consistent UI.
Thanks,
HansHi Hans,
Try removing the lineecho '</div>';
from both of these. Your display should be fine without any memberurl(most probably).
Regards
BrajeshHi Brajesh,
Just tried but that’s not working. Seems I really need that space/nbsp if memberbio is empty.Would you please add that if/else for me to add it?
Regards,
HansHi Hans,
The above code does not contain any stylistic markup. So, I am a bit confused.Can you please share me 1-2 screen shots(s) and help me understand the issue and desired solution.
Regards
BrajeshI try to explain: it’s only this part what needs to be extended:
if ( $memberbio = xprofile_get_field_data( 'Kurzbiografie', bp_get_member_user_id() ) ) : echo '<br/>'; echo $memberbio; echo '</div>'; endif;
The code has to check if that field is empty. If yes, it should return a space (as a “placeholder”), if it’s not empty then it should proceed the way the formula is now built. That’s all.
Regards,
HansHi Brajesh,
I just found the solution in your reply to this post…https://buddydev.com/support/forums/topic/insert-a-value-into-my-new-xprofile-numeric-field/
Regards,
HansHi Hans,
I am glad you have found the solution. I will still not suggest using the ‘‘. It will break the layout someday as it is not being used properly.Regards
Brajesh
You must be logged in to reply to this topic.