Skip to content

Instantly share code, notes, and snippets.

@sbrajesh
Created May 9, 2020 00:23
Show Gist options
  • Save sbrajesh/0ea24b0cafacaa098dbf8d61e5eda8be to your computer and use it in GitHub Desktop.
Save sbrajesh/0ea24b0cafacaa098dbf8d61e5eda8be to your computer and use it in GitHub Desktop.
profile-loop.php for BuddyPress bp-legacy with edit group link
<?php
/**
* BuddyPress - Members Profile Loop
*
* @package BuddyPress
* @subpackage bp-legacy
* @version 3.0.0
*/
/** This action is documented in bp-templates/bp-legacy/buddypress/members/single/profile/profile-wp.php */
do_action( 'bp_before_profile_loop_content' ); ?>
<?php if ( bp_has_profile() ) : ?>
<?php while ( bp_profile_groups() ) : bp_the_profile_group(); ?>
<?php if ( bp_profile_group_has_fields() ) : ?>
<?php
/** This action is documented in bp-templates/bp-legacy/buddypress/members/single/profile/profile-wp.php */
do_action( 'bp_before_profile_field_content' ); ?>
<div class="bp-widget <?php bp_the_profile_group_slug(); ?>">
<h2><?php bp_the_profile_group_name(); ?></h2>
<table class="profile-fields">
<?php while ( bp_profile_fields() ) : bp_the_profile_field(); ?>
<?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 endif; ?>
<?php
/**
* Fires after the display of a field table row for profile data.
*
* @since 1.1.0
*/
do_action( 'bp_profile_field_item' ); ?>
<?php endwhile; ?>
<?php if ( bp_is_my_profile() || is_super_admin() ) : ?>
<tr>
<td colspan="2">
<?php
$url = $link = trailingslashit( bp_displayed_user_domain() . bp_get_profile_slug() . '/edit/group/' . bp_get_the_profile_group_id() );
?>
<a href="<?php echo esc_url( $url ); ?>"><?php printf( " Edit %s", bp_get_the_profile_group_name() ); ?> </a>
</td>
</tr>
<?php endif; ?>
</table>
</div>
<?php
/** This action is documented in bp-templates/bp-legacy/buddypress/members/single/profile/profile-wp.php */
do_action( 'bp_after_profile_field_content' ); ?>
<?php endif; ?>
<?php endwhile; ?>
<?php
/** This action is documented in bp-templates/bp-legacy/buddypress/members/single/profile/profile-wp.php */
do_action( 'bp_profile_field_buttons' ); ?>
<?php endif; ?>
<?php
/** This action is documented in bp-templates/bp-legacy/buddypress/members/single/profile/profile-wp.php */
do_action( 'bp_after_profile_loop_content' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment