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

PHP bp_get_group_permalink函数代码示例

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

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



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

示例1: bp_em_record_activity_booking_save

/**
 * @param boolean $result
 * @param EM_Booking $EM_Booking
 * @return boolean
 */
function bp_em_record_activity_booking_save($result, $EM_Booking)
{
    if ($result) {
        $rejected_statuses = array(0, 2, 3);
        //these statuses apply to rejected/cancelled bookings
        $user = $EM_Booking->person;
        $member_slug = function_exists('bp_get_members_root_slug') ? bp_get_members_root_slug() : BP_MEMBERS_SLUG;
        $member_link = trailingslashit(bp_get_root_domain()) . $member_slug . '/' . $user->user_login;
        $user_link = "<a href='" . $member_link . "/'>" . $user->display_name . "</a>";
        $event_link = $EM_Booking->get_event()->output('#_EVENTLINK');
        $status = $EM_Booking->booking_status;
        $EM_Event = $EM_Booking->get_event();
        if (empty($EM_Event->group_id)) {
            if ($status == 1 || !get_option('dbem_bookings_approval') && $status < 2) {
                $action = sprintf(__('%s is attending %s.', 'dbem'), $user_link, $event_link);
            } elseif (($EM_Booking->previous_status == 1 || !get_option('dbem_bookings_approval') && $EM_Booking->previous_status < 2) && in_array($status, $rejected_statuses)) {
                $action = sprintf(__('%s will not be attending %s anymore.', 'dbem'), $user_link, $event_link);
            }
        } else {
            $group = new BP_Groups_Group($EM_Event->group_id);
            $group_link = '<a href="' . bp_get_group_permalink($group) . '">' . bp_get_group_name($group) . '</a>';
            if ($status == 1 || !get_option('dbem_bookings_approval') && $status < 2) {
                $action = sprintf(__('%s is attending %s of the group %s.', 'dbem'), $user_link, $event_link, $group_link);
            } elseif (($EM_Booking->previous_status == 1 || !get_option('dbem_bookings_approval') && $EM_Booking->previous_status < 2) && in_array($status, $rejected_statuses)) {
                $action = sprintf(__('%s will not be attending %s of group %s anymore.', 'dbem'), $user_link, $event_link, $group_link);
            }
        }
        if (!empty($action)) {
            bp_em_record_activity(array('user_id' => $EM_Booking->person->ID, 'action' => $action, 'primary_link' => $EM_Event->output('#_EVENTURL'), 'type' => 'new_booking', 'item_id' => $EM_Event->event_id, 'secondary_item_id' => $EM_Booking->booking_id, 'hide_sitewide' => $EM_Event->event_private));
            //group activity
            if (!empty($EM_Event->group_id)) {
                //tis a group event
                bp_em_record_activity(array('component' => 'groups', 'item_id' => $EM_Event->group_id, 'user_id' => $EM_Booking->person->ID, 'action' => $action, 'primary_link' => $EM_Event->output('#_EVENTURL'), 'type' => 'new_booking', 'secondary_item_id' => $EM_Booking->booking_id, 'hide_sitewide' => $EM_Event->event_private));
            }
        }
    }
    return $result;
}
开发者ID:rajankz,项目名称:webspace,代码行数:43,代码来源:bp-em-activity.php


示例2: bp_em_record_activity_booking_save

/**
 * @param boolean $result
 * @param EM_Booking $EM_Booking
 * @return boolean
 */
function bp_em_record_activity_booking_save($result, $EM_Booking)
{
    if ($result) {
        $user = $EM_Booking->person;
        $user_link = "<a href='" . get_bloginfo('wpurl') . '/' . BP_MEMBERS_SLUG . '/' . $user->user_login . "/'>" . $user->display_name . "</a>";
        $event_link = $EM_Booking->get_event()->output('#_EVENTLINK');
        $status = $EM_Booking->status;
        if ($status == 1 || !get_option('dbem_bookings_approval') && $status < 2) {
            $action = sprintf(__('%s is attending %s.', 'dbem'), $user_link, $event_link);
        } elseif (($EM_Booking->previous_status == 1 || !get_option('dbem_bookings_approval') && $EM_Booking->previous_status < 2) && ($status > 1 || empty($status) || !get_option('dbem_bookings_approval') && $status != 1)) {
            $action = sprintf(__('%s will not be attending %s anymore.', 'dbem'), $user_link, $event_link);
        }
        $EM_Event = $EM_Booking->get_event();
        if (!empty($EM_Event->group_id)) {
            $group = new BP_Groups_Group($EM_Event->group_id);
            $group_link = '<a href="' . bp_get_group_permalink($group) . '">' . bp_get_group_name($group) . '</a>';
            if ($status == 1 || !get_option('dbem_bookings_approval') && $status < 2) {
                $action = sprintf(__('%s is attending %s of the group %s.', 'dbem'), $user_link, $event_link, $group_link);
            } elseif (($EM_Booking->previous_status == 1 || !get_option('dbem_bookings_approval') && $EM_Booking->previous_status < 2) && ($status > 1 || empty($status) || !get_option('dbem_bookings_approval') && $status != 1)) {
                $action = sprintf(__('%s will not be attending %s of group %s anymore.', 'dbem'), $user_link, $event_link, $group_link);
            }
        }
        if (!empty($action)) {
            bp_em_record_activity(array('user_id' => $EM_Booking->person->ID, 'action' => $action, 'primary_link' => $EM_Event->output('#_EVENTURL'), 'type' => 'new_booking', 'item_id' => $EM_Event->id, 'secondary_item_id' => $EM_Booking->id));
            //group activity
            if (!empty($EM_Event->group_id)) {
                //tis a group event
                bp_em_record_activity(array('component' => 'groups', 'item_id' => $EM_Event->group_id, 'user_id' => $EM_Booking->person->ID, 'action' => $action, 'primary_link' => $EM_Event->output('#_EVENTURL'), 'type' => 'new_booking', 'secondary_item_id' => $EM_Booking->id));
            }
        }
    }
    return $result;
}
开发者ID:hypenotic,项目名称:slowfood,代码行数:38,代码来源:bp-em-activity.php


示例3: bp_course_nav_menu

/**
 * bp_course_nav_menu()
 * Navigation menu for BuddyPress course
 */
function bp_course_nav_menu()
{
    $nav = bp_course_get_nav_permalinks();
    $defaults = array('' => array('id' => 'home', 'label' => __('Home', 'vibe'), 'action' => '', 'link' => bp_get_course_permalink()), 'curriculum' => array('id' => 'curriculum', 'label' => __('Curriculum', 'vibe'), 'can_view' => 1, 'action' => empty($nav['curriculum_slug']) ? __('curriculum', 'vibe') : $nav['curriculum_slug'], 'link' => bp_get_course_permalink()), 'members' => array('id' => 'members', 'label' => __('Members', 'vibe'), 'can_view' => 1, 'action' => empty($nav['members_slug']) ? __('members', 'vibe') : $nav['members_slug'], 'link' => bp_get_course_permalink()), 'activity' => array('id' => 'activity', 'label' => __('Activity', 'vibe'), 'can_view' => 1, 'action' => empty($nav['activity_slug']) ? __('activity', 'vibe') : $nav['activity_slug'], 'link' => bp_get_course_permalink()));
    global $post;
    if ($post->post_type == 'course') {
        if (function_exists('bp_is_active') && bp_is_active('groups')) {
            $vgroup = get_post_meta(get_the_ID(), 'vibe_group', true);
            if (!empty($vgroup)) {
                $group = groups_get_group(array('group_id' => $vgroup));
                $defaults['group'] = array('id' => 'group', 'label' => __('Group', 'vibe'), 'action' => 'group', 'can_view' => 1, 'link' => bp_get_group_permalink($group), 'external' => true);
            }
        }
        if (in_array('bbpress/bbpress.php', apply_filters('active_plugins', get_option('active_plugins'))) || function_exists('is_plugin_active_for_network') && is_plugin_active_for_network('bbpress/bbpress.php')) {
            $forum = get_post_meta(get_the_ID(), 'vibe_forum', true);
            if (!empty($forum)) {
                $defaults['forum'] = array('id' => 'forum', 'label' => __('Forum', 'vibe'), 'action' => 'forum', 'can_view' => 1, 'link' => get_permalink($forum), 'external' => true);
            }
        }
    }
    $nav_menu = apply_filters('wplms_course_nav_menu', $defaults);
    global $bp;
    $action = bp_current_action();
    if (empty($action)) {
        !empty($_GET['action']) ? $action = $_GET['action'] : ($action = '');
    }
    if (is_array($nav_menu)) {
        foreach ($nav_menu as $key => $menu_item) {
            $menu_item['action'] = str_replace('/', '', $menu_item['action']);
            if ($key == $action) {
                $class = 'class="current"';
            } else {
                $class = '';
            }
            global $wp_query;
            if (!empty($nav[$menu_item['id'] . '_slug'])) {
                echo '<li id="' . $menu_item['id'] . '" ' . $class . '><a href="' . $menu_item['link'] . '' . (isset($menu_item['action']) && !isset($menu_item['external']) ? $menu_item['action'] : '') . '">' . $menu_item['label'] . '</a></li>';
            } else {
                echo '<li id="' . $menu_item['id'] . '" ' . $class . '><a href="' . $menu_item['link'] . '' . (!empty($menu_item['action']) && !isset($menu_item['external']) ? (strpos($menu_item['link'], '?') ? '&' : '?') . 'action=' . $menu_item['action'] : '') . '">' . $menu_item['label'] . '</a></li>';
            }
        }
    }
    if (is_super_admin() || is_instructor()) {
        $admin_slug = empty($nav['admin_slug']) ? _x('admin', 'course admin slug', 'vibe') : $nav['admin_slug'];
        $admin_slug = apply_filters('wplms_course_admin_slug', str_replace('/', '', $admin_slug));
        ?>
      <li id="admin" class="<?php 
        echo !empty($action) && ($action == 'admin' || $action == 'submission' || $action == 'stats') ? 'selected current' : '';
        ?>
"><a href="<?php 
        bp_course_permalink();
        echo $admin_slug;
        ?>
"><?php 
        _e('Admin', 'vibe');
        ?>
</a></li>
      <?php 
    }
}
开发者ID:nikitansk,项目名称:devschool,代码行数:64,代码来源:bp-course-functions.php


示例4: post_review

 function post_review($args = '')
 {
     global $bp;
     $defaults = array('content' => false, 'rating' => false, 'user_id' => $bp->loggedin_user->id, 'group_id' => $bp->groups->current_group->id);
     $r = wp_parse_args($args, $defaults);
     extract($r, EXTR_SKIP);
     if (empty($content) || !strlen(trim($content)) || empty($user_id) || empty($group_id)) {
         return false;
     }
     // Be sure the user is a member of the group before posting.
     if (!is_super_admin() && !groups_is_user_member($user_id, $group_id)) {
         return false;
     }
     // Record this in activity streams
     $activity_action = sprintf(__('%s reviewed %s:', 'bpgr'), bp_core_get_userlink($user_id), '<a href="' . bp_get_group_permalink($bp->groups->current_group) . '">' . esc_html($bp->groups->current_group->name) . '</a>');
     $rating_content = false;
     if (!empty($rating)) {
         $rating_content = '<span class="p-rating">' . bpgr_get_review_rating_html($rating) . '</span>';
     }
     $activity_content = $rating_content . $content;
     $activity_id = groups_record_activity(array('user_id' => $user_id, 'action' => $activity_action, 'content' => $activity_content, 'type' => 'review', 'item_id' => $group_id));
     $this->add_rating(array('score' => $rating, 'activity_id' => $activity_id, 'group_id' => $group_id));
     groups_update_groupmeta($group_id, 'last_activity', gmdate("Y-m-d H:i:s"));
     do_action('bpgr_posted_review', $args, $activity_id);
     return $activity_id;
 }
开发者ID:adisonc,项目名称:MaineLearning,代码行数:26,代码来源:classes.php


示例5: cfbgr_enqueue_current_user_has_access

/**
 * Restrict access to a group regarding its 'member type'
 *
 * If a user is not logged in, he is redirected to the login form
 * If a user ! member type, he is redirected to the groups directory
 * If a user is a super admin, he can access
 *
 * @param  bool $user_has_access
 * @param  array &$no_access_args the redirect args
 * @return bool False if member type doesn't match, true otherwise
 */
function cfbgr_enqueue_current_user_has_access($user_has_access, &$no_access_args)
{
    // If the user does not already have access bail
    if (empty($user_has_access)) {
        return $user_has_access;
    }
    // Get the member type of the group
    $restriction = groups_get_groupmeta(bp_get_current_group_id(), 'cf-buddypress-group-restrictions');
    // Don't touch to regular groups and leave Admins access
    if (empty($restriction) || bp_current_user_can('bp_moderate')) {
        return $user_has_access;
    }
    $current_group = groups_get_current_group();
    if (!is_user_logged_in()) {
        $user_has_access = false;
        $no_access_args = array('message' => __('You must log in to access the page you requested.', 'buddypress-group-restrictions'), 'root' => bp_get_group_permalink($current_group) . 'home/', 'redirect' => false);
        return $user_has_access;
        // Current user does not match the restriction
    } elseif ($restriction !== bp_get_member_type(bp_loggedin_user_id())) {
        $user_has_access = false;
        // Get infos about the member type
        $member_type_object = bp_get_member_type_object($restriction);
        $singular_name = '';
        if (!empty($member_type_object->labels['singular_name'])) {
            $singular_name = $member_type_object->labels['singular_name'];
        }
        // You need to redirect to a BuddyPress page to have
        $no_access_args = array('mode' => 3, 'message' => sprintf(__('Sorry the group you tried to enter is only viewable for %s members', 'buddypress-group-restrictions'), esc_html($singular_name)), 'root' => bp_get_groups_directory_permalink(), 'redirect' => false);
        return $user_has_access;
    }
    // By default, leave BuddyPress deal with access
    return $user_has_access;
}
开发者ID:WeFoster,项目名称:buddypress-group-restrictions,代码行数:44,代码来源:functions.php


示例6: dispatch_creation_activity_update

 function dispatch_creation_activity_update($post_id)
 {
     if (!function_exists('bp_activity_get')) {
         return false;
     }
     // WTF
     $created = $this->_data->get_option('bp-activity_autoupdate-event_created');
     if (!$created) {
         return false;
     }
     $event = new Eab_EventModel(get_post($post_id));
     if (!$event->is_published()) {
         return false;
     }
     $user_link = bp_core_get_userlink($event->get_author());
     $update = false;
     $group_id = $this->_is_group_event($event->get_id());
     $public_announcement = $this->_is_public_announcement($event->get_id());
     if ('any' == $created) {
         $update = sprintf(__('%s created an event', Eab_EventsHub::TEXT_DOMAIN), $user_link);
     } else {
         if ('group' == $created && $group_id) {
             $group = groups_get_group(array('group_id' => $group_id));
             $group_link = bp_get_group_permalink($group);
             $group_name = bp_get_group_name($group);
             $update = sprintf(__('%s created an event in <a href="%s">%s</a>', Eab_EventsHub::TEXT_DOMAIN), $user_link, $group_link, $group_name);
         } else {
             if ('pa' == $created && $public_announcement) {
                 $update = sprintf(__('%s created a public announcement', Eab_EventsHub::TEXT_DOMAIN), $user_link);
             }
         }
     }
     if (!$update) {
         return false;
     }
     $update = sprintf("{$update}, <a href='%s'>%s</a>", get_permalink($event->get_id()), $event->get_title());
     $existing = bp_activity_get(array("filter" => array("object" => 'eab_events', "action" => 'event_created', 'primary_id' => $event->get_id())));
     if (isset($existing['activities']) && !empty($existing['activities'])) {
         return false;
     }
     $activity = array('action' => $update, 'component' => 'eab_events', 'type' => 'event_created', 'item_id' => $event->get_id(), 'user_id' => $event->get_author());
     bp_activity_add($activity);
     if ($this->_data->get_option('bp-activity_autoupdate-created_group_post') && $group_id) {
         global $bp;
         $group_activity = $activity;
         $group_activity['component'] = $bp->groups->id;
         $group_activity['item_id'] = $group_id;
         $group_activity['secondary_item_id'] = $event->get_id();
         $existing = bp_activity_get(array("filter" => array('user_id' => $user_id, "object" => $bp->groups->id, "action" => 'event_created', 'primary_id' => $group_id, 'secondary_id' => $event->get_id())));
         if (isset($existing['activities']) && !empty($existing['activities'])) {
             $old = reset($existing['activities']);
             if (is_object($old) && isset($old->id)) {
                 $group_activity['id'] = $old->id;
             }
         }
         // Add group activity update
         groups_record_activity($group_activity);
     }
 }
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:59,代码来源:eab-buddypres-activity.php


示例7: bp_forums_directory_forums_setup

/**
 * Load the Forums directory.
 */
function bp_forums_directory_forums_setup()
{
    // Get BuddyPress once
    $bp = buddypress();
    if (bp_is_forums_component() && (!bp_current_action() || 'tag' == bp_current_action() && bp_action_variables()) && !bp_current_item()) {
        if (!bp_forums_has_directory()) {
            return false;
        }
        if (!bp_forums_is_installed_correctly()) {
            bp_core_add_message(__('The forums component has not been set up yet.', 'buddypress'), 'error');
            bp_core_redirect(bp_get_root_domain());
        }
        bp_update_is_directory(true, 'forums');
        do_action('bbpress_init');
        // Check to see if the user has posted a new topic from the forums page.
        if (isset($_POST['submit_topic']) && bp_is_active('forums')) {
            check_admin_referer('bp_forums_new_topic');
            $bp->groups->current_group = groups_get_group(array('group_id' => $_POST['topic_group_id']));
            if (!empty($bp->groups->current_group->id)) {
                // Auto join this user if they are not yet a member of this group
                if (!bp_current_user_can('bp_moderate') && 'public' == $bp->groups->current_group->status && !groups_is_user_member(bp_loggedin_user_id(), $bp->groups->current_group->id)) {
                    groups_join_group($bp->groups->current_group->id);
                }
                $error_message = '';
                $forum_id = groups_get_groupmeta($bp->groups->current_group->id, 'forum_id');
                if (!empty($forum_id)) {
                    if (empty($_POST['topic_title'])) {
                        $error_message = __('Please provide a title for your forum topic.', 'buddypress');
                    } else {
                        if (empty($_POST['topic_text'])) {
                            $error_message = __('Forum posts cannot be empty. Please enter some text.', 'buddypress');
                        }
                    }
                    if ($error_message) {
                        bp_core_add_message($error_message, 'error');
                        $redirect = bp_get_group_permalink($bp->groups->current_group) . 'forum';
                    } else {
                        if (!($topic = groups_new_group_forum_topic($_POST['topic_title'], $_POST['topic_text'], $_POST['topic_tags'], $forum_id))) {
                            bp_core_add_message(__('There was an error when creating the topic', 'buddypress'), 'error');
                            $redirect = bp_get_group_permalink($bp->groups->current_group) . 'forum';
                        } else {
                            bp_core_add_message(__('The topic was created successfully', 'buddypress'));
                            $redirect = bp_get_group_permalink($bp->groups->current_group) . 'forum/topic/' . $topic->topic_slug . '/';
                        }
                    }
                    bp_core_redirect($redirect);
                } else {
                    bp_core_add_message(__('Please pick the group forum where you would like to post this topic.', 'buddypress'), 'error');
                    bp_core_redirect(add_query_arg('new', '', bp_get_forums_directory_permalink()));
                }
            } else {
                bp_core_add_message(__('Please pick the group forum where you would like to post this topic.', 'buddypress'), 'error');
                bp_core_redirect(add_query_arg('new', '', bp_get_forums_directory_permalink()));
            }
        }
        do_action('bp_forums_directory_forums_setup');
        bp_core_load_template(apply_filters('bp_forums_template_directory_forums_setup', 'forums/index'));
    }
}
开发者ID:danielcoats,项目名称:schoolpress,代码行数:62,代码来源:bp-forums-screens.php


示例8: bp_activity_action_permalink_router

/**
 * Catch and route requests for single activity item permalinks.
 *
 * @since 1.2.0
 *
 * @uses bp_is_activity_component()
 * @uses bp_is_current_action()
 * @uses bp_action_variable()
 * @uses bp_activity_get_specific()
 * @uses bp_is_active()
 * @uses bp_core_get_user_domain()
 * @uses groups_get_group()
 * @uses bp_get_group_permalink()
 * @uses apply_filters_ref_array() To call the 'bp_activity_permalink_redirect_url' hook.
 * @uses bp_core_redirect()
 * @uses bp_get_root_domain()
 *
 * @return bool False on failure.
 */
function bp_activity_action_permalink_router()
{
    // Not viewing activity.
    if (!bp_is_activity_component() || !bp_is_current_action('p')) {
        return false;
    }
    // No activity to display.
    if (!bp_action_variable(0) || !is_numeric(bp_action_variable(0))) {
        return false;
    }
    // Get the activity details.
    $activity = bp_activity_get_specific(array('activity_ids' => bp_action_variable(0), 'show_hidden' => true));
    // 404 if activity does not exist
    if (empty($activity['activities'][0])) {
        bp_do_404();
        return;
    } else {
        $activity = $activity['activities'][0];
    }
    // Do not redirect at default.
    $redirect = false;
    // Redirect based on the type of activity.
    if (bp_is_active('groups') && $activity->component == buddypress()->groups->id) {
        // Activity is a user update.
        if (!empty($activity->user_id)) {
            $redirect = bp_core_get_user_domain($activity->user_id, $activity->user_nicename, $activity->user_login) . bp_get_activity_slug() . '/' . $activity->id . '/';
            // Activity is something else.
        } else {
            // Set redirect to group activity stream.
            if ($group = groups_get_group(array('group_id' => $activity->item_id))) {
                $redirect = bp_get_group_permalink($group) . bp_get_activity_slug() . '/' . $activity->id . '/';
            }
        }
        // Set redirect to users' activity stream.
    } elseif (!empty($activity->user_id)) {
        $redirect = bp_core_get_user_domain($activity->user_id, $activity->user_nicename, $activity->user_login) . bp_get_activity_slug() . '/' . $activity->id . '/';
    }
    // If set, add the original query string back onto the redirect URL.
    if (!empty($_SERVER['QUERY_STRING'])) {
        $query_frags = array();
        wp_parse_str($_SERVER['QUERY_STRING'], $query_frags);
        $redirect = add_query_arg(urlencode_deep($query_frags), $redirect);
    }
    /**
     * Filter the intended redirect url before the redirect occurs for the single activity item.
     *
     * @since 1.2.2
     *
     * @param array $value Array with url to redirect to and activity related to the redirect.
     */
    if (!($redirect = apply_filters_ref_array('bp_activity_permalink_redirect_url', array($redirect, &$activity)))) {
        bp_core_redirect(bp_get_root_domain());
    }
    // Redirect to the actual activity permalink page.
    bp_core_redirect($redirect);
}
开发者ID:swissspidy,项目名称:BuddyPress,代码行数:75,代码来源:bp-activity-actions.php


示例9: cacsp_format_activity_action

/**
 * Format activity actions.
 *
 * @param string $action   Activity action as determined by BuddyPress.
 * @param obj    $activity Activity item.
 * @return string
 */
function cacsp_format_activity_action($action, $activity)
{
    $paper = new CACSP_Paper($activity->secondary_item_id);
    $paper_id = $paper->ID;
    if (!$paper_id) {
        return $action;
    }
    $paper_title = $paper->post_title;
    $paper_link = get_permalink($paper->ID);
    $user_link = bp_core_get_userlink($activity->user_id);
    switch ($activity->type) {
        case 'new_cacsp_paper':
            $action = sprintf(__('%1$s created a new paper %2$s', 'social-paper'), $user_link, sprintf('<a href="%s">%s</a>', esc_url($paper_link), esc_html($paper_title)));
            break;
        case 'new_cacsp_comment':
            $comment = get_comment($activity->item_id);
            if (!$comment) {
                return $action;
            }
            if ($comment->user_id) {
                $commenter_link = bp_core_get_userlink($comment->user_id);
            } elseif ($comment->comment_author_url) {
                $commenter_link = sprintf('<a href="%s">%s</a>', esc_url($comment->comment_author_url), esc_html($comment->comment_author));
            } else {
                $commenter_link = esc_html($comment->comment_author);
            }
            $action = sprintf(__('%1$s commented on the paper %2$s', 'social-paper'), $commenter_link, sprintf('<a href="%s">%s</a>', esc_url($paper_link), esc_html($paper_title)));
            break;
        case 'new_cacsp_edit':
            $action = sprintf(__('%1$s edited the paper %2$s', 'social-paper'), $user_link, sprintf('<a href="%s">%s</a>', esc_url($paper_link), esc_html($paper_title)));
            break;
        case 'cacsp_paper_added_to_group':
            if (!bp_is_active('groups')) {
                return $action;
            }
            $group = groups_get_group(array('group_id' => $activity->item_id));
            $action = sprintf(__('%1$s added the paper %2$s to the group %3$s', 'social-paper'), $user_link, sprintf('<a href="%s">%s</a>', esc_url($paper_link), esc_html($paper_title)), sprintf('<a href="%s">%s</a>', esc_url(bp_get_group_permalink($group)), esc_html(stripslashes($group->name))));
            break;
        default:
            return $action;
    }
    /**
     * Filters the formatted action for paper activities.
     *
     * Used by hooks-buddypress-groups.php to add group information.
     *
     * @param string      $action      Formatted action string.
     * @param obj         $activity    Activity item.
     * @param CACSP_Paper $paper       Paper object.
     * @param string      $paper_title Paper title.
     * @param string      $paper_link  Paper URL.
     * @param string      $user_link   User link.
     */
    return apply_filters('cacsp_format_activity_action', $action, $activity, $paper, $paper_title, $paper_link, $user_link);
}
开发者ID:sheesh,项目名称:social-paper,代码行数:62,代码来源:hooks-buddypress-activity.php


示例10: bp_gmt_get_form_action

function bp_gmt_get_form_action($page = false, $group = false)
{
    global $bp, $groups_template;
    if (!$group) {
        $group =& $groups_template->group;
    }
    if (!$page) {
        $page = $bp->action_variables[0];
    }
    return apply_filters('bp_gtm_form_action', bp_get_group_permalink($group) . $bp->gtm->slug . '/' . $page);
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:11,代码来源:bp-gtm-functions.php


示例11: set_nav

 /**
  * set_nav()
  *
  * Sets up the component navigation
  */
 function set_nav()
 {
     global $bp;
     if (!$bp->groups->current_group || !$this->courseware_status($bp->groups->current_group->id)) {
         return;
     }
     $group_permalink = bp_get_group_permalink($bp->groups->current_group);
     bp_core_new_subnav_item(array('name' => __('Courseware', 'bpsp'), 'slug' => $bp->courseware->slug, 'parent_url' => $group_permalink, 'parent_slug' => $bp->groups->current_group->slug, 'screen_function' => array(&$this, 'screen_handler'), 'position' => 35, 'user_has_access' => $bp->groups->current_group->user_has_access, 'item_css_id' => 'courseware-group'));
     $this->nav_options[__('Home', 'bpsp')] = $group_permalink . $bp->courseware->slug;
     do_action('courseware_group_set_nav');
 }
开发者ID:nxtclass,项目名称:NXTClass,代码行数:16,代码来源:groups.class.php


示例12: bp_activity_action_permalink_router

/**
 * Allow core components and dependent plugins to register activity actions
 *
 * @since BuddyPress (1.2)
 *
 * @global object $bp BuddyPress global settings
 * @uses bp_is_activity_component()
 * @uses bp_is_current_action()
 * @uses bp_action_variable()
 * @uses bp_activity_get_specific()
 * @uses bp_is_active()
 * @uses bp_core_get_user_domain()
 * @uses groups_get_group()
 * @uses bp_get_group_permalink()
 * @uses apply_filters_ref_array() To call the 'bp_activity_permalink_redirect_url' hook
 * @uses bp_core_redirect()
 * @uses bp_get_root_domain()
 *
 * @return bool False on failure
 */
function bp_activity_action_permalink_router()
{
    global $bp;
    // Not viewing activity
    if (!bp_is_activity_component() || !bp_is_current_action('p')) {
        return false;
    }
    // No activity to display
    if (!bp_action_variable(0) || !is_numeric(bp_action_variable(0))) {
        return false;
    }
    // Get the activity details
    $activity = bp_activity_get_specific(array('activity_ids' => bp_action_variable(0), 'show_hidden' => true));
    // 404 if activity does not exist
    if (empty($activity['activities'][0])) {
        bp_do_404();
        return;
    } else {
        $activity = $activity['activities'][0];
    }
    // Do not redirect at default
    $redirect = false;
    // Redirect based on the type of activity
    if (bp_is_active('groups') && $activity->component == $bp->groups->id) {
        // Activity is a user update
        if (!empty($activity->user_id)) {
            $redirect = bp_core_get_user_domain($activity->user_id, $activity->user_nicename, $activity->user_login) . bp_get_activity_slug() . '/' . $activity->id . '/';
            // Activity is something else
        } else {
            // Set redirect to group activity stream
            if ($group = groups_get_group(array('group_id' => $activity->item_id))) {
                $redirect = bp_get_group_permalink($group) . bp_get_activity_slug() . '/' . $activity->id . '/';
            }
        }
        // Set redirect to users' activity stream
    } else {
        $redirect = bp_core_get_user_domain($activity->user_id, $activity->user_nicename, $activity->user_login) . bp_get_activity_slug() . '/' . $activity->id . '/';
    }
    // If set, add the original query string back onto the redirect URL
    if (!empty($_SERVER['QUERY_STRING'])) {
        $query_frags = array();
        wp_parse_str($_SERVER['QUERY_STRING'], $query_frags);
        $redirect = add_query_arg(urlencode_deep($query_frags), $redirect);
    }
    // Allow redirect to be filtered
    if (!($redirect = apply_filters_ref_array('bp_activity_permalink_redirect_url', array($redirect, &$activity)))) {
        bp_core_redirect(bp_get_root_domain());
    }
    // Redirect to the actual activity permalink page
    bp_core_redirect($redirect);
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:71,代码来源:bp-activity-actions.php


示例13: bp_reshare_prepare_reshare

function bp_reshare_prepare_reshare($activity_id)
{
    global $bp;
    $activity_to_reshare = bp_activity_get_specific('activity_ids=' . $activity_id);
    $activity = $activity_to_reshare['activities'][0];
    /* get and increment reshared count */
    $rs_count = bp_activity_get_meta($activity_id, 'reshared_count');
    $rs_count = !empty($rs_count) ? (int) $rs_count + 1 : 1;
    bp_activity_update_meta($activity_id, 'reshared_count', $rs_count);
    /* get an array of users that reshared the activity */
    $reshared_by = bp_activity_get_meta($activity_id, 'reshared_by');
    if (is_array($reshared_by) && !in_array($bp->loggedin_user->id, $reshared_by)) {
        $reshared_by[] = $bp->loggedin_user->id;
    } else {
        $reshared_by[] = $bp->loggedin_user->id;
    }
    bp_activity_update_meta($activity_id, 'reshared_by', $reshared_by);
    $secondary_avatar = bp_core_fetch_avatar(array('item_id' => $activity->user_id, 'object' => 'user', 'type' => 'thumb', 'alt' => $alt, 'class' => 'avatar', 'width' => 20, 'height' => 20));
    $component = $activity->component;
    $item_id = $activity->item_id;
    if ($component != 'activity') {
        if ($activity->type == 'new_blog_post') {
            $action = sprintf(__('%s reshared a <a href="%s">blog post</a> originally posted by %s', 'bp-reshare'), bp_core_get_userlink($bp->loggedin_user->id), $activity->primary_link, $secondary_avatar . bp_core_get_userlink($activity->user_id));
        } else {
            if ($activity->type == 'new_blog_comment') {
                $action = sprintf(__('%s reshared a <a href="%s">comment</a> originally posted by %s', 'bp-reshare'), bp_core_get_userlink($bp->loggedin_user->id), $activity->primary_link, $secondary_avatar . bp_core_get_userlink($activity->user_id));
            } else {
                if ($component == 'groups') {
                    $group = groups_get_group(array('group_id' => $item_id));
                    $group_link = '<a href="' . bp_get_group_permalink($group) . '">' . $group->name . '</a>';
                    if ($activity->type == 'new_forum_topic') {
                        $action = sprintf(__('%s reshared a <a href="%s">forum topic</a> originally posted by %s in the group %s', 'bp-reshare'), bp_core_get_userlink($bp->loggedin_user->id), $activity->primary_link, $secondary_avatar . bp_core_get_userlink($activity->user_id), $group_link);
                    } else {
                        if ($activity->type == 'new_forum_post') {
                            $action = sprintf(__('%s reshared a <a href="%s">forum reply</a> originally posted by %s in the group %s', 'bp-reshare'), bp_core_get_userlink($bp->loggedin_user->id), $activity->primary_link, $secondary_avatar . bp_core_get_userlink($activity->user_id), $group_link);
                        } else {
                            $action = sprintf(__("%s reshared an activity originally shared by %s in the group %s", 'bp-reshare'), bp_core_get_userlink($bp->loggedin_user->id), $secondary_avatar . bp_core_get_userlink($activity->user_id), $group_link);
                        }
                    }
                }
            }
        }
    } else {
        $action = sprintf(__("%s reshared an activity originally shared by %s", 'bp-reshare'), bp_core_get_userlink($bp->loggedin_user->id), $secondary_avatar . bp_core_get_userlink($activity->user_id));
    }
    $reshared_args = array('action' => apply_filters('bp_reshare_action_parent_activity', $action, $activity->type), 'content' => $activity->content, 'component' => $component, 'type' => 'reshare_update', 'user_id' => $bp->loggedin_user->id, 'secondary_item_id' => $activity_id, 'recorded_time' => bp_core_current_time(), 'hide_sitewide' => $activity->hide_sitewide);
    if (!empty($item_id)) {
        $reshared_args['item_id'] = $item_id;
    }
    return apply_filters('bp_reshare_prepare_reshare', $reshared_args, $activity_id);
}
开发者ID:KristianI,项目名称:bp-reshare,代码行数:51,代码来源:bp-reshare-functions.php


示例14: mpp_get_gallery_base_url

/**
 * Get the base url for the component gallery home page
 * e.g http://site.com/members/user-name/gallery //without any trailing slash
 * 
 * @param type $component
 * @return type
 * 
 * @todo In future, avoid dependecy on BuddyPress
 * 
 */
function mpp_get_gallery_base_url($component, $component_id)
{
    $base_url = '';
    if ($component == 'members') {
        $base_url = mpp_get_user_url($component_id) . MPP_GALLERY_SLUG;
    } elseif ($component == 'groups' && function_exists('bp_get_group_permalink')) {
        $base_url = bp_get_group_permalink(new BP_Groups_Group($component_id)) . MPP_GALLERY_SLUG;
    }
    //for admin new/edit gallery, specially new gallery
    if (!$base_url && (empty($component) || empty($component_id))) {
        $base_url = mpp_get_user_url(get_current_user_id()) . MPP_GALLERY_SLUG;
    }
    return apply_filters('mpp_get_gallery_base_url', untrailingslashit($base_url), $component, $component_id);
}
开发者ID:enboig,项目名称:mediapress,代码行数:24,代码来源:mpp-gallery-link-template.php


示例15: setup_nav

 public function setup_nav($current_user_access)
 {
     $bp = buddypress();
     if (!bp_is_group()) {
         return;
     }
     $group_id = bp_get_current_group_id();
     if (bcg_is_disabled($group_id)) {
         return;
     }
     $current_group = groups_get_current_group();
     $group_link = bp_get_group_permalink($current_group);
     bp_core_new_subnav_item(array('name' => __('Blog', 'blog-categories-for-groups'), 'slug' => BCG_SLUG, 'parent_url' => $group_link, 'parent_slug' => $current_group->slug, 'screen_function' => array($this, 'display'), 'position' => 10, 'user_has_access' => $current_user_access, 'item_css_id' => 'blog'));
 }
开发者ID:WP--plugins,项目名称:blog-categories-for-groups,代码行数:14,代码来源:bcg-screens.php


示例16: test_group_nav

 public function test_group_nav()
 {
     $bp_nav = buddypress()->bp_nav;
     $u = $this->factory->user->create();
     $g = $this->factory->group->create();
     $old_current_user = get_current_user_id();
     $this->set_current_user($u);
     $group = groups_get_group(array('group_id' => $g));
     $this->go_to(bp_get_group_permalink($group));
     $this->assertTrue(buddypress()->bp_nav[$group->slug]['position'] === -1);
     // Clean up
     buddypress()->bp_nav = $bp_nav;
     $this->set_current_user($old_current_user);
 }
开发者ID:jasonmcalpin,项目名称:BuddyPress,代码行数:14,代码来源:bpCoreNewNavItem.php


示例17: buddydrive_get_group_buddydrive_url

/**
 * Builds the BuddyDrive Group url
 *
 * @param integer $group_id the group id
 * @uses groups_get_group to get group datas
 * @uses groups_get_current_group() if no id was given to get current group datas
 * @uses bp_get_group_permalink() to build the group permalink
 * @uses buddydrive_get_slug() to get the BuddyDrive slug to end to the group url
 * @return string $buddydrive_link the link to user's BuddyDrive
 */
function buddydrive_get_group_buddydrive_url($group_id = 0)
{
    $buddydrive_link = false;
    if (!empty($group_id)) {
        $group = groups_get_group(array('group_id' => $group_id));
    } else {
        $group = groups_get_current_group();
    }
    if (!empty($group)) {
        $group_link = bp_get_group_permalink($group);
        $buddydrive_link = trailingslashit($group_link . buddydrive_get_slug());
    }
    return $buddydrive_link;
}
开发者ID:MrVibe,项目名称:buddydrive,代码行数:24,代码来源:buddydrive-item-functions.php


示例18: bp_group_documents_record_activity

/**
 * bp_group_documents_record_activity()
 *
 * If the activity stream component is installed, this function will record upload
 * and edit activity items.
 */
function bp_group_documents_record_activity($args = '')
{
    global $bp;
    if (!function_exists('bp_activity_add')) {
        return false;
    }
    $defaults = array( 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP bp_get_group_request_accept_link函数代码示例发布时间:2022-05-24
下一篇:
PHP bp_get_group_name函数代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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