Skip to:
Content
Pages
Categories
Search
Top
Bottom

Hiding empty profile fields is not working anymore


  • lbnn
    Participant

    @lbnn

    Hello,

    I modified the profile-loop.php file some time ago to hide profile fields that are empty but my code doesn’t work anymore, has any change been done to the code some updates ago ?

    Here is what I modified :

    <h2 class="screen-heading view-profile-screen"><?php esc_html_e( 'View Profile', 'buddypress' ); ?></h2>
    
    <?php bp_nouveau_xprofile_hook( 'before', '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 bp_nouveau_xprofile_hook( 'before', 'field_content' ); ?>
    
    			<div class="bp-widget <?php bp_the_profile_group_slug(); ?>">
    
    				<h3 class="screen-heading profile-group-title">
    					<?php bp_the_profile_group_name(); ?>
    				</h3>
    
    				<table class="profile-fields bp-tables-user">
    
    					<?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 bp_nouveau_xprofile_hook( '', 'field_item' ); ?>
    
    					<?php endwhile; ?>
    
    				</table>
    			</div>
    
    			<?php bp_nouveau_xprofile_hook( 'after', 'field_content' ); ?>
    
    		<?php endif; ?>
    
    	<?php endwhile; ?>
    
    	<?php bp_nouveau_xprofile_hook( '', 'field_buttons' ); ?>
    
    <?php endif; ?>
    
    <?php
    bp_nouveau_xprofile_hook( 'after', 'loop_content' );
    

    Can someone help me to hode those fields again please 🙂

  • You must be logged in to reply to this topic.
Skip to toolbar