本文整理汇总了PHP中bp_displayed_user_id函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_displayed_user_id函数的具体用法?PHP bp_displayed_user_id怎么用?PHP bp_displayed_user_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_displayed_user_id函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bp_members_admin_bar_user_admin_menu
/**
* Adds the User Admin top-level menu to user pages
*
* @package BuddyPress
* @since 1.5
*/
function bp_members_admin_bar_user_admin_menu()
{
global $bp, $wp_admin_bar;
// Only show if viewing a user
if (!bp_is_user()) {
return false;
}
// Don't show this menu to non site admins or if you're viewing your own profile
if (!current_user_can('edit_users') || bp_is_my_profile()) {
return false;
}
// User avatar
$avatar = bp_core_fetch_avatar(array('item_id' => $bp->displayed_user->id, 'email' => $bp->displayed_user->userdata->user_email, 'width' => 16, 'height' => 16));
// Unique ID for the 'My Account' menu
$bp->user_admin_menu_id = !empty($avatar) ? 'user-admin-with-avatar' : 'user-admin';
// Add the top-level User Admin button
$wp_admin_bar->add_menu(array('id' => $bp->user_admin_menu_id, 'title' => $avatar . bp_get_displayed_user_fullname(), 'href' => bp_displayed_user_domain()));
// User Admin > Edit this user's profile
$wp_admin_bar->add_menu(array('parent' => $bp->user_admin_menu_id, 'id' => 'edit-profile', 'title' => __("Edit Profile", 'buddypress'), 'href' => bp_get_members_component_link('profile', 'edit')));
// User Admin > Edit this user's avatar
$wp_admin_bar->add_menu(array('parent' => $bp->user_admin_menu_id, 'id' => 'change-avatar', 'title' => __("Edit Avatar", 'buddypress'), 'href' => bp_get_members_component_link('profile', 'change-avatar')));
// User Admin > Spam/unspam
if (!bp_core_is_user_spammer(bp_displayed_user_id())) {
$wp_admin_bar->add_menu(array('parent' => $bp->user_admin_menu_id, 'id' => 'spam-user', 'title' => __('Mark as Spammer', 'buddypress'), 'href' => wp_nonce_url(bp_displayed_user_domain() . 'admin/mark-spammer/', 'mark-unmark-spammer'), 'meta' => array('onclick' => 'confirm(" ' . __('Are you sure you want to mark this user as a spammer?', 'buddypress') . '");')));
} else {
$wp_admin_bar->add_menu(array('parent' => $bp->user_admin_menu_id, 'id' => 'unspam-user', 'title' => __('Not a Spammer', 'buddypress'), 'href' => wp_nonce_url(bp_displayed_user_domain() . 'admin/unmark-spammer/', 'mark-unmark-spammer'), 'meta' => array('onclick' => 'confirm(" ' . __('Are you sure you want to mark this user as not a spammer?', 'buddypress') . '");')));
}
// User Admin > Delete Account
$wp_admin_bar->add_menu(array('parent' => $bp->user_admin_menu_id, 'id' => 'delete-user', 'title' => __('Delete Account', 'buddypress'), 'href' => wp_nonce_url(bp_displayed_user_domain() . 'admin/delete-user/', 'delete-user'), 'meta' => array('onclick' => 'confirm(" ' . __("Are you sure you want to delete this user's account?", 'buddypress') . '");')));
}
示例2: setup_nav
/**
* Set up navigation.
*
* @param array $main_nav Array of main nav items.
* @param array $sub_nav Array of sub nav items.
*/
public function setup_nav($main_nav = array(), $sub_nav = array())
{
// Determine user to use
if (bp_displayed_user_domain()) {
$user_domain = bp_displayed_user_domain();
} elseif (bp_loggedin_user_domain()) {
$user_domain = bp_loggedin_user_domain();
} else {
return;
}
$access = bp_core_can_edit_settings();
$slug = bp_get_settings_slug();
$settings_link = trailingslashit($user_domain . $slug);
// Add the settings navigation item
$main_nav = array('name' => __('Settings', 'buddypress'), 'slug' => $slug, 'position' => 100, 'show_for_displayed_user' => $access, 'screen_function' => 'bp_settings_screen_general', 'default_subnav_slug' => 'general');
// Add General Settings nav item
$sub_nav[] = array('name' => __('General', 'buddypress'), 'slug' => 'general', 'parent_url' => $settings_link, 'parent_slug' => $slug, 'screen_function' => 'bp_settings_screen_general', 'position' => 10, 'user_has_access' => $access);
// Add Email nav item. Formerly called 'Notifications', we
// retain the old slug and function names for backward compat
$sub_nav[] = array('name' => __('Email', 'buddypress'), 'slug' => 'notifications', 'parent_url' => $settings_link, 'parent_slug' => $slug, 'screen_function' => 'bp_settings_screen_notification', 'position' => 20, 'user_has_access' => $access);
// Add Spam Account nav item
if (bp_current_user_can('bp_moderate')) {
$sub_nav[] = array('name' => __('Capabilities', 'buddypress'), 'slug' => 'capabilities', 'parent_url' => $settings_link, 'parent_slug' => $slug, 'screen_function' => 'bp_settings_screen_capabilities', 'position' => 80, 'user_has_access' => !bp_is_my_profile());
}
// Add Delete Account nav item
if (!bp_disable_account_deletion() && bp_is_my_profile() || bp_current_user_can('delete_users')) {
$sub_nav[] = array('name' => __('Delete Account', 'buddypress'), 'slug' => 'delete-account', 'parent_url' => $settings_link, 'parent_slug' => $slug, 'screen_function' => 'bp_settings_screen_delete_account', 'position' => 90, 'user_has_access' => !is_super_admin(bp_displayed_user_id()));
}
parent::setup_nav($main_nav, $sub_nav);
}
示例3: bp_xprofile_map_meta_caps
/**
* Maps XProfile caps to built in WordPress caps
*
* @since 1.6
*
* @param array $caps Capabilities for meta capability
* @param string $cap Capability name
* @param int $user_id User id
* @param mixed $args Arguments
* @uses get_post() To get the post
* @uses get_post_type_object() To get the post type object
* @uses apply_filters() Calls 'bp_map_meta_caps' with caps, cap, user id and
* args
* @return array Actual capabilities for meta capability
*/
function bp_xprofile_map_meta_caps($caps, $cap, $user_id, $args)
{
switch ($cap) {
case 'bp_xprofile_change_field_visibility':
$caps = array('exist');
// Must allow for logged-out users during registration
// You may pass args manually: $field_id, $profile_user_id
$field_id = isset($args[0]) ? (int) $args[0] : bp_get_the_profile_field_id();
$profile_user_id = isset($args[1]) ? (int) $args[1] : bp_displayed_user_id();
// Visibility on the fullname field is not editable
if (1 == $field_id) {
$caps[] = 'do_not_allow';
break;
}
// Has the admin disabled visibility modification for this field?
if ('disabled' == bp_xprofile_get_meta($field_id, 'field', 'allow_custom_visibility')) {
$caps[] = 'do_not_allow';
break;
}
// Friends don't let friends edit each other's visibility
if ($profile_user_id != bp_displayed_user_id() && !bp_current_user_can('bp_moderate')) {
$caps[] = 'do_not_allow';
break;
}
break;
}
return apply_filters('bp_xprofile_map_meta_caps', $caps, $cap, $user_id, $args);
}
示例4: 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;
}
示例5: edit_field_html
public function edit_field_html(array $raw_properties = array())
{
$user_id = bp_displayed_user_id();
if (isset($raw_properties['user_id'])) {
$user_id = (int) $raw_properties['user_id'];
unset($raw_properties['user_id']);
}
// HTML5 required attribute.
if (bp_get_the_profile_field_is_required()) {
$raw_properties['required'] = 'required';
$required = true;
} else {
$required = false;
}
?>
<label for="<?php
bp_the_profile_field_input_name();
?>
"><?php
bp_the_profile_field_name();
?>
<?php
if (bp_get_the_profile_field_is_required()) {
esc_html_e('(required)', 'buddypress');
}
?>
</label>
<?php
do_action(bp_get_the_profile_field_errors_action());
?>
<?php
bp_the_profile_field_options("user_id={$user_id}&required={$required}");
?>
<?php
}
开发者ID:baden03,项目名称:buddypress-xprofile-custom-fields-type,代码行数:35,代码来源:Bxcft_Field_Type_CheckboxAcceptance.php
示例6: setup_nav
function setup_nav()
{
global $bp;
$link = bp_displayed_user_id() ? bp_displayed_user_domain() : bp_loggedin_user_domain();
$reshare_nav = array('name' => __('Reshares', 'bp-reshare'), 'link' => $link . bp_get_activity_slug() . '/reshares/', 'slug' => 'reshares', 'css_id' => 'activity-reshares', 'user_has_access' => true, 'position' => 50, 'screen_function' => false);
$bp->bp_options_nav['activity']['reshares'] = $reshare_nav;
}
示例7: 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());
}
}
示例8: edit_field_html
/**
* Output the edit field HTML for this field type.
*
* Must be used inside the {@link bp_profile_fields()} template loop.
*
* @since 2.0.0
*
* @param array $raw_properties Optional key/value array of
* {@link http://dev.w3.org/html5/markup/input.checkbox.html permitted attributes}
* that you want to add.
*/
public function edit_field_html(array $raw_properties = array())
{
// User_id is a special optional parameter that we pass to
// {@link bp_the_profile_field_options()}.
if (isset($raw_properties['user_id'])) {
$user_id = (int) $raw_properties['user_id'];
unset($raw_properties['user_id']);
} else {
$user_id = bp_displayed_user_id();
}
?>
<fieldset class="checkbox">
<legend>
<?php
bp_the_profile_field_name();
?>
<?php
bp_the_profile_field_required_label();
?>
</legend>
<?php
/** This action is documented in bp-xprofile/bp-xprofile-classes */
do_action(bp_get_the_profile_field_errors_action());
?>
<?php
bp_the_profile_field_options(array('user_id' => $user_id));
?>
</fieldset>
<?php
}
示例9: 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);
}
示例10: setup_nav
/**
* Setup BuddyBar navigation
*/
function setup_nav()
{
// Define local variable
$sub_nav = array();
// Add the settings navigation item
$main_nav = array('name' => __('Settings', 'buddypress'), 'slug' => $this->slug, 'position' => 100, 'show_for_displayed_user' => bp_core_can_edit_settings(), 'screen_function' => 'bp_settings_screen_general', 'default_subnav_slug' => 'general');
// Determine user to use
if (bp_displayed_user_domain()) {
$user_domain = bp_displayed_user_domain();
} elseif (bp_loggedin_user_domain()) {
$user_domain = bp_loggedin_user_domain();
} else {
return;
}
$settings_link = trailingslashit($user_domain . $this->slug);
// Add General Settings nav item
$sub_nav[] = array('name' => __('General', 'buddypress'), 'slug' => 'general', 'parent_url' => $settings_link, 'parent_slug' => $this->slug, 'screen_function' => 'bp_settings_screen_general', 'position' => 10, 'user_has_access' => bp_core_can_edit_settings());
// Add Notifications nav item
$sub_nav[] = array('name' => __('Notifications', 'buddypress'), 'slug' => 'notifications', 'parent_url' => $settings_link, 'parent_slug' => $this->slug, 'screen_function' => 'bp_settings_screen_notification', 'position' => 20, 'user_has_access' => bp_core_can_edit_settings());
// Add Spam Account nav item
if (bp_current_user_can('bp_moderate')) {
$sub_nav[] = array('name' => __('Capabilities', 'buddypress'), 'slug' => 'capabilities', 'parent_url' => $settings_link, 'parent_slug' => $this->slug, 'screen_function' => 'bp_settings_screen_capabilities', 'position' => 80, 'user_has_access' => !bp_is_my_profile());
}
// Add Delete Account nav item
if (!bp_disable_account_deletion() || bp_current_user_can('delete_users')) {
$sub_nav[] = array('name' => __('Delete Account', 'buddypress'), 'slug' => 'delete-account', 'parent_url' => $settings_link, 'parent_slug' => $this->slug, 'screen_function' => 'bp_settings_screen_delete_account', 'position' => 90, 'user_has_access' => bp_is_my_profile() || !is_super_admin(bp_displayed_user_id()));
}
parent::setup_nav($main_nav, $sub_nav);
}
示例11: setup_current_component_id_for_members
public function setup_current_component_id_for_members($component_id)
{
if (bp_is_user()) {
return bp_displayed_user_id();
}
return $component_id;
}
示例12: profile_questions_loop
/**
* User's questions list loop.
*/
static function profile_questions_loop()
{
global $dwqa_options;
$submit_question_link = get_post_type_archive_link(CMA_AnswerThread::POST_TYPE);
$questions = get_posts(array('posts_per_page' => -1, 'author' => bp_displayed_user_id(), 'post_type' => CMA_AnswerThread::POST_TYPE));
include CMA_PATH . '/views/frontend/buddypress/user-questions-loop.phtml';
}
示例13: edit_field_html
/**
* Output the edit field HTML for this field type.
*
* Must be used inside the {@link bp_profile_fields()} template loop.
*
* @param array $raw_properties Optional key/value array of {@link http://dev.w3.org/html5/markup/input.radio.html permitted attributes} that you want to add.
* @since 2.0.0
*/
public function edit_field_html(array $raw_properties = array())
{
// user_id is a special optional parameter that we pass to
// {@link bp_the_profile_field_options()}.
if (isset($raw_properties['user_id'])) {
$user_id = (int) $raw_properties['user_id'];
unset($raw_properties['user_id']);
} else {
$user_id = bp_displayed_user_id();
}
?>
<div class="radio">
<label for="<?php
bp_the_profile_field_input_name();
?>
">
<?php
bp_the_profile_field_name();
?>
<?php
if (bp_get_the_profile_field_is_required()) {
?>
<?php
esc_html_e('(required)', 'buddypress');
?>
<?php
}
?>
</label>
<?php
/** This action is documented in bp-xprofile/bp-xprofile-classes */
do_action(bp_get_the_profile_field_errors_action());
?>
<?php
bp_the_profile_field_options(array('user_id' => $user_id));
if (!bp_get_the_profile_field_is_required()) {
?>
<a class="clear-value" href="javascript:clear( '<?php
echo esc_js(bp_get_the_profile_field_input_name());
?>
' );">
<?php
esc_html_e('Clear', 'buddypress');
?>
</a>
<?php
}
?>
</div>
<?php
}
示例14: mpp_current_component_id_for_user
function mpp_current_component_id_for_user($component_id)
{
if (mediapress()->is_bp_active() && bp_is_user()) {
return bp_displayed_user_id();
//that is displayed user id
}
return $component_id;
}
示例15: 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;
}
}