本文整理汇总了PHP中bp_current_action函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_current_action函数的具体用法?PHP bp_current_action怎么用?PHP bp_current_action使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_current_action函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bp_course_add_js
function bp_course_add_js()
{
global $bp;
if (!function_exists('vibe_logo_url')) {
return;
}
// Checks if WPLMS is active in current site in WP Multisite
wp_enqueue_script('bp-extras-js', plugins_url('/vibe-course-module/includes/js/course-module-js.min.js'), array('jquery'), bp_course_version(), true);
if (function_exists('vibe_get_option')) {
if (is_singular('unit') || is_singular('question') || is_singular('quiz') || is_singular('wplms-assignment') || is_page(vibe_get_option('take_course_page')) || is_page(vibe_get_option('create_course')) || isset($_GET['edit'])) {
wp_enqueue_script('jquery-ui-core');
wp_enqueue_script('jquery-ui-sortable');
wp_enqueue_script('jquery-ui-droppable');
wp_enqueue_script('jquery-ui-datepicker');
wp_enqueue_script('knob-js', plugins_url('/vibe-course-module/includes/js/jquery.knob.min.js'));
}
}
if (function_exists('bp_is_directory')) {
if (bp_is_directory() && bp_current_component() == 'course') {
wp_enqueue_script('jquery-ui-datepicker');
}
}
$action = bp_current_action();
if (isset($_GET['action'])) {
$action = $_GET['action'];
}
if (in_array($action, array('admin', 'submissions', 'stats'))) {
wp_enqueue_script('knob-js', plugins_url('/vibe-course-module/includes/js/jquery.knob.min.js'));
}
wp_enqueue_script('bp-course-js', plugins_url('/vibe-course-module/includes/js/course.js'), array('jquery', 'wp-mediaelement', 'buddypress-js'), bp_course_version(), true);
$color = bp_wplms_get_theme_color();
$single_dark_color = bp_wplms_get_theme_single_dark_color();
$translation_array = array('too_fast_answer' => _x('Too Fast or Answer not marked.', 'Quiz answer being marked very fast', 'vibe'), 'answer_saved' => _x('Answer Saved.', 'Save answer on every question, confirmation message', 'vibe'), 'processing' => _x('Processing...', 'Quiz question anwer save under progress', 'vibe'), 'saving_answer' => _x('Saving Answer...please wait', 'Saving quiz answers under progress', 'vibe'), 'remove_user_text' => __('This step is irreversible. Are you sure you want to remove the User from the course ?', 'vibe'), 'remove_user_button' => __('Confirm, Remove User from Course', 'vibe'), 'confirm' => _x('Confirm', 'Confirm button for various popup confirmation messages', 'vibe'), 'cancel' => _x('Cancel', 'Cancel button for various popup confirmation messages', 'vibe'), 'reset_user_text' => __('This step is irreversible. All Units, Quiz results would be reset for this user. Are you sure you want to Reset the Course for this User?', 'vibe'), 'reset_user_button' => __('Confirm, Reset Course for this User', 'vibe'), 'quiz_reset' => __('This step is irreversible. All Questions answers would be reset for this user. Are you sure you want to Reset the Quiz for this User? ', 'vibe'), 'quiz_reset_button' => __('Confirm, Reset Quiz for this User', 'vibe'), 'marks_saved' => __('Marks Saved', 'vibe'), 'quiz_marks_saved' => __('Quiz Marks Saved', 'vibe'), 'submit_quiz' => __('Submit Quiz', 'vibe'), 'sending_messages' => __('Sending Messages ...', 'vibe'), 'adding_students' => __('Adding Students to Course ...', 'vibe'), 'successfuly_added_students' => __('Students successfully added to Course', 'vibe'), 'unable_add_students' => __('Unable to Add students to Course', 'vibe'), 'select_fields' => __('Please select fields to download', 'vibe'), 'download' => __('Download', 'vibe'), 'timeout' => __('TIMEOUT', 'vibe'), 'theme_color' => $color, 'single_dark_color' => $single_dark_color, 'for_course' => __('for Course', 'vibe'), 'active_filters' => __('Active Filters', 'vibe'), 'clear_filters' => __('Clear all filters', 'vibe'), 'remove_comment' => __('Are you sure you want to remove this note?', 'vibe'), 'remove_comment_button' => __('Confirm, remove note', 'vibe'), 'private_comment' => __('Make Private', 'vibe'), 'add_comment' => __('Add your note', 'vibe'), 'submit_quiz_error' => __('Please add questions or retake the quiz !', 'vibe'), 'remove_announcement' => __('Are you sure you want to remove this Annoucement?', 'vibe'), 'start_quiz_notification' => __('You\'re about to start the Quiz. Please click confirm to begin the quiz.', 'vibe'), 'submit_quiz_notification' => __('Are you sure you want to submit the quiz. Submitting the quiz will freeze all your answers, you can not change them. Please confirm.', 'vibe'), 'check_results' => __('Check results', 'vibe'), 'correct' => __('Correct', 'vibe'), 'incorrect' => __('Incorrect', 'vibe'), 'confirm_apply' => _x('Are you sure you want to apply for this Course ?', 'confirmation message when user clicks on apply for course', 'vibe'), 'instructor_uncomplete_unit' => _x('Are you sure you want mark this unit "uncomplete" for the user ?', 'Popup confirmation message when instructor marks the unit uncomplete for the user.', 'vibe'), 'instructor_complete_unit' => _x('Are you sure you want to mark this unit "complete" for the user ?', 'Popup confirmation message ', 'vibe'), 'unanswered_questions' => __('You have few unanswered questions. Are you sure you want to continue ?', 'vibe'));
wp_localize_script('bp-course-js', 'vibe_course_module_strings', $translation_array);
}
示例2: user_profile_url
/**
* Override bbPress profile URL with BuddyPress profile URL
*
* @since bbPress (r3401)
* @param string $url
* @param int $user_id
* @param string $user_nicename
* @return string
*/
public function user_profile_url($user_id)
{
// Define local variable(s)
$profile_url = '';
// Special handling for forum component
if (bp_is_current_component('forums')) {
// Empty action or 'topics' action
if (!bp_current_action() || bp_is_current_action('topics')) {
$profile_url = bp_core_get_user_domain($user_id) . 'forums/topics';
// Empty action or 'topics' action
} elseif (bp_is_current_action('replies')) {
$profile_url = bp_core_get_user_domain($user_id) . 'forums/replies';
// 'favorites' action
} elseif (bbp_is_favorites_active() && bp_is_current_action('favorites')) {
$profile_url = $this->get_favorites_permalink('', $user_id);
// 'subscriptions' action
} elseif (bbp_is_subscriptions_active() && bp_is_current_action('subscriptions')) {
$profile_url = $this->get_subscriptions_permalink('', $user_id);
}
// Not in users' forums area
} else {
$profile_url = bp_core_get_user_domain($user_id);
}
return trailingslashit($profile_url);
}
示例3: bp_follow_add_activity_scope_filter
/**
* Filter the activity loop when we're on a "Following" page
*
* This is done:
* - On the activity directory and clicking on the "Following" tab
* - On a user's "Activity > Following" page
*
* @since 1.0.0
*
* @param string|array Current activity querystring
* @param string $object The current object or component
* @return array
*/
function bp_follow_add_activity_scope_filter($qs, $object)
{
global $bp;
// not on the activity object? stop now!
if ($object != 'activity') {
return $qs;
}
$set = false;
// activity directory
// can't use bp_is_activity_directory() yet since that's a BP 2.0 function
if (!bp_displayed_user_id() && bp_is_activity_component() && !bp_current_action()) {
// check if activity scope is following before manipulating
if (isset($_COOKIE['bp-activity-scope']) && 'following' === $_COOKIE['bp-activity-scope']) {
$set = true;
}
// user's activity following page
} elseif (bp_is_user_activity() && bp_is_current_action('following')) {
$set = true;
}
// not on a user page? stop now!
if (!$set) {
return $qs;
}
// set internal marker noting that our activity scope is applied
$bp->follow->activity_scope_set = 1;
$qs = wp_parse_args($qs);
$following_ids = bp_get_following_ids(array('user_id' => bp_displayed_user_id() ? bp_displayed_user_id() : bp_loggedin_user_id()));
// if $following_ids is empty, pass a negative number so no activity can be found
$following_ids = empty($following_ids) ? -1 : $following_ids;
$qs['user_id'] = $following_ids;
return apply_filters('bp_follow_add_activity_scope_filter', $qs, false);
}
示例4: bebop_feeds
function bebop_feeds()
{
global $bp, $wp_query, $this_bp_feed;
if (bp_is_activity_component()) {
$active_extensions = bebop_extensions::bebop_get_active_extension_names();
$active_extensions[] = 'all_oers';
foreach ($active_extensions as $extension) {
if (bp_current_action() == $extension) {
if ($extension == 'all_oers') {
$this_bp_feed = $extension;
} else {
if (bebop_tables::check_option_exists('bebop_' . $extension . '_rss_feed')) {
if (bebop_tables::get_option_value('bebop_' . $extension . '_rss_feed') == 'on') {
$this_bp_feed = $extension;
}
}
}
}
}
}
if (empty($this_bp_feed)) {
return false;
}
$wp_query->is_404 = false;
status_header(200);
include_once 'templates/user/bebop-feed-template.php';
die;
}
示例5: friends_screen_requests
/**
* Catch and process the Requests page.
*/
function friends_screen_requests()
{
if (bp_is_action_variable('accept', 0) && is_numeric(bp_action_variable(1))) {
// Check the nonce
check_admin_referer('friends_accept_friendship');
if (friends_accept_friendship(bp_action_variable(1))) {
bp_core_add_message(__('Friendship accepted', 'buddypress'));
} else {
bp_core_add_message(__('Friendship could not be accepted', 'buddypress'), 'error');
}
bp_core_redirect(trailingslashit(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action()));
} elseif (bp_is_action_variable('reject', 0) && is_numeric(bp_action_variable(1))) {
// Check the nonce
check_admin_referer('friends_reject_friendship');
if (friends_reject_friendship(bp_action_variable(1))) {
bp_core_add_message(__('Friendship rejected', 'buddypress'));
} else {
bp_core_add_message(__('Friendship could not be rejected', 'buddypress'), 'error');
}
bp_core_redirect(trailingslashit(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action()));
} elseif (bp_is_action_variable('cancel', 0) && is_numeric(bp_action_variable(1))) {
// Check the nonce
check_admin_referer('friends_withdraw_friendship');
if (friends_withdraw_friendship(bp_loggedin_user_id(), bp_action_variable(1))) {
bp_core_add_message(__('Friendship request withdrawn', 'buddypress'));
} else {
bp_core_add_message(__('Friendship request could not be withdrawn', 'buddypress'), 'error');
}
bp_core_redirect(trailingslashit(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action()));
}
do_action('friends_screen_requests');
bp_core_load_template(apply_filters('friends_template_requests', 'members/single/home'));
}
示例6: is_blogs
/**
* Are we looking at something that needs Blogs theme compatibility?
*
* @since 1.7.0
*/
public function is_blogs()
{
// Bail if not looking at a group.
if (!bp_is_blogs_component()) {
return;
}
// Bail if looking at a users sites.
if (bp_is_user()) {
return;
}
// Blog Directory.
if (is_multisite() && !bp_current_action()) {
bp_update_is_directory(true, 'blogs');
/**
* Fires if in the blog directory and BuddyPress needs Blog theme compatibility,
* before the actions and filters are added.
*
* @since 1.5.0
*/
do_action('bp_blogs_screen_index');
add_filter('bp_get_buddypress_template', array($this, 'directory_template_hierarchy'));
add_action('bp_template_include_reset_dummy_post_data', array($this, 'directory_dummy_post'));
add_filter('bp_replace_the_content', array($this, 'directory_content'));
// Create blog.
} elseif (is_user_logged_in() && bp_blog_signup_enabled()) {
add_filter('bp_get_buddypress_template', array($this, 'create_template_hierarchy'));
add_action('bp_template_include_reset_dummy_post_data', array($this, 'create_dummy_post'));
add_filter('bp_replace_the_content', array($this, 'create_content'));
}
}
示例7: friends_screen_requests
function friends_screen_requests()
{
if (bp_is_action_variable('accept', 0) && is_numeric(bp_action_variable(1))) {
// Check the nonce
check_admin_referer('friends_accept_friendship');
if (friends_accept_friendship(bp_action_variable(1))) {
bp_core_add_message(__('Friendship accepted', 'buddypress'));
} else {
bp_core_add_message(__('Friendship could not be accepted', 'buddypress'), 'error');
}
bp_core_redirect(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action());
} elseif (bp_is_action_variable('reject', 0) && is_numeric(bp_action_variable(1))) {
// Check the nonce
check_admin_referer('friends_reject_friendship');
if (friends_reject_friendship(bp_action_variable(1))) {
bp_core_add_message(__('Friendship rejected', 'buddypress'));
} else {
bp_core_add_message(__('Friendship could not be rejected', 'buddypress'), 'error');
}
bp_core_redirect(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action());
}
do_action('friends_screen_requests');
if (isset($_GET['new'])) {
bp_core_delete_notifications_by_type(bp_loggedin_user_id(), 'friends', 'friendship_request');
}
bp_core_load_template(apply_filters('friends_template_requests', 'members/single/home'));
}
示例8: bp_core_action_set_spammer_status
/**
* Catch a "Mark as Spammer/Not Spammer" click from the toolbar.
*
* When a site admin selects "Mark as Spammer/Not Spammer" from the admin menu
* this action will fire and mark or unmark the user and their blogs as spam.
* Must be a site admin for this function to run.
*
* Note: no longer used in the current state. See the Settings component.
*
* @param int $user_id Optional. User ID to mark as spam. Defaults to displayed
* user.
*/
function bp_core_action_set_spammer_status($user_id = 0)
{
// Only super admins can currently spam users (but they can't spam
// themselves)
if (!is_super_admin() || bp_is_my_profile()) {
return;
}
// Use displayed user if it's not yourself
if (empty($user_id)) {
$user_id = bp_displayed_user_id();
}
if (bp_is_current_component('admin') && in_array(bp_current_action(), array('mark-spammer', 'unmark-spammer'))) {
// Check the nonce
check_admin_referer('mark-unmark-spammer');
// To spam or not to spam
$status = bp_is_current_action('mark-spammer') ? 'spam' : 'ham';
// The heavy lifting
bp_core_process_spammer_status($user_id, $status);
// Add feedback message. @todo - Error reporting
if ('spam' == $status) {
bp_core_add_message(__('User marked as spammer. Spam users are visible only to site admins.', 'buddypress'));
} else {
bp_core_add_message(__('User removed as spammer.', 'buddypress'));
}
// Deprecated. Use bp_core_process_spammer_status.
$is_spam = 'spam' == $status;
do_action('bp_core_action_set_spammer_status', bp_displayed_user_id(), $is_spam);
// Redirect back to where we came from
bp_core_redirect(wp_get_referer());
}
}
示例9: bp_blogs_screen_index
function bp_blogs_screen_index()
{
if (is_multisite() && bp_is_blogs_component() && !bp_current_action()) {
bp_update_is_directory(true, 'blogs');
do_action('bp_blogs_screen_index');
bp_core_load_template(apply_filters('bp_blogs_screen_index', 'blogs/index'));
}
}
示例10: bp_portfolio_directory_setup
/**
* Load the index page
*/
function bp_portfolio_directory_setup()
{
if (bp_is_portfolio_component() && !bp_current_action() && !bp_current_item()) {
bp_update_is_directory(true, 'portfolio');
do_action('bp_portfolio_directory_setup');
bp_core_load_template(apply_filters('portfolio_directory_template', BP_PORTFOLIO_TEMPLATE . '/index'));
}
}
示例11: bp_forums_directory_forums_setup
function bp_forums_directory_forums_setup()
{
global $bp;
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 (!is_super_admin() && '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'));
}
}
示例12: wplms_assignments_enqueue_scripts
function wplms_assignments_enqueue_scripts()
{
if (is_singular('wplms-assignment') || isset($_GET['action']) && $_GET['action'] == 'admin' && isset($_GET['submissions']) || bp_current_action() == 'submissions') {
wp_enqueue_style('wplms-assignments-css', plugins_url('css/wplms-assignments.css', __FILE__));
wp_enqueue_script('wplms-assignments-js', plugins_url('js/wplms-assignments.js', __FILE__));
$translation_array = array('assignment_reset' => __('This step is irreversible. All Assignment submissions would be reset for this user. Are you sure you want to Reset the Assignment for this User? ', 'wplms-assignments'), 'assignment_reset_button' => __('Confirm, Assignment reset for this User', 'wplms-assignments'), 'marks_saved' => __('Marks Saved', 'wplms-assignments'), 'assignment_marks_saved' => __('Assignment Marks Saved', 'wplms-assignments'), 'cancel' => __('Cancel', 'wplms-assignments'), 'incorrect_file_format' => __('Incorrect file format ', 'wplms-assignments'), 'duplicate_file' => __('File already selected ', 'wplms-assignments'));
wp_localize_script('wplms-assignments-js', 'wplms_assignment_messages', $translation_array);
}
}
示例13: buddyblog_get_editable_post_id
/**
* Get the current editable post id
*
* Used with buddyPress simple front end post editing plugin
*
* @return int id of the post to edit
*/
function buddyblog_get_editable_post_id($id)
{
$action = bp_current_action();
if (bp_is_buddyblog_component() && $action == 'edit') {
$id = bp_action_variable(0);
}
return intval($id);
//intval or absint?
}
示例14: bp_core_new_nav_item
/**
* Adds a navigation item to the main navigation array used in BuddyPress themes.
*
* @package BuddyPress Core
* @global object $bp Global BuddyPress settings object
*/
function bp_core_new_nav_item($args = '')
{
global $bp;
$defaults = array('name' => false, 'slug' => false, 'item_css_id' => false, 'show_for_displayed_user' => true, 'site_admin_only' => false, 'position' => 99, 'screen_function' => false, 'default_subnav_slug' => false);
$r = nxt_parse_args($args, $defaults);
extract($r, EXTR_SKIP);
// If we don't have the required info we need, don't create this subnav item
if (empty($name) || empty($slug)) {
return false;
}
// If this is for site admins only and the user is not one, don't create the subnav item
if ($site_admin_only && !is_super_admin()) {
return false;
}
if (empty($item_css_id)) {
$item_css_id = $slug;
}
$bp->bp_nav[$slug] = array('name' => $name, 'slug' => $slug, 'link' => $bp->loggedin_user->domain . $slug . '/', 'css_id' => $item_css_id, 'show_for_displayed_user' => $show_for_displayed_user, 'position' => $position, 'screen_function' => &$screen_function);
/***
* If this nav item is hidden for the displayed user, and
* the logged in user is not the displayed user
* looking at their own profile, don't create the nav item.
*/
if (!$show_for_displayed_user && !bp_user_has_access()) {
return false;
}
/***
* If the nav item is visible, we are not viewing a user, and this is a root
* component, don't attach the default subnav function so we can display a
* directory or something else.
*/
if (-1 != $position && bp_is_root_component($slug) && !bp_displayed_user_id()) {
return;
}
// Look for current component
if (bp_is_current_component($slug) && !bp_current_action()) {
if (!is_object($screen_function[0])) {
add_action('bp_screens', $screen_function);
} else {
add_action('bp_screens', array(&$screen_function[0], $screen_function[1]), 3);
}
if (!empty($default_subnav_slug)) {
$bp->current_action = apply_filters('bp_default_component_subnav', $default_subnav_slug, $r);
}
// Look for current item
} elseif (bp_is_current_item($slug) && !bp_current_action()) {
if (!is_object($screen_function[0])) {
add_action('bp_screens', $screen_function);
} else {
add_action('bp_screens', array(&$screen_function[0], $screen_function[1]), 3);
}
if (!empty($default_subnav_slug)) {
$bp->current_action = apply_filters('bp_default_component_subnav', $default_subnav_slug, $r);
}
}
do_action('bp_core_new_nav_item', $r, $args, $defaults);
}
示例15: test_member_directory_when_nested_under_wp_page
/**
* @ticket BP6475
*/
public function test_member_directory_when_nested_under_wp_page()
{
$p = $this->factory->post->create(array('post_type' => 'page', 'post_name' => 'foo'));
$members_page = get_page_by_path('members');
wp_update_post(array('ID' => $members_page->ID, 'post_parent' => $p));
$members_page_permalink = bp_get_root_domain() . '/foo/members/';
$this->go_to($members_page_permalink);
$this->assertTrue(bp_is_members_component());
$this->assertEquals('', bp_current_action());
}