bp_nouveau_group_manage_screen()
Load the requested Manage Screen for the current group.
Description
Source
File: bp-templates/bp-nouveau/includes/groups/template-tags.php
function bp_nouveau_group_manage_screen() {
$action = bp_action_variable( 0 );
$is_group_create = bp_is_group_create();
$output = '';
if ( $is_group_create ) {
$action = bp_action_variable( 1 );
}
$screen_id = sanitize_file_name( $action );
if ( ! bp_is_group_admin_screen( $screen_id ) && ! bp_is_group_creation_step( $screen_id ) ) {
return;
}
if ( ! $is_group_create ) {
/**
* Fires inside the group admin form and before the content.
*
* @since BuddyPress 1.1.0
*/
do_action( 'bp_before_group_admin_content' );
$core_screen = bp_nouveau_group_get_core_manage_screens( $screen_id );
// It's a group step, get the creation screens.
} else {
$core_screen = bp_nouveau_group_get_core_create_screens( $screen_id );
}
if ( ! $core_screen ) {
if ( ! $is_group_create ) {
/**
* Fires inside the group admin template.
*
* Allows plugins to add custom group edit screens.
*
* @since BuddyPress 1.1.0
*/
do_action( 'groups_custom_edit_steps' );
// Else use the group create hook
} else {
/**
* Fires inside the group admin template.
*
* Allows plugins to add custom group creation steps.
*
* @since BuddyPress 1.1.0
*/
do_action( 'groups_custom_create_steps' );
}
// Else we load the core screen.
} else {
if ( ! empty( $core_screen['hook'] ) ) {
/**
* Fires before the display of group delete admin.
*
* @since BuddyPress 1.1.0 For most hooks.
* @since BuddyPress 2.4.0 For the cover photo hook.
*/
do_action( 'bp_before_' . $core_screen['hook'] );
}
$template = 'groups/single/admin/' . $screen_id;
if ( ! empty( $core_screen['template'] ) ) {
$template = $core_screen['template'];
}
bp_get_template_part( $template );
if ( ! empty( $core_screen['hook'] ) ) {
/**
* Fires before the display of group delete admin.
*
* @since BuddyPress 1.1.0 For most hooks.
* @since BuddyPress 2.4.0 For the cover photo hook.
*/
do_action( 'bp_after_' . $core_screen['hook'] );
}
if ( ! empty( $core_screen['nonce'] ) ) {
if ( ! $is_group_create ) {
$output = sprintf( '<p><input type="submit" value="%s" id="save" name="save" /></p>', esc_attr__( 'Save Changes', 'buddyboss' ) );
// Specific case for the delete group screen
if ( 'delete-group' === $screen_id ) {
$output = sprintf(
'<div class="submit">
<input type="submit" disabled="disabled" value="%s" id="delete-group-button" name="delete-group-button" />
</div>',
esc_attr__( 'Delete Group', 'buddyboss' )
);
}
}
}
}
if ( $is_group_create ) {
/**
* Fires before the display of the group creation step buttons.
*
* @since BuddyPress 1.1.0
*/
do_action( 'bp_before_group_creation_step_buttons' );
if ( 'crop-image' !== bp_get_avatar_admin_step() ) {
$creation_step_buttons = '';
if ( ! bp_is_first_group_creation_step() ) {
$creation_step_buttons .= sprintf(
'<input type="button" value="%1$s" id="group-creation-previous" name="previous" onclick="%2$s" />',
esc_attr__( 'Previous Step', 'buddyboss' ),
"location.href='" . esc_js( esc_url_raw( bp_get_group_creation_previous_link() ) ) . "'"
);
}
if ( ! bp_is_last_group_creation_step() && ! bp_is_first_group_creation_step() ) {
$creation_step_buttons .= sprintf(
'<input type="submit" value="%s" id="group-creation-next" name="save" />',
esc_attr__( 'Next Step', 'buddyboss' )
);
}
if ( bp_is_first_group_creation_step() ) {
$creation_step_buttons .= sprintf(
'<input type="submit" value="%s" id="group-creation-create" name="save" />',
esc_attr__( 'Create Group and Continue', 'buddyboss' )
);
}
if ( bp_is_last_group_creation_step() ) {
$creation_step_buttons .= sprintf(
'<input type="submit" value="%s" id="group-creation-finish" name="save" />',
esc_attr__( 'Finish', 'buddyboss' )
);
}
// Set the output for the buttons
$output = sprintf( '<div class="submit" id="previous-next">%s</div>', $creation_step_buttons );
}
/**
* Fires after the display of the group creation step buttons.
*
* @since BuddyPress 1.1.0
*/
do_action( 'bp_after_group_creation_step_buttons' );
}
/**
* Avoid nested forms with the Backbone views for the group invites step.
*/
if ( 'group-invites' === bp_get_groups_current_create_step() ) {
printf(
'<form action="%s" method="post" enctype="multipart/form-data">',
bp_get_group_creation_form_action()
);
}
if ( ! empty( $core_screen['nonce'] ) ) {
wp_nonce_field( $core_screen['nonce'] );
}
printf(
'<input type="hidden" name="group-id" id="group-id" value="%s" />',
$is_group_create ? esc_attr( bp_get_new_group_id() ) : esc_attr( bp_get_group_id() )
);
// The submit actions
echo $output;
if ( ! $is_group_create ) {
/**
* Fires inside the group admin form and after the content.
*
* @since BuddyPress 1.1.0
*/
do_action( 'bp_after_group_admin_content' );
} else {
/**
* Fires and displays the groups directory content.
*
* @since BuddyPress 1.1.0
*/
do_action( 'bp_directory_groups_content' );
}
/**
* Avoid nested forms with the Backbone views for the group invites step.
*/
if ( 'group-invites' === bp_get_groups_current_create_step() ) {
echo '</form>';
}
}
Changelog
| Version | Description |
|---|---|
| BuddyPress 3.0.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.