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

PHP BP_Groups_Member类代码示例

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

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



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

示例1: test_group_access_test_friends

 /**
  * @group invite_anyone_group_invite_access_test
  *
  * Using this as a proxy for testing every possible combination
  */
 public function test_group_access_test_friends()
 {
     $settings = bp_get_option('invite_anyone');
     bp_update_option('invite_anyone', array('group_invites_can_admin' => 'friends', 'group_invites_can_group_admin' => 'friends', 'group_invites_can_group_mod' => 'friends', 'group_invites_can_group_member' => 'friends'));
     unset($GLOBALS['iaoptions']);
     $g = $this->factory->group->create();
     $u1 = $this->factory->user->create(array('role' => 'administrator'));
     $this->add_user_to_group($u1, $g);
     $u2 = $this->factory->user->create();
     $this->add_user_to_group($u2, $g);
     $u3 = $this->factory->user->create();
     $this->add_user_to_group($u3, $g);
     $m3 = new BP_Groups_Member($u3, $g);
     $m3->promote('mod');
     $u4 = $this->factory->user->create();
     $this->add_user_to_group($u4, $g);
     $m4 = new BP_Groups_Member($u4, $g);
     $m4->promote('admin');
     $user = new WP_User($u1);
     $this->assertSame('friends', invite_anyone_group_invite_access_test($g, $u1));
     $this->assertSame('friends', invite_anyone_group_invite_access_test($g, $u2));
     $this->assertSame('friends', invite_anyone_group_invite_access_test($g, $u3));
     $this->assertSame('friends', invite_anyone_group_invite_access_test($g, $u4));
     bp_update_option('invite_anyone', $settings);
 }
开发者ID:socialray,项目名称:surfied-2-0,代码行数:30,代码来源:test-sample.php


示例2: groups_notification_group_updated

function groups_notification_group_updated($group_id)
{
    global $bp;
    $group = new BP_Groups_Group($group_id);
    $sitename = wp_specialchars_decode(get_blog_option(bp_get_root_blog_id(), 'blogname'), ENT_QUOTES);
    $subject = '[' . $sitename . '] ' . __('Group Details Updated', 'buddypress');
    $user_ids = BP_Groups_Member::get_group_member_ids($group->id);
    foreach ((array) $user_ids as $user_id) {
        if ('no' == bp_get_user_meta($user_id, 'notification_groups_group_updated', true)) {
            continue;
        }
        $ud = bp_core_get_core_userdata($user_id);
        // Set up and send the message
        $to = $ud->user_email;
        $group_link = site_url(bp_get_groups_root_slug() . '/' . $group->slug);
        $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/';
        $message = sprintf(__('Group details for the group "%1$s" were updated:

To view the group: %2$s

---------------------
', 'buddypress'), $group->name, $group_link);
        $message .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link);
        /* Send the message */
        $to = apply_filters('groups_notification_group_updated_to', $to);
        $subject = apply_filters_ref_array('groups_notification_group_updated_subject', array($subject, &$group));
        $message = apply_filters_ref_array('groups_notification_group_updated_message', array($message, &$group, $group_link, $settings_link));
        wp_mail($to, $subject, $message);
        unset($message, $to);
    }
    do_action('bp_groups_sent_updated_email', $user_ids, $subject, '', $group_id);
}
开发者ID:newington,项目名称:buddypress,代码行数:33,代码来源:bp-groups-notifications.php


示例3: groups_notification_group_updated

function groups_notification_group_updated($group_id)
{
    $group = groups_get_group(array('group_id' => $group_id));
    $subject = bp_get_email_subject(array('text' => __('Group Details Updated', 'buddypress')));
    $user_ids = BP_Groups_Member::get_group_member_ids($group->id);
    foreach ((array) $user_ids as $user_id) {
        if ('no' == bp_get_user_meta($user_id, 'notification_groups_group_updated', true)) {
            continue;
        }
        $ud = bp_core_get_core_userdata($user_id);
        // Set up and send the message
        $to = $ud->user_email;
        $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/';
        $message = sprintf(__('Group details for the group "%1$s" were updated:

To view the group: %2$s

---------------------
', 'buddypress'), $group->name, $group_link);
        $message .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link);
        /* Send the message */
        $to = apply_filters('groups_notification_group_updated_to', $to);
        $subject = apply_filters_ref_array('groups_notification_group_updated_subject', array($subject, &$group));
        $message = apply_filters_ref_array('groups_notification_group_updated_message', array($message, &$group, $group_link, $settings_link));
        wp_mail($to, $subject, $message);
        unset($message, $to);
    }
    do_action('bp_groups_sent_updated_email', $user_ids, $subject, '', $group_id);
}
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:31,代码来源:bp-groups-notifications.php


示例4: set_up_user_groups

 /**
  * Get a list of a user's groups, as well as those groups of which
  * the user is an admin or mod
  *
  * @since 1.2
  */
 protected function set_up_user_groups()
 {
     $groups = BP_Groups_Member::get_group_ids($this->user_id);
     $this->user_groups['groups'] = $groups['groups'];
     $admin_groups = BP_Groups_Member::get_is_admin_of($this->user_id);
     $mod_groups = BP_Groups_Member::get_is_mod_of($this->user_id);
     $this->user_groups['admin_mod_of'] = array_merge(wp_list_pluck($admin_groups['groups'], 'id'), wp_list_pluck($mod_groups['groups'], 'id'));
 }
开发者ID:adisonc,项目名称:MaineLearning,代码行数:14,代码来源:access-query.php


示例5: user_member_ids

 public function user_member_ids()
 {
     if (is_null($this->_user_members)) {
         if (self::owner_type_group == $this->owner_type) {
             $this->_user_members = (array) BP_Groups_Member::get_group_member_ids($this->owner_id);
         } else {
             $this->_user_members = array($this->owner_id);
         }
     }
     return $this->_user_members;
 }
开发者ID:jeffryevans,项目名称:biblefox-wp,代码行数:11,代码来源:plan.php


示例6: groups_notification_group_updated

/**
 * Notify all group members when a group is updated.
 *
 * @since BuddyPress (1.0.0)
 *
 * @param int $group_id ID of the group.
 * @param BP_Groups_Group $old_group Group before new details were saved.
 */
function groups_notification_group_updated($group_id = 0, $old_group = null)
{
    $group = groups_get_group(array('group_id' => $group_id));
    if ($old_group instanceof BP_Groups_Group) {
        $changed = array();
        if ($group->name !== $old_group->name) {
            $changed[] = sprintf(_x('* Name changed from "%s" to "%s"', 'Group update email text', 'buddypress'), esc_html($old_group->name), esc_html($group->name));
        }
        if ($group->description !== $old_group->description) {
            $changed[] = sprintf(_x('* Description changed from "%s" to "%s"', 'Group update email text', 'buddypress'), esc_html($old_group->description), esc_html($group->description));
        }
    }
    /**
     * Filters the bullet points listing updated items in the email notification after a group is updated.
     *
     * @since BuddyPress (2.2.0)
     *
     * @param array $changed Array of bullet points.
     */
    $changed = apply_filters('groups_notification_group_update_updated_items', $changed);
    $changed_text = '';
    if (!empty($changed)) {
        $changed_text = "\n\n" . implode("\n", $changed);
    }
    $subject = bp_get_email_subject(array('text' => __('Group Details Updated', 'buddypress')));
    $user_ids = BP_Groups_Member::get_group_member_ids($group->id);
    foreach ((array) $user_ids as $user_id) {
        // Continue if member opted out of receiving this email
        if ('no' === bp_get_user_meta($user_id, 'notification_groups_group_updated', true)) {
            continue;
        }
        $ud = bp_core_get_core_userdata($user_id);
        // Set up and send the message
        $to = $ud->user_email;
        $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/';
        $message = sprintf(__('Group details for the group "%1$s" were updated: %2$s

To view the group: %3$s

---------------------
', 'buddypress'), $group->name, $changed_text, $group_link);
        $message .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link);
        /* Send the message */
        $to = apply_filters('groups_notification_group_updated_to', $to);
        $subject = apply_filters_ref_array('groups_notification_group_updated_subject', array($subject, &$group));
        $message = apply_filters_ref_array('groups_notification_group_updated_message', array($message, &$group, $group_link, $settings_link));
        wp_mail($to, $subject, $message);
        unset($message, $to);
    }
    do_action('bp_groups_sent_updated_email', $user_ids, $subject, '', $group_id);
}
开发者ID:sdh100shaun,项目名称:pantheon,代码行数:61,代码来源:bp-groups-notifications.php


示例7: groups_notification_group_updated

/**
 * Notify all group members when a group is updated.
 *
 * @since 1.0.0
 *
 * @param int                  $group_id  ID of the group.
 * @param BP_Groups_Group|null $old_group Group before new details were saved.
 */
function groups_notification_group_updated($group_id = 0, $old_group = null)
{
    $group = groups_get_group($group_id);
    if ($old_group instanceof BP_Groups_Group) {
        $changed = array();
        if ($group->name !== $old_group->name) {
            $changed[] = sprintf(_x('* Name changed from "%s" to "%s".', 'Group update email text', 'buddypress'), esc_html($old_group->name), esc_html($group->name));
        }
        if ($group->description !== $old_group->description) {
            $changed[] = sprintf(_x('* Description changed from "%s" to "%s".', 'Group update email text', 'buddypress'), esc_html($old_group->description), esc_html($group->description));
        }
    }
    /**
     * Filters the bullet points listing updated items in the email notification after a group is updated.
     *
     * @since 2.2.0
     *
     * @param array $changed Array of bullet points.
     */
    $changed = apply_filters('groups_notification_group_update_updated_items', $changed);
    $changed_text = '';
    if (!empty($changed)) {
        $changed_text = implode("\n", $changed);
    }
    $user_ids = BP_Groups_Member::get_group_member_ids($group->id);
    foreach ((array) $user_ids as $user_id) {
        // Continue if member opted out of receiving this email.
        if ('no' === bp_get_user_meta($user_id, 'notification_groups_group_updated', true)) {
            continue;
        }
        $unsubscribe_args = array('user_id' => $user_id, 'notification_type' => 'groups-details-updated');
        $args = array('tokens' => array('changed_text' => $changed_text, 'group' => $group, 'group.id' => $group_id, 'group.url' => esc_url(bp_get_group_permalink($group)), 'group.name' => $group->name, 'unsubscribe' => esc_url(bp_email_get_unsubscribe_link($unsubscribe_args))));
        bp_send_email('groups-details-updated', (int) $user_id, $args);
    }
    /**
     * Fires after the notification is sent that a group has been updated.
     *
     * See https://buddypress.trac.wordpress.org/ticket/3644 for blank message parameter.
     *
     * @since 1.5.0
     * @since 2.5.0 $subject has been unset and is deprecated.
     *
     * @param array  $user_ids Array of user IDs to notify about the update.
     * @param string $subject  Deprecated in 2.5; now an empty string.
     * @param string $value    Empty string preventing PHP error.
     * @param int    $group_id ID of the group that was updated.
     */
    do_action('bp_groups_sent_updated_email', $user_ids, '', '', $group_id);
}
开发者ID:buddypress,项目名称:BuddyPress-build,代码行数:57,代码来源:bp-groups-notifications.php


示例8: 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;
}
开发者ID:netconstructor,项目名称:buddypress-activity-plus,代码行数:49,代码来源:bpfb_group_documents.php


示例9: groups_notification_group_updated

function groups_notification_group_updated( $group_id ) {
	global $bp;

	$group    = new BP_Groups_Group( $group_id );
	$sitename = wp_specialchars_decode( get_blog_option( BP_ROOT_BLOG, 'blogname' ), ENT_QUOTES );
	$subject  = '[' . $sitename . '] ' . __( 'Group Details Updated', 'buddypress' );

	$user_ids = BP_Groups_Member::get_group_member_ids( $group->id );
	foreach ( (array)$user_ids as $user_id ) {
		if ( 'no' == get_user_meta( $user_id, 'notification_groups_group_updated', true ) ) continue;

		$ud = bp_core_get_core_userdata( $user_id );

		// Set up and send the message
		$to = $ud->user_email;

		$group_link = site_url( $bp->groups->slug . '/' . $group->slug );
		$settings_link = bp_core_get_user_domain( $user_id ) .  BP_SETTINGS_SLUG . '/notifications/';

		$message = sprintf( __(
'Group details for the group "%s" were updated:

To view the group: %s

---------------------
', 'buddypress' ), $group->name, $group_link );

		$message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );

		/* Send the message */
		$to = apply_filters( 'groups_notification_group_updated_to', $to );
		$subject = apply_filters( 'groups_notification_group_updated_subject', $subject, &$group );
		$message = apply_filters( 'groups_notification_group_updated_message', $message, &$group, $group_link );

		wp_mail( $to, $subject, $message );

		unset( $message, $to );
	}
}
开发者ID:n-sane,项目名称:zaroka,代码行数:39,代码来源:bp-groups-notifications.php


示例10: bp_legacy_theme_ajax_invite_user

/**
 * Invites a friend to join a group via a POST request.
 *
 * @since BuddyPress (1.2)
 * @todo Audit return types
 */
function bp_legacy_theme_ajax_invite_user()
{
    // Bail if not a POST action
    if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
        return;
    }
    check_ajax_referer('groups_invite_uninvite_user');
    if (!$_POST['friend_id'] || !$_POST['friend_action'] || !$_POST['group_id']) {
        return;
    }
    if (!bp_groups_user_can_send_invites($_POST['group_id'])) {
        return;
    }
    if (!friends_check_friendship(bp_loggedin_user_id(), $_POST['friend_id'])) {
        return;
    }
    $group_id = (int) $_POST['group_id'];
    $friend_id = (int) $_POST['friend_id'];
    if ('invite' == $_POST['friend_action']) {
        $group = groups_get_group($group_id);
        // Users who have previously requested membership do not need
        // another invitation created for them
        if (BP_Groups_Member::check_for_membership_request($friend_id, $group_id)) {
            $user_status = 'is_pending';
            // Create the user invitation
        } elseif (groups_invite_user(array('user_id' => $friend_id, 'group_id' => $group_id))) {
            $user_status = 'is_invited';
            // Miscellaneous failure
        } else {
            return;
        }
        $user = new BP_Core_User($friend_id);
        $uninvite_url = bp_is_current_action('create') ? bp_get_groups_directory_permalink() . 'create/step/group-invites/?user_id=' . $friend_id : bp_get_group_permalink($group) . 'send-invites/remove/' . $friend_id;
        echo '<li id="uid-' . esc_attr($user->id) . '">';
        echo $user->avatar_thumb;
        echo '<h4>' . $user->user_link . '</h4>';
        echo '<span class="activity">' . esc_attr($user->last_active) . '</span>';
        echo '<div class="action">
				<a class="button remove" href="' . wp_nonce_url($uninvite_url, 'groups_invite_uninvite_user') . '" id="uid-' . esc_attr($user->id) . '">' . __('Remove Invite', 'buddypress') . '</a>
			  </div>';
        if ('is_pending' == $user_status) {
            echo '<p class="description">' . sprintf(__('%s has previously requested to join this group. Sending an invitation will automatically add the member to the group.', 'buddypress'), $user->user_link) . '</p>';
        }
        echo '</li>';
        exit;
    } elseif ('uninvite' == $_POST['friend_action']) {
        // Users who have previously requested membership should not
        // have their requests deleted on the "uninvite" action
        if (BP_Groups_Member::check_for_membership_request($friend_id, $group_id)) {
            return;
        }
        // Remove the unsent invitation
        if (!groups_uninvite_user($friend_id, $group_id)) {
            return;
        }
        exit;
    } else {
        return;
    }
}
开发者ID:kosir,项目名称:thatcamp-org,代码行数:66,代码来源:buddypress-functions.php


示例11: bp_em_group_events_build_sql_conditions

function bp_em_group_events_build_sql_conditions($conditions, $args)
{
    if (!empty($args['group']) && is_numeric($args['group'])) {
        $conditions['group'] = "( `group_id`={$args['group']} )";
    } elseif (!empty($args['group']) && $args['group'] == 'my') {
        $groups = groups_get_user_groups(get_current_user_id());
        if (count($groups) > 0) {
            $conditions['group'] = "( `group_id` IN (" . implode(',', $groups['groups']) . ") )";
        }
    }
    //deal with private groups and events
    if (is_user_logged_in()) {
        global $wpdb;
        //find out what private groups they belong to, and don't show private group events not in their memberships
        $group_ids = BP_Groups_Member::get_group_ids(get_current_user_id());
        if ($group_ids['total'] > 0) {
            $conditions['group_privacy'] = "(`event_private`=0 OR (`event_private`=1 AND (`group_id` IS NULL OR `group_id` = 0)) OR (`event_private`=1 AND `group_id` IN (" . implode(',', $group_ids['groups']) . ")))";
        } else {
            //find out what private groups they belong to, and don't show private group events not in their memberships
            $conditions['group_privacy'] = "(`event_private`=0 OR (`event_private`=1 AND (`group_id` IS NULL OR `group_id` = 0)))";
        }
    }
    return $conditions;
}
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:24,代码来源:bp-em-groups.php


示例12: test_user_can_dissociate_from_group_within_group_mod

 /**
  * @group map_meta_cap
  * @group dissociate_from_group
  */
 public function test_user_can_dissociate_from_group_within_group_mod()
 {
     $g = $this->factory->group->create();
     $old_current_user = get_current_user_id();
     $u1 = $this->factory->user->create();
     $gm1 = new BP_Groups_Member($u1, $g);
     $gm1->promote('admin');
     $this->set_current_user($u1);
     $this->go_to(bp_get_group_permalink(groups_get_group(array('group_id' => $g))));
     // $this->go_to( bp_docs_get_doc_link( $post_id ) );
     $this->assertTrue(current_user_can('bp_docs_dissociate_from_group'));
 }
开发者ID:Apatrid,项目名称:buddypress-docs,代码行数:16,代码来源:test-permissions.php


示例13: groups_remove_data_for_user

/**
 * Delete all group membership information for the specified user.
 *
 * @since 1.0.0
 *
 * @param int $user_id ID of the user.
 */
function groups_remove_data_for_user($user_id)
{
    BP_Groups_Member::delete_all_for_user($user_id);
    /**
     * Fires after the deletion of all data for a user.
     *
     * @since 1.1.0
     *
     * @param int $user_id ID of the user whose data is being deleted.
     */
    do_action('groups_remove_data_for_user', $user_id);
}
开发者ID:jasonmcalpin,项目名称:BuddyPress,代码行数:19,代码来源:bp-groups-functions.php


示例14: groups_remove_data_for_user

function groups_remove_data_for_user($user_id)
{
    global $bp;
    BP_Groups_Member::delete_all_for_user($user_id);
    bp_core_delete_notifications_from_user($user_id, $bp->groups->id, 'new_membership_request');
    do_action('groups_remove_data_for_user', $user_id);
}
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:7,代码来源:bp-groups-functions.php


示例15: bp_admin_repair_group_count

/**
 * Recalculate group counts for each user.
 *
 * @since BuddyPress (2.0.0)
 *
 * @return array
 */
function bp_admin_repair_group_count()
{
    global $wpdb;
    if (!bp_is_active('groups')) {
        return;
    }
    $statement = __('Counting the number of groups for each user&hellip; %s', 'buddypress');
    $result = __('Failed!', 'buddypress');
    $sql_delete = "DELETE FROM {$wpdb->usermeta} WHERE meta_key IN ( 'total_group_count' );";
    if (is_wp_error($wpdb->query($sql_delete))) {
        return array(1, sprintf($statement, $result));
    }
    $bp = buddypress();
    // Walk through all users on the site
    $total_users = $wpdb->get_row("SELECT count(ID) as c FROM {$wpdb->users}")->c;
    if ($total_users > 0) {
        $per_query = 500;
        $offset = 0;
        while ($offset < $total_users) {
            // But only bother to update counts for users that have groups
            $users = $wpdb->get_col($wpdb->prepare("SELECT user_id FROM {$bp->groups->table_name_members} WHERE is_confirmed = 1 AND is_banned = 0 AND user_id > %d AND user_id <= %d", $offset, $offset + $per_query));
            foreach ($users as $user) {
                BP_Groups_Member::refresh_total_group_count_for_user($user);
            }
            $offset += $per_query;
        }
    } else {
        return array(2, sprintf($statement, $result));
    }
    return array(0, sprintf($statement, __('Complete!', 'buddypress')));
}
开发者ID:un1coin,项目名称:ovn-space,代码行数:38,代码来源:bp-core-admin-tools.php


示例16: bp_group_documents_email_notification

/**
 * bp_group_documents_email_notificiation()
 *
 * This function will send email notifications to users on successful document upload.
 * For each group memeber, it will check to see the users notification settings first, 
 * if the user has the notifications turned on, they will be sent a formatted email notification. 
 */
function bp_group_documents_email_notification($document)
{
    global $bp;
    $user_name = bp_core_get_userlink($bp->loggedin_user->id, true);
    $user_profile_link = bp_core_get_userlink($bp->loggedin_user->id, false, true);
    $group_name = $bp->groups->current_group->name;
    $group_link = bp_get_group_permalink($bp->groups->current_group);
    $document_name = $document->name;
    $document_link = $document->get_url();
    $subject = '[' . get_blog_option(1, 'blogname') . '] ' . sprintf(__('A document was uploaded to %s', 'bp-group-documents'), $bp->groups->current_group->name);
    //these will be all the emails getting the update
    //'user_id' => 'user_email
    $emails = array();
    //first get the admin & moderator emails
    if (count($bp->groups->current_group->admins)) {
        foreach ($bp->groups->current_group->admins as $user) {
            if ('no' == get_user_meta($user->user_id, 'notification_group_documents_upload_mod')) {
                continue;
            }
            $emails[$user->user_id] = $user->user_email;
        }
    }
    if (count($bp->groups->current_group->mods)) {
        foreach ($bp->groups->current_group->mods as $user) {
            if ('no' == get_user_meta($user->user_id, 'notification_group_documents_upload_mod')) {
                continue;
            }
            if (!in_array($user->user_email, $emails)) {
                $emails[$user->user_id] = $user->user_email;
            }
        }
    }
    //now get all member emails, checking to make sure not to send any emails twice
    $user_ids = BP_Groups_Member::get_group_member_ids($bp->groups->current_group->id);
    foreach ((array) $user_ids as $user_id) {
        if ('no' == get_user_meta($user_id, 'notification_group_documents_upload_member')) {
            continue;
        }
        $ud = bp_core_get_core_userdata($user_id);
        if (!in_array($ud->user_email, $emails)) {
            $emails[$user_id] = $ud->user_email;
        }
    }
    foreach ($emails as $current_id => $current_email) {
        $message = sprintf(__('%s uploaded a new file: %s to the group: %s.

To see %s\'s profile: %s

To see the group %s\'s homepage: %s

To download the new document directly: %s

------------------------
', 'bp-group-documents'), $user_name, $document_name, $group_name, $user_name, $user_profile_link, $group_name, $group_link, $document_link);
        $settings_link = bp_core_get_user_domain($current_id) . $bp->settings->slug . '/notifications/';
        $message .= sprintf(__('To disable these notifications please log in and go to: %s', 'bp-group-documents'), $settings_link);
        // Set up and send the message
        $to = $current_email;
        wp_mail($to, $subject, $message);
        unset($to, $message);
    }
    //end foreach
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:70,代码来源:notifications.php


示例17: gradebook_screen

 /**
  * gradebook_screen( $vars )
  *
  * Hooks into screen_handler
  * Adds a UI to assignments for gradebook management.
  *
  * @param Array $vars a set of variables received for this screen template
  * @return Array $vars a set of variable passed to this screen template
  */
 function gradebook_screen($vars)
 {
     global $bp;
     $nonce_name = 'gradebook_nonce';
     $nonce_import_name = 'gradebook_import_nonce';
     $nonce_clear_name = 'gradebook_clear_nonce';
     if (!$this->has_gradebook_caps($bp->loggedin_user->id) && !is_super_admin()) {
         $vars['die'] = __('BuddyPress Courseware Error while forbidden user tried to manage gradebook.', 'bpsp');
         return $vars;
     }
     $students = BP_Groups_Member::get_all_for_group($bp->groups->current_group->id);
     if (isset($_POST['_nxtnonce'])) {
         $is_nonce = nxt_verify_nonce($_POST['_nxtnonce'], $nonce_name);
     }
     if (isset($_POST['_nxtnonce']) && true != $is_nonce) {
         $vars['die'] = __('BuddyPress Courseware Nonce Error while updating gradebook.', 'bpsp');
         return $vars;
     }
     $gradebook_id = $this->has_gradebook($this->current_assignment);
     if (!$gradebook_id) {
         $vars['die'] = __('BuddyPress Courseware Error while creating gradebook.', 'bpsp');
         return $vars;
     }
     if (!empty($_POST['grade'])) {
         foreach ($_POST['grade'] as $grade) {
             if (!empty($grade) && !empty($grade['uid']) && !empty($grade['value'])) {
                 # If grade was added or updated!
                 $status = $this->save_grade($gradebook_id, $grade);
                 if ($status !== null) {
                     $data = array('grade' => $grade, 'teacher' => $bp->loggedin_user->userdata, 'assignment' => $this->current_assignment);
                     if ($status == true) {
                         do_action('courseware_grade_added', $data);
                     } else {
                         do_action('courseware_grade_updated', $data);
                     }
                 }
             }
         }
         $vars['message'] = __('Gradebook saved.', 'bpsp');
     }
     $vars['name'] = 'gradebook';
     $vars['students'] = $students['members'];
     if (empty($vars['grades'])) {
         $vars['grades'] = $this->load_grades($gradebook_id, true);
     }
     $vars['bpsp_gradebook_format'] = get_option('bpsp_gradebook_format');
     $vars['assignment'] = BPSP_Assignments::is_assignment($this->current_assignment);
     $vars['gradebook_permalink'] = $vars['assignment_permalink'] . '/gradebook';
     $vars['clear_gradebook_permalink'] = add_query_arg('_nxtnonce', nxt_create_nonce($nonce_clear_name), $vars['gradebook_permalink'] . '/clear');
     $vars['import_gradebook_nonce'] = nxt_nonce_field($nonce_import_name, '_nxtnonce', true, false);
     $vars['nonce'] = nxt_nonce_field($nonce_name, '_nxtnonce', true, false);
     return $vars;
 }
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:62,代码来源:gradebook.class.php


示例18: populate_extras

 /**
  * Populates extra fields such as group and friendship counts.
  */
 public function populate_extras()
 {
     if (bp_is_active('friends')) {
         $this->total_friends = BP_Friends_Friendship::total_friend_count($this->id);
     }
     if (bp_is_active('groups')) {
         $this->total_groups = BP_Groups_Member::total_group_count($this->id);
         $this->total_groups = sprintf(_n('%d group', '%d groups', $this->total_groups, 'buddypress'), $this->total_groups);
     }
 }
开发者ID:kosir,项目名称:thatcamp-org,代码行数:13,代码来源:class-bp-core-user.php


示例19: filter_user_groups

 /**
  * Get a list of a user's groups, filtered by a search string.
  *
  * @param string   $filter  Search term. Matches against 'name' and
  *                          'description' fields.
  * @param int      $user_id ID of the user whose groups are being searched.
  *                          Default: the displayed user.
  * @param mixed    $order   Not used.
  * @param int|null $limit   Optional. The max number of results to return.
  *                          Default: null (no limit).
  * @param int|null $page    Optional. The page offset of results to return.
  *                          Default: null (no limit).
  * @return false|array {
  *     @type array $groups Array of matched and paginated group objects.
  *     @type int   $total  Total count of groups matching the query.
  * }
  */
 public static function filter_user_groups($filter, $user_id = 0, $order = false, $limit = null, $page = null)
 {
     global $wpdb;
     if (empty($user_id)) {
         $user_id = bp_displayed_user_id();
     }
     $search_terms_like = bp_esc_like($filter) . '%';
     $pag_sql = $order_sql = $hidden_sql = '';
     if (!empty($limit) && !empty($page)) {
         $pag_sql = $wpdb->prepare(" LIMIT %d, %d", intval(($page - 1) * $limit), intval($limit));
     }
     // Get all the group ids for the current user's groups.
     $gids = BP_Groups_Member::get_group_ids($user_id);
     if (empty($gids['groups'])) {
         return false;
     }
     $bp = buddypress();
     $gids = esc_sql(implode(',', wp_parse_id_list($gids['groups'])));
     $paged_groups = $wpdb->get_results($wpdb->prepare("SELECT id as group_id FROM {$bp->groups->table_name} WHERE ( name LIKE %s OR description LIKE %s ) AND id IN ({$gids}) {$pag_sql}", $search_terms_like, $search_terms_like));
     $total_groups = $wpdb->get_var($wpdb->prepare("SELECT COUNT(id) FROM {$bp->groups->table_name} WHERE ( name LIKE %s OR description LIKE %s ) AND id IN ({$gids})", $search_terms_like, $search_terms_like));
     return array('groups' => $paged_groups, 'total' => $total_groups);
 }
开发者ID:swissspidy,项目名称:BuddyPress,代码行数:39,代码来源:class-bp-groups-group.php


示例20: __construct

 function __construct($group_id, $per_page, $max, $exclude_admins_mods, $exclude_banned, $exclude)
 {
     global $bp;
     $this->pag_page = isset($_REQUEST['mlpage']) ? intval($_REQUEST['mlpage']) : 1;
     $this->pag_num = isset($_REQUEST['num']) ? intval($_REQUEST['num']) : $per_page;
     $this->members = BP_Groups_Member::get_all_for_group($group_id, $this->pag_num, $this->pag_page, $exclude_admins_mods, $exclude_banned, $exclude);
     if (!$max || $max >= (int) $this->members['count']) {
         $this->total_member_count = (int) $this->members['count'];
     } else {
         $this->total_member_count = (int) $max;
     }
     $this->members = $this->members['members'];
     if ($max) {
         if ($max >= count($this->members)) {
             $this->member_count = count($this->members);
         } else {
             $this->member_count = (int) $max;
         }
     } else {
         $this->member_count = count($this->members);
     }
     $this->pag_links = paginate_links(array('base' => add_query_arg('mlpage', '%#%'), 'format' => '', 'total' => ceil($this->total_member_count / $this->pag_num), 'current' => $this->pag_page, 'prev_text' => '&larr;', 'next_text' => '&rarr;', 'mid_size' => 1));
 }
开发者ID:newington,项目名称:buddypress,代码行数:23,代码来源:bp-groups-template.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP BP_Messages_Thread类代码示例发布时间:2022-05-23
下一篇:
PHP BP_Groups_Group类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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