BuddyDev

Search

[Resolved] Profile Info in Members List


  • Participant
    Level: Enlightened
    Posts: 134
    HansRuedi Keller on #26229

    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,
    Hans


  • Keymaster
    (BuddyDev Team)
    Posts: 14737
    Brajesh Singh on #26234

    Hi Hans,
    Try removing the line

    
    echo '</div>';
    

    from both of these. Your display should be fine without any memberurl(most probably).

    Regards
    Brajesh


  • Participant
    Level: Enlightened
    Posts: 134
    HansRuedi Keller on #26237

    Hi 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,
    Hans


  • Keymaster
    (BuddyDev Team)
    Posts: 14737
    Brajesh Singh on #26243

    Hi 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
    Brajesh


  • Participant
    Level: Enlightened
    Posts: 134
    HansRuedi Keller on #26244
    This reply has been marked as private.

  • Participant
    Level: Enlightened
    Posts: 134
    HansRuedi Keller on #26245

    I 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,
    Hans


  • Participant
    Level: Enlightened
    Posts: 134
    HansRuedi Keller on #26258

    Hi 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,
    Hans


  • Keymaster
    (BuddyDev Team)
    Posts: 14737
    Brajesh Singh on #26273

    Hi 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.

This topic is: resolved
Subscribe