本文整理汇总了PHP中bp_get_group_id函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_get_group_id函数的具体用法?PHP bp_get_group_id怎么用?PHP bp_get_group_id使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_get_group_id函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getGroups
function getGroups($force = false)
{
//need a user id for this
if (empty($this->ID)) {
return false;
}
//check cache
if (isset($this->groups) && !$force) {
return $this->groups;
}
//remove the bp-site-groups filter
remove_filter('groups_get_groups', 'bpsg_groups_get_groups');
//get corresponding class ids for buddypress groups this user is a member of
$groups = array();
if (bp_has_groups(array('user_id' => $this->ID))) {
while (bp_groups()) {
bp_the_group();
$group_id = bp_get_group_id();
$groups[] = groups_get_group(array('group_id' => $group_id));
}
}
//add the bp-site-groups filter back
add_filter('groups_get_groups', 'bpsg_groups_get_groups');
$this->groups = $groups;
return $this->groups;
}
示例2: bp_checkins_group_can_checkin
function bp_checkins_group_can_checkin()
{
if (groups_get_groupmeta(bp_get_group_id(), 'checkins_ok')) {
return true;
} else {
return false;
}
}
示例3: mpp_group_set_gallery_state
/**
* Set Gallery as enabled/disabled
*
* @param type $group_id
* @param type $enabled
* @return boolean
*/
function mpp_group_set_gallery_state($group_id = false, $enabled = 'yes')
{
if (!$group_id) {
$group_id = bp_get_group_id(groups_get_current_group());
}
if (!$group_id) {
return false;
}
//default settings from gloabl
$is_enabled = groups_update_groupmeta($group_id, '_mpp_is_enabled', $enabled);
return $is_enabled;
}
示例4: get_group_courseware
function get_group_courseware($group_id = null)
{
global $bp;
if (!$group_id) {
$group_id = $bp->groups->current_group->id;
}
$group_data['bibliography'] = array();
$group_data['assignments_count'] = 0;
$group_data['responses_count'] = 0;
$group_data['own_responses_count'] = 0;
$group_data['assignment_topics_count'] = 0;
$group_data['user_grades'] = array();
$group_data['user_bookmark'] = null;
$group_data['courses'] = (array) BPSP_Courses::has_courses($group_id);
$group_data['lectures'] = (array) BPSP_Lectures::has_lectures($group_id);
$group_data['assignments'] = (array) BPSP_Assignments::has_assignments($group_id);
$group_data['schedules'] = BPSP_Schedules::has_schedules($group_id);
$group_data['lectures'] = BPSP_Lectures::has_lectures($group_id);
$posts = array_merge($group_data['courses'], $group_data['assignments']);
if ($posts) {
foreach ($posts as &$post) {
// Get group bibs
$group_data['bibliography'] = array_merge($group_data['bibliography'], BPSP_Bibliography::get_bibs($post->ID));
// Get group responses
if ($post->post_type == 'assignment') {
// Forum threads
if (get_post_meta($post->ID, 'topic_link', true) != '') {
$group_data['assignment_topics_count'] += 1;
}
// Responses
$post->responses = get_children(array('post_parent' => $post->ID, 'post_type' => 'response'));
foreach ($post->responses as $pr) {
if ($pr->post_author == get_current_user_id()) {
$group_data['own_responses_count']++;
}
$group_data['responses_count']++;
}
// Gradebook
$group_data['user_grades'][] = BPSP_Gradebook::load_grade_by_user_id($post->ID, $bp->loggedin_user->id);
}
}
}
$bookmark = get_user_meta(get_current_user_id(), 'bookmark_' . bp_get_group_id(), true);
if ($bookmark) {
$group_data['user_bookmark'] = BPSP_Lectures::is_lecture($bookmark);
}
$group_data['assignments_count'] = count($group_data['assignments']);
$group_data['bibliography_count'] = count($group_data['bibliography']);
return $group_data;
}
示例5: klein_get_cover_photo_src
/**
* Returns the cover photo url
* @return string the cover photo url
*/
function klein_get_cover_photo_src()
{
if (!function_exists('bcp_get_cover_photo')) {
return;
}
$item_id = bp_displayed_user_id();
$item_type = 'user';
if (bp_is_group()) {
$item_id = bp_get_group_id();
$item_type = 'group';
}
$args = array('type' => $item_type, 'object_id' => $item_id);
$cover_photo_url = esc_url(bcp_get_cover_photo($args));
return $cover_photo_url;
}
示例6: thatcamp_camp_summary
function thatcamp_camp_summary()
{
$summary = 'A new THATCamp has been registered at <a href="http://thatcamp.org">thatcamp.org</a>:<br /><br />';
$summary .= 'Name: ' . bp_get_group_name() . '<br />';
$permalink = thatcamp_get_camp_permalink();
$summary .= 'URL: <a href="' . thatcamp_get_camp_permalink() . '">' . thatcamp_get_camp_permalink() . '</a><br />';
$location = thatcamp_get_location(bp_get_group_id());
if ($location) {
$summary .= 'Location: ' . $location . '<br />';
}
$date = thatcamp_get_camp_date_pretty(bp_get_group_id());
if ($date) {
$summary .= 'Date: ' . $date . '<br />';
}
echo $summary;
}
示例7: get
function get()
{
if (false === $this->group_id) {
global $groups_template;
if (!empty($groups_template->group)) {
$group_id = bp_get_group_id();
if (!empty($group_id)) {
$this->group_id = $group_id;
}
} else {
if (isset($this->media) && isset($this->media->context_id)) {
$this->group_id = $this->media->context_id;
} else {
return false;
}
}
}
$this->featured = groups_get_groupmeta($this->group_id, 'rtmedia_group_featured_media', true);
return $this->featured;
}
示例8: manage_course_settings
function manage_course_settings($group_id = NULL)
{
wp_enqueue_script('jquery-ui-datepicker');
$args = array('post_type' => 'course', 'post_per_page' => -1);
global $bp;
$group_id = bp_get_group_id();
?>
<h3><?php
_e('Connect with Course');
?>
</h3>
<?php
$course_id = groups_get_groupmeta($group_id, 'course_id');
$the_query = get_posts($args);
echo '<select name="group_course" class="chosen"><option value="">' . __('Select a Course', 'vibe') . '</option>';
foreach ($the_query as $result) {
echo '<option value="' . $result->ID . '" ' . selected($result->ID, $course_id) . '>' . $result->post_title . '</option>';
}
echo '</select>';
?>
<hr />
<h4><?php
_e('Start Date/Time');
?>
</h4>
<?php
$start_date = groups_get_groupmeta($group_id, 'start_date');
echo '<input type="text" name="start_date" class="date_box" value="' . $start_date . '" />';
?>
<script>
jQuery(document).ready(function(){
jQuery('.date_box').datepicker({
dateFormat: 'yy-mm-dd'
});
});
</script>
<hr />
<?php
}
示例9: cfbgr_group_single_item_restriction_message
/**
* Output the restriction rules on the Single Group pages
*
* @since 1.0.2
*/
function cfbgr_group_single_item_restriction_message()
{
// Get group restriction data.
$restriction_type = groups_get_groupmeta(bp_get_group_id(), 'cf-buddypress-group-restrictions');
// Exit early if the group isn't restricted.
if (empty($restriction_type)) {
return;
}
?>
<div class="group-restriction-notice single-group-restriction-notice">
<?php
printf(__('This group is open to %s members only.', 'buddypress-group-restrictions'), $restriction_type);
?>
</div>
<?php
}
示例10: bpgr_user_previous_review_args
function bpgr_user_previous_review_args()
{
$args = array('user_id' => bp_loggedin_user_id(), 'type' => 'review', 'item_id' => bp_get_group_id(), 'max' => 1);
return apply_filters('bpgr_user_previous_review_args', $args);
}
示例11: invite_anyone_screen_one_content
//.........这里部分代码省略.........
?>
<label for="invite-anyone-custom-message"><?php
_e('Message:', 'invite-anyone');
?>
</label>
<textarea name="invite_anyone_custom_message" id="invite-anyone-custom-message" disabled="disabled"><?php
echo invite_anyone_invitation_message($returned_message);
?>
</textarea>
<input type="hidden" name="invite_anyone_custom_message" value="<?php
echo invite_anyone_invitation_message();
?>
" />
<?php
}
?>
</li>
<?php
if (invite_anyone_are_groups_running()) {
?>
<?php
if ($iaoptions['can_send_group_invites_email'] == 'yes' && bp_has_groups("per_page=10000&type=alphabetical&user_id=" . bp_loggedin_user_id())) {
?>
<li>
<p><?php
_e('(optional) Select some groups. Invitees will receive invitations to these groups when they join the site.', 'invite-anyone');
?>
</p>
<ul id="invite-anyone-group-list">
<?php
while (bp_groups()) {
bp_the_group();
?>
<?php
// Enforce per-group invitation settings
if (!bp_groups_user_can_send_invites(bp_get_group_id()) || 'anyone' !== invite_anyone_group_invite_access_test(bp_get_group_id())) {
continue;
}
?>
<li>
<input type="checkbox" name="invite_anyone_groups[]" id="invite_anyone_groups-<?php
bp_group_id();
?>
" value="<?php
bp_group_id();
?>
" <?php
if ($from_group == bp_get_group_id() || array_search(bp_get_group_id(), $returned_groups)) {
?>
checked<?php
}
?>
/>
<label for="invite_anyone_groups-<?php
bp_group_id();
?>
" class="invite-anyone-group-name"><?php
bp_group_avatar_mini();
?>
<span><?php
bp_group_name();
?>
</span></label>
</li>
<?php
}
?>
</ul>
</li>
<?php
}
?>
<?php
}
?>
<?php
do_action('invite_anyone_addl_fields');
?>
</ol>
<div class="submit">
<input type="submit" name="invite-anyone-submit" id="invite-anyone-submit" value="<?php
_e('Send Invites', 'buddypress');
?>
" />
</div>
</form>
<?php
}
示例12: _e
<div class="activity single-group">
<h3><?php
_e('Blog Activity', 'groupblog');
?>
</h3>
<?php
if (bp_has_activities('per_page=5&object=blogs&primary_id=' . get_groupblog_blog_id(bp_get_group_id()))) {
?>
<div class="pagination">
<div class="pag-count"><?php
bp_activity_pagination_count();
?>
</div>
<div class="pagination-links"><?php
bp_activity_pagination_links();
?>
</div>
</div>
<?php
if (empty($_POST['page'])) {
?>
<ul id="activity-stream" class="activity-list item-list">
<?php
}
?>
<?php
示例13: sub_nav
public function sub_nav()
{
global $rtmedia, $rtmedia_query;
if (function_exists('bp_is_group') && bp_is_group()) {
if (isset($rtmedia->options['buddypress_enableOnGroup']) && $rtmedia->options['buddypress_enableOnGroup'] == '0') {
return;
}
global $bp;
$counts = $this->actual_counts($bp->groups->current_group->id, "group");
} else {
if (class_exists('BuddyPress') && isset($rtmedia->options['buddypress_enableOnProfile']) && $rtmedia->options['buddypress_enableOnProfile'] == '0') {
return;
}
$counts = $this->actual_counts();
}
$default = false;
if (function_exists('bp_is_group') && bp_is_group()) {
$link = get_rtmedia_group_link(bp_get_group_id());
$model = new RTMediaModel();
$other_count = $model->get_other_album_count(bp_get_group_id(), "group");
} else {
if (function_exists('bp_displayed_user_id') && bp_displayed_user_id()) {
$link = get_rtmedia_user_link(bp_displayed_user_id());
} elseif (get_query_var('author')) {
$link = get_rtmedia_user_link(get_query_var('author'));
}
$model = new RTMediaModel();
$other_count = $model->get_other_album_count(bp_displayed_user_id(), "profile");
}
$all = '';
if (!isset($rtmedia_query->action_query->media_type)) {
$all = 'class="current selected"';
}
echo apply_filters('rtmedia_sub_nav_all', '<li id="rtmedia-nav-item-all-li" ' . $all . '><a id="rtmedia-nav-item-all" href="' . trailingslashit($link) . RTMEDIA_MEDIA_SLUG . '/">' . __("All", "rtmedia") . '<span>' . (isset($counts['total']['all']) ? $counts['total']['all'] : 0) . '</span>' . '</a></li>');
if (!isset($rtmedia_query->action_query->action) || empty($rtmedia_query->action_query->action)) {
$default = true;
}
//print_r($rtmedia_query->action_query);
$global_album = '';
$albums = '';
if (isset($rtmedia_query->action_query->media_type) && $rtmedia_query->action_query->media_type == 'album') {
$albums = 'class="current selected"';
}
//$other_count = 0;
if (is_rtmedia_album_enable()) {
if (!isset($counts['total']["album"])) {
$counts['total']["album"] = 0;
}
$counts['total']["album"] = $counts['total']["album"] + $other_count;
$album_label = __(defined('RTMEDIA_ALBUM_PLURAL_LABEL') ? constant('RTMEDIA_ALBUM_PLURAL_LABEL') : 'Albums', 'rtmedia');
echo apply_filters('rtmedia_sub_nav_albums', '<li id="rtmedia-nav-item-albums-li" ' . $albums . '><a id="rtmedia-nav-item-albums" href="' . trailingslashit($link) . RTMEDIA_MEDIA_SLUG . '/album/">' . $album_label . '<span>' . (isset($counts['total']["album"]) ? $counts['total']["album"] : 0) . '</span>' . '</a></li>');
}
foreach ($rtmedia->allowed_types as $type) {
//print_r($type);
if (!isset($rtmedia->options['allowedTypes_' . $type['name'] . '_enabled'])) {
continue;
}
if (!$rtmedia->options['allowedTypes_' . $type['name'] . '_enabled']) {
continue;
}
$selected = '';
if (isset($rtmedia_query->action_query->media_type) && $type['name'] == $rtmedia_query->action_query->media_type) {
$selected = ' class="current selected"';
} else {
$selected = '';
}
$context = isset($rtmedia_query->query['context']) ? $rtmedia_query->query['context'] : 'default';
$context_id = isset($rtmedia_query->query['context_id']) ? $rtmedia_query->query['context_id'] : 0;
$name = strtoupper($type['name']);
$is_group = false;
$profile = self::profile_id();
if (!$profile) {
$profile = self::group_id();
$is_group = true;
}
if (!$is_group) {
$profile_link = trailingslashit(get_rtmedia_user_link($profile));
} else {
$profile_link = trailingslashit(get_rtmedia_group_link($profile));
}
$type_label = __(defined('RTMEDIA_' . $name . '_PLURAL_LABEL') ? constant('RTMEDIA_' . $name . '_PLURAL_LABEL') : $type['plural_label'], 'rtmedia');
echo apply_filters('rtmedia_sub_nav_' . $type['name'], '<li id="rtmedia-nav-item-' . $type['name'] . '-' . $context . '-' . $context_id . '-li" ' . $selected . '><a id="rtmedia-nav-item-' . $type['name'] . '" href="' . $profile_link . RTMEDIA_MEDIA_SLUG . '/' . constant('RTMEDIA_' . $name . '_SLUG') . '/' . '">' . $type_label . '<span>' . (isset($counts['total'][$type['name']]) ? $counts['total'][$type['name']] : 0) . '</span>' . '</a></li>', $type['name']);
}
do_action("add_extra_sub_nav");
}
示例14: run_stat_hub_csv
/**
* Create the hub overview CSV when requested.
*
* @since 1.0.0
*/
public function run_stat_hub_csv()
{
global $wpdb;
$bp = buddypress();
// Output headers so that the file is downloaded rather than displayed.
header('Content-Type: text/csv; charset=utf-8');
header('Content-Disposition: attachment; filename=cc-hubs-overview.csv');
// Create a file pointer connected to the output stream.
$output = fopen('php://output', 'w');
// Write a header row.
$row = array('Hub ID', 'Name', 'Slug', 'Status', 'Date Created', 'Last Activity', 'Parent Hub ID', 'Total Members', 'Creator ID', 'Creator Email', 'Forum', 'BP Docs', 'CC Hub Home Page', 'CC Hub Pages', 'CC Hub Narratives', 'Custom Plugins');
fputcsv($output, $row);
// Groups Loop
if (bp_has_groups(array('order' => 'ASC', 'orderby' => 'date_created', 'page' => null, 'per_page' => null, 'max' => false, 'show_hidden' => true, 'user_id' => null, 'meta_query' => false, 'include' => false, 'exclude' => false, 'populate_extras' => false, 'update_meta_cache' => false))) {
while (bp_groups()) {
bp_the_group();
$group_id = bp_get_group_id();
$group_object = groups_get_group(array('group_id' => (int) $group_id, 'populate_extras' => true));
// Hub ID
$row = array($group_id);
// Name
$row[] = bp_get_group_name();
// Slug
$row[] = bp_get_group_slug();
// Status
$row[] = bp_get_group_status();
// Date Created
$row[] = $group_object->date_created;
// Date of last activity
$row[] = $group_object->last_activity;
// Parent Hub ID
$row[] = $wpdb->get_var($wpdb->prepare("SELECT g.parent_id FROM {$bp->groups->table_name} g WHERE g.id = %d", $group_id));
// Total Members
$row[] = groups_get_total_member_count($group_id);
// Creator ID
$creator_id = $group_object->creator_id;
$row[] = $creator_id;
// Creator Email
$creator = get_user_by('id', $creator_id);
$row[] = $creator->user_email;
// Forum
$row[] = $group_object->enable_forum;
// BP Docs
if (function_exists('bp_docs_is_docs_enabled_for_group')) {
$row[] = bp_docs_is_docs_enabled_for_group($group_id);
} else {
$row[] = '';
}
// CC Hub Home Page
if (function_exists('cc_get_group_home_page_post') && cc_get_group_home_page_post($group_id)->have_posts()) {
$row[] = 1;
} else {
$row[] = 0;
}
// CC Hub Pages
$row[] = (bool) groups_get_groupmeta($group_id, "ccgp_is_enabled");
// CC Hub Narratives
$row[] = (bool) groups_get_groupmeta($group_id, "ccgn_is_enabled");
// Custom Plugins
// To make your group-specific plugin be counted, so something like this:
/* add_filter( 'cc_stats_custom_plugins', 'prefix_report_custom_plugin', 10, 2 );
* function prefix_report_custom_plugin( $custom_plugins, $group_id ) {
* if ( $group_id == sa_get_group_id() ) {
* $custom_plugins[] = "CC Salud America";
* }
* return $custom_plugins;
* }
*/
$custom_plugins = apply_filters('cc_stats_custom_plugins', array(), $group_id);
$custom_plugins = implode(' ', $custom_plugins);
$row[] = $custom_plugins;
// Write the row.
fputcsv($output, $row);
}
}
fclose($output);
exit;
}
示例15: array
// If a specific faction was requested, filter for it
if (isset($faction)) {
$args['meta_query'] = array(array('key' => 'group_faction', 'value' => $faction, 'compare' => '='));
}
?>
<?php
if (bp_has_groups($args)) {
?>
<ul id="groups-list" class="directory-list" role="main">
<?php
// Loop through all members
while (bp_groups()) {
bp_the_group();
$group = new Apoc_Group(bp_get_group_id(), 'directory', 100);
?>
<li id="group-<?php
bp_group_id();
?>
" class="group directory-entry">
<div class="directory-member reply-author">
<?php
echo $group->block;
?>
</div>
<div class="directory-content">
<header class="activity-header">
<p class="activity"><?php
bp_group_last_active();