本文整理汇总了PHP中groups_update_groupmeta函数的典型用法代码示例。如果您正苦于以下问题:PHP groups_update_groupmeta函数的具体用法?PHP groups_update_groupmeta怎么用?PHP groups_update_groupmeta使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了groups_update_groupmeta函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: toggle_save
function toggle_save($group_id)
{
if (!empty($_POST['bpgr_toggle'])) {
groups_update_groupmeta($group_id, 'bpgr_is_reviewable', 'yes');
} else {
groups_update_groupmeta($group_id, 'bpgr_is_reviewable', 'no');
}
}
示例2: set
function set($media_id = false)
{
if (false === $media_id) {
return;
}
if (false === $this->group_id) {
return;
}
groups_update_groupmeta($this->group_id, 'rtmedia_group_featured_media', $media_id);
}
示例3: create_object
function create_object($args)
{
if (!isset($args['creator_id'])) {
$args['creator_id'] = get_current_user_id();
}
$group_id = groups_create_group($args);
groups_update_groupmeta($group_id, 'total_member_count', 1);
groups_update_groupmeta($group_id, 'last_activity', bp_core_current_time());
return $this->get_object_by_id($group_id);
}
示例4: save_course_settings
function save_course_settings()
{
$group_id = $_POST['group-id'];
if (isset($_POST['group_course']) && is_numeric($_POST['group_course'])) {
$c = groups_update_groupmeta($group_id, 'course_id', $_POST['group_course']);
}
if (isset($_POST['start_date'])) {
$c = groups_update_groupmeta($group_id, 'start_date', $_POST['start_date']);
}
}
示例5: test_bp_has_groups_with_meta_query
/**
* Integration test to make sure meta_query is getting passed through
*
* @group bp_has_groups
*/
public function test_bp_has_groups_with_meta_query()
{
$g1 = $this->factory->group->create();
$g2 = $this->factory->group->create();
groups_update_groupmeta($g1, 'foo', 'bar');
global $groups_template;
bp_has_groups(array('meta_query' => array(array('key' => 'foo', 'value' => 'bar'))));
$ids = wp_list_pluck($groups_template->groups, 'id');
$this->assertEquals($ids, array($g1));
}
示例6: test_bp_groups_delete_group_cache_on_metadata_change
/**
* @group groups_update_groupmeta
* @group groups_delete_group_cache_on_metadata_change
*/
public function test_bp_groups_delete_group_cache_on_metadata_change()
{
$g = $this->factory->group->create();
// Prime cache
groups_update_groupmeta($g, 'foo', 'bar');
groups_get_group($g);
$this->assertNotEmpty(wp_cache_get($g, 'bp_groups'));
// Trigger flush
groups_update_groupmeta($g, 'foo', 'baz');
$this->assertFalse(wp_cache_get($g, 'bp_groups'));
}
示例7: group_fields_save
function group_fields_save($group_id)
{
$plain_fields = array('completionpermonth');
foreach ($plain_fields as $field) {
$key = $field;
if (isset($_POST[$key])) {
$value = $_POST[$key];
groups_update_groupmeta($group_id, $field, $value);
}
}
}
示例8: groups_update_last_activity
function groups_update_last_activity($group_id = 0)
{
global $bp;
if (empty($group_id)) {
$group_id = $bp->groups->current_group->id;
}
if (empty($group_id)) {
return false;
}
groups_update_groupmeta($group_id, 'last_activity', bp_core_current_time());
}
示例9: groups_left_group
function groups_left_group($group_id, $user_id = 0)
{
global $bp;
if (empty($user_id)) {
$user_id = bp_loggedin_user_id();
}
// Record this in activity streams
groups_record_activity(array('type' => 'left_group', 'item_id' => $group_id, 'user_id' => $user_id));
// Modify group meta
groups_update_groupmeta($group_id, 'last_activity', bp_core_current_time());
return true;
}
示例10: description_complete_enregistrement
function description_complete_enregistrement($id_projet)
{
global $bp, $wpdb;
$tab_champs = array('description-complete');
// Plusieurs champs possibles
foreach ($tab_champs as $champ) {
$key = $champ;
if (isset($_POST[$key])) {
$valeur = $_POST[$key];
groups_update_groupmeta($id_projet, $champ, $valeur);
}
}
}
示例11: setUp
public function setUp()
{
parent::setUp();
$bp = buddypress();
$this->current_group = $bp->groups->current_group;
$this->current_component = $bp->current_component;
$this->current_user = get_current_user_id();
$this->group_admin_id = $this->factory->user->create();
$this->set_current_user($this->group_admin_id);
$this->group_id = $this->factory->group->create(array('creator_id' => $this->group_admin_id));
// Activate WP Idea Stream for the group
groups_update_groupmeta($this->group_id, '_group_ideastream_activate', 1);
// Set current component
$bp->current_component = $bp->groups->id;
}
示例12: groups_new_group_forum
/**
* Creates a new forum inside a specific BuddyPress group.
*
* Uses the bundled version of bbPress packaged with BuddyPress.
*
* @since BuddyPress (1.0.0)
*
* @param int $group_id The group ID that the new forum should be attached to.
* @param string $group_name The group name.
* @param string $group_desc The group description.
*/
function groups_new_group_forum($group_id = 0, $group_name = '', $group_desc = '')
{
if (empty($group_id)) {
$group_id = bp_get_current_group_id();
}
if (empty($group_name)) {
$group_name = bp_get_current_group_name();
}
if (empty($group_desc)) {
$group_desc = bp_get_current_group_description();
}
$forum_id = bp_forums_new_forum(array('forum_name' => $group_name, 'forum_desc' => $group_desc));
groups_update_groupmeta($group_id, 'forum_id', $forum_id);
do_action('groups_new_group_forum', $forum_id, $group_id);
}
示例13: groups_new_group_forum
function groups_new_group_forum($group_id = 0, $group_name = '', $group_desc = '')
{
global $bp;
if (empty($group_id)) {
$group_id = $bp->groups->current_group->id;
}
if (empty($group_name)) {
$group_name = $bp->groups->current_group->name;
}
if (empty($group_desc)) {
$group_desc = $bp->groups->current_group->description;
}
$forum_id = bp_forums_new_forum(array('forum_name' => $group_name, 'forum_desc' => $group_desc));
groups_update_groupmeta($group_id, 'forum_id', $forum_id);
do_action('groups_new_group_forum', $forum_id, $group_id);
}
示例14: upgrade_1_02
function upgrade_1_02()
{
global $bp, $wpdb;
$sql = $wpdb->prepare("SELECT group_id, meta_value FROM {$bp->groups->table_name_groupmeta} WHERE meta_key = 'bpgr_rating'");
$old_ratings = $wpdb->get_results($sql);
foreach ($old_ratings as $old_rating) {
$group_id = $old_rating->group_id;
$rating = maybe_unserialize($old_rating->meta_value);
if (!empty($rating['avg_score'])) {
groups_update_groupmeta($group_id, 'bpgr_rating', $rating['avg_score']);
}
if (!empty($rating['number'])) {
groups_update_groupmeta($group_id, 'bpgr_how_many_ratings', $rating['number']);
}
}
}
示例15: test_follow_blog_and_groupblog
/**
* @group groupblog
*/
public function test_follow_blog_and_groupblog()
{
if (!is_multisite()) {
return;
}
// save the current user and override logged-in user
$old_user = get_current_user_id();
$u = $this->factory->user->create();
$this->set_current_user($u);
// create some blogs
$b = $this->factory->blog->create(array('title' => 'Groupblog', 'user_id' => $u));
$b2 = $this->factory->blog->create(array('title' => 'Test blog 1', 'user_id' => $u));
$b3 = $this->factory->blog->create(array('title' => 'Test blog 2', 'user_id' => $u));
// create a group and connect a blog
$g = $this->factory->group->create(array('creator_id' => $u));
groups_update_groupmeta($g, 'groupblog_blog_id', $b);
// follow the groupblog
$f = bp_follow_start_following(array('leader_id' => $b, 'follower_id' => $u, 'follow_type' => 'blogs'));
// follow a regular blog
$f2 = bp_follow_start_following(array('leader_id' => $b2, 'follower_id' => $u, 'follow_type' => 'blogs'));
// add some activity items
$a = $this->factory->activity->create(array('component' => buddypress()->groups->id, 'type' => 'new_groupblog_post', 'user_id' => $u, 'item_id' => $g, 'secondary_item_id' => 1));
$a2 = $this->factory->activity->create(array('component' => buddypress()->blogs->id, 'type' => 'new_blog_post', 'user_id' => $u, 'item_id' => $b3, 'secondary_item_id' => 1));
$a3 = $this->factory->activity->create(array('component' => buddypress()->blogs->id, 'type' => 'new_blog_post', 'user_id' => $u, 'item_id' => $b2, 'secondary_item_id' => 1));
// fake that we're on a user's "Activity > Followed Sites" page
add_filter('bp_ajax_querystring', array($this, 'add_activity_scope_filter'));
// fake that BP groupblog is installed so groupblog filter will kick in
if (!function_exists('bp_groupblog_init')) {
function bp_groupblog_init()
{
}
}
// run the activity loop
global $activities_template;
bp_has_activities(bp_ajax_querystring('activity'));
// grab the activity IDs from the loop
$ids = wp_list_pluck($activities_template->activities, 'id');
// assert!
$this->assertEquals(array($a, $a3), $ids);
// reset everything
$activities_template = null;
$this->set_current_user($old_user);
remove_filter('bp_ajax_querystring', array($this, 'add_activity_scope_filter'));
}