本文整理汇总了PHP中bp_get_groups_current_create_step函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_get_groups_current_create_step函数的具体用法?PHP bp_get_groups_current_create_step怎么用?PHP bp_get_groups_current_create_step使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_get_groups_current_create_step函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bp_is_first_group_creation_step
function bp_is_first_group_creation_step()
{
global $bp;
$keys = array_keys($bp->groups->group_creation_steps);
$first_step = array_shift($keys);
if ($first_step == bp_get_groups_current_create_step()) {
return true;
}
return false;
}
示例2: bp_get_the_body_class
//.........这里部分代码省略.........
$bp_classes[] = 'profile-edit';
}
if (bp_is_user_friends_activity()) {
$bp_classes[] = 'friends-activity';
}
if (bp_is_user_groups_activity()) {
$bp_classes[] = 'groups-activity';
}
/* Messages **********************************************************/
if (bp_is_messages_inbox()) {
$bp_classes[] = 'inbox';
}
if (bp_is_messages_sentbox()) {
$bp_classes[] = 'sentbox';
}
if (bp_is_messages_compose_screen()) {
$bp_classes[] = 'compose';
}
if (bp_is_notices()) {
$bp_classes[] = 'notices';
}
if (bp_is_user_friend_requests()) {
$bp_classes[] = 'friend-requests';
}
if (bp_is_create_blog()) {
$bp_classes[] = 'create-blog';
}
/* Groups ************************************************************/
if (bp_is_group()) {
$bp_classes[] = 'group-' . groups_get_current_group()->slug;
// Add current group types.
if ($group_types = bp_groups_get_group_type(bp_get_current_group_id(), false)) {
foreach ($group_types as $group_type) {
$bp_classes[] = sprintf('group-type-%s', esc_attr($group_type));
}
}
}
if (bp_is_group_leave()) {
$bp_classes[] = 'leave-group';
}
if (bp_is_group_invites()) {
$bp_classes[] = 'group-invites';
}
if (bp_is_group_members()) {
$bp_classes[] = 'group-members';
}
if (bp_is_group_forum_topic()) {
$bp_classes[] = 'group-forum-topic';
}
if (bp_is_group_forum_topic_edit()) {
$bp_classes[] = 'group-forum-topic-edit';
}
if (bp_is_group_forum()) {
$bp_classes[] = 'group-forum';
}
if (bp_is_group_admin_page()) {
$bp_classes[] = 'group-admin';
$bp_classes[] = bp_get_group_current_admin_tab();
}
if (bp_is_group_create()) {
$bp_classes[] = 'group-create';
$bp_classes[] = bp_get_groups_current_create_step();
}
if (bp_is_group_home()) {
$bp_classes[] = 'group-home';
}
if (bp_is_single_activity()) {
$bp_classes[] = 'activity-permalink';
}
/* Registration ******************************************************/
if (bp_is_register_page()) {
$bp_classes[] = 'registration';
}
if (bp_is_activation_page()) {
$bp_classes[] = 'activation';
}
/* Current Component & Action ****************************************/
if (!bp_is_blog_page()) {
$bp_classes[] = bp_current_component();
$bp_classes[] = bp_current_action();
}
/* Clean up ***********************************************************/
// Add BuddyPress class if we are within a BuddyPress page.
if (!bp_is_blog_page()) {
$bp_classes[] = 'buddypress';
}
// Merge WP classes with BuddyPress classes and remove any duplicates.
$classes = array_unique(array_merge((array) $bp_classes, (array) $wp_classes));
/**
* Filters the BuddyPress classes to be added to body_class()
*
* @since 1.1.0
*
* @param array $classes Array of body classes to add.
* @param array $bp_classes Array of BuddyPress-based classes.
* @param array $wp_classes Array of WordPress-based classes.
* @param array $custom_classes Array of classes that were passed to get_body_class().
*/
return apply_filters('bp_get_the_body_class', $classes, $bp_classes, $wp_classes, $custom_classes);
}
示例3: bp_is_first_group_creation_step
/**
* Is the user looking at the first step in the group creation process
*
* @since 1.1.0
*
* @param string $step Step to compare.
* @return bool True if yes, False if no
*/
function bp_is_first_group_creation_step($step = '')
{
// Use current step, if no step passed.
if (empty($step)) {
$step = bp_get_groups_current_create_step();
}
// Get the first step.
$bp = buddypress();
$steps = array_keys($bp->groups->group_creation_steps);
$f_step = array_shift($steps);
// Compare first step to step.
$retval = $f_step === $step;
/**
* Filters whether or not user is looking at first step in group creation process.
*
* @since 2.4.0
*
* @param bool $retval Whether or not we are looking at first step.
* @param array $steps Array of steps from the group creation process.
* @param string $step Step to compare.
*/
return (bool) apply_filters('bp_is_first_group_creation_step', $retval, $steps, $step);
}
示例4: groups_action_create_group
/**
* Catch and process group creation form submissions.
*/
function groups_action_create_group()
{
global $bp;
// If we're not at domain.org/groups/create/ then return false
if (!bp_is_groups_component() || !bp_is_current_action('create')) {
return false;
}
if (!is_user_logged_in()) {
return false;
}
if (!bp_user_can_create_groups()) {
bp_core_add_message(__('Sorry, you are not allowed to create groups.', 'buddypress'), 'error');
bp_core_redirect(trailingslashit(bp_get_root_domain() . '/' . bp_get_groups_root_slug()));
}
// Make sure creation steps are in the right order
groups_action_sort_creation_steps();
// If no current step is set, reset everything so we can start a fresh group creation
$bp->groups->current_create_step = bp_action_variable(1);
if (!bp_get_groups_current_create_step()) {
unset($bp->groups->current_create_step);
unset($bp->groups->completed_create_steps);
setcookie('bp_new_group_id', false, time() - 1000, COOKIEPATH);
setcookie('bp_completed_create_steps', false, time() - 1000, COOKIEPATH);
$reset_steps = true;
$keys = array_keys($bp->groups->group_creation_steps);
bp_core_redirect(bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create/step/' . array_shift($keys) . '/');
}
// If this is a creation step that is not recognized, just redirect them back to the first screen
if (bp_get_groups_current_create_step() && empty($bp->groups->group_creation_steps[bp_get_groups_current_create_step()])) {
bp_core_add_message(__('There was an error saving group details. Please try again.', 'buddypress'), 'error');
bp_core_redirect(bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create/');
}
// Fetch the currently completed steps variable
if (isset($_COOKIE['bp_completed_create_steps']) && !isset($reset_steps)) {
$bp->groups->completed_create_steps = json_decode(base64_decode(stripslashes($_COOKIE['bp_completed_create_steps'])));
}
// Set the ID of the new group, if it has already been created in a previous step
if (isset($_COOKIE['bp_new_group_id'])) {
$bp->groups->new_group_id = (int) $_COOKIE['bp_new_group_id'];
$bp->groups->current_group = groups_get_group(array('group_id' => $bp->groups->new_group_id));
// Only allow the group creator to continue to edit the new group
if (!bp_is_group_creator($bp->groups->current_group, bp_loggedin_user_id())) {
bp_core_add_message(__('Only the group creator may continue editing this group.', 'buddypress'), 'error');
bp_core_redirect(bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create/');
}
}
// If the save, upload or skip button is hit, lets calculate what we need to save
if (isset($_POST['save'])) {
// Check the nonce
check_admin_referer('groups_create_save_' . bp_get_groups_current_create_step());
if ('group-details' == bp_get_groups_current_create_step()) {
if (empty($_POST['group-name']) || empty($_POST['group-desc']) || !strlen(trim($_POST['group-name'])) || !strlen(trim($_POST['group-desc']))) {
bp_core_add_message(__('Please fill in all of the required fields', 'buddypress'), 'error');
bp_core_redirect(bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create/step/' . bp_get_groups_current_create_step() . '/');
}
$new_group_id = isset($bp->groups->new_group_id) ? $bp->groups->new_group_id : 0;
if (!($bp->groups->new_group_id = groups_create_group(array('group_id' => $new_group_id, 'name' => $_POST['group-name'], 'description' => $_POST['group-desc'], 'slug' => groups_check_slug(sanitize_title(esc_attr($_POST['group-name']))), 'date_created' => bp_core_current_time(), 'status' => 'public')))) {
bp_core_add_message(__('There was an error saving group details, please try again.', 'buddypress'), 'error');
bp_core_redirect(bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create/step/' . bp_get_groups_current_create_step() . '/');
}
}
if ('group-settings' == bp_get_groups_current_create_step()) {
$group_status = 'public';
$group_enable_forum = 1;
if (!isset($_POST['group-show-forum'])) {
$group_enable_forum = 0;
} else {
// Create the forum if enable_forum = 1
if (bp_is_active('forums') && !groups_get_groupmeta($bp->groups->new_group_id, 'forum_id')) {
groups_new_group_forum();
}
}
if ('private' == $_POST['group-status']) {
$group_status = 'private';
} else {
if ('hidden' == $_POST['group-status']) {
$group_status = 'hidden';
}
}
if (!($bp->groups->new_group_id = groups_create_group(array('group_id' => $bp->groups->new_group_id, 'status' => $group_status, 'enable_forum' => $group_enable_forum)))) {
bp_core_add_message(__('There was an error saving group details, please try again.', 'buddypress'), 'error');
bp_core_redirect(bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create/step/' . bp_get_groups_current_create_step() . '/');
}
// Set the invite status
// Checked against a whitelist for security
$allowed_invite_status = apply_filters('groups_allowed_invite_status', array('members', 'mods', 'admins'));
$invite_status = !empty($_POST['group-invite-status']) && in_array($_POST['group-invite-status'], (array) $allowed_invite_status) ? $_POST['group-invite-status'] : 'members';
groups_update_groupmeta($bp->groups->new_group_id, 'invite_status', $invite_status);
}
if ('group-invites' === bp_get_groups_current_create_step()) {
if (!empty($_POST['friends'])) {
foreach ((array) $_POST['friends'] as $friend) {
groups_invite_user(array('user_id' => $friend, 'group_id' => $bp->groups->new_group_id));
}
}
groups_send_invites(bp_loggedin_user_id(), $bp->groups->new_group_id);
}
//.........这里部分代码省略.........
示例5: maybe_create_screen
/**
* Call the create_screen() method, if we're on the right page
*
* @since BuddyPress (1.8)
*/
public function maybe_create_screen()
{
if (!bp_is_group_creation_step($this->screens['create']['slug'])) {
return;
}
call_user_func($this->screens['create']['screen_callback'], $this->group_id);
$this->nonce_field('create');
// The create screen requires an additional nonce field
// due to a quirk in the way the templates are built
wp_nonce_field('groups_create_save_' . bp_get_groups_current_create_step());
}
示例6: bp_get_the_body_class
//.........这里部分代码省略.........
}
if (bp_is_user_change_avatar()) {
$bp_classes[] = 'change-avatar';
}
if (bp_is_user_profile_edit()) {
$bp_classes[] = 'profile-edit';
}
if (bp_is_user_friends_activity()) {
$bp_classes[] = 'friends-activity';
}
if (bp_is_user_groups_activity()) {
$bp_classes[] = 'groups-activity';
}
if (is_user_logged_in()) {
$bp_classes[] = 'logged-in';
}
/** Messages **********************************************************/
if (bp_is_messages_inbox()) {
$bp_classes[] = 'inbox';
}
if (bp_is_messages_sentbox()) {
$bp_classes[] = 'sentbox';
}
if (bp_is_messages_compose_screen()) {
$bp_classes[] = 'compose';
}
if (bp_is_notices()) {
$bp_classes[] = 'notices';
}
if (bp_is_user_friend_requests()) {
$bp_classes[] = 'friend-requests';
}
if (bp_is_create_blog()) {
$bp_classes[] = 'create-blog';
}
/** Groups ************************************************************/
if (bp_is_group_leave()) {
$bp_classes[] = 'leave-group';
}
if (bp_is_group_invites()) {
$bp_classes[] = 'group-invites';
}
if (bp_is_group_members()) {
$bp_classes[] = 'group-members';
}
if (bp_is_group_forum_topic()) {
$bp_classes[] = 'group-forum-topic';
}
if (bp_is_group_forum_topic_edit()) {
$bp_classes[] = 'group-forum-topic-edit';
}
if (bp_is_group_forum()) {
$bp_classes[] = 'group-forum';
}
if (bp_is_group_admin_page()) {
$bp_classes[] = 'group-admin';
$bp_classes[] = bp_get_group_current_admin_tab();
}
if (bp_is_group_create()) {
$bp_classes[] = 'group-create';
$bp_classes[] = bp_get_groups_current_create_step();
}
if (bp_is_group_home()) {
$bp_classes[] = 'group-home';
}
if (bp_is_single_activity()) {
$bp_classes[] = 'activity-permalink';
}
/** Registration ******************************************************/
if (bp_is_register_page()) {
$bp_classes[] = 'registration';
}
if (bp_is_activation_page()) {
$bp_classes[] = 'activation';
}
/** Current Component & Action ****************************************/
if (!bp_is_blog_page()) {
$bp_classes[] = bp_current_component();
$bp_classes[] = bp_current_action();
}
/** Clean up***********************************************************/
// We don't want WordPress blog classes to appear on non-blog pages.
if (!bp_is_blog_page()) {
// Observe WP custom background body class
if (in_array('custom-background', (array) $wp_classes)) {
$bp_classes[] = 'custom-background';
}
// Preserve any custom classes already set
if (!empty($custom_classes)) {
$wp_classes = (array) $custom_classes;
} else {
$wp_classes = array();
}
}
// Merge WP classes with BP classes
$classes = array_merge((array) $bp_classes, (array) $wp_classes);
// Remove any duplicates
$classes = array_unique($classes);
return apply_filters('bp_get_the_body_class', $classes, $bp_classes, $wp_classes, $custom_classes);
}
示例7: bp_get_the_body_class
//.........这里部分代码省略.........
if (bp_is_user_friends()) {
$bp_classes[] = 'my-friends';
}
if (bp_is_user_messages()) {
$bp_classes[] = 'my-messages';
}
if (bp_is_user_recent_commments()) {
$bp_classes[] = 'recent-comments';
}
if (bp_is_user_recent_posts()) {
$bp_classes[] = 'recent-posts';
}
if (bp_is_user_change_avatar()) {
$bp_classes[] = 'change-avatar';
}
if (bp_is_user_profile_edit()) {
$bp_classes[] = 'profile-edit';
}
if (bp_is_user_friends_activity()) {
$bp_classes[] = 'friends-activity';
}
if (bp_is_user_groups_activity()) {
$bp_classes[] = 'groups-activity';
}
/** Messages **********************************************************/
if (bp_is_messages_inbox()) {
$bp_classes[] = 'inbox';
}
if (bp_is_messages_sentbox()) {
$bp_classes[] = 'sentbox';
}
if (bp_is_messages_compose_screen()) {
$bp_classes[] = 'compose';
}
if (bp_is_notices()) {
$bp_classes[] = 'notices';
}
if (bp_is_user_friend_requests()) {
$bp_classes[] = 'friend-requests';
}
if (bp_is_create_blog()) {
$bp_classes[] = 'create-blog';
}
/** Groups ************************************************************/
if (bp_is_group()) {
$bp_classes[] = 'group-' . groups_get_current_group()->slug;
}
if (bp_is_group_leave()) {
$bp_classes[] = 'leave-group';
}
if (bp_is_group_invites()) {
$bp_classes[] = 'group-invites';
}
if (bp_is_group_members()) {
$bp_classes[] = 'group-members';
}
if (bp_is_group_forum_topic()) {
$bp_classes[] = 'group-forum-topic';
}
if (bp_is_group_forum_topic_edit()) {
$bp_classes[] = 'group-forum-topic-edit';
}
if (bp_is_group_forum()) {
$bp_classes[] = 'group-forum';
}
if (bp_is_group_admin_page()) {
$bp_classes[] = 'group-admin';
$bp_classes[] = bp_get_group_current_admin_tab();
}
if (bp_is_group_create()) {
$bp_classes[] = 'group-create';
$bp_classes[] = bp_get_groups_current_create_step();
}
if (bp_is_group_home()) {
$bp_classes[] = 'group-home';
}
if (bp_is_single_activity()) {
$bp_classes[] = 'activity-permalink';
}
/** Registration ******************************************************/
if (bp_is_register_page()) {
$bp_classes[] = 'registration';
}
if (bp_is_activation_page()) {
$bp_classes[] = 'activation';
}
/** Current Component & Action ****************************************/
if (!bp_is_blog_page()) {
$bp_classes[] = bp_current_component();
$bp_classes[] = bp_current_action();
}
/** Clean up ***********************************************************/
// Add BuddyPress class if we are within a BuddyPress page
if (!bp_is_blog_page()) {
$bp_classes[] = 'buddypress';
}
// Merge WP classes with BuddyPress classes and remove any duplicates
$classes = array_unique(array_merge((array) $bp_classes, (array) $wp_classes));
return apply_filters('bp_get_the_body_class', $classes, $bp_classes, $wp_classes, $custom_classes);
}
示例8: ass_save_default_subscription
function ass_save_default_subscription($group)
{
if (isset($_POST['ass-default-subscription']) && ($postval = $_POST['ass-default-subscription'])) {
if ($postval && $postval != 'no') {
groups_update_groupmeta($group->id, 'ass_default_subscription', $postval);
// during group creation, also save the sub level for the group creator
if ('group-settings' == bp_get_groups_current_create_step()) {
ass_group_subscription($postval, $group->creator_id, $group->id);
}
} elseif ($postval == 'no') {
groups_delete_groupmeta($group->id, 'ass_default_subscription');
}
}
}
示例9: submit_guild
function submit_guild(&$group)
{
// If the user is allowed to delete posts, then they can also create guilds and bypass validation requirements
if (!bp_is_group_create() || current_user_can('delete_others_posts')) {
return;
}
// Get the BP object
global $bp;
// Retrieve and sanitize submission data
$group->server = $_POST['group-server'];
$group->interests = implode(',', $_POST['group-interests']);
$group->faction = $_POST['group-faction'];
$group->website = esc_url($_POST['group-website']);
$group->style = $_POST['group-style'];
// Validate submitted data
if ('' === $group->server) {
$error = 'Please select your guild's platform and server.';
} elseif (empty($group->interests)) {
$error = 'Please select your guild's primary interests.';
} elseif (empty($group->faction)) {
$error = 'Please select your guild's primary alliance.';
}
// Assign the current group to the group object
$bp->groups->current_group = $group;
// If there was an error, display it and redirect
if (isset($error)) {
bp_core_add_message($error, 'error');
bp_core_redirect(bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create/step/' . bp_get_groups_current_create_step() . '/');
} else {
// Get the current user
$user = new WP_User(get_current_user_id());
$username = $user->display_name;
$user_email = $user->user_email;
$profile = bp_core_get_userlink($user->ID);
// Set email headers
$emailto = 'admin@tamrielfoundry.com';
$subject = 'Guild Creation Request From ' . $username;
$headers[] = "From: {$username} <{$user_email}>\r\n";
$headers[] = "Content-Type: text/html; charset=UTF-8";
// User Information
$body = "<h3>Submitting User</h3>";
$body .= "<ul>";
$body .= '<li>Guild Leader: ' . $profile . '</li>';
$body .= '<li>Email: ' . $user_email . '</li>';
$body .= "</ul>";
// Guild Information
$body .= "<h3>Guild Information</h3>";
$body .= "<ul>";
$body .= '<li>Guild Name: ' . $group->name . '</li>';
$body .= '<li>Website: ' . $group->website . '</li>';
$body .= '<li>Server: ' . $group->server . '</li>';
$body .= '<li>Faction: ' . $group->faction . '</li>';
$body .= '<li>Interests: ' . $group->interests . '</li>';
$body .= '<li>Style: ' . $group->style . '</li>';
$body .= "</ul>";
// Guild Description
$body .= "<h3>Guild Description</h3>";
$body .= '<div>' . stripslashes($group->description) . '</div>';
// Send the mail!
wp_mail($emailto, $subject, $body, $headers);
// Redirect
bp_core_add_message('Thank you for submitting your guild, ' . $user->fullname . '. Your request was successfully sent. We will review it and respond as soon as possible. If your request is approved, you will be added to your group, and promoted to guild leader. We will contact you via email regarding your guild request once it has been processed. Thank you for contributing to Tamriel Foundry!');
bp_core_redirect(SITEURL . '/' . bp_get_groups_root_slug());
}
}
示例10: myfossil_group_creation_tabs
function myfossil_group_creation_tabs()
{
global $bp;
if (!is_array($bp->groups->group_creation_steps)) {
return false;
}
if (!bp_get_groups_current_create_step()) {
$keys = array_keys($bp->groups->group_creation_steps);
$bp->groups->current_create_step = array_shift($keys);
}
foreach ((array) $bp->groups->group_creation_steps as $slug => $step) {
$is_enabled = bp_are_previous_group_creation_steps_complete($slug);
$selected = bp_get_groups_current_create_step() == $slug;
if ($selected) {
$tpl = '<li class="current active selected">';
} else {
$tpl = "<li>";
}
if ($is_enabled) {
$tpl .= sprintf('<a href="%s/%s/create/step/%s">%s</a>', bp_get_root_domain(), bp_get_groups_root_slug(), $slug, $step['name']);
} else {
$tpl .= sprintf('<a>%s</a>', $step['name']);
}
$tpl .= "</li>";
print $tpl;
}
unset($is_enabled);
do_action('groups_creation_tabs');
}