当前位置: 首页>>代码示例>>PHP>>正文


PHP groups_get_group_admins函数代码示例

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


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

示例1: is_user_owner

 public function is_user_owner($user_id = 0)
 {
     if (!$user_id) {
         $user_id = $GLOBALS['user_ID'];
     }
     if (self::owner_type_user == $this->owner_type) {
         return $user_id == $this->owner_id;
     }
     if (self::owner_type_group == $this->owner_type) {
         if (is_null($this->_user_owners)) {
             $admins = groups_get_group_admins($this->owner_id);
             $this->_user_owners = array();
             foreach ($admins as $admin) {
                 $this->_user_owners[$admin->user_id] = true;
             }
         }
         return $this->_user_owners[$user_id];
     }
     return false;
 }
开发者ID:jeffryevans,项目名称:biblefox-wp,代码行数:20,代码来源:plan.php

示例2: bp_get_group_join_button

function bp_get_group_join_button($group = false)
{
    global $groups_template;
    if (empty($group)) {
        $group =& $groups_template->group;
    }
    if (!is_user_logged_in() || bp_group_is_user_banned($group)) {
        return false;
    }
    // Group creation was not completed or status is unknown
    if (!$group->status) {
        return false;
    }
    // Already a member
    if (isset($group->is_member) && $group->is_member) {
        // Stop sole admins from abandoning their group
        $group_admins = groups_get_group_admins($group->id);
        if (1 == count($group_admins) && $group_admins[0]->user_id == bp_loggedin_user_id()) {
            return false;
        }
        $button = array('id' => 'leave_group', 'component' => 'groups', 'must_be_logged_in' => true, 'block_self' => false, 'wrapper_class' => 'group-button ' . $group->status, 'wrapper_id' => 'groupbutton-' . $group->id, 'link_href' => wp_nonce_url(bp_get_group_permalink($group) . 'leave-group', 'groups_leave_group'), 'link_text' => __('Leave Group', 'buddypress'), 'link_title' => __('Leave Group', 'buddypress'), 'link_class' => 'group-button leave-group');
        // Not a member
    } else {
        // Show different buttons based on group status
        switch ($group->status) {
            case 'hidden':
                return false;
                break;
            case 'public':
                $button = array('id' => 'join_group', 'component' => 'groups', 'must_be_logged_in' => true, 'block_self' => false, 'wrapper_class' => 'group-button ' . $group->status, 'wrapper_id' => 'groupbutton-' . $group->id, 'link_href' => wp_nonce_url(bp_get_group_permalink($group) . 'join', 'groups_join_group'), 'link_text' => __('Join Group', 'buddypress'), 'link_title' => __('Join Group', 'buddypress'), 'link_class' => 'group-button join-group');
                break;
            case 'private':
                // Member has outstanding invitation -
                // show an "Accept Invitation" button
                if ($group->is_invited) {
                    $button = array('id' => 'accept_invite', 'component' => 'groups', 'must_be_logged_in' => true, 'block_self' => false, 'wrapper_class' => 'group-button ' . $group->status, 'wrapper_id' => 'groupbutton-' . $group->id, 'link_href' => add_query_arg('redirect_to', bp_get_group_permalink($group), bp_get_group_accept_invite_link($group)), 'link_text' => __('Accept Invitation', 'buddypress'), 'link_title' => __('Accept Invitation', 'buddypress'), 'link_class' => 'group-button accept-invite');
                    // Member has requested membership but request is pending -
                    // show a "Request Sent" button
                } elseif ($group->is_pending) {
                    $button = array('id' => 'membership_requested', 'component' => 'groups', 'must_be_logged_in' => true, 'block_self' => false, 'wrapper_class' => 'group-button pending ' . $group->status, 'wrapper_id' => 'groupbutton-' . $group->id, 'link_href' => bp_get_group_permalink($group), 'link_text' => __('Request Sent', 'buddypress'), 'link_title' => __('Request Sent', 'buddypress'), 'link_class' => 'group-button pending membership-requested');
                    // Member has not requested membership yet -
                    // show a "Request Membership" button
                } else {
                    $button = array('id' => 'request_membership', 'component' => 'groups', 'must_be_logged_in' => true, 'block_self' => false, 'wrapper_class' => 'group-button ' . $group->status, 'wrapper_id' => 'groupbutton-' . $group->id, 'link_href' => wp_nonce_url(bp_get_group_permalink($group) . 'request-membership', 'groups_request_membership'), 'link_text' => __('Request Membership', 'buddypress'), 'link_title' => __('Request Membership', 'buddypress'), 'link_class' => 'group-button request-membership');
                }
                break;
        }
    }
    // Filter and return the HTML button
    return bp_get_button(apply_filters('bp_get_group_join_button', $button));
}
开发者ID:kd5ytx,项目名称:Empirical-Wordpress,代码行数:51,代码来源:bp-groups-template.php

示例3: bp_get_group_join_button

/**
 * Return button to join a group.
 *
 * @since 1.0.0
 *
 * @param object|bool $group Single group object.
 * @return mixed
 */
function bp_get_group_join_button($group = false)
{
    global $groups_template;
    // Set group to current loop group if none passed.
    if (empty($group)) {
        $group =& $groups_template->group;
    }
    // Don't show button if not logged in or previously banned.
    if (!is_user_logged_in() || bp_group_is_user_banned($group)) {
        return false;
    }
    // Group creation was not completed or status is unknown.
    if (empty($group->status)) {
        return false;
    }
    // Already a member.
    if (!empty($group->is_member)) {
        // Stop sole admins from abandoning their group.
        $group_admins = groups_get_group_admins($group->id);
        if (1 == count($group_admins) && bp_loggedin_user_id() === (int) $group_admins[0]->user_id) {
            return false;
        }
        // Setup button attributes.
        $button = array('id' => 'leave_group', 'component' => 'groups', 'must_be_logged_in' => true, 'block_self' => false, 'wrapper_class' => 'group-button ' . $group->status, 'wrapper_id' => 'groupbutton-' . $group->id, 'link_href' => wp_nonce_url(bp_get_group_permalink($group) . 'leave-group', 'groups_leave_group'), 'link_text' => __('Leave Group', 'buddypress'), 'link_title' => __('Leave Group', 'buddypress'), 'link_class' => 'group-button leave-group');
        // Not a member.
    } else {
        // Show different buttons based on group status.
        switch ($group->status) {
            case 'hidden':
                return false;
            case 'public':
                $button = array('id' => 'join_group', 'component' => 'groups', 'must_be_logged_in' => true, 'block_self' => false, 'wrapper_class' => 'group-button ' . $group->status, 'wrapper_id' => 'groupbutton-' . $group->id, 'link_href' => wp_nonce_url(bp_get_group_permalink($group) . 'join', 'groups_join_group'), 'link_text' => __('Join Group', 'buddypress'), 'link_title' => __('Join Group', 'buddypress'), 'link_class' => 'group-button join-group');
                break;
            case 'private':
                // Member has outstanding invitation -
                // show an "Accept Invitation" button.
                if ($group->is_invited) {
                    $button = array('id' => 'accept_invite', 'component' => 'groups', 'must_be_logged_in' => true, 'block_self' => false, 'wrapper_class' => 'group-button ' . $group->status, 'wrapper_id' => 'groupbutton-' . $group->id, 'link_href' => add_query_arg('redirect_to', bp_get_group_permalink($group), bp_get_group_accept_invite_link($group)), 'link_text' => __('Accept Invitation', 'buddypress'), 'link_title' => __('Accept Invitation', 'buddypress'), 'link_class' => 'group-button accept-invite');
                    // Member has requested membership but request is pending -
                    // show a "Request Sent" button.
                } elseif ($group->is_pending) {
                    $button = array('id' => 'membership_requested', 'component' => 'groups', 'must_be_logged_in' => true, 'block_self' => false, 'wrapper_class' => 'group-button pending ' . $group->status, 'wrapper_id' => 'groupbutton-' . $group->id, 'link_href' => bp_get_group_permalink($group), 'link_text' => __('Request Sent', 'buddypress'), 'link_title' => __('Request Sent', 'buddypress'), 'link_class' => 'group-button pending membership-requested');
                    // Member has not requested membership yet -
                    // show a "Request Membership" button.
                } else {
                    $button = array('id' => 'request_membership', 'component' => 'groups', 'must_be_logged_in' => true, 'block_self' => false, 'wrapper_class' => 'group-button ' . $group->status, 'wrapper_id' => 'groupbutton-' . $group->id, 'link_href' => wp_nonce_url(bp_get_group_permalink($group) . 'request-membership', 'groups_request_membership'), 'link_text' => __('Request Membership', 'buddypress'), 'link_title' => __('Request Membership', 'buddypress'), 'link_class' => 'group-button request-membership');
                }
                break;
        }
    }
    /**
     * Filters the HTML button for joining a group.
     *
     * @since 1.2.6
     * @since 2.4.0 Added $group parameter to filter args.
     *
     * @param string $button HTML button for joining a group.
     * @param object $group BuddyPress group object
     */
    return bp_get_button(apply_filters('bp_get_group_join_button', $button, $group));
}
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:69,代码来源:bp-groups-template.php

示例4: test_groups_get_group_admins_cache_on_member_save

 /**
  * @group groups_get_group_admins
  */
 public function test_groups_get_group_admins_cache_on_member_save()
 {
     $u1 = $this->factory->user->create();
     $u2 = $this->factory->user->create();
     $g = $this->factory->group->create(array('creator_id' => $u1));
     // prime cache
     groups_get_group_admins($g);
     // promote user 2 to an admin via BP_Groups_Member::save()
     self::add_user_to_group($u2, $g, array('is_admin' => 1));
     // assert that cache is invalidated
     $this->assertEmpty(wp_cache_get($g, 'bp_group_admins'));
     // assert new cached value
     $this->assertEquals(2, count(groups_get_group_admins($g)));
 }
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:17,代码来源:cache.php

示例5: groups_screen_group_admin_manage_members

/**
 * This function handles actions related to member management on the group admin.
 */
function groups_screen_group_admin_manage_members()
{
    if ('manage-members' != bp_get_group_current_admin_tab()) {
        return false;
    }
    if (!bp_is_item_admin()) {
        return false;
    }
    $bp = buddypress();
    if (bp_action_variable(1) && bp_action_variable(2) && bp_action_variable(3)) {
        if (bp_is_action_variable('promote', 1) && (bp_is_action_variable('mod', 2) || bp_is_action_variable('admin', 2)) && is_numeric(bp_action_variable(3))) {
            $user_id = bp_action_variable(3);
            $status = bp_action_variable(2);
            // Check the nonce first.
            if (!check_admin_referer('groups_promote_member')) {
                return false;
            }
            // Promote a user.
            if (!groups_promote_member($user_id, $bp->groups->current_group->id, $status)) {
                bp_core_add_message(__('There was an error when promoting that user. Please try again.', 'buddypress'), 'error');
            } else {
                bp_core_add_message(__('User promoted successfully', 'buddypress'));
            }
            /**
             * Fires before the redirect after a group member has been promoted.
             *
             * @since 1.0.0
             *
             * @param int $user_id ID of the user being promoted.
             * @param int $id      ID of the group user is promoted within.
             */
            do_action('groups_promoted_member', $user_id, $bp->groups->current_group->id);
            bp_core_redirect(bp_get_group_permalink(groups_get_current_group()) . 'admin/manage-members/');
        }
    }
    if (bp_action_variable(1) && bp_action_variable(2)) {
        if (bp_is_action_variable('demote', 1) && is_numeric(bp_action_variable(2))) {
            $user_id = bp_action_variable(2);
            // Check the nonce first.
            if (!check_admin_referer('groups_demote_member')) {
                return false;
            }
            // Stop sole admins from abandoning their group.
            $group_admins = groups_get_group_admins($bp->groups->current_group->id);
            if (1 == count($group_admins) && $group_admins[0]->user_id == $user_id) {
                bp_core_add_message(__('This group must have at least one admin', 'buddypress'), 'error');
            } elseif (!groups_demote_member($user_id, $bp->groups->current_group->id)) {
                bp_core_add_message(__('There was an error when demoting that user. Please try again.', 'buddypress'), 'error');
            } else {
                bp_core_add_message(__('User demoted successfully', 'buddypress'));
            }
            /**
             * Fires before the redirect after a group member has been demoted.
             *
             * @since 1.0.0
             *
             * @param int $user_id ID of the user being demoted.
             * @param int $id      ID of the group user is demoted within.
             */
            do_action('groups_demoted_member', $user_id, $bp->groups->current_group->id);
            bp_core_redirect(bp_get_group_permalink(groups_get_current_group()) . 'admin/manage-members/');
        }
        if (bp_is_action_variable('ban', 1) && is_numeric(bp_action_variable(2))) {
            $user_id = bp_action_variable(2);
            // Check the nonce first.
            if (!check_admin_referer('groups_ban_member')) {
                return false;
            }
            // Ban a user.
            if (!groups_ban_member($user_id, $bp->groups->current_group->id)) {
                bp_core_add_message(__('There was an error when banning that user. Please try again.', 'buddypress'), 'error');
            } else {
                bp_core_add_message(__('User banned successfully', 'buddypress'));
            }
            /**
             * Fires before the redirect after a group member has been banned.
             *
             * @since 1.0.0
             *
             * @param int $user_id ID of the user being banned.
             * @param int $id      ID of the group user is banned from.
             */
            do_action('groups_banned_member', $user_id, $bp->groups->current_group->id);
            bp_core_redirect(bp_get_group_permalink(groups_get_current_group()) . 'admin/manage-members/');
        }
        if (bp_is_action_variable('unban', 1) && is_numeric(bp_action_variable(2))) {
            $user_id = bp_action_variable(2);
            // Check the nonce first.
            if (!check_admin_referer('groups_unban_member')) {
                return false;
            }
            // Remove a ban for user.
            if (!groups_unban_member($user_id, $bp->groups->current_group->id)) {
                bp_core_add_message(__('There was an error when unbanning that user. Please try again.', 'buddypress'), 'error');
            } else {
                bp_core_add_message(__('User ban removed successfully', 'buddypress'));
            }
//.........这里部分代码省略.........
开发者ID:swissspidy,项目名称:BuddyPress,代码行数:101,代码来源:bp-groups-screens.php

示例6: groups_screen_group_admin_manage_members

/**
 * This function handles actions related to member management on the group admin.
 */
function groups_screen_group_admin_manage_members()
{
    if ('manage-members' != bp_get_group_current_admin_tab()) {
        return false;
    }
    if (!bp_is_item_admin()) {
        return false;
    }
    $bp = buddypress();
    if (bp_action_variable(1) && bp_action_variable(2) && bp_action_variable(3)) {
        if (bp_is_action_variable('promote', 1) && (bp_is_action_variable('mod', 2) || bp_is_action_variable('admin', 2)) && is_numeric(bp_action_variable(3))) {
            $user_id = bp_action_variable(3);
            $status = bp_action_variable(2);
            // Check the nonce first.
            if (!check_admin_referer('groups_promote_member')) {
                return false;
            }
            // Promote a user.
            if (!groups_promote_member($user_id, $bp->groups->current_group->id, $status)) {
                bp_core_add_message(__('There was an error when promoting that user. Please try again.', 'buddypress'), 'error');
            } else {
                bp_core_add_message(__('User promoted successfully', 'buddypress'));
            }
            do_action('groups_promoted_member', $user_id, $bp->groups->current_group->id);
            bp_core_redirect(bp_get_group_permalink(groups_get_current_group()) . 'admin/manage-members/');
        }
    }
    if (bp_action_variable(1) && bp_action_variable(2)) {
        if (bp_is_action_variable('demote', 1) && is_numeric(bp_action_variable(2))) {
            $user_id = bp_action_variable(2);
            // Check the nonce first.
            if (!check_admin_referer('groups_demote_member')) {
                return false;
            }
            // Stop sole admins from abandoning their group
            $group_admins = groups_get_group_admins($bp->groups->current_group->id);
            if (1 == count($group_admins) && $group_admins[0]->user_id == $user_id) {
                bp_core_add_message(__('This group must have at least one admin', 'buddypress'), 'error');
            } elseif (!groups_demote_member($user_id, $bp->groups->current_group->id)) {
                bp_core_add_message(__('There was an error when demoting that user. Please try again.', 'buddypress'), 'error');
            } else {
                bp_core_add_message(__('User demoted successfully', 'buddypress'));
            }
            do_action('groups_demoted_member', $user_id, $bp->groups->current_group->id);
            bp_core_redirect(bp_get_group_permalink(groups_get_current_group()) . 'admin/manage-members/');
        }
        if (bp_is_action_variable('ban', 1) && is_numeric(bp_action_variable(2))) {
            $user_id = bp_action_variable(2);
            // Check the nonce first.
            if (!check_admin_referer('groups_ban_member')) {
                return false;
            }
            // Ban a user.
            if (!groups_ban_member($user_id, $bp->groups->current_group->id)) {
                bp_core_add_message(__('There was an error when banning that user. Please try again.', 'buddypress'), 'error');
            } else {
                bp_core_add_message(__('User banned successfully', 'buddypress'));
            }
            do_action('groups_banned_member', $user_id, $bp->groups->current_group->id);
            bp_core_redirect(bp_get_group_permalink(groups_get_current_group()) . 'admin/manage-members/');
        }
        if (bp_is_action_variable('unban', 1) && is_numeric(bp_action_variable(2))) {
            $user_id = bp_action_variable(2);
            // Check the nonce first.
            if (!check_admin_referer('groups_unban_member')) {
                return false;
            }
            // Remove a ban for user.
            if (!groups_unban_member($user_id, $bp->groups->current_group->id)) {
                bp_core_add_message(__('There was an error when unbanning that user. Please try again.', 'buddypress'), 'error');
            } else {
                bp_core_add_message(__('User ban removed successfully', 'buddypress'));
            }
            do_action('groups_unbanned_member', $user_id, $bp->groups->current_group->id);
            bp_core_redirect(bp_get_group_permalink(groups_get_current_group()) . 'admin/manage-members/');
        }
        if (bp_is_action_variable('remove', 1) && is_numeric(bp_action_variable(2))) {
            $user_id = bp_action_variable(2);
            // Check the nonce first.
            if (!check_admin_referer('groups_remove_member')) {
                return false;
            }
            // Remove a user.
            if (!groups_remove_member($user_id, $bp->groups->current_group->id)) {
                bp_core_add_message(__('There was an error removing that user from the group. Please try again.', 'buddypress'), 'error');
            } else {
                bp_core_add_message(__('User removed successfully', 'buddypress'));
            }
            do_action('groups_removed_member', $user_id, $bp->groups->current_group->id);
            bp_core_redirect(bp_get_group_permalink(groups_get_current_group()) . 'admin/manage-members/');
        }
    }
    do_action('groups_screen_group_admin_manage_members', $bp->groups->current_group->id);
    bp_core_load_template(apply_filters('groups_template_group_admin_manage_members', 'groups/single/home'));
}
开发者ID:sdh100shaun,项目名称:pantheon,代码行数:98,代码来源:bp-groups-screens.php

示例7: get_teachers

 /**
  * get_teachers( $group_id )
  *
  * Returns an array with group teachers user_id
  * @param Int $group_id, the group ID to check for
  * @return Mixed, an array of user_id's
  */
 function get_teachers($group_id)
 {
     $teachers = array();
     $group_admins = groups_get_group_admins($group_id);
     foreach ($group_admins as $admin) {
         if (self::is_teacher($admin->user_id)) {
             $teachers[] = $admin->user_id;
         }
     }
     return $teachers;
 }
开发者ID:ruanbarbosa,项目名称:buddypress-courseware,代码行数:18,代码来源:roles.class.php

示例8: groups_action_leave_group

/**
 * Catch and process "Leave Group" button clicks.
 *
 * When a group member clicks on the "Leave Group" button from a group's page,
 * this function is run.
 *
 * Note: When leaving a group from the group directory, AJAX is used and
 * another function handles this. See {@link bp_legacy_theme_ajax_joinleave_group()}.
 *
 * @since BuddyPress (1.2.4)
 */
function groups_action_leave_group()
{
    if (!bp_is_single_item() || !bp_is_groups_component() || !bp_is_current_action('leave-group')) {
        return false;
    }
    // Nonce check
    if (!check_admin_referer('groups_leave_group')) {
        return false;
    }
    // User wants to leave any group
    if (groups_is_user_member(bp_loggedin_user_id(), bp_get_current_group_id())) {
        $bp = buddypress();
        // Stop sole admins from abandoning their group
        $group_admins = groups_get_group_admins(bp_get_current_group_id());
        if (1 == count($group_admins) && $group_admins[0]->user_id == bp_loggedin_user_id()) {
            bp_core_add_message(__('This group must have at least one admin', 'buddypress'), 'error');
        } elseif (!groups_leave_group($bp->groups->current_group->id)) {
            bp_core_add_message(__('There was an error leaving the group.', 'buddypress'), 'error');
        } else {
            bp_core_add_message(__('You successfully left the group.', 'buddypress'));
        }
        $redirect = bp_get_group_permalink(groups_get_current_group());
        if ('hidden' == $bp->groups->current_group->status) {
            $redirect = trailingslashit(bp_loggedin_user_domain() . bp_get_groups_slug());
        }
        bp_core_redirect($redirect);
    }
    bp_core_load_template(apply_filters('groups_template_group_home', 'groups/single/home'));
}
开发者ID:eresyyl,项目名称:mk,代码行数:40,代码来源:bp-groups-actions.php

示例9: get_teachers

 /**
  * get_teachers( $group_id )
  *
  * Returns an array with group teachers user_id
  * @param Int $group_id, the group ID to check for
  * @return Mixed, an array of user_id's
  */
 function get_teachers($group_id)
 {
     $teachers = array();
     $group_admins = groups_get_group_admins($group_id);
     $group_members = groups_get_group_members($group_id);
     $group_members = array_merge($group_admins, $group_members['members']);
     foreach ($group_members as $member) {
         if (self::can_teach($member->user_id)) {
             $teachers[] = $member->user_id;
         }
     }
     return $teachers;
 }
开发者ID:adisonc,项目名称:MaineLearning,代码行数:20,代码来源:roles.class.php

示例10: groups_send_membership_request

function groups_send_membership_request( $requesting_user_id, $group_id ) {
	global $bp;

	/* Prevent duplicate requests */
	if ( groups_check_for_membership_request( $requesting_user_id, $group_id ) )
		return false;

	/* Check if the user is already a member or is banned */
	if ( groups_is_user_member( $requesting_user_id, $group_id ) || groups_is_user_banned( $requesting_user_id, $group_id ) )
		return false;

	$requesting_user = new BP_Groups_Member;
	$requesting_user->group_id = $group_id;
	$requesting_user->user_id = $requesting_user_id;
	$requesting_user->inviter_id = 0;
	$requesting_user->is_admin = 0;
	$requesting_user->user_title = '';
	$requesting_user->date_modified = gmdate( "Y-m-d H:i:s" );
	$requesting_user->is_confirmed = 0;
	$requesting_user->comments = $_POST['group-request-membership-comments'];

	if ( $requesting_user->save() ) {
		$admins = groups_get_group_admins( $group_id );

		require_once ( BP_PLUGIN_DIR . '/bp-groups/bp-groups-notifications.php' );

		for ( $i = 0; $i < count( $admins ); $i++ ) {
			// Saved okay, now send the email notification
			groups_notification_new_membership_request( $requesting_user_id, $admins[$i]->user_id, $group_id, $requesting_user->id );
		}

		do_action( 'groups_membership_requested', $requesting_user_id, $admins, $group_id, $requesting_user->id );

		return true;
	}

	return false;
}
开发者ID:n-sane,项目名称:zaroka,代码行数:38,代码来源:bp-groups.php

示例11: bp_get_group_join_button

	function bp_get_group_join_button( $group = false ) {
		global $bp, $groups_template;

		if ( !$group )
			$group =& $groups_template->group;

		// If they're not logged in or are banned from the group, no join button.
		if ( !is_user_logged_in() || $group->is_banned )
			return false;

		// Group creation was not completed or status is unknown
		if ( !$group->status )
			return false;

		// Already a member
		if ( $group->is_member ) {

			// Stop sole admins from abandoning their group
			if ( $bp->is_item_admin && count( groups_get_group_admins( $group->id ) ) < 2 )
				return false;

			$button = array(
				'id'                => 'leave_group',
				'component'         => 'groups',
				'must_be_logged_in' => true,
				'block_self'        => false,
				'wrapper_class'     => 'group-button ' . $group->status,
				'wrapper_id'        => 'groupbutton-' . $group->id,
				'link_class'        => 'leave-group',
				'link_href'         => wp_nonce_url( bp_get_group_permalink( $group ) . 'leave-group', 'groups_leave_group' ),
				'link_text'         => __( 'Leave Group', 'buddypress' ),
				'link_title'        => __( 'Leave Group', 'buddypress' )
			);

		// Not a member
		} else {

			// Show different buttons based on group status
			switch ( $group->status ) {
				case 'hidden' :
					return false;
					break;

				case 'public':
					$button = array(
						'id'                => 'join_group',
						'component'         => 'groups',
						'must_be_logged_in' => true,
						'block_self'        => false,
						'wrapper_class'     => 'group-button ' . $group->status,
						'wrapper_id'        => 'groupbutton-' . $group->id,
						'link_class'        => 'join-group',
						'link_href'         => wp_nonce_url( bp_get_group_permalink( $group ) . 'join', 'groups_join_group' ),
						'link_text'         => __( 'Join Group', 'buddypress' ),
						'link_title'        => __( 'Join Group', 'buddypress' )
					);
					break;

				case 'private' :

					// Member has not requested membership yet
					if ( !bp_group_has_requested_membership( $group ) ) {
						$button = array(
							'id'                => 'request_membership',
							'component'         => 'groups',
							'must_be_logged_in' => true,
							'block_self'        => false,
							'wrapper_class'     => 'group-button ' . $group->status,
							'wrapper_id'        => 'groupbutton-' . $group->id,
							'link_class'        => 'request-membership',
							'link_href'         => wp_nonce_url( bp_get_group_permalink( $group ) . 'request-membership', 'groups_request_membership' ),
							'link_text'         => __( 'Request Membership', 'buddypress' ),
							'link_title'        => __( 'Request Membership', 'buddypress' ),
						);

					// Member has requested membership already
					} else {
						$button = array(
							'id'                => 'membership_requested',
							'component'         => 'groups',
							'must_be_logged_in' => true,
							'block_self'        => false,
							'wrapper_class'     => 'group-button pending ' . $group->status,
							'wrapper_id'        => 'groupbutton-' . $group->id,
							'link_class'        => 'membership-requested',
							'link_href'         => bp_get_group_permalink( $group ),
							'link_text'         => __( 'Request Sent', 'buddypress' ),
							'link_title'        => __( 'Request Sent', 'buddypress' ),
						);
					}

					break;
			}
		}

		// Filter and return the HTML button
		return bp_get_button( apply_filters( 'bp_get_group_join_button', $button ) );
	}
开发者ID:n-sane,项目名称:zaroka,代码行数:98,代码来源:bp-groups-templatetags.php

示例12: groups_send_membership_request

function groups_send_membership_request($requesting_user_id, $group_id)
{
    global $bp;
    /* Check the nonce first. */
    if (!check_admin_referer('groups_request_membership')) {
        return false;
    }
    $requesting_user = new BP_Groups_Member();
    $requesting_user->group_id = $group_id;
    $requesting_user->user_id = $requesting_user_id;
    $requesting_user->inviter_id = 0;
    $requesting_user->is_admin = 0;
    $requesting_user->user_title = '';
    $requesting_user->date_modified = time();
    $requesting_user->is_confirmed = 0;
    $requesting_user->comments = $_POST['group-request-membership-comments'];
    if ($requesting_user->save()) {
        $admins = groups_get_group_admins($group_id);
        require_once BP_PLUGIN_DIR . '/bp-groups/bp-groups-notifications.php';
        for ($i = 0; $i < count($admins); $i++) {
            // Saved okay, now send the email notification
            groups_notification_new_membership_request($requesting_user_id, $admins[$i]->user_id, $group_id, $requesting_user->id);
        }
        do_action('groups_membership_requested', $requesting_user_id, $admins, $group_id, $requesting_user->id);
        return true;
    }
    return false;
}
开发者ID:alvaropereyra,项目名称:shrekcms,代码行数:28,代码来源:bp-groups.php

示例13: ass_send_welcome_email

/**
 * Send welcome email to new group members
 *
 * @uses apply_filters() Filter 'ass_welcome_email' to change the content/subject of the email
 */
function ass_send_welcome_email($group_id, $user_id)
{
    $user = bp_core_get_core_userdata($user_id);
    $welcome_email = groups_get_groupmeta($group_id, 'ass_welcome_email');
    $welcome_email = apply_filters('ass_welcome_email', $welcome_email, $group_id);
    // for multilingual filtering
    $welcome_email_enabled = isset($welcome_email['enabled']) ? $welcome_email['enabled'] : 'no';
    if ('no' == $welcome_email_enabled) {
        return;
    }
    $subject = ass_clean_subject($welcome_email['subject'], false);
    $message = ass_clean_content($welcome_email['content']);
    if (!$user->user_email || 'yes' != $welcome_email_enabled || empty($message)) {
        return;
    }
    if (get_option('ass-global-unsubscribe-link') == 'yes') {
        $global_link = bp_core_get_user_domain($user_id) . '?bpass-action=unsubscribe&access_key=' . md5("{$user_id}unsubscribe" . wp_salt());
        $message .= "\n\n---------------------\n";
        $message .= sprintf(__('To disable emails from all your groups at once click: %s', 'bp-ass'), $global_link);
    }
    $group_admin_ids = groups_get_group_admins($group_id);
    $group_admin = bp_core_get_core_userdata($group_admin_ids[0]->user_id);
    $headers = array("From: \"{$group_admin->display_name}\" <{$group_admin->user_email}>");
    wp_mail($user->user_email, $subject, $message, $headers);
}
开发者ID:pausaura,项目名称:agora_nodes,代码行数:30,代码来源:bp-activity-subscription-functions.php

示例14: bp_group_admin_memberlist

function bp_group_admin_memberlist($admin_list = false, $group = false)
{
    global $groups_template;
    if (!$group) {
        $group =& $groups_template->group;
    }
    $admins = groups_get_group_admins($group->id);
    ?>
	<?php 
    if ($admins) {
        ?>
		<ul id="admins-list" class="item-list<?php 
        if ($admin_list) {
            ?>
 single-line<?php 
        }
        ?>
">
		<?php 
        foreach ($admins as $admin) {
            ?>
			<?php 
            if ($admin_list) {
                ?>
			<li>
				<?php 
                echo bp_core_get_avatar($admin->user_id, 1, 30, 30);
                ?>
				<h5><?php 
                echo bp_core_get_userlink($admin->user_id);
                ?>
</h5>
			</li>
			<?php 
            } else {
                ?>
			<li>
				<?php 
                echo bp_core_get_avatar($admin->user_id, 1);
                ?>
				<h5><?php 
                echo bp_core_get_userlink($admin->user_id);
                ?>
</h5>
				<span class="activity"><?php 
                echo bp_core_get_last_activity(strtotime($admin->date_modified), __('joined %s ago', 'buddypress'));
                ?>
</span>
				
				<?php 
                if (function_exists('friends_install')) {
                    ?>
					<div class="action">
						<?php 
                    bp_add_friend_button($admin->user_id);
                    ?>
					</div>
				<?php 
                }
                ?>
			</li>		
			<?php 
            }
            ?>
		<?php 
        }
        ?>
		</ul>
	<?php 
    } else {
        ?>
		<div id="message" class="info">
			<p><?php 
        _e('This group has no administrators', 'buddypress');
        ?>
</p>
		</div>
	<?php 
    }
}
开发者ID:alvaropereyra,项目名称:shrekcms,代码行数:80,代码来源:bp-groups-templatetags.php

示例15: groups_send_membership_request

/**
 * Create a group membership request.
 *
 * @param int $requesting_user_id ID of the user requesting membership.
 * @param int $group_id           ID of the group.
 *
 * @return bool True on success, false on failure.
 */
function groups_send_membership_request($requesting_user_id, $group_id)
{
    // Prevent duplicate requests
    if (groups_check_for_membership_request($requesting_user_id, $group_id)) {
        return false;
    }
    // Check if the user is already a member or is banned
    if (groups_is_user_member($requesting_user_id, $group_id) || groups_is_user_banned($requesting_user_id, $group_id)) {
        return false;
    }
    // Check if the user is already invited - if so, simply accept invite
    if (groups_check_user_has_invite($requesting_user_id, $group_id)) {
        groups_accept_invite($requesting_user_id, $group_id);
        return true;
    }
    $requesting_user = new BP_Groups_Member();
    $requesting_user->group_id = $group_id;
    $requesting_user->user_id = $requesting_user_id;
    $requesting_user->inviter_id = 0;
    $requesting_user->is_admin = 0;
    $requesting_user->user_title = '';
    $requesting_user->date_modified = bp_core_current_time();
    $requesting_user->is_confirmed = 0;
    $requesting_user->comments = isset($_POST['group-request-membership-comments']) ? $_POST['group-request-membership-comments'] : '';
    if ($requesting_user->save()) {
        $admins = groups_get_group_admins($group_id);
        // Saved okay, now send the email notification
        for ($i = 0, $count = count($admins); $i < $count; ++$i) {
            groups_notification_new_membership_request($requesting_user_id, $admins[$i]->user_id, $group_id, $requesting_user->id);
        }
        /**
         * Fires after the creation of a new membership request.
         *
         * @since 1.0.0
         *
         * @param int   $requesting_user_id  ID of the user requesting membership.
         * @param array $admins              Array of group admins.
         * @param int   $group_id            ID of the group being requested to.
         * @param int   $requesting_user->id ID of the user requesting membership.
         */
        do_action('groups_membership_requested', $requesting_user_id, $admins, $group_id, $requesting_user->id);
        return true;
    }
    return false;
}
开发者ID:jasonmcalpin,项目名称:BuddyPress,代码行数:53,代码来源:bp-groups-functions.php


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