本文整理汇总了PHP中groups_get_groupmeta函数的典型用法代码示例。如果您正苦于以下问题:PHP groups_get_groupmeta函数的具体用法?PHP groups_get_groupmeta怎么用?PHP groups_get_groupmeta使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了groups_get_groupmeta函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: admin_metabox
/**
* Render Metabox
*
* @param type $item
*/
public function admin_metabox($item)
{
$group_id = $item->id;
$page_id = groups_get_groupmeta($group_id, '_group_linked_page', true);
wp_nonce_field('_bp_linked_group_page', '_bp_linked_group_page_nonce');
wp_dropdown_pages(array('name' => '_group_linked_page', 'selected' => $page_id, 'show_option_none' => __('Please select a page')));
}
示例2: buddyboss_cover_photo_get
/**
* This function return the object val from given object and object_id
* @param <string> $object mention for what you need cover eg. user,taxonomy,group
* @param <int> $object_id ID of the object
* @return <string> Object value of object.
**/
function buddyboss_cover_photo_get($object, $object_id)
{
global $bb_cover_photo_support;
if (!in_array($object, $bb_cover_photo_support)) {
//return nothing.
return false;
}
$attachment = null;
//user
if ($object == 'user') {
$meta = get_user_meta($object_id, "_bb_cover_photo", true);
return (array) @$meta;
}
//taxonomy
if ($object == 'taxonomy') {
return '';
}
//group
if ($object == 'group') {
$meta = groups_get_groupmeta($object_id, '_bb_cover_photo', true);
return (array) @$meta;
}
//forum
if ($object == 'forum') {
$meta = get_post_meta($object_id, '_bb_cover_photo', true);
return (array) @$meta;
}
}
示例3: mpp_get_allowed_space
/**
* Get allowed space for the given component( In MB)
* @param type $component
* @param type $component_id
* @return numeric : no. of MBs
*/
function mpp_get_allowed_space($component, $component_id = null)
{
if (!empty($component_id)) {
if ($component == 'members') {
$space_allowed = bp_get_user_meta($component_id, 'mpp_upload_space', true);
} elseif ($component == 'groups' && function_exists('groups_get_groupmeta')) {
$space_allowed = groups_get_groupmeta($component_id, 'mpp_upload_space', true);
}
}
if (empty($component_id) || empty($space_allowed)) {
//if owner id is empty
//get the gallery/group space
if ($component == 'members') {
$space_allowed = mpp_get_option('mpp_upload_space');
} elseif ($component == 'groups') {
$space_allowed = mpp_get_option('mpp_upload_space_groups');
}
}
//we should have some value by now
//if( empty($space_allowed))
/// $space_allowed = get_option("gallery_upload_space");//currently let us deal with blog space gallery will have it's own limit later
if (empty($space_allowed)) {
$space_allowed = mpp_get_option('mpp_upload_space');
}
//if we still don't have anything
if (empty($space_allowed) || !is_numeric($space_allowed)) {
$space_allowed = 10;
}
//by default
return apply_filters('mpp_allowed_space', $space_allowed, $component, $component_id);
//allow to override for specific users/groups
}
示例4: bp_forums_directory_forums_setup
/**
* Load the Forums directory.
*/
function bp_forums_directory_forums_setup()
{
// Get BuddyPress once
$bp = buddypress();
if (bp_is_forums_component() && (!bp_current_action() || 'tag' == bp_current_action() && bp_action_variables()) && !bp_current_item()) {
if (!bp_forums_has_directory()) {
return false;
}
if (!bp_forums_is_installed_correctly()) {
bp_core_add_message(__('The forums component has not been set up yet.', 'buddypress'), 'error');
bp_core_redirect(bp_get_root_domain());
}
bp_update_is_directory(true, 'forums');
do_action('bbpress_init');
// Check to see if the user has posted a new topic from the forums page.
if (isset($_POST['submit_topic']) && bp_is_active('forums')) {
check_admin_referer('bp_forums_new_topic');
$bp->groups->current_group = groups_get_group(array('group_id' => $_POST['topic_group_id']));
if (!empty($bp->groups->current_group->id)) {
// Auto join this user if they are not yet a member of this group
if (!bp_current_user_can('bp_moderate') && 'public' == $bp->groups->current_group->status && !groups_is_user_member(bp_loggedin_user_id(), $bp->groups->current_group->id)) {
groups_join_group($bp->groups->current_group->id);
}
$error_message = '';
$forum_id = groups_get_groupmeta($bp->groups->current_group->id, 'forum_id');
if (!empty($forum_id)) {
if (empty($_POST['topic_title'])) {
$error_message = __('Please provide a title for your forum topic.', 'buddypress');
} else {
if (empty($_POST['topic_text'])) {
$error_message = __('Forum posts cannot be empty. Please enter some text.', 'buddypress');
}
}
if ($error_message) {
bp_core_add_message($error_message, 'error');
$redirect = bp_get_group_permalink($bp->groups->current_group) . 'forum';
} else {
if (!($topic = groups_new_group_forum_topic($_POST['topic_title'], $_POST['topic_text'], $_POST['topic_tags'], $forum_id))) {
bp_core_add_message(__('There was an error when creating the topic', 'buddypress'), 'error');
$redirect = bp_get_group_permalink($bp->groups->current_group) . 'forum';
} else {
bp_core_add_message(__('The topic was created successfully', 'buddypress'));
$redirect = bp_get_group_permalink($bp->groups->current_group) . 'forum/topic/' . $topic->topic_slug . '/';
}
}
bp_core_redirect($redirect);
} else {
bp_core_add_message(__('Please pick the group forum where you would like to post this topic.', 'buddypress'), 'error');
bp_core_redirect(add_query_arg('new', '', bp_get_forums_directory_permalink()));
}
} else {
bp_core_add_message(__('Please pick the group forum where you would like to post this topic.', 'buddypress'), 'error');
bp_core_redirect(add_query_arg('new', '', bp_get_forums_directory_permalink()));
}
}
do_action('bp_forums_directory_forums_setup');
bp_core_load_template(apply_filters('bp_forums_template_directory_forums_setup', 'forums/index'));
}
}
示例5: bp_forums_delete_group_forum
function bp_forums_delete_group_forum($group_id)
{
$forum_id = groups_get_groupmeta($group_id, 'forum_id');
if (!empty($forum_id) && is_int($forum_id)) {
do_action('bbpress_init');
bb_delete_forum($forum_id);
}
}
示例6: bp_checkins_group_can_checkin
function bp_checkins_group_can_checkin()
{
if (groups_get_groupmeta(bp_get_group_id(), 'checkins_ok')) {
return true;
} else {
return false;
}
}
示例7: groups_update_group_forum
function groups_update_group_forum($group_id)
{
$group = new BP_Groups_Group($group_id);
if (empty($group->enable_forum) || !bp_is_active('forums')) {
return false;
}
$args = array('forum_id' => groups_get_groupmeta($group_id, 'forum_id'), 'forum_name' => $group->name, 'forum_desc' => $group->description, 'forum_slug' => $group->slug);
bp_forums_update_forum(apply_filters('groups_update_group_forum', $args));
}
示例8: bp_cover_group_get_image_scr
function bp_cover_group_get_image_scr()
{
global $bp;
if (empty($group_id)) {
$group_id = $bp->groups->current_group->id;
}
$image = groups_get_groupmeta($group_id, 'bp_cover_group', true);
$filter .= "<img class='bp-cover' src='{$image}'/>";
return $filter;
}
示例9: meso_fetch_random_groups
function meso_fetch_random_groups($limit = '', $size = '', $type = '', $block_id = '')
{
global $wpdb, $bp;
$fetch_group = "SELECT * FROM " . $wpdb->base_prefix . "bp_groups WHERE status = 'public' ORDER BY rand() LIMIT {$limit}";
$sql_fetch_group = $wpdb->get_results($fetch_group);
?>
<ul class="random-groups item-list group-in-<?php
echo $block_id;
?>
">
<?php
$no_avatar = 'http://www.gravatar.com/avatar';
foreach ($sql_fetch_group as $group_fe) {
$avatar_full = bp_core_fetch_avatar('item_id=' . $group_fe->id . '&class=avatar&object=group&type=' . $type . '&width=' . $size . '&height=' . $size);
$group_description = stripslashes($group_fe->description);
?>
<li>
<div class="item-avatar"><?php
echo $avatar_full;
?>
</div>
<div class="item">
<div class="item-title">
<a title="<?php
echo $group_fe->name . ' - ' . dez_get_short_text($group_description, 150);
?>
" href="<?php
echo home_url() . '/' . bp_get_root_slug('groups') . '/' . $group_fe->slug;
?>
"><?php
echo $group_fe->name;
?>
</a>
</div>
<div class="item-meta">
<span class="activity">
<?php
echo groups_get_groupmeta($group_fe->id, $meta_key = 'total_member_count');
?>
<?php
echo bp_get_root_slug('members');
?>
</span>
</div>
</div>
</li>
<?php
}
?>
</ul>
<?php
}
示例10: groups_update_group_forum
/**
* Update group forum metadata (title, description, slug) when the group's details are edited.
*
* @since BuddyPress (1.1.0)
*
* @param int $group_id Group id, passed from groups_details_updated.
*/
function groups_update_group_forum($group_id)
{
$group = groups_get_group(array('group_id' => $group_id));
/**
* Bail in the following three situations:
* 1. Forums are not enabled for this group
* 2. The BP Forum component is not enabled
* 3. The built-in bbPress forums are not correctly installed (usually means they've been
* uninstalled)
*/
if (empty($group->enable_forum) || !bp_is_active('forums') || function_exists('bp_forums_is_installed_correctly') && !bp_forums_is_installed_correctly()) {
return false;
}
bp_forums_update_forum(apply_filters('groups_update_group_forum', array('forum_id' => groups_get_groupmeta($group_id, 'forum_id'), 'forum_name' => $group->name, 'forum_desc' => $group->description, 'forum_slug' => $group->slug)));
}
示例11: bpfb_documents_allowed
/**
* Checks upload permissions.
* Adapted from Group Documents plugin.
*/
function bpfb_documents_allowed($group = false)
{
if (!$group) {
return false;
}
$user = wp_get_current_user();
$moderator_of = BP_Groups_Member::get_is_admin_of($user->ID) + BP_Groups_Member::get_is_mod_of($user->ID);
$moderator_of = is_array($moderator_of) && isset($moderator_of['groups']) ? $moderator_of['groups'] : false;
$is_mod = false;
foreach ($moderator_of as $gm) {
if ($gm->id == $group->id) {
$is_mod = true;
break;
}
}
switch (get_option('bp_group_documents_upload_permission')) {
case 'mods_decide':
switch (groups_get_groupmeta($group->id, 'group_documents_upload_permission')) {
case 'mods_only':
if ($is_mod) {
return true;
}
break;
case 'members':
default:
if (bp_group_is_member($group)) {
return true;
}
break;
}
break;
case 'mods_only':
if ($is_mod) {
return true;
}
break;
case 'members':
default:
if (bp_group_is_member($group)) {
return true;
}
break;
}
return false;
}
示例12: bp_forums_directory_forums_setup
function bp_forums_directory_forums_setup() {
global $bp;
if ( $bp->current_component == $bp->forums->slug ) {
if ( (int) $bp->site_options['bp-disable-forum-directory'] || !function_exists( 'groups_install' ) )
return false;
if ( !bp_forums_is_installed_correctly() ) {
bp_core_add_message( __( 'The forums component has not been set up yet.', 'buddypress' ), 'error' );
bp_core_redirect( $bp->root_domain );
}
$bp->is_directory = true;
do_action( 'bbpress_init' );
/* Check to see if the user has posted a new topic from the forums page. */
if ( isset( $_POST['submit_topic'] ) && function_exists( 'bp_forums_new_topic' ) ) {
/* Check the nonce */
check_admin_referer( 'bp_forums_new_topic' );
if ( $bp->groups->current_group = groups_get_group( array( 'group_id' => $_POST['topic_group_id'] ) ) ) {
/* Auto join this user if they are not yet a member of this group */
if ( !is_super_admin() && 'public' == $bp->groups->current_group->status && !groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) )
groups_join_group( $bp->groups->current_group->id, $bp->groups->current_group->id );
if ( $forum_id = groups_get_groupmeta( $bp->groups->current_group->id, 'forum_id' ) ) {
if ( !$topic = groups_new_group_forum_topic( $_POST['topic_title'], $_POST['topic_text'], $_POST['topic_tags'], $forum_id ) )
bp_core_add_message( __( 'There was an error when creating the topic', 'buddypress'), 'error' );
else
bp_core_add_message( __( 'The topic was created successfully', 'buddypress') );
bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . '/forum/topic/' . $topic->topic_slug . '/' );
} else {
bp_core_add_message( __( 'Please pick the group forum where you would like to post this topic.', 'buddypress' ), 'error' );
}
}
}
do_action( 'bp_forums_directory_forums_setup' );
bp_core_load_template( apply_filters( 'bp_forums_template_directory_forums_setup', 'forums/index' ) );
}
}
示例13: get
function get()
{
if (false === $this->group_id) {
global $groups_template;
if (!empty($groups_template->group)) {
$group_id = bp_get_group_id();
if (!empty($group_id)) {
$this->group_id = $group_id;
}
} else {
if (isset($this->media) && isset($this->media->context_id)) {
$this->group_id = $this->media->context_id;
} else {
return false;
}
}
}
$this->featured = groups_get_groupmeta($this->group_id, 'rtmedia_group_featured_media', true);
return $this->featured;
}
示例14: test_bp_groups_update_meta_cache
/**
* @group bp_groups_update_meta_cache
*/
public function test_bp_groups_update_meta_cache()
{
$g1 = $this->factory->group->create();
$g2 = $this->factory->group->create();
$time = bp_core_current_time();
// Set up some data
groups_update_groupmeta($g1, 'total_member_count', 4);
groups_update_groupmeta($g1, 'last_activity', $time);
groups_update_groupmeta($g1, 'foo', 'bar');
groups_update_groupmeta($g2, 'total_member_count', 81);
groups_update_groupmeta($g2, 'last_activity', $time);
groups_update_groupmeta($g2, 'foo', 'baz');
// Prime the cache for $g1
groups_update_groupmeta($g1, 'foo', 'bar');
groups_get_groupmeta($g1, 'foo');
// Ensure an empty cache for $g2
wp_cache_delete($g2, 'group_meta');
bp_groups_update_meta_cache(array($g1, $g2));
$expected = array($g1 => array('total_member_count' => array(4), 'last_activity' => array($time), 'foo' => array('bar')), $g2 => array('total_member_count' => array(81), 'last_activity' => array($time), 'foo' => array('baz')));
$found = array($g1 => wp_cache_get($g1, 'group_meta'), $g2 => wp_cache_get($g2, 'group_meta'));
$this->assertEquals($expected, $found);
}
示例15: populate
function populate()
{
global $wpdb, $bp;
if ($group = $wpdb->get_row($wpdb->prepare("SELECT g.* FROM {$bp->groups->table_name} g WHERE g.id = %d", $this->id))) {
bp_groups_update_meta_cache($this->id);
$this->id = $group->id;
$this->creator_id = $group->creator_id;
$this->name = stripslashes($group->name);
$this->slug = $group->slug;
$this->description = stripslashes($group->description);
$this->status = $group->status;
$this->enable_forum = $group->enable_forum;
$this->date_created = $group->date_created;
$this->last_activity = groups_get_groupmeta($this->id, 'last_activity');
$this->total_member_count = groups_get_groupmeta($this->id, 'total_member_count');
$this->is_member = BP_Groups_Member::check_is_member(bp_loggedin_user_id(), $this->id);
// If this is a private or hidden group, does the current user have access?
if ('private' == $this->status || 'hidden' == $this->status) {
if ($this->is_member && is_user_logged_in() || bp_current_user_can('bp_moderate')) {
$this->user_has_access = true;
} else {
$this->user_has_access = false;
}
} else {
$this->user_has_access = true;
}
// Get group admins and mods
$admin_mods = $wpdb->get_results(apply_filters('bp_group_admin_mods_user_join_filter', $wpdb->prepare("SELECT u.ID as user_id, u.user_login, u.user_email, u.user_nicename, m.is_admin, m.is_mod FROM {$wpdb->users} u, {$bp->groups->table_name_members} m WHERE u.ID = m.user_id AND m.group_id = %d AND ( m.is_admin = 1 OR m.is_mod = 1 )", $this->id)));
foreach ((array) $admin_mods as $user) {
if ((int) $user->is_admin) {
$this->admins[] = $user;
} else {
$this->mods[] = $user;
}
}
} else {
$this->id = 0;
}
}