Пример #1
0
function bp_profile_group_tabs()
{
    global $bp, $group_name;
    if (!($groups = wp_cache_get('xprofile_groups_inc_empty', 'bp'))) {
        $groups = BP_XProfile_Group::get(array('fetch_fields' => true));
        wp_cache_set('xprofile_groups_inc_empty', $groups, 'bp');
    }
    if (empty($group_name)) {
        $group_name = bp_profile_group_name(false);
    }
    $tabs = array();
    for ($i = 0, $count = count($groups); $i < $count; ++$i) {
        if ($group_name == $groups[$i]->name) {
            $selected = ' class="current"';
        } else {
            $selected = '';
        }
        if (!empty($groups[$i]->fields)) {
            $link = $bp->displayed_user->domain . $bp->profile->slug . '/edit/group/' . $groups[$i]->id;
            $tabs[] = sprintf('<li %1$s><a href="%2$s">%3$s</a></li>', $selected, $link, esc_html($groups[$i]->name));
        }
    }
    $tabs = apply_filters('xprofile_filter_profile_group_tabs', $tabs, $groups, $group_name);
    foreach ((array) $tabs as $tab) {
        echo $tab;
    }
    do_action('xprofile_profile_group_tabs');
}
Пример #2
0
<?php

get_header();
?>

<div class="content-header">
	
	<ul class="content-header-nav">
		<?php 
bp_profile_group_tabs();
?>
	</ul>
	
</div>

<div id="content">
	
	<h2><?php 
printf(__("Editing '%s'", "buddypress"), bp_profile_group_name(false));
?>
</h2>
	
	<?php 
bp_edit_profile_form();
?>

</div>

<?php 
get_footer();
Пример #3
0
function bp_profile_group_tabs() {
	global $bp, $group_name;

	if ( !$groups = wp_cache_get( 'xprofile_groups_inc_empty', 'bp' ) ) {
		$groups = BP_XProfile_Group::get( array( 'fetch_fields' => true ) );
		wp_cache_set( 'xprofile_groups_inc_empty', $groups, 'bp' );
	}

	if ( empty( $group_name ) )
		$group_name = bp_profile_group_name(false);

	for ( $i = 0; $i < count($groups); $i++ ) {
		if ( $group_name == $groups[$i]->name ) {
			$selected = ' class="current"';
		} else {
			$selected = '';
		}

		if ( $groups[$i]->fields )
			echo '<li' . $selected . '><a href="' . $bp->displayed_user->domain . $bp->profile->slug . '/edit/group/' . $groups[$i]->id . '">' . esc_attr( $groups[$i]->name ) . '</a></li>';
	}

	do_action( 'xprofile_profile_group_tabs' );
}
Пример #4
0
/**
 * Output the tabs to switch between profile field groups.
 *
 * @return string Field group tabs markup.
 */
function bp_profile_group_tabs()
{
    global $bp, $group_name;
    $groups = bp_profile_get_field_groups();
    if (empty($group_name)) {
        $group_name = bp_profile_group_name(false);
    }
    $tabs = array();
    for ($i = 0, $count = count($groups); $i < $count; ++$i) {
        if ($group_name == $groups[$i]->name) {
            $selected = ' class="current"';
        } else {
            $selected = '';
        }
        if (!empty($groups[$i]->fields)) {
            $link = trailingslashit(bp_displayed_user_domain() . $bp->profile->slug . '/edit/group/' . $groups[$i]->id);
            $tabs[] = sprintf('<li %1$s><a href="%2$s">%3$s</a></li>', $selected, $link, esc_html($groups[$i]->name));
        }
    }
    $tabs = apply_filters('xprofile_filter_profile_group_tabs', $tabs, $groups, $group_name);
    foreach ((array) $tabs as $tab) {
        echo $tab;
    }
    do_action('xprofile_profile_group_tabs');
}
Пример #5
0
/**
 * Output the tabs to switch between profile field groups.
 *
 * @return string Field group tabs markup.
 */
function bp_profile_group_tabs()
{
    global $bp, $group_name;
    $groups = bp_profile_get_field_groups();
    if (empty($group_name)) {
        $group_name = bp_profile_group_name(false);
    }
    $tabs = array();
    for ($i = 0, $count = count($groups); $i < $count; ++$i) {
        if ($group_name == $groups[$i]->name) {
            $selected = ' class="current"';
        } else {
            $selected = '';
        }
        if (!empty($groups[$i]->fields)) {
            $link = trailingslashit(bp_displayed_user_domain() . $bp->profile->slug . '/edit/group/' . $groups[$i]->id);
            $tabs[] = sprintf('<li %1$s><a href="%2$s">%3$s</a></li>', $selected, $link, esc_html($groups[$i]->name));
        }
    }
    /**
     * Filters the tabs to display for profile field groups.
     *
     * @since BuddyPress (1.5.0)
     *
     * @param array  $tabs       Array of tabs to display.
     * @param array  $groups     Array of profile groups.
     * @param string $group_name Name of the current group displayed.
     */
    $tabs = apply_filters('xprofile_filter_profile_group_tabs', $tabs, $groups, $group_name);
    foreach ((array) $tabs as $tab) {
        echo $tab;
    }
    /**
     * Fires at the end of the tab output for switching between profile field groups.
     *
     * @since BuddyPress (1.0.0)
     */
    do_action('xprofile_profile_group_tabs');
}
function bp_profile_group_tabs()
{
    global $bp, $group_name;
    if (!($groups = wp_cache_get('xprofile_groups_inc_empty', 'bp'))) {
        $groups = BP_XProfile_Group::get_all();
        wp_cache_set('xprofile_groups_inc_empty', $groups, 'bp');
    }
    if (empty($group_name)) {
        $group_name = bp_profile_group_name(false);
    }
    for ($i = 0; $i < count($groups); $i++) {
        if ($group_name == $groups[$i]->name) {
            $selected = ' class="current"';
        } else {
            $selected = '';
        }
        echo '<li' . $selected . '><a href="' . $bp->loggedin_user->domain . $bp->profile->slug . '/edit/group/' . $groups[$i]->id . '">' . $groups[$i]->name . '</a></li>';
    }
    do_action('xprofile_profile_group_tabs');
}