本文整理汇总了PHP中bp_is_current_action函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_is_current_action函数的具体用法?PHP bp_is_current_action怎么用?PHP bp_is_current_action使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_is_current_action函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bp_follow_blogs_add_activity_scope_filter
/**
* Filter the activity loop.
*
* Specifically, when on the activity directory and clicking on the "Followed
* Sites" tab.
*
* @param str $qs The querystring for the BP loop
* @param str $object The current object for the querystring
* @return str Modified querystring
*/
function bp_follow_blogs_add_activity_scope_filter($qs, $object)
{
// not on the blogs object? stop now!
if ($object != 'activity') {
return $qs;
}
// parse querystring into an array
$r = wp_parse_args($qs);
if (bp_is_current_action(constant('BP_FOLLOW_BLOGS_USER_ACTIVITY_SLUG'))) {
$r['scope'] = 'followblogs';
}
if (!isset($r['scope'])) {
return $qs;
}
if ('followblogs' !== $r['scope']) {
return $qs;
}
// get blog IDs that the user is following
$following_ids = bp_get_following_ids(array('user_id' => bp_displayed_user_id() ? bp_displayed_user_id() : bp_loggedin_user_id(), 'follow_type' => 'blogs'));
// if $following_ids is empty, pass a negative number so no blogs can be found
$following_ids = empty($following_ids) ? -1 : $following_ids;
$args = array('user_id' => 0, 'object' => 'blogs', 'primary_id' => $following_ids);
// make sure we add a separator if we have an existing querystring
if (!empty($qs)) {
$qs .= '&';
}
// add our follow parameters to the end of the querystring
$qs .= build_query($args);
// support BP Groupblog
// We need to filter the WHERE SQL conditions to do this
if (function_exists('bp_groupblog_init')) {
add_filter('bp_activity_get_where_conditions', 'bp_follow_blogs_groupblog_activity_where_conditions', 10, 2);
}
return $qs;
}
示例2: bp_core_action_delete_user
/**
* Process user deletion requests.
*
* Note: No longer called here. See the Settings component.
*/
function bp_core_action_delete_user()
{
$userID = bp_displayed_user_id();
echo "Buddypress:";
echo $userID;
$now = current_time('mysql');
$args = array('date_query' => array('after' => '5 minute ago', 'before' => $now, 'inclusive' => true), 'post_id' => $postID, 'user_id' => $userID, 'count' => true);
$userActivityCount = get_comments($args);
if (!bp_current_user_can('bp_moderate') || bp_is_my_profile() || !bp_displayed_user_id() || $userActivityCount != 0) {
return false;
}
if (bp_is_current_component('admin') && bp_is_current_action('delete-user') && $userActivityCount == 0) {
// Check the nonce.
check_admin_referer('delete-user');
$errors = false;
$style = "<style> #account-delete-form .submit{ display:none !important;} </style>";
if ($userActivityCount != 0) {
$errors = true;
return $style;
}
do_action('bp_core_before_action_delete_user', $errors);
if (bp_core_delete_account(bp_displayed_user_id()) || $userActivityCount == 0) {
bp_core_add_message(sprintf(__('%s has been deleted from the system.', 'buddypress'), bp_get_displayed_user_fullname()));
} else {
bp_core_add_message(sprintf(__('There was an error deleting %s from the system. Please try again.', 'buddypress'), bp_get_displayed_user_fullname()), 'error');
$errors = true;
}
do_action('bp_core_action_delete_user', $errors);
if ($errors) {
bp_core_redirect(bp_displayed_user_domain());
} else {
bp_core_redirect(bp_loggedin_user_domain());
}
}
}
示例3: bp_core_action_set_spammer_status
/**
* 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.
*
* @package BuddyPress Core
* @param int $user_id Optional user ID to mark as spam
* @global object $nxtdb Global NXTClass Database object
*/
function bp_core_action_set_spammer_status($user_id = 0)
{
// 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(nxt_get_referer());
}
}
示例4: messages_add_autocomplete_css
/**
* Enqueue the CSS for messages autocomplete.
*
* @todo Why do we call wp_print_styles()?
*/
function messages_add_autocomplete_css()
{
if (bp_is_messages_component() && bp_is_current_action('compose')) {
wp_enqueue_style('bp-messages-autocomplete');
wp_print_styles();
}
}
示例5: friends_action_remove_friend
/**
* Catch and process Remove Friendship requests.
*
* @since 1.0.1
*/
function friends_action_remove_friend()
{
if (!bp_is_friends_component() || !bp_is_current_action('remove-friend')) {
return false;
}
if (!($potential_friend_id = (int) bp_action_variable(0))) {
return false;
}
if ($potential_friend_id == bp_loggedin_user_id()) {
return false;
}
$friendship_status = BP_Friends_Friendship::check_is_friend(bp_loggedin_user_id(), $potential_friend_id);
if ('is_friend' == $friendship_status) {
if (!check_admin_referer('friends_remove_friend')) {
return false;
}
if (!friends_remove_friend(bp_loggedin_user_id(), $potential_friend_id)) {
bp_core_add_message(__('Friendship could not be canceled.', 'buddypress'), 'error');
} else {
bp_core_add_message(__('Friendship canceled', 'buddypress'));
}
} elseif ('is_friends' == $friendship_status) {
bp_core_add_message(__('You are not yet friends with this user', 'buddypress'), 'error');
} else {
bp_core_add_message(__('You have a pending friendship request with this user', 'buddypress'), 'error');
}
bp_core_redirect(wp_get_referer());
return false;
}
示例6: is_group
/**
* Are we looking at something that needs group theme compatibility?
*
* @since 1.7.0
*/
public function is_group()
{
// Bail if not looking at a group.
if (!bp_is_groups_component()) {
return;
}
// Group Directory.
if (!bp_current_action() && !bp_current_item()) {
bp_update_is_directory(true, 'groups');
/**
* Fires at the start of the group theme compatibility setup.
*
* @since 1.1.0
*/
do_action('groups_directory_groups_setup');
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'));
// Creating a group.
} elseif (bp_is_groups_component() && bp_is_current_action('create')) {
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'));
// Group page.
} elseif (bp_is_single_item()) {
add_filter('bp_get_buddypress_template', array($this, 'single_template_hierarchy'));
add_action('bp_template_include_reset_dummy_post_data', array($this, 'single_dummy_post'));
add_filter('bp_replace_the_content', array($this, 'single_content'));
}
}
示例7: bp_checkins_is_group_places_area
function bp_checkins_is_group_places_area()
{
if (bp_is_groups_component() && bp_is_single_item() && bp_is_current_action('checkins') && bp_action_variable(0) == 'places') {
return true;
} else {
return false;
}
}
示例8: bp_reshare_is_user_profile_reshares
function bp_reshare_is_user_profile_reshares()
{
if (bp_is_activity_component() && bp_displayed_user_id() && bp_is_current_action('reshares')) {
return true;
} else {
return false;
}
}
示例9: messages_add_autocomplete_css
function messages_add_autocomplete_css()
{
if (bp_is_messages_component() && bp_is_current_action('compose')) {
$min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
wp_enqueue_style('bp-messages-autocomplete', buddypress()->plugin_url . "bp-messages/css/autocomplete/jquery.autocompletefb{$min}.css", array(), bp_get_version());
wp_print_styles();
}
}
示例10: bp_chekins_allow_comments
function bp_chekins_allow_comments($retval, $open, $post_id)
{
if (bp_is_current_component('checkins') && bp_is_current_action('place') && bp_action_variable(0)) {
return $open;
} else {
return $retval;
}
}
示例11: bcg_is_component
/**
* Are we dealing with blog categories pages?
* @return type
*/
function bcg_is_component()
{
$bp = buddypress();
if (bp_is_current_component($bp->groups->slug) && bp_is_current_action(BCG_SLUG)) {
return true;
}
return false;
}
示例12: messages_add_autocomplete_css
function messages_add_autocomplete_css()
{
if (bp_is_messages_component() && bp_is_current_action('compose')) {
if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
wp_enqueue_style('bp-messages-autocomplete', BP_PLUGIN_URL . 'bp-messages/css/autocomplete/jquery.autocompletefb.dev.css', array(), bp_get_version());
} else {
wp_enqueue_style('bp-messages-autocomplete', BP_PLUGIN_URL . 'bp-messages/css/autocomplete/jquery.autocompletefb.css', array(), bp_get_version());
}
wp_print_styles();
}
}
示例13: bp_blogs_screen_create_a_blog
/**
* Load the "Create a Blog" screen.
*/
function bp_blogs_screen_create_a_blog()
{
if (!is_multisite() || !bp_is_blogs_component() || !bp_is_current_action('create')) {
return false;
}
if (!is_user_logged_in() || !bp_blog_signup_enabled()) {
return false;
}
do_action('bp_blogs_screen_create_a_blog');
bp_core_load_template(apply_filters('bp_blogs_template_create_a_blog', 'blogs/create'));
}
示例14: messages_add_autocomplete_css
function messages_add_autocomplete_css()
{
global $bp;
if (bp_is_messages_component() && bp_is_current_action('compose')) {
if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
nxt_enqueue_style('bp-messages-autocomplete', BP_PLUGIN_URL . '/bp-messages/css/autocomplete/jquery.autocompletefb.dev.css', array(), '20110723');
} else {
nxt_enqueue_style('bp-messages-autocomplete', BP_PLUGIN_URL . '/bp-messages/css/autocomplete/jquery.autocompletefb.css', array(), '20110723');
}
nxt_print_styles();
}
}
示例15: bp_portfolio_screen_edit
/**
* Sets up and displays the screen output for the sub nav item "portfolio/edit/%d"
*/
function bp_portfolio_screen_edit()
{
if (bp_is_portfolio_component() and bp_is_current_action('edit') and bp_displayed_user_id() == bp_loggedin_user_id()) {
if (isset($_POST['edit'])) {
// Check to see if the project belong to the logged_in user
global $project;
$project_id = bp_action_variable();
$project = new BP_Portfolio_Item();
$project->get(array('id' => $project_id));
if ($project->query->post->post_author != bp_loggedin_user_id()) {
bp_core_add_message(__('There was an error recording the project, please try again', 'bp-portfolio'), 'error');
bp_core_load_template(apply_filters('bp_portfolio_template_screen_add', BP_PORTFOLIO_TEMPLATE . '/personal'));
}
// Check the nonce
if (!wp_verify_nonce($_POST['_wpnonce'], 'project_form_nonce')) {
bp_core_add_message(__('There was an error recording the project, please try again', 'bp-portfolio'), 'error');
bp_core_load_template(apply_filters('bp_portfolio_template_screen_add', BP_PORTFOLIO_TEMPLATE . '/personal'));
}
if (empty($_POST['title-input']) or empty($_POST['url-input']) or empty($_POST['description'])) {
bp_core_add_message(__('All fields are required', 'bp-portfolio'), 'error');
$project_id = bp_action_variable();
global $project;
$project = new BP_Portfolio_Item();
$project->get(array('id' => $project_id));
} else {
// Edit the post
$posts = array('id' => bp_action_variable(), 'author_id' => bp_loggedin_user_id(), 'title' => $_POST['title-input'], 'description' => $_POST['description'], 'url' => $_POST['url-input']);
// Is that a capture has been sent ?
if (isset($_FILES['screenshot-input']) and $_FILES['screenshot-input']['error'] == 0) {
$posts['screenshot'] = $_FILES['screenshot-input'];
}
if ($item = bp_portfolio_save_item($posts)) {
bp_core_add_message(__('Project has been edited', 'bp-portfolio'));
bp_core_redirect(bp_core_get_user_domain(bp_loggedin_user_id()) . bp_get_portfolio_slug());
} else {
bp_core_add_message(__('There was an error recording the item, please try again', 'bp-portfolio'), 'error');
}
}
} else {
// Create a global $project, so template will know that this is the edit page
if ($project_id = bp_action_variable()) {
global $project;
$project_id = bp_action_variable();
$project = new BP_Portfolio_Item();
$project->get(array('id' => $project_id));
if ($project->query->post->post_author == bp_loggedin_user_id()) {
bp_core_load_template(apply_filters('bp_portfolio_template_screen_one', BP_PORTFOLIO_TEMPLATE . '/add'));
}
}
}
}
}