• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP groups_is_user_admin函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中groups_is_user_admin函数的典型用法代码示例。如果您正苦于以下问题:PHP groups_is_user_admin函数的具体用法?PHP groups_is_user_admin怎么用?PHP groups_is_user_admin使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了groups_is_user_admin函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: bp_gtm_get_access

function bp_gtm_get_access($user_id = false, $group_id = false, $action = false)
{
    global $wpdb, $bp;
    if (!$user_id) {
        $user_id = $bp->loggedin_user->id;
    }
    if (!$bp->groups->current_group->id) {
        return false;
    }
    if (!$group_id) {
        $group_id = $bp->groups->current_group->id;
    }
    if (groups_is_user_admin($bp->loggedin_user->id, $bp->groups->current_group->id) || is_super_admin() || is_network_admin()) {
        return true;
    }
    $sql = "SELECT `{$bp->gtm->table_roles}`. *\n                    FROM `{$bp->gtm->table_roles}`\n                    INNER JOIN `{$bp->gtm->table_roles_caps}` ON {$bp->gtm->table_roles_caps}.`role_id` = `{$bp->gtm->table_roles}`.`id`\n                    WHERE `{$bp->gtm->table_roles_caps}`.`user_id` = {$user_id}\n                        AND `{$bp->gtm->table_roles_caps}`.`group_id` = {$group_id}\n                        AND (\n                            `{$bp->gtm->table_roles}`.`group_id` = {$group_id}\n                            OR `{$bp->gtm->table_roles}`.`group_id` = '0'\n                        )\n                    LIMIT 1";
    $result = $wpdb->get_results($wpdb->prepare($sql));
    if (empty($result)) {
        return false;
    }
    if ($result[0]->{$action} == 1) {
        return true;
    }
    return false;
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:25,代码来源:roles.php


示例2: bcg_current_user_can_post

/**
 * Can the current user post to group blog
 * @global type $bp
 * @return type 
 */
function bcg_current_user_can_post()
{
    $user_id = bp_loggedin_user_id();
    $group_id = bp_get_current_group_id();
    $can_post = is_user_logged_in() && (groups_is_user_admin($user_id, $group_id) || groups_is_user_mod($user_id, $group_id));
    return apply_filters('bcg_current_user_can_post', $can_post, $group_id, $user_id);
}
开发者ID:WP--plugins,项目名称:blog-categories-for-groups,代码行数:12,代码来源:bcg-permissions.php


示例3: wpmudev_chat_is_moderator

/**
 * Test whether logged in user is a moderator
 *
 * @param	Array	$moderator_roles Moderator roles
 * @return	bool	$moderator	 True if moderator False if not
 */
function wpmudev_chat_is_moderator($chat_session, $debug = false)
{
    global $current_user, $bp;
    if ($chat_session['session_type'] === "bp-group") {
        if (function_exists('groups_is_user_mod') && function_exists('groups_is_user_admin')) {
            if (groups_is_user_mod($bp->loggedin_user->id, $bp->groups->current_group->id) || groups_is_user_admin($bp->loggedin_user->id, $bp->groups->current_group->id) || is_super_admin()) {
                return true;
            }
        }
        return false;
    }
    if ($chat_session['session_type'] === "private") {
        global $wpmudev_chat;
        if (!isset($chat_session['invite-info']['message']['host']['auth_hash'])) {
            return false;
        } else {
            if (!isset($wpmudev_chat->chat_auth['auth_hash'])) {
                return false;
            } else {
                if ($chat_session['invite-info']['message']['host']['auth_hash'] === $wpmudev_chat->chat_auth['auth_hash']) {
                    return true;
                } else {
                    return false;
                }
            }
        }
    }
    // all others
    // If the chat session doesn't have any defined moderator roles then no need to go further.
    if (!is_array($chat_session['moderator_roles']) || !count($chat_session['moderator_roles'])) {
        return false;
    }
    if (!is_multisite()) {
        if ($current_user->ID) {
            foreach ($chat_session['moderator_roles'] as $role) {
                if (in_array($role, $current_user->roles)) {
                    return true;
                }
            }
        }
    } else {
        // We only consider super admins IF the normal 'administrator' role is set.
        if (is_super_admin() && array_search('administrator', $chat_session['moderator_roles']) !== false) {
            return true;
        }
        if ($current_user->ID) {
            foreach ($chat_session['moderator_roles'] as $role) {
                if (in_array($role, $current_user->roles)) {
                    return true;
                }
            }
        }
    }
    return false;
}
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:61,代码来源:wpmudev_chat_utilities.php


示例4: bp_em_group_event_can_manage

/**
 * @param boolean $result
 * @param EM_Event $EM_Event
 */
function bp_em_group_event_can_manage($result, $EM_Event)
{
    if (!$result && !empty($EM_Event->group_id) && bp_is_active('groups')) {
        //only override if already false, incase it's true
        if (groups_is_user_admin(get_current_user_id(), $EM_Event->group_id) && current_user_can('edit_events')) {
            //This user is an admin of the owner's group, so they can edit this event.
            return true;
        }
    }
    return $result;
}
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:15,代码来源:bp-em-groups.php


示例5: __construct

 /**
  * Here you can see more customization of the config options
  */
 function __construct()
 {
     global $buddyforms, $buddyforms_user_can;
     $buddyforms_pig = get_option('buddyforms_pig_options');
     $this->post_in_group_form_slug = groups_get_groupmeta(bp_get_current_group_id(), '_bf_pig_form_slug', true);
     $this->buddyforms_pig = groups_get_groupmeta(bp_get_current_group_id(), '_buddyforms_pig', true);
     $buddyforms_user_can = false;
     //$this->enable_create_step       = false;
     $form_slug = $this->post_in_group_form_slug;
     $name = $buddyforms[$form_slug]['name'];
     if (isset($this->buddyforms_pig['create'])) {
         switch ($this->buddyforms_pig['create']) {
             case 'admin':
                 if (groups_is_user_admin(bp_loggedin_user_id(), bp_get_current_group_id())) {
                     $buddyforms_user_can = true;
                 }
                 break;
             case 'mod':
                 if (groups_is_user_mod(bp_loggedin_user_id(), bp_get_current_group_id()) || groups_is_user_admin(bp_loggedin_user_id(), bp_get_current_group_id())) {
                     $buddyforms_user_can = true;
                 }
                 break;
             case 'member':
             default:
                 if (groups_is_user_member(bp_loggedin_user_id(), bp_get_current_group_id())) {
                     $buddyforms_user_can = true;
                 }
                 break;
         }
     }
     $args = array('slug' => $form_slug, 'name' => $name);
     switch ($buddyforms_pig['permission']) {
         case 'all':
             add_action('bp_after_group_settings_admin', array($this, 'bp_pig_after_group_manage_members_admin'), 1, 1);
             add_action('groups_group_settings_edited', array($this, 'bf_pig_groups_group_settings_edited'), 10, 1);
             add_action('bp_after_group_settings_creation_step', array($this, 'bp_pig_after_group_manage_members_admin'), 1, 1);
             add_action('groups_create_group_step_save_group-settings', array($this, 'bf_pig_groups_group_settings_edited'), 10, 1);
             break;
         case 'group-admin':
             add_action('bp_after_group_settings_admin', array($this, 'bp_pig_after_group_manage_members_admin'), 1, 1);
             add_action('groups_group_settings_edited', array($this, 'bf_pig_groups_group_settings_edited'), 10, 1);
             break;
         case 'admin':
             if (is_super_admin()) {
                 add_action('bp_after_group_settings_admin', array($this, 'bp_pig_after_group_manage_members_admin'), 1, 1);
                 add_action('groups_group_settings_edited', array($this, 'bf_pig_groups_group_settings_edited'), 10, 1);
             }
             break;
     }
     parent::init($args);
 }
开发者ID:BuddyForms,项目名称:BuddyForms-Post-in-Groups,代码行数:54,代码来源:buddyforms-post-in-groups.php


示例6: add_class_to_rtmedia_gallery

 function add_class_to_rtmedia_gallery($classes)
 {
     global $rtmedia_query;
     $user_id = get_current_user_id();
     if (is_rt_admin() || isset($rtmedia_query->query['context']) && $rtmedia_query->query['context'] == 'profile' && isset($rtmedia_query->query['context_id']) && $rtmedia_query->query['context_id'] == $user_id) {
         $classes .= " rtm-pro-allow-action";
     }
     if (isset($rtmedia_query->query['context']) && $rtmedia_query->query['context'] == 'group') {
         $group_id = $rtmedia_query->query['context_id'];
         if (groups_is_user_mod($user_id, $group_id) || groups_is_user_admin($user_id, $group_id)) {
             $classes .= " rtm-pro-allow-action";
         }
     }
     return $classes;
 }
开发者ID:fs-contributor,项目名称:rtMedia,代码行数:15,代码来源:RTMediaGalleryItemAction.php


示例7: bp_em_group_event_can_manage

/**
 * Overrides the default capability of the user for another owner's event if the user is a group admin and the event belongs to a group. 
 * User must have the relevant permissions globally in order to inherit that capability for this event as well.
 * @param boolean $result
 * @param EM_Event $EM_Event
 */
function bp_em_group_event_can_manage($result, $EM_Event, $owner_capability, $admin_capability, $user_to_check)
{
    if (!$result && $EM_Event->event_owner != get_current_user_id() && !empty($EM_Event->group_id) && bp_is_active('groups')) {
        //only override if already false, incase it's true
        //if the user is an admin of this group, and actually has the relevant permissions globally, they can manage this event
        $EM_Object = new EM_Object();
        //create new object to prevent infinite loop should we call $EM_Event->can_manage();
        if (groups_is_user_admin(get_current_user_id(), $EM_Event->group_id) && $EM_Object->can_manage($owner_capability, $admin_capability, $user_to_check)) {
            //This user is an admin of the owner's group, so they can edit this event.
            return true;
        } else {
            $EM_Event->add_error($EM_Object->get_errors());
            //add any applicable errors
        }
    }
    return $result;
}
开发者ID:KhanMaytok,项目名称:events-manager,代码行数:23,代码来源:bp-em-groups.php


示例8: before_render

 function before_render()
 {
     if (!class_exists('BuddyPress') || !bp_is_active('groups')) {
         return false;
     }
     $this->get();
     // if group id is not set, don't render "Set featured"
     if (empty($this->group_id)) {
         return false;
     }
     $user_id = get_current_user_id();
     // if current is not group moderator or group admin, don't render "Set featured"
     if (!groups_is_user_mod($user_id, $this->group_id) && !groups_is_user_admin($user_id, $this->group_id) && !is_rt_admin()) {
         return false;
     }
     // if current media is not any group media, don't render "Set featured"
     if (!(isset($this->settings[$this->media->media_type]) && $this->settings[$this->media->media_type]) || isset($this->media->context) && 'group' != $this->media->context) {
         return false;
     }
     if (isset($this->action_query) && isset($this->action_query->id) && $this->action_query->id == $this->featured) {
         $this->label = $this->undo_label;
     }
 }
开发者ID:socialray,项目名称:surfied-2-0,代码行数:23,代码来源:RTMediaGroupFeatured.php


示例9: groups_ajax_invite_user

function groups_ajax_invite_user()
{
    global $bp;
    check_ajax_referer('groups_invite_uninvite_user');
    if (!$_POST['friend_id'] || !$_POST['friend_action'] || !$_POST['group_id']) {
        return false;
    }
    if (!groups_is_user_admin($bp->loggedin_user->id, $_POST['group_id'])) {
        return false;
    }
    if (!friends_check_friendship($bp->loggedin_user->id, $_POST['friend_id'])) {
        return false;
    }
    if ('invite' == $_POST['friend_action']) {
        if (!groups_invite_user($_POST['friend_id'], $_POST['group_id'])) {
            return false;
        }
        $user = new BP_Core_User($_POST['friend_id']);
        echo '<li id="uid-' . $user->id . '">';
        echo attribute_escape($user->avatar_thumb);
        echo '<h4>' . attribute_escape($user->user_link) . '</h4>';
        echo '<span class="activity">' . attribute_escape($user->last_active) . '</span>';
        echo '<div class="action">
				<a class="remove" href="' . wp_nonce_url($bp->loggedin_user->domain . $bp->groups->slug . '/' . $_POST['group_id'] . '/invites/remove/' . $user->id, 'groups_invite_uninvite_user') . '" id="uid-' . attribute_escape($user->id) . '">' . __('Remove Invite', 'buddypress') . '</a> 
			  </div>';
        echo '</li>';
    } else {
        if ('uninvite' == $_POST['friend_action']) {
            if (!groups_uninvite_user($_POST['friend_id'], $_POST['group_id'])) {
                return false;
            }
            return true;
        } else {
            return false;
        }
    }
}
开发者ID:alvaropereyra,项目名称:shrekcms,代码行数:37,代码来源:bp-groups-ajax.php


示例10: groups_notification_promoted_member

/**
 * Notify group member they have been promoted.
 *
 * @since 1.0.0
 *
 * @param int $user_id  ID of the user.
 * @param int $group_id ID of the group.
 * @return false|null False on failure.
 */
function groups_notification_promoted_member($user_id = 0, $group_id = 0)
{
    // What type of promotion is this?
    if (groups_is_user_admin($user_id, $group_id)) {
        $promoted_to = __('an administrator', 'buddypress');
        $type = 'member_promoted_to_admin';
    } else {
        $promoted_to = __('a moderator', 'buddypress');
        $type = 'member_promoted_to_mod';
    }
    // Trigger a BuddyPress Notification.
    if (bp_is_active('notifications')) {
        bp_notifications_add_notification(array('user_id' => $user_id, 'item_id' => $group_id, 'component_name' => buddypress()->groups->id, 'component_action' => $type));
    }
    // Bail if admin opted out of receiving this email.
    if ('no' === bp_get_user_meta($user_id, 'notification_groups_admin_promotion', true)) {
        return false;
    }
    $group = groups_get_group(array('group_id' => $group_id));
    $ud = bp_core_get_core_userdata($user_id);
    $group_link = bp_get_group_permalink($group);
    $settings_slug = function_exists('bp_get_settings_slug') ? bp_get_settings_slug() : 'settings';
    $settings_link = bp_core_get_user_domain($user_id) . $settings_slug . '/notifications/';
    // Set up and send the message.
    $to = $ud->user_email;
    $subject = bp_get_email_subject(array('text' => sprintf(__('You have been promoted in the group: "%s"', 'buddypress'), $group->name)));
    $message = sprintf(__('You have been promoted to %1$s for the group: "%2$s".

To view the group please visit: %3$s

---------------------
', 'buddypress'), $promoted_to, $group->name, $group_link);
    // Only show the disable notifications line if the settings component is enabled.
    if (bp_is_active('settings')) {
        $message .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link);
    }
    /**
     * Filters the user email that the group promotion notification will be sent to.
     *
     * @since 1.2.0
     *
     * @param string $to User email the promotion notification is being sent to.
     */
    $to = apply_filters('groups_notification_promoted_member_to', $to);
    /**
     * Filters the group promotion notification subject that will be sent to user.
     *
     * @since 1.2.0
     *
     * @param string          $subject Promotion notification email subject text.
     * @param BP_Groups_Group $group   Object holding the current group instance. Passed by reference.
     */
    $subject = apply_filters_ref_array('groups_notification_promoted_member_subject', array($subject, &$group));
    /**
     * Filters the group promotion notification message that will be sent to user.
     *
     * @since 1.2.0
     *
     * @param string          $message       Promotion notification email message text.
     * @param BP_Groups_Group $group         Object holding the current group instance. Passed by reference.
     * @param string          $promoted_to   Role that the user was promoted to within the group.
     * @param string          $group_link    URL permalink for the group that the promotion was related to.
     * @param string          $settings_link URL permalink for the user's notification settings area.
     */
    $message = apply_filters_ref_array('groups_notification_promoted_member_message', array($message, &$group, $promoted_to, $group_link, $settings_link));
    wp_mail($to, $subject, $message);
    /**
     * Fires after the notification is sent that a member has been promoted.
     *
     * @since 1.5.0
     *
     * @param int    $user_id  ID of the user who was promoted.
     * @param string $subject  Email notification subject text.
     * @param string $message  Email notification message text.
     * @param int    $group_id ID of the group that the user is a member of.
     */
    do_action('bp_groups_sent_promoted_email', $user_id, $subject, $message, $group_id);
}
开发者ID:swissspidy,项目名称:BuddyPress,代码行数:87,代码来源:bp-groups-notifications.php


示例11: test_groups_is_user_admin_expected_false

 public function test_groups_is_user_admin_expected_false()
 {
     $this->add_user_to_group(self::$user, self::$groups[0], array('is_admin' => false));
     $this->add_user_to_group(self::$user, self::$groups[1], array('is_admin' => true));
     $this->assertEquals(false, groups_is_user_admin(self::$user, self::$groups[0]));
 }
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:6,代码来源:groupsIsUser.php


示例12: friends_get_friends_invite_list

/**
 * Get a list of friends that a user can invite into this group.
 *
 * Excludes friends that are already in the group, and banned friends if the
 * user is not a group admin.
 *
 * @since BuddyPress (1.0.0)
 *
 * @param int $user_id User ID whose friends to see can be invited. Default:
 *        ID of the logged-in user.
 * @param int $group_id Group to check possible invitations against.
 * @return mixed False if no friends, array of users if friends.
 */
function friends_get_friends_invite_list($user_id = 0, $group_id = 0)
{
    // Default to logged in user id
    if (empty($user_id)) {
        $user_id = bp_loggedin_user_id();
    }
    // Only group admins can invited previously banned users
    $user_is_admin = (bool) groups_is_user_admin($user_id, $group_id);
    // Assume no friends
    $friends = array();
    // Default args
    $args = apply_filters('bp_friends_pre_get_invite_list', array('user_id' => $user_id, 'type' => 'alphabetical', 'per_page' => 0));
    // User has friends
    if (bp_has_members($args)) {
        /**
         * Loop through all friends and try to add them to the invitation list.
         *
         * Exclude friends that:
         *     1. are already members of the group
         *     2. are banned from this group if the current user is also not a
         *        group admin.
         */
        while (bp_members()) {
            // Load the member
            bp_the_member();
            // Get the user ID of the friend
            $friend_user_id = bp_get_member_user_id();
            // Skip friend if already in the group
            if (groups_is_user_member($friend_user_id, $group_id)) {
                continue;
            }
            // Skip friend if not group admin and user banned from group
            if (false === $user_is_admin && groups_is_user_banned($friend_user_id, $group_id)) {
                continue;
            }
            // Friend is safe, so add it to the array of possible friends
            $friends[] = array('id' => $friend_user_id, 'full_name' => bp_get_member_name());
        }
    }
    // If no friends, explicitly set to false
    if (empty($friends)) {
        $friends = false;
    }
    // Allow friends to be filtered
    return apply_filters('bp_friends_get_invite_list', $friends, $user_id, $group_id);
}
开发者ID:eresyyl,项目名称:mk,代码行数:59,代码来源:bp-friends-functions.php


示例13: map_meta_caps

 /**
  * Map rendez-vous caps for the group's context
  *
  * @package Rendez Vous
  * @subpackage Groups
  *
  * @since Rendez Vous (1.1.0)
  *
  * @param  array                      $caps Capabilities for meta capability
  * @param  string                     $cap Capability name
  * @param  int                        $user_id User id
  * @param  mixed                      $args Arguments
  * @uses   bp_is_group()              to make sure the user is displaying a group
  * @uses   groups_get_current_group() to get the current group object
  * @uses   groups_is_user_member()    to check if the user is a member of the group
  * @uses   groups_is_user_admin()     to check if the user is an admin of the group
  * @return array                      Actual capabilities for meta capability
  */
 public function map_meta_caps($caps = array(), $cap = '', $user_id = 0, $args = array())
 {
     if (!bp_is_group() || empty($user_id)) {
         return $caps;
     }
     $group = groups_get_current_group();
     switch ($cap) {
         case 'publish_rendez_vouss':
             if (!empty($group->id) && groups_is_user_member($user_id, $group->id)) {
                 $caps = array('exist');
             }
             break;
         case 'subscribe_rendez_vous':
             if (groups_is_user_member($user_id, $group->id)) {
                 $caps = array('exist');
             } else {
                 $caps = array('manage_options');
             }
             break;
             // Group Admins have full powers
         // Group Admins have full powers
         case 'read_private_rendez_vouss':
         case 'edit_rendez_vouss':
         case 'edit_others_rendez_vouss':
         case 'edit_rendez_vous':
         case 'delete_rendez_vous':
         case 'delete_rendez_vouss':
         case 'delete_others_rendez_vouss':
             if (!in_array('exist', $caps) && groups_is_user_admin($user_id, $group->id)) {
                 $caps = array('exist');
             }
             break;
     }
     return $caps;
 }
开发者ID:socialray,项目名称:surfied-2-0,代码行数:53,代码来源:rendez-vous-groups.php


示例14: can_user_create_album_in_group

/**
 *
 * @param type $group_id
 * @param type $user_id
 *
 * @return boolean
 */
function can_user_create_album_in_group($group_id = false, $user_id = false)
{
    if ($group_id == false) {
        $group = groups_get_current_group();
        $group_id = $group->id;
    }
    $upload_level = groups_get_groupmeta($group_id, "rt_media_group_control_level");
    if (empty($upload_level)) {
        $upload_level = groups_get_groupmeta($group_id, "bp_media_group_control_level");
        if (empty($upload_level)) {
            $upload_level = "all";
        }
    }
    $user_id = get_current_user_id();
    $display_flag = false;
    if (groups_is_user_member($user_id, $group_id)) {
        if ($upload_level == "admin") {
            if (groups_is_user_admin($user_id, $group_id) > 0) {
                $display_flag = true;
            }
        } else {
            if ($upload_level == "moderators") {
                if (groups_is_user_mod($user_id, $group_id) || groups_is_user_admin($user_id, $group_id)) {
                    $display_flag = true;
                }
            } else {
                $display_flag = true;
            }
        }
    }
    $display_flag = apply_filters('can_user_create_album_in_group', $display_flag);
    return $display_flag;
}
开发者ID:EfncoPlugins,项目名称:rtMedia,代码行数:40,代码来源:rt-template-functions.php


示例15: groups_notification_promoted_member

function groups_notification_promoted_member($user_id, $group_id)
{
    if (groups_is_user_admin($user_id, $group_id)) {
        $promoted_to = __('an administrator', 'buddypress');
        $type = 'member_promoted_to_admin';
    } else {
        $promoted_to = __('a moderator', 'buddypress');
        $type = 'member_promoted_to_mod';
    }
    // Post a screen notification first.
    bp_core_add_notification($group_id, $user_id, 'groups', $type);
    if ('no' == bp_get_user_meta($user_id, 'notification_groups_admin_promotion', true)) {
        return false;
    }
    $group = groups_get_group(array('group_id' => $group_id));
    $ud = bp_core_get_core_userdata($user_id);
    $group_link = bp_get_group_permalink($group);
    $settings_slug = function_exists('bp_get_settings_slug') ? bp_get_settings_slug() : 'settings';
    $settings_link = bp_core_get_user_domain($user_id) . $settings_slug . '/notifications/';
    // Set up and send the message
    $to = $ud->user_email;
    $subject = bp_get_email_subject(array('text' => sprintf(__('You have been promoted in the group: "%s"', 'buddypress'), $group->name)));
    $message = sprintf(__('You have been promoted to %1$s for the group: "%2$s".

To view the group please visit: %3$s

---------------------
', 'buddypress'), $promoted_to, $group->name, $group_link);
    // Only show the disable notifications line if the settings component is enabled
    if (bp_is_active('settings')) {
        $message .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link);
    }
    /* Send the message */
    $to = apply_filters('groups_notification_promoted_member_to', $to);
    $subject = apply_filters_ref_array('groups_notification_promoted_member_subject', array($subject, &$group));
    $message = apply_filters_ref_array('groups_notification_promoted_member_message', array($message, &$group, $promoted_to, $group_link, $settings_link));
    wp_mail($to, $subject, $message);
    do_action('bp_groups_sent_promoted_email', $user_id, $subject, $message, $group_id);
}
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:39,代码来源:bp-groups-notifications.php


示例16: array

<?php

global $EM_Event;
if (!function_exists('bp_is_active') || !bp_is_active('groups')) {
    return false;
}
$user_groups = array();
$group_data = groups_get_user_groups(get_current_user_id());
if (!is_super_admin()) {
    foreach ($group_data['groups'] as $group_id) {
        if (groups_is_user_admin(get_current_user_id(), $group_id)) {
            $user_groups[] = groups_get_group(array('group_id' => $group_id));
        }
    }
    $group_count = count($user_groups);
} else {
    $groups = groups_get_groups(array('show_hidden' => true, 'per_page' => 0));
    $user_groups = $groups['groups'];
    $group_count = $groups['total'];
}
if (count($user_groups) > 0) {
    ?>
	<p>
	<select name="group_id">
		<option value=""><?php 
    _e('Not a Group Event', 'dbem');
    ?>
</option>
		<?php 
    //in case user isn't a group mod, but can edit other users' events
    if (!empty($EM_Event->group_id) && !in_array($EM_Event->group_id, $group_data['groups'])) {
开发者ID:sajjadalisiddiqui,项目名称:cms,代码行数:31,代码来源:group.php


示例17: current_user_can_modify_settings

 private function current_user_can_modify_settings($group_id = false)
 {
     if (!$group_id) {
         $group_id = bp_get_current_group_id();
     }
     if (is_super_admin() || groups_is_user_admin(get_current_user_id(), $group_id)) {
         return true;
     }
     return false;
 }
开发者ID:Kemitestech,项目名称:WordPress-Skeleton,代码行数:10,代码来源:link-page-to-groups.php


示例18: groups_leave_group

function groups_leave_group($group_id, $user_id = 0)
{
    global $bp;
    if (empty($user_id)) {
        $user_id = bp_loggedin_user_id();
    }
    // Don't let single admins leave the group.
    if (count(groups_get_group_admins($group_id)) < 2) {
        if (groups_is_user_admin($user_id, $group_id)) {
            bp_core_add_message(__('As the only Admin, you cannot leave the group.', 'buddypress'), 'error');
            return false;
        }
    }
    $membership = new BP_Groups_Member($user_id, $group_id);
    // This is exactly the same as deleting an invite, just is_confirmed = 1 NOT 0.
    if (!groups_uninvite_user($user_id, $group_id)) {
        return false;
    }
    /**
     * If the user joined this group less than five minutes ago, remove the
     * joined_group activity so users cannot flood the activity stream by
     * joining/leaving the group in quick succession.
     */
    if (bp_is_active('activity') && gmmktime() <= strtotime('+5 minutes', (int) strtotime($membership->date_modified))) {
        bp_activity_delete(array('component' => $bp->groups->id, 'type' => 'joined_group', 'user_id' => $user_id, 'item_id' => $group_id));
    }
    bp_core_add_message(__('You successfully left the group.', 'buddypress'));
    do_action('groups_leave_group', $group_id, $user_id);
    return true;
}
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:30,代码来源:bp-groups-functions.php


示例19: edit_screen_save

 /**
  * The routine run after the user clicks Save from your admin tab
  *
  * You'll be pulling your data out of the $_POST global. Be sure to
  * sanitize as necessary.
  */
 function edit_screen_save()
 {
     global $bp, $wpdb;
     if (!bp_is_group_admin_screen($this->slug)) {
         return false;
     }
     if (!isset($_POST['wpmudev_chat_settings_save_wpnonce']) || !wp_verify_nonce($_POST['wpmudev_chat_settings_save_wpnonce'], 'wpmudev_chat_settings_save')) {
         return false;
     }
     // Controls our menu visibility. See the __construct logic.
     if (isset($_POST[$this->settings_slug . '_enable']) && $_POST[$this->settings_slug . '_enable'] == "on") {
         $enabled = "yes";
     } else {
         $enabled = "no";
     }
     groups_update_groupmeta($bp->groups->current_group->id, $this->settings_slug . '_enable', $enabled);
     if (!isset($_POST['chat'])) {
         return false;
     }
     if (groups_is_user_mod($bp->loggedin_user->id, $bp->groups->current_group->id) || groups_is_user_admin($bp->loggedin_user->id, $bp->groups->current_group->id) || is_super_admin()) {
         $success = $chat_section = false;
         $chat_settings = $_POST['chat'];
         if (isset($chat_settings['section'])) {
             $chat_section = $chat_settings['section'];
             unset($chat_settings['section']);
         }
         $chat_settings['session_type'] = 'bp-group';
         $chat_settings['id'] = 'wpmudev-chat-bp-group-' . $bp->groups->current_group->id;
         $chat_settings['blog_id'] = $wpdb->blogid;
         groups_update_groupmeta($bp->groups->current_group->id, $this->settings_slug, $chat_settings);
         /* Insert your edit screen save code here */
         $success = true;
         /* 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', 'buddypress'), 'error');
         } else {
             bp_core_add_message(__('Settings saved successfully', 'buddypress'));
         }
     }
     bp_core_redirect(bp_get_group_permalink($bp->groups->current_group) . 'admin/' . $this->slug);
 }
开发者ID:VLabsInc,项目名称:WordPressPlatforms,代码行数:47,代码来源:wpmudec_chat_buddypress_group_1.7.2.php


示例20: groups_notification_promoted_member

/**
 * Notify group member they have been promoted.
 *
 * @since 1.0.0
 *
 * @param int $user_id  ID of the user.
 * @param int $group_id ID of the group.
 */
function groups_notification_promoted_member($user_id = 0, $group_id = 0)
{
    // What type of promotion is this?
    if (groups_is_user_admin($user_id, $group_id)) {
        $promoted_to = __('an administrator', 'buddypress');
        $type = 'member_promoted_to_admin';
    } else {
        $promoted_to = __('a moderator', 'buddypress');
        $type = 'member_promoted_to_mod';
    }
    // Trigger a BuddyPress Notification.
    if (bp_is_active('notifications')) {
        bp_notifications_add_notification(array('user_id' => $user_id, 'item_id' => $group_id, 'component_name' => buddypress()->groups->id, 'component_action' => $type));
    }
    // Bail if admin opted out of receiving this email.
    if ('no' === bp_get_user_meta($user_id, 'notification_groups_admin_promotion', true)) {
        return;
    }
    $unsubscribe_args = array('user_id' => $user_id, 'notification_type' => 'groups-member-promoted');
    $group = groups_get_group($group_id);
    $args = array('tokens' => array('group' => $group, 'group.id' => $group_id, 'group.url' => esc_url(bp_get_group_permalink($group)), 'group.name' => $group->name, 'promoted_to' => $promoted_to, 'user.id' => $user_id, 'unsubscribe' => esc_url(bp_email_get_unsubscribe_link($unsubscribe_args))));
    bp_send_email('groups-member-promoted', (int) $user_id, $args);
}
开发者ID:buddypress,项目名称:BuddyPress-build,代码行数:31,代码来源:bp-groups-notifications.php



注:本文中的groups_is_user_admin函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP groups_is_user_banned函数代码示例发布时间:2022-05-15
下一篇:
PHP groups_is_member函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap