/** * 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; }
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; }
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; }
function bp_checkins_group_can_checkin() { if (groups_get_groupmeta(bp_get_group_id(), 'checkins_ok')) { return true; } else { return false; } }
/** * 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; }
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; }
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; }
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 }
/** * 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 }
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); }
function invite_anyone_screen_one_content() { global $bp; $iaoptions = invite_anyone_options(); // Hack - catch already=accepted if (!empty($_GET['already']) && 'accepted' === $_GET['already'] && bp_is_my_profile()) { _e('It looks like you’ve already accepted your invitation to join the site.', 'invite-anyone'); return; } // If the user has maxed out his invites, no need to go on if (!empty($iaoptions['email_limit_invites_toggle']) && $iaoptions['email_limit_invites_toggle'] == 'yes' && !current_user_can('delete_others_pages')) { $sent_invites = invite_anyone_get_invitations_by_inviter_id(bp_displayed_user_id()); $sent_invites_count = $sent_invites->post_count; if ($sent_invites_count >= $iaoptions['limit_invites_per_user']) { ?> <h4><?php _e('Invite New Members', 'invite-anyone'); ?> </h4> <p id="welcome-message"><?php _e('You have sent the maximum allowed number of invitations.', 'invite-anyone'); ?> </em></p> <?php return; } } if (!($max_invites = $iaoptions['max_invites'])) { $max_invites = 5; } $from_group = false; if (!empty($bp->action_variables)) { if ('group-invites' == $bp->action_variables[0]) { $from_group = $bp->action_variables[1]; } } $returned_data = !empty($bp->invite_anyone->returned_data) ? $bp->invite_anyone->returned_data : false; /* If the user is coming from the widget, $returned_emails is populated with those email addresses */ if (isset($_POST['invite_anyone_widget'])) { check_admin_referer('invite-anyone-widget_' . $bp->loggedin_user->id); if (!empty($_POST['invite_anyone_email_addresses'])) { $returned_data['error_emails'] = invite_anyone_parse_addresses($_POST['invite_anyone_email_addresses']); } /* If the widget appeared on a group page, the group ID should come along with it too */ if (isset($_POST['invite_anyone_widget_group'])) { $returned_data['groups'] = $_POST['invite_anyone_widget_group']; } } // $returned_groups is padded so that array_search (below) returns true for first group */ $counter = 0; $returned_groups = array(0); if (!empty($returned_data['groups'])) { foreach ($returned_data['groups'] as $group_id) { $returned_groups[] = $group_id; } } // Get the returned email subject, if there is one $returned_subject = !empty($returned_data['subject']) ? stripslashes($returned_data['subject']) : false; // Get the returned email message, if there is one $returned_message = !empty($returned_data['message']) ? stripslashes($returned_data['message']) : false; if (!empty($returned_data['error_message'])) { ?> <div class="invite-anyone-error error"> <p><?php _e("Some of your invitations were not sent. Please see the errors below and resubmit the failed invitations.", 'invite-anyone'); ?> </p> </div> <?php } $blogname = get_bloginfo('name'); $welcome_message = sprintf(__('Invite friends to join %s by following these steps:', 'invite-anyone'), $blogname); ?> <form id="invite-anyone-by-email" action="<?php echo $bp->displayed_user->domain . $bp->invite_anyone->slug . '/sent-invites/send/'; ?> " method="post"> <h4><?php _e('Invite New Members', 'invite-anyone'); ?> </h4> <?php if (isset($iaoptions['email_limit_invites_toggle']) && $iaoptions['email_limit_invites_toggle'] == 'yes' && !current_user_can('delete_others_pages')) { if (!isset($sent_invites)) { $sent_invites = invite_anyone_get_invitations_by_inviter_id(bp_loggedin_user_id()); $sent_invites_count = $sent_invites->post_count; } $limit_invite_count = (int) $iaoptions['limit_invites_per_user'] - (int) $sent_invites_count; if ($limit_invite_count < 0) { $limit_invite_count = 0; } ?> <p class="description"><?php printf(__('The site administrator has limited each user to %1$d invitations. You have %2$d invitations remaining.', 'invite-anyone'), (int) $iaoptions['limit_invites_per_user'], (int) $limit_invite_count); ?> </p> <?php } ?> <p id="welcome-message"><?php echo $welcome_message; ?> </p> <ol id="invite-anyone-steps"> <li> <?php if (!empty($returned_data['error_message'])) { ?> <div class="invite-anyone-error error"> <p><?php echo $returned_data['error_message']; ?> </p> </div> <?php } ?> <div class="manual-email"> <p> <?php _e('Enter email addresses below, one per line.', 'invite-anyone'); ?> <?php if (invite_anyone_allowed_domains()) { ?> <?php _e('You can only invite people whose email addresses end in one of the following domains:', 'invite-anyone'); ?> <?php echo invite_anyone_allowed_domains(); } ?> </p> <?php if (false !== ($max_no_invites = invite_anyone_max_invites())) { ?> <p class="description"><?php printf(__('You can invite a maximum of %s people at a time.', 'invite-anyone'), $max_no_invites); ?> </p> <?php } ?> <?php invite_anyone_email_fields($returned_data['error_emails']); ?> </div> <?php /* invite_anyone_after_addresses gets $iaoptions so that Cloudsponge etc can tell whether certain components are activated, without an additional lookup */ ?> <?php do_action('invite_anyone_after_addresses', $iaoptions); ?> </li> <li> <?php if ($iaoptions['subject_is_customizable'] == 'yes') { ?> <label for="invite-anyone-custom-subject"><?php _e('(optional) Customize the subject line of the invitation email.', 'invite-anyone'); ?> </label> <textarea name="invite_anyone_custom_subject" id="invite-anyone-custom-subject" rows="15" cols="10" ><?php echo invite_anyone_invitation_subject($returned_subject); ?> </textarea> <?php } else { ?> <label for="invite-anyone-custom-subject"><?php _e('Subject: <span class="disabled-subject">Subject line is fixed</span>', 'invite-anyone'); ?> </label> <textarea name="invite_anyone_custom_subject" id="invite-anyone-custom-subject" rows="15" cols="10" disabled="disabled"><?php echo invite_anyone_invitation_subject($returned_subject); ?> </textarea> <input type="hidden" id="invite-anyone-customised-subject" name="invite_anyone_custom_subject" value="<?php echo invite_anyone_invitation_subject(); ?> " /> <?php } ?> </li> <li> <?php if ($iaoptions['message_is_customizable'] == 'yes') { ?> <label for="invite-anyone-custom-message"><?php _e('(optional) Customize the text of the invitation.', 'invite-anyone'); ?> </label> <p class="description"><?php _e('The message will also contain a custom footer containing links to accept the invitation or opt out of further email invitations from this site.', 'invite-anyone'); ?> </p> <textarea name="invite_anyone_custom_message" id="invite-anyone-custom-message" cols="40" rows="10"><?php echo invite_anyone_invitation_message($returned_message); ?> </textarea> <?php } else { ?> <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 }
<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
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"); }
/** * 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; }
// 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();
"><?php bp_group_name(); ?> </a></h1> <p class="status"><?php bp_group_type(); ?> </p> </div> <div class="info-group"> <?php if (function_exists('bp_wire_get_post_list')) { ?> <?php bp_wire_get_post_list(bp_get_group_id(), __('Group Wire', 'buddypress'), sprintf(__('The are no wire posts for %s', 'buddypress'), bp_get_group_name()), bp_group_is_member(), true); ?> <?php } ?> </div> </div> </div> <?php } } ?> </div>
/** * Get the row class of the current group in the loop. * * @since 1.7.0 * * @param array $classes Array of custom classes. * @return string Row class of the group. */ function bp_get_group_class($classes = array()) { global $groups_template; // Add even/odd classes, but only if there's more than 1 group. if ($groups_template->group_count > 1) { $pos_in_loop = (int) $groups_template->current_group; $classes[] = $pos_in_loop % 2 ? 'even' : 'odd'; // If we've only one group in the loop, don't bother with odd and even. } else { $classes[] = 'bp-single-group'; } // Group type - public, private, hidden. $classes[] = sanitize_key($groups_template->group->status); // Add current group types. if ($group_types = bp_groups_get_group_type(bp_get_group_id(), false)) { foreach ($group_types as $group_type) { $classes[] = sprintf('group-type-%s', esc_attr($group_type)); } } // User's group role. if (bp_is_user_active()) { // Admin. if (bp_group_is_admin()) { $classes[] = 'is-admin'; } // Moderator. if (bp_group_is_mod()) { $classes[] = 'is-mod'; } // Member. if (bp_group_is_member()) { $classes[] = 'is-member'; } } // Whether a group avatar will appear. if (bp_disable_group_avatar_uploads() || !buddypress()->avatar->show_avatars) { $classes[] = 'group-no-avatar'; } else { $classes[] = 'group-has-avatar'; } /** * Filters classes that will be applied to row class of the current group in the loop. * * @since 1.7.0 * * @param array $classes Array of determined classes for the row. */ $classes = apply_filters('bp_get_group_class', $classes); $classes = array_merge($classes, array()); $retval = 'class="' . join(' ', $classes) . '"'; return $retval; }
<?php do_action('bp_before_activity_loop'); ?> <?php if (bp_has_activities('object=groups&primary_id=' . bp_get_group_id())) { ?> <?php /* Show pagination if JS is not enabled, since the "Load More" link will do nothing */ ?> <noscript> <div class="pagination"> <div class="pag-count"><?php bp_activity_pagination_count(); ?> </div> <div class="pagination-links"><?php bp_activity_pagination_links(); ?> </div> </div> </noscript> <?php if (empty($_POST['page'])) { ?> <ul id="activity-stream" class="activity-list item-list"> <?php }
function group_custom_field($meta_key = '') { return groups_get_groupmeta(bp_get_group_id(), $meta_key); }
<?php bcg_show_post_form(bp_get_group_id());
<?php if (bp_has_groups('user_id=' . bp_loggedin_user_id() . '&type=alphabetical&max=100&per_page=100&populate_extras=0')) { while (bp_groups()) { bp_the_group(); ?> <option value="<?php bp_group_id(); ?> "><?php bp_group_name(); ?> </option> <?php $dd_fake_select .= '<li><a href="#" data-group-id="' . bp_get_group_id() . '">' . bp_get_group_name() . '</a></li>'; ?> <?php } } ?> </select> <div class="dd-button-dropdown dd-bp-post-in-fake"> <div class="dd-button-dropdown-content"> <ul> <?php echo $dd_fake_select; ?>
function bp_group_id() { echo bp_get_group_id(); }
function build_html() { // Get the group object $group = new Apoc_Group(bp_get_group_id(), 'directory', 100); // Store everything in an output buffer ob_start(); ?> <div id="featured-group-widget" class="widget"> <header class="widget-header"> <h3 class="widget-title">Featured Guild</h3> </header> <div class="featured-guild-widget group directory-entry"> <div class="directory-member reply-author"> <?php echo $group->block; ?> </div> </div> </div><?php // Get the contents of the buffer $html = ob_get_contents(); ob_end_clean(); // Return the html to the class return $html; }
function get_value($meta_key = '') { return groups_get_groupmeta(bp_get_group_id(), $meta_key); }
</div> <div class="statistics"> <div class="count_icon member_count_icon"> <i class="fa fa-user"></i> <div class="member_count"> <?php bp_group_member_count(); ?> </div> </div> <div class="count_icon updates_count_icon"> <i class="fa fa-refresh"></i> <div class="update_count"> <?php global $wpdb; $group_id = bp_get_group_id(); $update_count = $wpdb->get_var("SELECT COUNT(*) FROM wp_bp_activity WHERE item_id={$group_id}"); echo $update_count; ?> </div> </div> </div> </div> <?php if (false) { ?> <li <?php bp_group_class(); ?> > <div class="item-avatar">
/** * Displays the Projects under 'Projects' tab under group. * @param int $group_id The Group ID. * @return void */ function display($group_id = null) { do_action('task_breaker_before_projects_archive'); $group_id = bp_get_group_id(); ?> <h3> <?php esc_html_e('Projects', 'task_breaker'); ?> </h3> <div id="task_breaker-intranet-projects"> <?php task_breaker_new_project_modal($group_id); ?> <?php $args = array('meta_key' => 'task_breaker_project_group_id', 'meta_value' => absint($group_id)); ?> <?php task_breaker_project_loop($args); ?> </div> <?php do_action('task_breaker_after_projects_archive'); return; }
} else { // Begin BP 1.2 code ?> <?php do_action('bp_before_group_send_invites_content'); ?> <?php if (invite_anyone_access_test() && !bp_is_group_create()) { ?> <p><?php _e('Want to invite someone to the group who is not yet a member of the site?', 'bp-invite-anyone'); ?> <a href="<?php echo bp_loggedin_user_domain() . BP_INVITE_ANYONE_SLUG . '/invite-new-members/group-invites/' . bp_get_group_id(); ?> "><?php _e('Send invitations by email.', 'bp-invite-anyone'); ?> </a></p> <?php } ?> <?php if (!bp_get_new_group_id()) { ?> <form action="<?php invite_anyone_group_invite_form_action(); ?>
/** * BuddyPress - Group Header * * @package BuddyPress * @subpackage Boss */ ?> <?php do_action('bp_before_group_header'); ?> <?php //output cover photo. if (boss_get_option('boss_layout_style') != 'boxed' && boss_get_option('boss_cover_group')) { echo buddyboss_cover_photo("group", bp_get_group_id()); } ?> <div id="item-header-cover" class="table"> <div class="table-cell"> <span class="bp-group-hierarchy-breadcrumbs"><?php bp_group_hierarchy_breadcrumbs(); ?> </span> <div id="group-name"> <h1 class="main-title"><?php $group_name = bp_get_group_name(); if (!empty($group_name)) { //Get truncated string with long width group title
function bp_group_id($group = false) { echo bp_get_group_id($group); }
/** * Prints the box content. * * @param WP_Post $post The object for the current post/page. */ function bpgroups_meta_box_callback($post) { // Add an nonce field so we can check for it later. wp_nonce_field('bpgroups_meta_box', 'bpgroups_meta_box_nonce'); // to store the groups this user is member of $buddypressgroups = array(); $checkgroups = array(); // Get real Buddypress Groups if (function_exists('bp_groups')) { if (bp_has_groups()) { while (bp_groups()) { bp_the_group(); $groupname = bp_get_group_name(); $groupslug = bp_get_group_slug(); // Set group as taxonomy term if not already done $termexists = term_exists($groupname, 'buddypress_groups'); if (empty($termexists)) { wp_insert_term($groupname, 'buddypress_groups', array('slug' => strtolower($groupname))); } // Get only groups the current user is member of if (groups_is_user_member(get_current_user_id(), bp_get_group_id())) { $buddypressgroups[] = array('name' => $groupname, 'slug' => $groupslug); $checkgroups[] = strtolower($groupslug); } } } } // Remove tax terms that have no buddypress group counterpart anymore in case of changes $allgroupterms = get_terms('buddypress_groups', array('hide_empty' => false)); foreach ($allgroupterms as $groupterm) { if (!in_array($groupterm->slug, $checkgroups) && $groupterm->slug != 'keine') { // just keep non assignment term $term = get_term_by('slug', $groupterm->name, 'buddypress_groups'); if ($term) { wp_delete_term($term->term_id, 'buddypress_groups'); } } } //get the group assigned to this post if any $assignedgroups = wp_get_object_terms(array($post->ID), array('buddypress_groups')); $assignedgroup = 'keine'; // posts without assignments if ($assignedgroups) { $assignedgroup = $assignedgroups[0]->slug; // technically more than one but we use only one } ?> <p> <select name="bpgroups_groupselector" id="bpgroups_groupselector" size="1"> <option value="keine" <?php selected($assignedgroup, 'keine', true); ?> >Keine</option> <?php foreach ($buddypressgroups as $bpgroup) { $name = $bpgroup['name']; $slug = $bpgroup['slug']; ?> <option value="<?php echo esc_html($slug); ?> " <?php selected($assignedgroup, $slug, true); ?> ><?php echo esc_html($name); ?> </option> <?php } ?> </select> </p> <?php }