本文整理汇总了PHP中bp_get_new_group_id函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_get_new_group_id函数的具体用法?PHP bp_get_new_group_id怎么用?PHP bp_get_new_group_id使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_get_new_group_id函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bp_group_id
if (!bp_get_new_group_id()) {
?>
<input type="hidden" name="group_id" id="group_id" value="<?php
bp_group_id();
?>
" /><?php
} else {
?>
<input type="hidden" name="group_id" id="group_id" value="<?php
bp_new_group_id();
?>
" /><?php
}
?>
<?php
if (!bp_get_new_group_id()) {
?>
</form>
<?php
}
?>
<?php
do_action('bp_after_group_send_invites_content');
?>
<?php
}
示例2: bp_new_group_id
function bp_new_group_id()
{
echo bp_get_new_group_id();
}
示例3: get_group_id
/**
* Get the current group id
*
* Check for:
* - current group
* - new group
* - group admin
*
* @since BuddyPress (1.8)
*/
public static function get_group_id()
{
// Usually this will work
$group_id = bp_get_current_group_id();
// On the admin, get the group id out of the $_GET params
if (empty($group_id) && is_admin() && (isset($_GET['page']) && 'bp-groups' === $_GET['page']) && !empty($_GET['gid'])) {
$group_id = (int) $_GET['gid'];
}
// This fallback will only be hit when the create step is very
// early
if (empty($group_id) && bp_get_new_group_id()) {
$group_id = bp_get_new_group_id();
}
// On some setups, the group id has to be fetched out of the
// $_POST array
// @todo Figure out why this is happening during group creation
if (empty($group_id) && isset($_POST['group_id'])) {
$group_id = (int) $_POST['group_id'];
}
return $group_id;
}
示例4: create_screen_save
/**
* The create screen save method
*
* @package Rendez Vous
* @subpackage Groups
*
* @since Rendez Vous (1.1.0)
*
* @param int $group_id the group ID
* @uses bp_get_new_group_id() to get the just created group ID
* @uses Rendez_Vous_Group->edit_screen_save() to save the group extension settings
*/
public function create_screen_save($group_id = null)
{
// Check for possibly empty group_id
if (empty($group_id)) {
$group_id = bp_get_new_group_id();
}
return $this->edit_screen_save($group_id);
}
示例5: bp_groupblog_signup_blog
/**
* bp_groupblog_signup_blog($blogname = '', $blog_title = '', $errors = '')
*
* This function is called from the template and initiates the blog creation.
*/
function bp_groupblog_signup_blog($blogname = '', $blog_title = '', $errors = '')
{
global $current_user, $current_site, $groupblog_create_screen;
global $bp, $filtered_results;
if (!is_wp_error($errors)) {
$errors = new WP_Error();
}
// allow definition of default variables
$filtered_results = apply_filters('signup_blog_init', array('blogname' => $blogname, 'blog_title' => $blog_title, 'errors' => $errors));
$blogname = $filtered_results['blogname'];
$blog_title = $filtered_results['blog_title'];
$errors = $filtered_results['errors'];
if (!isset($groupblog_create_screen)) {
$groupblog_create_screen = false;
}
// Get the group id, which is fetched differently depending on whether this is a group
// Create or Edit screen
$group_id = bp_is_group_create() ? bp_get_new_group_id() : bp_get_current_group_id();
$disabled = !bp_groupblog_silent_add($group_id) || !bp_groupblog_is_blog_enabled($group_id) ? ' disabled="true" ' : '';
if (!$groupblog_create_screen) {
?>
<h2><?php
_e('Group Blog', 'groupblog');
?>
</h2>
<form id="setupform" method="post" action="<?php
bp_groupblog_admin_form_action('group-blog');
?>
">
<input type="hidden" name="stage" value="gimmeanotherblog" />
<?php
do_action("signup_hidden_fields");
?>
<?php
}
?>
<div class="checkbox">
<label><input type="checkbox" name="groupblog-enable-blog" id="groupblog-enable-blog" value="1"<?php
bp_groupblog_show_enabled($group_id);
?>
/> <?php
_e('Enable group blog', 'groupblog');
?>
</label>
</div>
<?php
bp_groupblog_show_blog_form($blogname, $blog_title, $errors);
?>
<br />
<div id="groupblog-member-options">
<h3><?php
_e('Member Options', 'groupblog');
?>
</h3>
<p><?php
_e('Enable blog posting to allow adding of group members to the blog with the roles set below.', 'groupblog');
?>
<br /><?php
_e('When disabled, all members will temporarily be set to subscribers, disabling posting.', 'groupblog');
?>
</p>
<div class="checkbox">
<label><input<?php
if (!bp_groupblog_is_blog_enabled($group_id)) {
?>
disabled="true"<?php
}
?>
type="checkbox" name="groupblog-silent-add" id="groupblog-silent-add" value="1"<?php
if (bp_groupblog_silent_add($group_id)) {
?>
checked="checked"<?php
}
?>
/> <?php
_e('Enable member blog posting', 'groupblog');
?>
</label>
</div>
<?php
// Assign our default roles to variables.
// If nothing has been saved in the groupmeta yet, then we assign our own defalt values.
if (!($groupblog_default_admin_role = groups_get_groupmeta($bp->groups->current_group->id, 'groupblog_default_admin_role'))) {
$groupblog_default_admin_role = $bp->groupblog->default_admin_role;
}
if (!($groupblog_default_mod_role = groups_get_groupmeta($bp->groups->current_group->id, 'groupblog_default_mod_role'))) {
//.........这里部分代码省略.........
示例6: create_screen_save
/**
* Save the Group Forum data on create
*
* @since bbPress (r3465)
*/
public function create_screen_save($group_id = 0)
{
// Nonce check
if (!bbp_verify_nonce_request('groups_create_save_' . $this->slug)) {
bbp_add_error('bbp_create_group_forum_screen_save', __('<strong>ERROR</strong>: Are you sure you wanted to do that?', 'bbpress'));
return;
}
// Check for possibly empty group_id
if (empty($group_id)) {
$group_id = bp_get_new_group_id();
}
$create_forum = !empty($_POST['bbp-create-group-forum']) ? true : false;
$forum_id = 0;
$forum_ids = bbp_get_group_forum_ids($group_id);
if (!empty($forum_ids)) {
$forum_id = (int) is_array($forum_ids) ? $forum_ids[0] : $forum_ids;
}
// Create a forum, or not
switch ($create_forum) {
case true:
// Bail if initial content was already created
if (!empty($forum_id)) {
return;
}
// Set the default forum status
switch (bp_get_new_group_status()) {
case 'hidden':
$status = bbp_get_hidden_status_id();
break;
case 'private':
$status = bbp_get_private_status_id();
break;
case 'public':
default:
$status = bbp_get_public_status_id();
break;
}
// Create the initial forum
$forum_id = bbp_insert_forum(array('post_parent' => bbp_get_group_forums_root_id(), 'post_title' => bp_get_new_group_name(), 'post_content' => bp_get_new_group_description(), 'post_status' => $status));
// Run the BP-specific functions for new groups
$this->new_forum(array('forum_id' => $forum_id));
// Update forum active
groups_update_groupmeta(bp_get_new_group_id(), '_bbp_forum_enabled_' . $forum_id, true);
// Toggle forum on
$this->toggle_group_forum(bp_get_new_group_id(), true);
break;
case false:
// Forum was created but is now being undone
if (!empty($forum_id)) {
// Delete the forum
wp_delete_post($forum_id, true);
// Delete meta values
groups_delete_groupmeta(bp_get_new_group_id(), 'forum_id');
groups_delete_groupmeta(bp_get_new_group_id(), '_bbp_forum_enabled_' . $forum_id);
// Toggle forum off
$this->toggle_group_forum(bp_get_new_group_id(), false);
}
break;
}
}
示例7: create_screen_save_notab
public function create_screen_save_notab($group_id = 0)
{
// No nonce check, since there's no tab
// Check for possibly empty group_id
if (empty($group_id)) {
$group_id = bp_get_new_group_id();
}
// We always set this true, because we always create a forum (the user doesn't get to choose whether they want it or not anymore)
$create_forum = true;
//!empty( $_POST['bbp-create-group-forum'] ) ? true : false;
$forum_id = 0;
$forum_ids = bbp_get_group_forum_ids($group_id);
if (!empty($forum_ids)) {
$forum_id = (int) is_array($forum_ids) ? $forum_ids[0] : $forum_ids;
}
// Create a forum, or not
switch ($create_forum) {
case true:
// Bail if initial content was already created
if (!empty($forum_id)) {
return;
}
// Set the default forum status
switch (bp_get_new_group_status()) {
case 'hidden':
$status = bbp_get_hidden_status_id();
break;
case 'private':
$status = bbp_get_private_status_id();
break;
case 'public':
default:
$status = bbp_get_public_status_id();
break;
}
// Create the initial forum
$forum_id = bbp_insert_forum(array('post_parent' => bbp_get_group_forums_root_id(), 'post_title' => bp_get_new_group_name(), 'post_content' => bp_get_new_group_description(), 'post_status' => $status));
// Run the BP-specific functions for new groups
$this->new_forum(array('forum_id' => $forum_id));
// Update forum active
groups_update_groupmeta(bp_get_new_group_id(), '_bbp_forum_enabled_' . $forum_id, true);
// Toggle forum on
$this->toggle_group_forum(bp_get_new_group_id(), true);
break;
case false:
// Forum was created but is now being undone
if (!empty($forum_id)) {
// Delete the forum
wp_delete_post($forum_id, true);
// Delete meta values
groups_delete_groupmeta(bp_get_new_group_id(), 'forum_id');
groups_delete_groupmeta(bp_get_new_group_id(), '_bbp_forum_enabled_' . $forum_id);
// Toggle forum off
$this->toggle_group_forum(bp_get_new_group_id(), false);
}
break;
}
}
示例8: invite_anyone_create_screen_content
//.........这里部分代码省略.........
<span class="activity"><?php
bp_group_invite_user_last_active();
?>
</span>
<?php
do_action('bp_group_send_invites_item');
?>
<div class="action">
<a class="remove" href="<?php
bp_group_invite_user_remove_invite_url();
?>
" id="<?php
bp_group_invite_item_id();
?>
"><?php
_e('Remove Invite', 'buddypress');
?>
</a>
<?php
do_action('bp_group_send_invites_item_action');
?>
</div>
</li>
<?php
}
?>
<?php
}
?>
</ul>
<?php
do_action('bp_after_group_send_invites_list');
?>
</div>
<div class="clear"></div>
<?php
if ($event != 'create') {
?>
<div class="submit">
<input type="submit" name="submit" id="submit" value="<?php
_e('Send Invites', 'buddypress');
?>
" />
</div>
<?php
}
?>
<?php
wp_nonce_field('groups_send_invites', '_wpnonce_send_invites');
?>
<!-- Don't leave out this sweet field -->
<?php
if (!bp_get_new_group_id()) {
?>
<input type="hidden" name="group_id" id="group_id" value="<?php
bp_group_id();
?>
" /><?php
} else {
?>
<input type="hidden" name="group_id" id="group_id" value="<?php
bp_new_group_id();
?>
" /><?php
}
?>
<?php
if ($event != 'create') {
?>
</form>
<?php
}
?>
<?php
do_action('bp_after_group_send_invites_content');
?>
<?php
}
}
示例9: create_screen_save
/**
* Save the Group Forum data on create
*
* @since bbPress (r3465)
*/
public function create_screen_save()
{
check_admin_referer('groups_create_save_' . $this->slug);
$create_forum = !empty($_POST['bbp-create-group-forum']) ? true : false;
$forum_id = 0;
$forum_ids = bbp_get_group_forum_ids(bp_get_new_group_id());
if (!empty($forum_ids)) {
$forum_id = (int) is_array($forum_ids) ? $forum_ids[0] : $forum_ids;
}
// Create a forum, or not
switch ($create_forum) {
case true:
// Bail if initial content was already created
if (!empty($forum_id)) {
return;
}
// Set the default forum status
switch (bp_get_new_group_status()) {
case 'hidden':
$status = bbp_get_hidden_status_id();
break;
case 'private':
$status = bbp_get_private_status_id();
break;
case 'public':
default:
$status = bbp_get_public_status_id();
break;
}
// Create the initial forum
$forum_id = bbp_insert_forum(array('post_parent' => bbp_get_group_forums_root_id(), 'post_title' => bp_get_new_group_name(), 'post_content' => bp_get_new_group_description(), 'post_status' => $status));
// Run the BP-specific functions for new groups
$this->new_forum(array('forum_id' => $forum_id));
break;
case false:
// Forum was created but is now being undone
if (!empty($forum_id)) {
wp_delete_post($forum_id, true);
groups_delete_groupmeta(bp_get_new_group_id(), 'forum_id');
}
break;
}
}