本文整理汇总了PHP中groups_delete_groupmeta函数的典型用法代码示例。如果您正苦于以下问题:PHP groups_delete_groupmeta函数的具体用法?PHP groups_delete_groupmeta怎么用?PHP groups_delete_groupmeta使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了groups_delete_groupmeta函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct()
{
global $bp, $wpmudev_chat;
$wpmudev_chat->load_configs();
$this->settings_slug = 'wpmudev_chat_bp_group';
$this->slug = $wpmudev_chat->get_option('bp_menu_slug', 'global');
$this->name = $wpmudev_chat->get_option('bp_menu_label', 'global');
$this->create_step_position = 21;
$this->nav_item_position = 31;
$this->enable_nav_item = false;
if (isset($bp->groups->current_group->id)) {
if (groups_is_user_member($bp->loggedin_user->id, $bp->groups->current_group->id)) {
// First check if the old value
$enabled = groups_get_groupmeta($bp->groups->current_group->id, 'wpmudevchatbpgroupenable');
if (!empty($enabled)) {
groups_delete_groupmeta($bp->groups->current_group->id, 'wpmudevchatbpgroupenable');
groups_update_groupmeta($bp->groups->new_group_id, $this->settings_slug . '_enable', $enabled);
}
$enabled = groups_get_groupmeta($bp->groups->current_group->id, $this->settings_slug . '_enable');
if ($enabled == "yes") {
$this->enable_nav_item = true;
}
$atts = groups_get_groupmeta($bp->groups->current_group->id, $this->settings_slug);
//if (!empty($atts)) {
//if ((isset($atts['bp_menu_slug'])) && (!empty($atts['bp_menu_slug']))) {
// $this->slug = $atts['bp_menu_slug'];
//}
//if ((isset($atts['bp_menu_label'])) && (!empty($atts['bp_menu_label']))) {
// $this->nav_item_name = $atts['bp_menu_label'];
//}
//}
//echo "slug=[". $this->slug ."]<br />";
}
}
}
示例2: __construct
function __construct()
{
global $bp, $wpmudev_chat;
$wpmudev_chat->load_configs();
$this->create_step_position = 21;
$this->nav_item_position = 31;
$this->slug = $wpmudev_chat->get_option('bp_menu_slug', 'global');
$this->name = $wpmudev_chat->get_option('bp_menu_label', 'global');
$this->enable_nav_item = false;
if (isset($bp->groups->current_group->id)) {
if (groups_is_user_member($bp->loggedin_user->id, $bp->groups->current_group->id)) {
// First check if the old value
$enabled = groups_get_groupmeta($bp->groups->current_group->id, 'wpmudevchatbpgroupenable');
if (!empty($enabled)) {
echo "here!<br />";
groups_delete_groupmeta($bp->groups->current_group->id, 'wpmudevchatbpgroupenable');
groups_update_groupmeta($bp->groups->new_group_id, self::settings_slug . '_enable', $enabled);
}
$enabled = groups_get_groupmeta($bp->groups->current_group->id, self::settings_slug . '_enable', true);
if ($enabled == "yes") {
$this->enable_nav_item = true;
}
}
}
$args = array('slug' => $this->slug, 'name' => $this->name, 'enable_nav_item' => $this->enable_nav_item, 'nav_item_position' => $this->nav_item_position, 'screens' => array('edit' => array('name' => $this->name, 'submit_text' => __('Submit', $wpmudev_chat->translation_domain)), 'create' => array('position' => $this->create_step_position)));
parent::init($args);
}
示例3: delete_pic_cover_group
function delete_pic_cover_group($activity_id)
{
global $bp;
$group_id = $bp->groups->current_group->id;
$activity_id = $_POST['activity_id'];
$attachment_id = bp_activity_get_meta($activity_id, 'all_bp_cover_group', true);
wp_delete_attachment($attachment_id, true);
groups_delete_groupmeta($group_id, 'bp_cover_group');
groups_delete_groupmeta($group_id, 'bp_cover_group_position');
bp_activity_delete(array('id' => $activity_id, 'item_id' => $group_id));
BP_Activity_Activity::delete_activity_meta_entries($activity_id);
}
示例4: delete
function delete()
{
global $nxtdb, $bp;
// Delete groupmeta for the group
groups_delete_groupmeta($this->id);
// Fetch the user IDs of all the members of the group
$user_ids = BP_Groups_Member::get_group_member_ids($this->id);
$user_ids = implode(',', (array) $user_ids);
// Modify group count usermeta for members
$nxtdb->query($nxtdb->prepare("UPDATE {$nxtdb->usermeta} SET meta_value = meta_value - 1 WHERE meta_key = 'total_group_count' AND user_id IN ( {$user_ids} )"));
// Now delete all group member entries
BP_Groups_Member::delete_all($this->id);
do_action_ref_array('bp_groups_delete_group', array(&$this));
// Finally remove the group entry from the DB
if (!$nxtdb->query($nxtdb->prepare("DELETE FROM {$bp->groups->table_name} WHERE id = %d", $this->id))) {
return false;
}
return true;
}
示例5: groups_update_groupmeta
function groups_update_groupmeta($group_id, $meta_key, $meta_value)
{
global $nxtdb, $bp;
if (!is_numeric($group_id)) {
return false;
}
$meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
if (is_string($meta_value)) {
$meta_value = stripslashes($nxtdb->escape($meta_value));
}
$meta_value = maybe_serialize($meta_value);
if (empty($meta_value)) {
return groups_delete_groupmeta($group_id, $meta_key);
}
$cur = $nxtdb->get_row($nxtdb->prepare("SELECT * FROM " . $bp->groups->table_name_groupmeta . " WHERE group_id = %d AND meta_key = %s", $group_id, $meta_key));
if (!$cur) {
$nxtdb->query($nxtdb->prepare("INSERT INTO " . $bp->groups->table_name_groupmeta . " ( group_id, meta_key, meta_value ) VALUES ( %d, %s, %s )", $group_id, $meta_key, $meta_value));
} else {
if ($cur->meta_value != $meta_value) {
$nxtdb->query($nxtdb->prepare("UPDATE " . $bp->groups->table_name_groupmeta . " SET meta_value = %s WHERE group_id = %d AND meta_key = %s", $meta_value, $group_id, $meta_key));
} else {
return false;
}
}
// Update the cached object and recache
nxt_cache_set('bp_groups_groupmeta_' . $group_id . '_' . $meta_key, $meta_value, 'bp');
return true;
}
示例6: 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;
}
}
示例7: gtags_save_tags
function gtags_save_tags($group)
{
global $bp;
if (isset($_POST['group-tags']) && $_POST['group-tags']) {
$grouptags = str_replace("\\'", "", $_POST['group-tags']);
// remove single quotes cause they dont work!
$grouptags = apply_filters('gtags_save_tags', $grouptags);
groups_update_groupmeta($group->id, 'gtags_group_tags', $grouptags);
} elseif ($bp->action_variables[0] == 'edit-details') {
// delete the group tags if empty, and we're on the edit details page
groups_delete_groupmeta($group->id, 'gtags_group_tags');
}
}
示例8: update
/**
* Update association
*
* @param type $group_id
* @return type
*/
public function update($group_id)
{
if (!isset($_POST['_bp_linked_group_page_nonce'])) {
return;
}
if (!$this->current_user_can_modify_settings($group_id)) {
return;
}
if (!wp_verify_nonce($_POST['_bp_linked_group_page_nonce'], '_bp_linked_group_page')) {
return;
}
$page_id = absint($_POST['_group_linked_page']);
if (!$page_id) {
groups_delete_groupmeta($group_id, '_group_linked_page');
} else {
groups_update_groupmeta($group_id, '_group_linked_page', $page_id);
}
}
示例9: 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;
}
}
示例10: mpp_delete_groups_wall_gallery_id
function mpp_delete_groups_wall_gallery_id($group_id, $type, $gallery_id)
{
$key = "_mpp_wall_{$type}_gallery_id";
return groups_delete_groupmeta($group_id, $key, $gallery_id);
}
示例11: user_register_classes
static function user_register_classes($user_id)
{
global $wpdb;
//get user's email address
$user = get_userdata($user_id);
//get all invites by email
$sqlQuery = "SELECT * FROM " . $wpdb->prefix . "bp_groups_groupmeta WHERE meta_value = '" . esc_sql(strtolower($user->user_email)) . "' ";
$invites = $wpdb->get_results($sqlQuery);
if (!empty($invites)) {
foreach ($invites as $invite) {
//add to group
groups_join_group($invite->group_id, $user_id);
//remove meta value
groups_delete_groupmeta($invite->group_id, "sp_invites", strtolower($user->user_email));
}
}
}
示例12: ass_save_default_subscription
function ass_save_default_subscription($group)
{
global $bp, $_POST;
if (isset($_POST['ass-default-subscription']) && ($postval = $_POST['ass-default-subscription'])) {
if ($postval && $postval != 'no') {
groups_update_groupmeta($group->id, 'ass_default_subscription', $postval);
} elseif ($postval == 'no') {
groups_delete_groupmeta($group->id, 'ass_default_subscription');
}
}
}
示例13: test_groups_delete_groupmeta_with_delete_all
/**
* @group groupmeta
* @group groups_delete_groupmeta
*/
public function test_groups_delete_groupmeta_with_delete_all()
{
// With no meta key, don't delete for all items - just delete
// all for a single item
$g1 = $this->factory->group->create();
$g2 = $this->factory->group->create();
groups_add_groupmeta($g1, 'foo', 'bar');
groups_add_groupmeta($g1, 'foo1', 'bar1');
groups_add_groupmeta($g2, 'foo', 'bar');
groups_add_groupmeta($g2, 'foo1', 'bar1');
$this->assertTrue(groups_delete_groupmeta($g1, 'foo', '', true));
$this->assertSame('', groups_get_groupmeta($g1, 'foo'));
$this->assertSame('', groups_get_groupmeta($g2, 'foo'));
$this->assertSame('bar1', groups_get_groupmeta($g1, 'foo1'));
$this->assertSame('bar1', groups_get_groupmeta($g2, 'foo1'));
}
示例14: edit_screen_save
/**
* Save the settings of the group
*/
public function edit_screen_save($group_id = null)
{
if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
return false;
}
check_admin_referer('groups_edit_save_' . $this->slug, 'altctrl');
$group_id = !empty($group_id) ? $group_id : bp_get_current_group_id();
$altctrl = array();
if (empty($_POST['_altctrl'])) {
return;
} else {
$altctrl = $_POST['_altctrl'];
}
if (!empty($altctrl['request'])) {
groups_update_groupmeta($group_id, '_altctrl_request', absint($altctrl['request']));
} else {
groups_delete_groupmeta($group_id, '_altctrl_request');
}
if (!empty($altctrl['tabs'])) {
groups_update_groupmeta($group_id, '_altctrl_tabs', array_map('sanitize_title', $altctrl['tabs']));
} else {
groups_delete_groupmeta($group_id, '_altctrl_tabs');
}
$page_id = $altctrl['page_id'];
if (!empty($altctrl['page_cb']) && !empty($altctrl['page_content'])) {
$page_id = wp_insert_post(array('ID' => $page_id, 'post_status' => 'publish', 'post_type' => 'group_front', 'post_content' => $altctrl['page_content']));
update_post_meta($page_id, '_altctrl_group_id', $group_id);
groups_update_groupmeta($group_id, '_altctrl_page_id', $page_id);
}
if (!empty($altctrl['page_id']) && empty($altctrl['page_cb'])) {
if (wp_delete_post($page_id)) {
groups_delete_groupmeta($group_id, '_altctrl_page_id', $page_id);
}
}
bp_core_add_message(__('Settings saved successfully', 'altctrl-public-group'));
bp_core_redirect(bp_get_group_permalink(buddypress()->groups->current_group) . 'admin/' . $this->slug);
}
示例15: edit_screen_save
/**
* Save the settings of the group
*
* @param integer $group_id the group id we save settings for
* @uses check_admin_referer() for security reasons
* @uses bp_get_current_group_id() to get the group id
* @uses groups_update_groupmeta() to set the BuddyDrive option if needed
* @uses groups_delete_groupmeta() to delete the BuddyDrive option if needed
* @uses buddydrive_remove_buddyfiles_from_group() to eventually remove attached BuddyDrive items
* @uses is_admin() to check if we're in WP backend
* @uses bp_core_add_message() to inform about success / error
* @uses bp_core_redirect() to avoid some refreshing stuff
* @uses bp_get_group_permalink() to redirect to
*/
public function edit_screen_save($group_id = null)
{
if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
return false;
}
check_admin_referer('groups_edit_save_' . $this->slug, 'buddydrive_group_admin');
$group_id = !empty($group_id) ? $group_id : bp_get_current_group_id();
/* Insert your edit screen save code here */
$buddydrive_ok = !empty($_POST['_group_buddydrive_activate']) ? $_POST['_group_buddydrive_activate'] : false;
if (!empty($buddydrive_ok)) {
$success = groups_update_groupmeta($group_id, '_buddydrive_enabled', $buddydrive_ok);
} else {
$success = groups_delete_groupmeta($group_id, '_buddydrive_enabled');
// we need to remove folders and items attached to this group in this case
buddydrive_remove_buddyfiles_from_group($group_id);
}
if (!is_admin()) {
/* To post an error/success message to the screen, use the following */
if (!$success) {
bp_core_add_message(__('There was an error saving, please try again', 'buddydrive'), 'error');
} else {
bp_core_add_message(__('Settings saved successfully', 'buddydrive'));
}
bp_core_redirect(bp_get_group_permalink(buddypress()->groups->current_group) . 'admin/' . $this->slug);
}
}