本文整理汇总了PHP中bp_get_groups_root_slug函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_get_groups_root_slug函数的具体用法?PHP bp_get_groups_root_slug怎么用?PHP bp_get_groups_root_slug使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_get_groups_root_slug函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bp_get_groups_action_link
function bp_get_groups_action_link($action = '', $query_args = '', $nonce = false)
{
global $bp;
// Must be displayed user
if (empty($bp->groups->current_group->id)) {
return;
}
// Append $action to $url if there is no $type
if (!empty($action)) {
$url = bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . $bp->groups->current_group->slug . '/' . $action;
} else {
$url = bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . $bp->groups->current_group->slug;
}
// Add a slash at the end of our user url
$url = trailingslashit($url);
// Add possible query arg
if (!empty($query_args) && is_array($query_args)) {
$url = add_query_arg($query_args, $url);
}
// To nonce, or not to nonce...
if (true === $nonce) {
$url = wp_nonce_url($url);
} elseif (is_string($nonce)) {
$url = wp_nonce_url($url, $nonce);
}
// Return the url, if there is one
if (!empty($url)) {
return $url;
}
}
示例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);
}
示例3: custom_media_nav_tab
/**
* Load Custom tabs on BuddyPress
*
* @global object $bp global BuddyPress object
*/
function custom_media_nav_tab()
{
global $bp;
if (!function_exists("bp_core_new_nav_item")) {
return;
}
if (bp_is_blog_page() || !bp_is_group() && !(isset($bp->displayed_user) && isset($bp->displayed_user->id)) || apply_filters('rtmedia_render_bp_nav', false)) {
return;
}
global $rtmedia;
if (function_exists("bp_is_group") && !bp_is_group()) {
if (isset($bp->displayed_user) && isset($bp->displayed_user->id)) {
$profile_counts = $this->actual_counts($bp->displayed_user->id);
}
$tab_position = apply_filters('rtmedia_media_tab_position', 99);
if ($rtmedia->options["buddypress_enableOnProfile"] != 0) {
bp_core_new_nav_item(array('name' => RTMEDIA_MEDIA_LABEL . '<span>' . $profile_counts['total']['all'] . '</span>', 'slug' => apply_filters('rtmedia_media_tab_slug', RTMEDIA_MEDIA_SLUG), 'screen_function' => array($this, 'media_screen'), 'default_subnav_slug' => 'all', 'position' => $tab_position));
}
}
if (bp_is_group() && $rtmedia->options["buddypress_enableOnGroup"] != 0) {
global $bp;
$media_enabled = true;
//filter for rtMedia PRO for PER GROUP MEDIA enable/disable functionality
$media_enabled = apply_filters('rtmedia_media_enabled_for_current_group', $media_enabled);
// check if current user can view this group
$current_group = groups_get_current_group();
$is_visible_to_current_user = $current_group->is_visible;
if ($media_enabled && $is_visible_to_current_user) {
$group_counts = $this->actual_counts($bp->groups->current_group->id, "group");
$bp->bp_options_nav[bp_get_current_group_slug()]['media'] = array('name' => RTMEDIA_MEDIA_LABEL . '<span>' . $group_counts['total']['all'] . '</span>', 'link' => trailingslashit(bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . bp_get_current_group_slug() . '/') . RTMEDIA_MEDIA_SLUG, 'slug' => RTMEDIA_MEDIA_SLUG, 'user_has_access' => true, 'css_id' => 'rtmedia-media-nav', 'position' => 99, 'screen_function' => array($this, 'media_screen'), 'default_subnav_slug' => 'all');
}
}
}
示例4: add_cover
function add_cover()
{
if (!is_user_logged_in()) {
return;
}
$user_ID = get_current_user_id();
$output = '';
if (groups_is_user_mod($user_ID, $this->group_id) || groups_is_user_admin($user_ID, $this->group_id)) {
if ($this->get_cover()) {
$message = __("Change Cover", 'bpcp');
} else {
$message = __("Add Cover", 'bpcp');
}
$group = groups_get_group(array('group_id' => $this->group_id));
$group_permalink = trailingslashit(bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . $group->slug . '/');
$output .= '<div class="profile-cover-action">';
$output .= '<a href="' . trailingslashit($group_permalink . 'admin') . $this->slug . '" class="button">' . $message . '</a>';
$output .= '</div>';
}
$default_cover = bp_get_option('bpcp-group-default');
if ($this->get_cover() || $default_cover) {
$output .= '<div class="profile-cover-inner"></div>';
}
echo $output;
}
示例5: custom_media_nav_tab
/**
* Load Custom tabs on BuddyPress
*
* @global object $bp global BuddyPress object
*/
function custom_media_nav_tab()
{
$bp = buddypress();
if (!function_exists('bp_core_new_nav_item')) {
return;
}
if (bp_is_blog_page() || !bp_is_group() && !(isset($bp->displayed_user) && isset($bp->displayed_user->id)) || apply_filters('rtmedia_render_bp_nav', false)) {
return;
}
global $rtmedia;
if (function_exists('bp_is_group') && !bp_is_group()) {
if (isset($bp->displayed_user) && isset($bp->displayed_user->id)) {
$profile_counts = $this->actual_counts($bp->displayed_user->id);
}
$tab_position = apply_filters('rtmedia_media_tab_position', 99);
if (0 !== intval($rtmedia->options['buddypress_enableOnProfile'])) {
bp_core_new_nav_item(array('name' => RTMEDIA_MEDIA_LABEL . ' <span>' . $profile_counts['total']['all'] . '</span>', 'slug' => apply_filters('rtmedia_media_tab_slug', RTMEDIA_MEDIA_SLUG), 'screen_function' => array($this, 'media_screen'), 'default_subnav_slug' => 'all', 'position' => $tab_position));
}
}
if (bp_is_group() && 0 !== intval($rtmedia->options['buddypress_enableOnGroup'])) {
$media_enabled = true;
//filter for rtMedia PRO for PER GROUP MEDIA enable/disable functionality
$media_enabled = apply_filters('rtmedia_media_enabled_for_current_group', $media_enabled);
// check if current user can view this group
$current_group = groups_get_current_group();
/**
* remove `$current_group->is_visible` and add `bp_group_is_visible( $current_group )`
* reason : In Buddypress 2.7 `is_visible` return false so we can't display `media` tab on group
* issue id : http://git.rtcamp.com/rtmedia/rtMedia/issues/119
*/
// $is_visible_to_current_user = $current_group->is_visible;
$is_visible_to_current_user = bp_group_is_visible($current_group);
if ($media_enabled && $is_visible_to_current_user) {
$group_counts = $this->actual_counts($bp->groups->current_group->id, 'group');
$slug = apply_filters('rtmedia_group_media_tab_slug', RTMEDIA_MEDIA_SLUG);
if (isset($bp->version) && $bp->version > '2.5.3') {
/*
* As from BuddyPress 2.6, you can't access $bp->bp_options_nav directly.
* Use `bp_core_new_subnav_item` to add subnav item.
*
* Check https://buddypress.trac.wordpress.org/ticket/6534 and https://buddypress.trac.wordpress.org/changeset/10745
* for more details
*/
bp_core_new_subnav_item(array('name' => RTMEDIA_MEDIA_LABEL . ' <span>' . $group_counts['total']['all'] . '</span>', 'link' => trailingslashit(bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . bp_get_current_group_slug() . '/') . $slug, 'slug' => $slug, 'parent_slug' => bp_get_current_group_slug(), 'parent_url' => trailingslashit(bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . bp_get_current_group_slug() . '/'), 'user_has_access' => true, 'css_id' => 'rtmedia-media-nav', 'position' => 99, 'screen_function' => array($this, 'media_screen'), 'default_subnav_slug' => 'all'));
} else {
$bp->bp_options_nav[bp_get_current_group_slug()]['media'] = array('name' => RTMEDIA_MEDIA_LABEL . ' <span>' . $group_counts['total']['all'] . '</span>', 'link' => trailingslashit(bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . bp_get_current_group_slug() . '/') . $slug, 'slug' => $slug, 'user_has_access' => true, 'css_id' => 'rtmedia-media-nav', 'position' => 99, 'screen_function' => array($this, 'media_screen'), 'default_subnav_slug' => 'all');
}
}
}
}
示例6: humcore_format_activity_action_new_group_deposit
/**
* Format 'new_group_deposit' activity action.
*
* @param object $activity Activity data.
* @return string $action Formatted activity action.
*/
function humcore_format_activity_action_new_group_deposit($action, $activity)
{
$item_post = get_post($activity->secondary_item_id);
$item_link = sprintf('<a href="%1$s">%2$s</a>', esc_url($activity->primary_link), esc_html($item_post->post_title));
$post_metadata = json_decode(get_post_meta($activity->secondary_item_id, '_deposit_metadata', true), true);
if (!empty($post_metadata['committee_id'])) {
$committee = groups_get_group(array('group_id' => $post_metadata['committee_id']));
$initiator_url = trailingslashit(bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . $committee->slug . '/');
$initiator_name = $committee->name;
$initiator_link = sprintf('<a href="%1$sdeposits/">%2$s</a>', esc_url($initiator_url), esc_html($initiator_name));
} else {
$initiator_url = bp_core_get_userlink($activity->user_id, false, true);
$initiator_name = bp_core_get_userlink($activity->user_id, true, false);
$initiator_link = sprintf('<a href="%1$sdeposits/">%2$s</a>', esc_url($initiator_url), esc_html($initiator_name));
}
$group = groups_get_group(array('group_id' => $activity->item_id));
$group_link = sprintf('<a href="%1$sdeposits/">%2$s</a>', esc_url(bp_get_group_permalink($group)), esc_html($group->name));
$action = sprintf(__('%1$s deposited %2$s in the group %3$s', 'humcore_domain'), $initiator_link, $item_link, $group_link);
return apply_filters('humcore_format_activity_action_new_group_deposit', $action, $activity);
}
示例7: bd_docs_get_current_group_id
/**
* figure out the current used buddypress group_id
*
* @since 0.1
* @access public
* @returns int $group_id
*/
public function bd_docs_get_current_group_id()
{
$group_id = false;
if (bp_docs_is_bp_docs_page() && NULL !== bp_docs_get_current_doc()) {
$group_id = bp_docs_get_associated_group_id(get_the_ID());
} else {
$path = $_SERVER['REQUEST_URI'];
$p_arr = explode('/', $path);
if (isset($p_arr[1]) && $p_arr[1] == bp_get_groups_root_slug()) {
$slug = $p_arr[2];
$group_id = BP_Groups_Group::get_id_from_slug($slug);
} else {
$u = parse_url(wp_get_referer());
$path = $u['path'];
$p_arr = explode('/', $path);
if (isset($p_arr[1]) && $p_arr[1] == bp_get_groups_root_slug()) {
$slug = $p_arr[2];
$group_id = BP_Groups_Group::get_id_from_slug($slug);
}
}
}
return $group_id;
}
示例8: __
if ($cb_bp_current_component == 'groups' && ($cb_bp_current_action == 'my-groups' || $cb_bp_current_action == 'invites')) {
$cb_title_prefix = NULL;
$cb_title = __('Groups', 'cubell');
}
if ($cb_bp_current_component == 'settings') {
$cb_title_prefix = '<span>' . __('Settings', 'cubell') . ' <i class="icon-long-arrow-right"></i></span> ';
}
if ($cb_bp_current_component == 'forums') {
$cb_title_prefix = '<span>' . __('Forums', 'cubell') . ' <i class="icon-long-arrow-right"></i></span> ';
}
if ($cb_bp_current_component == 'activity' && $cb_bp_current_action == NULL) {
$cb_title = __('Latest Activity', 'cubell');
$cb_breadcrumbs_override = true;
}
if ($cb_bp_current_component == 'groups' && $cb_bp_current_action == NULL) {
$cb_title = '<span>' . __('Groups', 'cubell') . ' ' . '<a class="cb-group-create cb-tip-bot" title="' . __('Create a Group', 'buddypress') . '" href="' . trailingslashit(bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/create') . '"><i class="icon-plus"></i></a>';
$cb_group_creator = NULL;
}
if ($cb_bp_current_component == 'groups' && $cb_bp_current_action == 'create') {
$cb_title_prefix = '<span>' . __('Groups', 'cubell') . ' <i class="icon-long-arrow-right"></i></span> ';
$cb_title = __('Create a Group', 'buddypress');
}
if ((string) (int) $cb_bp_current_action == $cb_bp_current_action && $cb_bp_current_component == 'activity') {
$cb_bp_class = 'cb-activity-stream ';
$cb_title_prefix = NULL;
$cb_title = __('Activity', 'cubell');
}
$cb_title = '<h1 id="cb-cat-title">' . $cb_title_prefix . $cb_title . '</h1>';
$cb_user_page = 'cb-author-page ';
$cb_sidebar_position = NULL;
if ($cb_buddypress_sidebar == 'sidebar_left') {
示例9: bp_core_action_search_site
/**
* A javascript-free implementation of the search functions in BuddyPress.
*
* @param string $slug The slug to redirect to for searching.
*/
function bp_core_action_search_site($slug = '')
{
if (!bp_is_current_component(bp_get_search_slug())) {
return;
}
if (empty($_POST['search-terms'])) {
bp_core_redirect(bp_get_root_domain());
return;
}
$search_terms = stripslashes($_POST['search-terms']);
$search_which = !empty($_POST['search-which']) ? $_POST['search-which'] : '';
$query_string = '/?s=';
if (empty($slug)) {
switch ($search_which) {
case 'posts':
$slug = '';
$var = '/?s=';
// If posts aren't displayed on the front page, find the post page's slug.
if ('page' == get_option('show_on_front')) {
$page = get_post(get_option('page_for_posts'));
if (!is_wp_error($page) && !empty($page->post_name)) {
$slug = $page->post_name;
$var = '?s=';
}
}
break;
case 'blogs':
$slug = bp_is_active('blogs') ? bp_get_blogs_root_slug() : '';
break;
case 'forums':
$slug = bp_is_active('forums') ? bp_get_forums_root_slug() : '';
$query_string = '/?fs=';
break;
case 'groups':
$slug = bp_is_active('groups') ? bp_get_groups_root_slug() : '';
break;
case 'members':
default:
$slug = bp_get_members_root_slug();
break;
}
if (empty($slug) && 'posts' != $search_which) {
bp_core_redirect(bp_get_root_domain());
return;
}
}
bp_core_redirect(apply_filters('bp_core_search_site', home_url($slug . $query_string . urlencode($search_terms)), $search_terms));
}
示例10: migrate_single_media
function migrate_single_media($result, $album = false)
{
$blog_id = get_current_blog_id();
$old = $result;
if (function_exists('bp_core_get_table_prefix')) {
$bp_prefix = bp_core_get_table_prefix();
} else {
$bp_prefix = '';
}
global $wpdb;
if (false !== $album && !is_object($result)) {
$id = $wpdb->get_var($wpdb->prepare("select ID from {$this->bmp_table} where media_id = %d", $result));
if (null == $id) {
$sql = "select\n a.post_id as 'post_id',\n a.meta_value as 'privacy',\n b.meta_value as 'context_id',\n c.meta_value as 'activity_id',\n p.post_type,\n p.post_mime_type,\n p.post_author as 'media_author',\n p.post_title as 'media_title',\n p.post_parent as 'parent'\n from\n {$wpdb->postmeta} a\n left join\n {$wpdb->postmeta} b ON ((a.post_id = b.post_id)\n and (b.meta_key = 'bp-media-key'))\n left join\n {$wpdb->postmeta} c ON (a.post_id = c.post_id)\n and (c.meta_key = 'bp_media_child_activity')\n left join\n {$wpdb->posts} p ON (a.post_id = p.ID)\n where\n a.post_id = %d and (NOT p.ID IS NULL)\n and a.meta_key = 'bp_media_privacy'";
$result = $wpdb->get_row($wpdb->prepare($sql, $result));
} else {
return $id;
}
}
if (!isset($result) || !isset($result->post_id)) {
return $old;
}
$media_id = $result->post_id;
if (intval($result->context_id) > 0) {
$media_context = 'profile';
$prefix = 'users/' . abs(intval($result->context_id));
} else {
$media_context = 'group';
$prefix = bp_get_groups_root_slug() . abs(intval($result->context_id));
}
$old_type = '';
if ('attachment' != $result->post_type) {
$media_type = 'album';
} else {
$mime_type = strtolower($result->post_mime_type);
$old_type = '';
if (0 === strpos($mime_type, 'image')) {
$media_type = 'photo';
$old_type = 'photos';
} else {
if (0 === strpos($mime_type, 'audio')) {
$media_type = 'music';
$old_type = 'music';
} else {
if (0 === strpos($mime_type, 'video')) {
$media_type = 'video';
$old_type = 'videos';
} else {
$media_type = 'other';
}
}
}
}
$activity_data = $wpdb->get_row($wpdb->prepare("select * from {$bp_prefix}bp_activity where id= %d", $result->activity_id));
if ('album' != $media_type) {
$this->importmedia($media_id, $prefix);
}
if ($this->table_exists($bp_prefix . 'bp_activity') && class_exists('BP_Activity_Activity')) {
$bp_activity = new BP_Activity_Activity();
$activity_sql = $wpdb->prepare("SELECT\n *\n FROM\n {$bp_prefix}bp_activity\n where\n id in (select distinct\n a.meta_value\n from\n {$wpdb->postmeta} a\n left join\n {$wpdb->posts} p ON (a.post_id = p.ID)\n where\n (NOT p.ID IS NULL) and p.ID = %d\n and a.meta_key = 'bp_media_child_activity')", $media_id);
$all_activity = $wpdb->get_results($activity_sql);
remove_all_actions('wp_insert_comment');
foreach ($all_activity as $activity) {
$comments = $bp_activity->get_activity_comments($activity->id, $activity->mptt_left, $activity->mptt_right);
$exclude = get_post_meta($media_id, 'rtmedia_imported_activity', true);
if (!is_array($exclude)) {
$exclude = array();
}
if ($comments) {
$this->insert_comment($media_id, $comments, $exclude);
}
}
}
if (0 !== intval($result->parent)) {
$album_id = $this->migrate_single_media($result->parent, true);
} else {
$album_id = 0;
}
if (function_exists('bp_activity_get_meta')) {
$likes = bp_activity_get_meta($result->activity_id, 'favorite_count');
} else {
$likes = 0;
}
$wpdb->insert($this->bmp_table, array('blog_id' => $blog_id, 'media_id' => $media_id, 'media_type' => $media_type, 'context' => $media_context, 'context_id' => abs(intval($result->context_id)), 'activity_id' => $result->activity_id, 'privacy' => intval($result->privacy) * 10, 'media_author' => $result->media_author, 'media_title' => $result->media_title, 'album_id' => $album_id, 'likes' => $likes), array('%d', '%d', '%s', '%s', '%d', '%d', '%d', '%d', '%s', '%d', '%d'));
$last_id = $wpdb->insert_id;
// Photo tag meta migration
//$photo_tag_meta = get_post_meta($media_id, "bp-media-user-tags", true);
// if($photo_tag_meta && !empty($photo_tag_meta)){
// $wpdb->insert(
// $wpdb->prefix . "rt_rtm_media_meta", array(
// 'media_id' => $media_id,
// 'meta_key' => "user-tags",
// "meta_value" => maybe_serialize($photo_tag_meta)), array('%d', '%s', '%s'));
// }
if ('album' != $media_type && function_exists('bp_core_get_user_domain') && $activity_data) {
if (function_exists('bp_core_get_table_prefix')) {
$bp_prefix = bp_core_get_table_prefix();
} else {
$bp_prefix = '';
}
//.........这里部分代码省略.........
示例11: rtmedia_pagination_page_link
function rtmedia_pagination_page_link($page_no)
{
global $rtmedia_media, $rtmedia_interaction, $rtmedia_query;
$page_url = 'pg/' . $page_no;
$site_url = is_multisite() ? trailingslashit(get_site_url(get_current_blog_id())) : trailingslashit(get_site_url());
$author_name = get_query_var('author_name');
$link = '';
if ($rtmedia_interaction && isset($rtmedia_interaction->context) && $rtmedia_interaction->context->type == "profile") {
if (function_exists("bp_core_get_user_domain")) {
$link .= trailingslashit(bp_core_get_user_domain($rtmedia_query->media_query['media_author']));
} else {
$link .= $site_url . 'author/' . $author_name . '/';
}
} else {
if ($rtmedia_interaction && isset($rtmedia_interaction->context) && $rtmedia_interaction->context->type == 'group') {
if (function_exists("bp_get_current_group_slug")) {
$link .= $site_url . bp_get_groups_root_slug() . '/' . bp_get_current_group_slug() . '/';
}
} else {
//$post = get_post ( $rtmedia_media->post_parent );
$post = get_post(get_post_field("post_parent", $rtmedia_query->media->media_id));
$link .= $site_url . $post->post_name . '/';
}
}
$link .= RTMEDIA_MEDIA_SLUG . '/';
if (isset($rtmedia_query->media_query["album_id"]) && intval($rtmedia_query->media_query["album_id"]) > 0) {
$link .= $rtmedia_query->media_query["album_id"] . "/";
}
if (isset($rtmedia_query->action_query->media_type)) {
if (in_array($rtmedia_query->action_query->media_type, array("photo", "music", "video", "album", "playlist"))) {
$link .= $rtmedia_query->action_query->media_type . '/';
}
}
return apply_filters('rtmedia_pagination_page_link', $link . $page_url, $link, $page_url);
}
示例12: widget
function widget($args, $instance)
{
$user_id = apply_filters('bp_group_widget_user_id', '0');
extract($args);
if (empty($instance['group_default'])) {
$instance['group_default'] = 'popular';
}
if (empty($instance['title'])) {
$instance['title'] = __('Groups', 'buddypress');
}
echo $before_widget;
$title = !empty($instance['link_title']) ? '<a href="' . trailingslashit(bp_get_root_domain() . '/' . bp_get_groups_root_slug()) . '">' . $instance['title'] . '</a>' : $instance['title'];
echo $before_title . $title . $after_title;
?>
<?php
if (bp_has_groups('user_id=' . $user_id . '&type=' . $instance['group_default'] . '&max=' . $instance['max_groups'] . '&per_page=' . $instance['max_groups'])) {
?>
<div class="item-options" id="groups-list-options">
<a href="<?php
echo site_url(bp_get_groups_root_slug());
?>
" id="newest-groups"<?php
if ($instance['group_default'] == 'newest') {
?>
class="selected"<?php
}
?>
><?php
_e("Newest", 'buddypress');
?>
</a> |
<a href="<?php
echo site_url(bp_get_groups_root_slug());
?>
" id="recently-active-groups"<?php
if ($instance['group_default'] == 'active') {
?>
class="selected"<?php
}
?>
><?php
_e("Active", 'buddypress');
?>
</a> |
<a href="<?php
echo site_url(bp_get_groups_root_slug());
?>
" id="popular-groups" <?php
if ($instance['group_default'] == 'popular') {
?>
class="selected"<?php
}
?>
><?php
_e("Popular", 'buddypress');
?>
</a>
</div>
<ul id="groups-list" class="item-list">
<?php
while (bp_groups()) {
bp_the_group();
?>
<li>
<div class="item-avatar">
<a href="<?php
bp_group_permalink();
?>
" title="<?php
bp_group_name();
?>
"><?php
bp_group_avatar_thumb();
?>
</a>
</div>
<div class="item">
<div class="item-title"><a href="<?php
bp_group_permalink();
?>
" title="<?php
bp_group_name();
?>
"><?php
bp_group_name();
?>
</a></div>
<div class="item-meta">
<span class="activity">
<?php
if ('newest' == $instance['group_default']) {
printf(__('created %s', 'buddypress'), bp_get_group_date_created());
}
if ('active' == $instance['group_default']) {
printf(__('active %s', 'buddypress'), bp_get_group_last_active());
} else {
if ('popular' == $instance['group_default']) {
//.........这里部分代码省略.........
示例13: printBuddypressGroupAssignment
/**
* Prints the group assignment of a post on the theme on the single.php template file
*
* @param text $text Text for the link. Use %s as placeholder for the link, e.g 'Dieser Beitrag ist mit der Gruppe %s verknüpft.' (default)
* @param obj $obj Optionally a specicific post object, if not set the current post in the loop
* @param bool $linkbuddypressgroup True for linking to the real Buddypress group page, false for the group taxonomy.
*/
function printBuddypressGroupAssignment($text = 'Dieser Beitrag ist mit der Gruppe %s verknüpft.', $obj = NULL, $linkbuddypressgroup = true)
{
global $post;
if (!is_null($obj)) {
$obj = $post;
}
$groups = wp_get_object_terms(array($post->ID), array('buddypress_groups'));
if ($groups) {
$group_name = $groups[0]->name;
$group_slug = $groups[0]->slug;
if ($group_slug != 'keine') {
if ($linkbuddypressgroup && function_exists('bp_get_groups_root_slug')) {
$group_link = get_bloginfo('url') . '/' . bp_get_groups_root_slug() . '/' . $group_slug;
} else {
$group_link = get_term_link($groups[0]);
}
$link = '<a href="' . esc_url($group_link) . '" title="' . esc_attr($group_name) . '">' . esc_html($group_name) . '</a>';
if (is_null($text)) {
$text = 'Gruppe: %s';
}
?>
<p><?php
printf($text, $link);
?>
</p>
<?php
}
}
}
示例14: wp_nonce_field
</div>
<?php
wp_nonce_field('bp_forums_new_topic');
?>
</form><!-- #forum-topic-form -->
<?php
} elseif (bp_is_active('groups')) {
?>
<div id="message" class="info">
<p><?php
printf(__("You are not a member of any groups so you don't have any group forums you can post in. To start posting, first find a group that matches the topic subject you'd like to start. If this group does not exist, why not <a href='%s'>create a new group</a>? Once you have joined or created the group you can post your topic in that group's forum.", 'buddypress'), site_url(bp_get_groups_root_slug() . '/create/'));
?>
</p>
</div>
<?php
}
?>
<?php
}
?>
</div><!-- #new-topic-post -->
<?php
示例15: _register
function _register()
{
global $bp;
// If admin/create names and slugs are not provided, they fall back on the main
// name and slug for the extension
if (!$this->admin_name) {
$this->admin_name = $this->name;
}
if (!$this->admin_slug) {
$this->admin_slug = $this->slug;
}
if (!$this->create_name) {
$this->create_name = $this->name;
}
if (!$this->create_slug) {
$this->create_slug = $this->slug;
}
if (!empty($this->enable_create_step)) {
// Insert the group creation step for the new group extension
$bp->groups->group_creation_steps[$this->create_slug] = array('name' => $this->create_name, 'slug' => $this->create_slug, 'position' => $this->create_step_position);
// Attach the group creation step display content action
add_action('groups_custom_create_steps', array(&$this, 'create_screen'));
// Attach the group creation step save content action
add_action('groups_create_group_step_save_' . $this->create_slug, array(&$this, 'create_screen_save'));
}
// When we are viewing a single group, add the group extension nav item
if (bp_is_group()) {
if ($this->visibility == 'public' || $this->visibility != 'public' && $bp->groups->current_group->user_has_access) {
if ($this->enable_nav_item) {
bp_core_new_subnav_item(array('name' => !$this->nav_item_name ? $this->name : $this->nav_item_name, 'slug' => $this->slug, 'parent_slug' => $bp->groups->current_group->slug, 'parent_url' => bp_get_group_permalink($bp->groups->current_group), 'position' => $this->nav_item_position, 'item_css_id' => 'nav-' . $this->slug, 'screen_function' => array(&$this, '_display_hook'), 'user_has_access' => $this->enable_nav_item));
// When we are viewing the extension display page, set the title and options title
if (bp_is_current_action($this->slug)) {
add_action('bp_template_content_header', create_function('', 'echo "' . esc_attr($this->name) . '";'));
add_action('bp_template_title', create_function('', 'echo "' . esc_attr($this->name) . '";'));
}
}
// Hook the group home widget
if (!bp_current_action() && bp_is_current_action('home')) {
add_action($this->display_hook, array(&$this, 'widget_display'));
}
}
}
// Construct the admin edit tab for the new group extension
if (!empty($this->enable_edit_item) && bp_is_item_admin()) {
add_action('groups_admin_tabs', create_function('$current, $group_slug', '$selected = ""; if ( "' . esc_attr($this->admin_slug) . '" == $current ) $selected = " class=\\"current\\""; echo "<li{$selected}><a href=\\"' . trailingslashit(bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/{$group_slug}/admin/' . esc_attr($this->admin_slug)) . '\\">' . esc_attr($this->admin_name) . '</a></li>";'), 10, 2);
// Catch the edit screen and forward it to the plugin template
if (bp_is_groups_component() && bp_is_current_action('admin') && bp_is_action_variable($this->admin_slug, 0)) {
// Check whether the user is saving changes
$this->edit_screen_save();
add_action('groups_custom_edit_steps', array(&$this, 'edit_screen'));
if ('' != locate_template(array('groups/single/home.php'), false)) {
bp_core_load_template(apply_filters('groups_template_group_home', 'groups/single/home'));
} else {
add_action('bp_template_content_header', create_function('', 'echo "<ul class=\\"content-header-nav\\">"; bp_group_admin_tabs(); echo "</ul>";'));
add_action('bp_template_content', array(&$this, 'edit_screen'));
bp_core_load_template(apply_filters('bp_core_template_plugin', '/groups/single/plugins'));
}
}
}
}