Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] Show empty fields in profile


  • junithorn
    Participant

    @junithorn

    Hi all, as far as I can tell empty fields should be enabled when I change

    <?php if ( bp_has_profile(‘hide_empty_fields=0’) ) : ?>

    to

    <?php if ( bp_has_profile() ) : ?>

    in profile-loop.php, sadly however the empty profile fields still wont show up.

Viewing 4 replies - 1 through 4 (of 4 total)

  • junithorn
    Participant

    @junithorn

    Err, sorry I had those two reversed.


    junithorn
    Participant

    @junithorn

    Just an FYI to anyone curious, here is the solution:

    <?php do_action( 'bp_before_profile_loop_content' ); ?>
    
    <?php if ( bp_has_profile('hide_empty_fields=0') ) : ?>
    
    	<?php while ( bp_profile_groups() ) : bp_the_profile_group(); ?>
    
    		<?php if ( bp_profile_group_has_fields() ) : ?>
    
    			<?php do_action( 'bp_before_profile_field_content' ); ?>
    
    			<div class="bp-widget <?php bp_the_profile_group_slug(); ?>">
    
    				<h4><?php bp_the_profile_group_name(); ?></h4>
    
    				<table class="profile-fields">
    
    					<?php while ( bp_profile_fields() ) : bp_the_profile_field('hide_empty_fields=0'); ?>
    
    						<?php if ( bp_field_has_data() ) : ?>
    
    							<tr<?php bp_field_css_class(); ?>>
    
    								<td class="label"><?php bp_the_profile_field_name(); ?></td>
    
    								<td class="data"><?php bp_the_profile_field_value(); ?></td>
    
    							</tr>
    							
    						<?php elseif ( !bp_field_has_data() ) : ?>
    						
    								<tr<?php bp_field_css_class(); ?>>
    
    								<td class="label"><?php bp_the_profile_field_name(); ?></td>
    
    								<td class="data"><?php bp_the_profile_field_value(); ?></td>
    
    							</tr>
    							
    						<?php endif; ?>
    
    						<?php do_action( 'bp_profile_field_item' ); ?>
    
    					<?php endwhile; ?>
    
    				</table>
    			</div>
    
    			<?php do_action( 'bp_after_profile_field_content' ); ?>
    
    		<?php endif; ?>
    
    	<?php endwhile; ?>
    
    	<?php do_action( 'bp_profile_field_buttons' ); ?>
    
    <?php endif; ?>
    
    <?php do_action( 'bp_after_profile_loop_content' ); ?>
    

    dorf
    Participant

    @dorf

    You rock for posting this! Thank you


    CommonEasy
    Participant

    @commoneasy

    is there a way of just adding this in your functions.php file?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] Show empty fields in profile’ is closed to new replies.
Skip to toolbar