本文整理汇总了PHP中bp_get_displayed_user_username函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_get_displayed_user_username函数的具体用法?PHP bp_get_displayed_user_username怎么用?PHP bp_get_displayed_user_username使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_get_displayed_user_username函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bp_dtheme_js_terms
function bp_dtheme_js_terms()
{
?>
<script type="text/javascript">
<?php
if (get_option('priority_loading') == 'enable') {
?>
head.ready(function() {
<?php
}
?>
var bp_terms_my_favs = '<?php
_e("My Favorites", "buddypress");
?>
';
var bp_terms_accepted = '<?php
_e("Accepted", "buddypress");
?>
';
var bp_terms_rejected = '<?php
_e("Rejected", "buddypress");
?>
';
var bp_terms_show_all_comments = '<?php
_e("Show all comments for this thread", "buddypress");
?>
';
var bp_terms_show_all = '<?php
_e("Show all", "buddypress");
?>
';
var bp_terms_comments = '<?php
_e("comments", "buddypress");
?>
';
var bp_terms_close = '<?php
_e("Close", "buddypress");
?>
';
var bp_terms_mention_explain = '<?php
printf(__("%s is a unique identifier for %s that you can type into any message on this site. %s will be sent a notification and a link to your message any time you use it.", "buddypress"), '@' . bp_get_displayed_user_username(), bp_get_user_firstname(bp_get_displayed_user_fullname()), bp_get_user_firstname(bp_get_displayed_user_fullname()));
?>
';
<?php
if (get_option('priority_loading') == 'enable') {
?>
});
<?php
}
?>
</script>
<?php
}
示例2: bp_tpack_init
function bp_tpack_init()
{
global $wp_themes;
/* Check to make sure the active theme is not bp-default */
if ('bp-default' == get_option('template')) {
return false;
}
/* Load the default BuddyPress AJAX functions */
if (!(int) get_option('bp_tpack_disable_js')) {
require_once BP_PLUGIN_DIR . '/bp-themes/bp-default/_inc/ajax.php';
/* Load the default BuddyPress javascript */
wp_enqueue_script('bp-js', BP_PLUGIN_URL . '/bp-themes/bp-default/_inc/global.js', array('jquery'));
// Add words that we need to use in JS to the end of the page so they can be
// translated and still used.
$params = array('my_favs' => __('My Favorites', 'buddypress'), 'accepted' => __('Accepted', 'buddypress'), 'rejected' => __('Rejected', 'buddypress'), 'show_all_comments' => __('Show all comments for this thread', 'buddypress'), 'show_all' => __('Show all', 'buddypress'), 'comments' => __('comments', 'buddypress'), 'close' => __('Close', 'buddypress'), 'mention_explain' => sprintf(__("%s is a unique identifier for %s that you can type into any message on this site. %s will be sent a notification and a link to your message any time you use it.", 'buddypress'), '@' . bp_get_displayed_user_username(), bp_get_user_firstname(bp_get_displayed_user_fullname()), bp_get_user_firstname(bp_get_displayed_user_fullname())));
wp_localize_script('bp-js', 'BP_DTheme', $params);
}
/* Add the wireframe BP page styles */
if (!(int) get_option('bp_tpack_disable_css')) {
wp_enqueue_style('bp-css', plugins_url($path = basename(dirname(__FILE__))) . '/bp.css');
}
}
示例3: bp_tpack_enqueue_scripts
/**
* Enqueues BuddyPress JS and related AJAX functions
*
* @since 1.2
*/
function bp_tpack_enqueue_scripts()
{
// Do not enqueue JS if it's disabled
if (get_option('bp_tpack_disable_js')) {
return;
}
// Add words that we need to use in JS to the end of the page so they can be translated and still used.
$params = array('my_favs' => __('My Favorites', 'buddypress'), 'accepted' => __('Accepted', 'buddypress'), 'rejected' => __('Rejected', 'buddypress'), 'show_all_comments' => __('Show all comments for this thread', 'buddypress'), 'show_all' => __('Show all', 'buddypress'), 'comments' => __('comments', 'buddypress'), 'close' => __('Close', 'buddypress'));
// BP 1.5+
if (version_compare(BP_VERSION, '1.3', '>')) {
// Bump this when changes are made to bust cache
$version = '20110818';
$params['view'] = __('View', 'buddypress');
} else {
$version = '20110729';
if (bp_displayed_user_id()) {
$params['mention_explain'] = sprintf(__("%s is a unique identifier for %s that you can type into any message on this site. %s will be sent a notification and a link to your message any time you use it.", 'buddypress'), '@' . bp_get_displayed_user_username(), bp_get_user_firstname(bp_get_displayed_user_fullname()), bp_get_user_firstname(bp_get_displayed_user_fullname()));
}
}
// Enqueue the global JS - Ajax will not work without it
nxt_enqueue_script('dtheme-ajax-js', BP_PLUGIN_URL . '/bp-themes/bp-default/_inc/global.js', array('jquery'), $version);
// Localize the JS strings
nxt_localize_script('dtheme-ajax-js', 'BP_DTheme', $params);
}
示例4: bp_displayed_user_username
/**
* Output the username of the displayed user.
*/
function bp_displayed_user_username()
{
echo bp_get_displayed_user_username();
}
示例5: require_once
// Load the AJAX functions for the theme
require_once( TEMPLATEPATH . '/_inc/ajax.php' );
// Load the javascript for the theme
wp_enqueue_script( 'dtheme-ajax-js', get_template_directory_uri() . '/_inc/global.js', array( 'jquery' ) );
// Add words that we need to use in JS to the end of the page so they can be translated and still used.
$params = array(
'my_favs' => __( 'My Favorites', 'buddypress' ),
'accepted' => __( 'Accepted', 'buddypress' ),
'rejected' => __( 'Rejected', 'buddypress' ),
'show_all_comments' => __( 'Show all comments for this thread', 'buddypress' ),
'show_all' => __( 'Show all', 'buddypress' ),
'comments' => __( 'comments', 'buddypress' ),
'close' => __( 'Close', 'buddypress' ),
'mention_explain' => sprintf( __( "%s is a unique identifier for %s that you can type into any message on this site. %s will be sent a notification and a link to your message any time you use it.", 'buddypress' ), '@' . bp_get_displayed_user_username(), bp_get_user_firstname( bp_get_displayed_user_fullname() ), bp_get_user_firstname( bp_get_displayed_user_fullname() ) )
);
wp_localize_script( 'dtheme-ajax-js', 'BP_DTheme', $params );
/**
* Add the JS needed for blog comment replies
*
* @package BuddyPress Theme
* @since 1.2
*/
function bp_dtheme_add_blog_comments_js() {
if ( is_singular() ) wp_enqueue_script( 'comment-reply' );
}
add_action( 'template_redirect', 'bp_dtheme_add_blog_comments_js' );
/**
示例6: setup_item
/**
* Gets the item id of the item (eg group, user) associated with the page you're on.
*
* @since 1.0-beta
*
* @return str $view The current item type
*/
function setup_item()
{
global $bp;
if (empty($this->item_type)) {
return false;
}
$id = '';
$name = '';
$slug = '';
switch ($this->item_type) {
case 'group':
if (bp_is_active('groups') && bp_is_group()) {
$group = groups_get_current_group();
$id = $group->id;
$name = $group->name;
$slug = $group->slug;
}
break;
case 'user':
if (bp_is_user()) {
$id = bp_displayed_user_id();
$name = bp_get_displayed_user_fullname();
$slug = bp_get_displayed_user_username();
}
break;
}
// Todo: abstract into groups. Will be a pain
$this->item_id = apply_filters('bp_docs_get_item_id', $id);
$this->item_name = apply_filters('bp_docs_get_item_name', $name);
$this->item_slug = apply_filters('bp_docs_get_item_slug', $slug);
// Put some stuff in $bp
$bp->bp_docs->current_item = $this->item_id;
}
示例7: wp_idea_stream_buddypress_displayed_user_username
/**
* Map IdeaStream displayed username to BuddyPress one
*
* @package WP Idea Stream
* @subpackage buddypress/functions
*
* @since 2.0.0
*
* @param string $username the username
* @uses bp_get_displayed_user_username() to get displayed user nicename
* @return string the username
*/
function wp_idea_stream_buddypress_displayed_user_username($username = '')
{
if (empty($username)) {
$username = bp_get_displayed_user_username();
}
return $username;
}
示例8: meso_schema_breadcrumbs
//.........这里部分代码省略.........
}
}
echo ' ' . $delimiter . ' ' . __('You are reading »', 'mesocolumn');
} else {
$category = get_the_category();
if ($category) {
foreach ($category as $cat) {
echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_category_link($cat->term_id) . '">' . '<span' . $schema_prop_title . '>' . $cat->name . '</span>' . '</a></span>' . $delimiter . ' ';
}
}
echo __('You are reading »', 'mesocolumn');
}
} elseif (!is_single() && !is_page() && get_post_type() != 'post' && !is_404()) {
$post_type = get_post_type_object(get_post_type());
echo $before . $post_type->labels->singular_name . $after;
} elseif (is_attachment()) {
$parent = get_post($post->post_parent);
$cat = get_the_category($parent->ID);
$cat = $cat[0];
if ($cat) {
echo get_category_parents($cat, TRUE, ' ' . $delimiter . ' ');
}
echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_permalink($parent) . '">' . '<span' . $schema_prop_title . '>' . $parent->post_title . '</span>' . '</a></span>';
if ($showCurrent == 1) {
echo ' ' . $delimiter . ' ' . $before . get_the_title() . $after;
}
} elseif (is_page() && !$post->post_parent) {
if (class_exists('buddypress')) {
global $bp;
if (bp_is_groups_component()) {
echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . home_url() . '/' . bp_get_root_slug('groups') . '">' . '<span' . $schema_prop_title . '>' . bp_get_root_slug('groups') . '</span>' . '</a></span>';
if (!bp_is_directory()) {
echo $delimiter . '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . home_url() . '/' . bp_get_root_slug('groups') . '/' . bp_current_item() . '">' . '<span' . $schema_prop_title . '>' . bp_current_item() . '</span>' . '</a></span>';
if (bp_current_action()) {
echo $delimiter . '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . home_url() . '/' . bp_get_root_slug('groups') . '/' . bp_current_item() . '/' . bp_current_action() . '">' . '<span' . $schema_prop_title . '>' . bp_current_action() . '</span>' . '</a></span>';
}
}
} else {
if (bp_is_members_directory()) {
echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . home_url() . '/' . bp_get_root_slug('members') . '">' . '<span' . $schema_prop_title . '>' . bp_get_root_slug('members') . '</span>' . '</a></span>';
} else {
if (bp_is_user()) {
echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . home_url() . '/' . bp_get_root_slug('members') . '">' . '<span' . $schema_prop_title . '>' . bp_get_root_slug('members') . '</span>' . '</a></span>';
echo $delimiter . '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . bp_core_get_user_domain($bp->displayed_user->id) . '">' . '<span' . $schema_prop_title . '>' . bp_get_displayed_user_username() . '</span>' . '</a></span>';
if (bp_current_action()) {
echo $delimiter . '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . bp_core_get_user_domain($bp->displayed_user->id) . bp_current_component() . '">' . '<span' . $schema_prop_title . '>' . bp_current_component() . '</span>' . '</a></span>';
}
} else {
if (bp_is_directory()) {
echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_permalink() . '">' . '<span' . $schema_prop_title . '>' . bp_current_component() . '</span>' . '</a></span>';
} else {
echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_permalink() . '">' . '<span' . $schema_prop_title . '>' . the_title_attribute('echo=0') . '</span>' . '</a></span>';
}
}
}
}
} else {
echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_permalink() . '">' . '<span' . $schema_prop_title . '>' . the_title_attribute('echo=0') . '</span>' . '</a></span>';
}
} elseif (is_page() && $post->post_parent) {
$parent_id = $post->post_parent;
$breadcrumbs = array();
while ($parent_id) {
$page = get_page($parent_id);
$breadcrumbs[] = '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_permalink($page->ID) . '">' . '<span' . $schema_prop_title . '>' . get_the_title($page->ID) . '</span>' . '</a></span>';
$parent_id = $page->post_parent;
}
$breadcrumbs = array_reverse($breadcrumbs);
for ($i = 0; $i < count($breadcrumbs); $i++) {
echo $breadcrumbs[$i];
if ($i != count($breadcrumbs) - 1) {
echo ' ' . $delimiter . ' ';
}
}
echo $delimiter . '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_permalink() . '">' . '<span' . $schema_prop_title . '>' . the_title_attribute('echo=0') . '</span>' . '</a></span>';
} elseif (is_tag()) {
$tag_id = get_term_by('name', single_cat_title('', false), 'post_tag');
if ($tag_id) {
$tag_link = get_tag_link($tag_id->term_id);
}
echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . $tag_link . '">' . '<span' . $schema_prop_title . '>' . single_cat_title('', false) . '</span>' . '</a></span>';
} elseif (is_author()) {
global $author;
$userdata = get_userdata($author);
echo '<span' . $schema_link . '><a' . $schema_prop_url . ' href="' . get_author_posts_url($userdata->ID) . '">' . '<span' . $schema_prop_title . '>' . $userdata->display_name . '</span>' . '</a></span>';
} elseif (is_404()) {
echo ' ' . $delimiter . ' ' . __('Error 404', 'mesocolumn');
}
if (get_query_var('paged')) {
if (is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author()) {
echo ' (';
}
echo ' ' . $delimiter . ' ' . __('Page', 'mesocolumn') . ' ' . get_query_var('paged');
if (is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author()) {
echo ')';
}
}
echo '</div></div>';
}
}
示例9: bp_mytheme_post_update
function bp_mytheme_post_update()
{
global $bp;
// Check the nonce
check_admin_referer('post_update', '_wpnonce_post_update');
if (!is_user_logged_in()) {
echo '-1';
return false;
}
if (empty($_POST['content'])) {
echo '-1<div id="message" class="error"><p>' . __('Please enter some content to post.', 'buddypress') . '</p></div>';
return false;
}
if (empty($_POST['object']) && function_exists('bp_activity_post_update')) {
if (!bp_is_home() && bp_is_member()) {
$content = "@" . bp_get_displayed_user_username() . " " . $_POST['content'];
} else {
$content = $_POST['content'];
}
$activity_id = bp_activity_post_update(array('content' => $content));
} elseif ($_POST['object'] == 'groups') {
if (!empty($_POST['item_id']) && function_exists('groups_post_update')) {
$activity_id = groups_post_update(array('content' => $_POST['content'], 'group_id' => $_POST['item_id']));
}
} else {
$activity_id = apply_filters('bp_activity_custom_update', $_POST['object'], $_POST['item_id'], $_POST['content']);
}
if (!$activity_id) {
echo '-1<div id="message" class="error"><p>' . __('There was a problem posting your update, please try again.', 'buddypress') . '</p></div>';
return false;
}
if (bp_has_activities('include=' . $activity_id)) {
?>
<?php
while (bp_activities()) {
bp_the_activity();
?>
<?php
locate_template(array('activity/entry-wall.php'), true);
?>
<?php
}
?>
<?php
}
}
示例10: amt_buddypress_jsonld_schemaorg
function amt_buddypress_jsonld_schemaorg($metadata_arr, $post, $options, $attachments, $embedded_media)
{
// User Profiles
// Determines if a BuddyPress user profile has been requested
if (bp_is_user_profile()) {
// https://codex.buddypress.org/developer/the-bp-global/
global $bp;
// $user_id = $bp->displayed_user->id;
$user_id = bp_displayed_user_id();
// $user_domain = $bp->displayed_user->domain;
// bp_core_get_user_domain( bp_displayed_user_id() )
$user_domain = bp_displayed_user_domain();
$user_profile_url = trailingslashit(bp_displayed_user_domain() . amt_bp_get_profile_slug());
$user_fullname = $bp->displayed_user->fullname;
// $user_fullname = bp_displayed_user_fullname();
// $user_username = $bp->displayed_user->user_login;
$user_username = bp_get_displayed_user_username();
//$wp_user_obj = get_user_by( 'id', $user_id );
$wp_user_obj = get_userdata($user_id);
//var_dump($wp_user_obj);
// Context
$metadata_arr['@context'] = 'http://schema.org';
// Schema.org type
$metadata_arr['@type'] = 'Person';
// name
$metadata_arr['name'] = esc_attr($user_fullname);
// URL
$metadata_arr['url'] = esc_url($user_profile_url, array('http', 'https'));
// mainEntityOfPage
$metadata_arr['mainEntityOfPage'] = esc_url($user_profile_url, array('http', 'https'));
// Related resources as sameAs
$metadata_arr['sameAs'] = array();
// Facebook Profile
//$fb_author_url = get_the_author_meta('amt_facebook_author_profile_url', $user_id);
$fb_author_url = get_user_meta($user_id, 'amt_facebook_author_profile_url', true);
if (!empty($fb_author_url)) {
$metadata_arr['sameAs'][] = esc_url($fb_author_url, array('http', 'https'));
}
// Twitter
//$twitter_author_username = get_the_author_meta('amt_twitter_author_username', $user_id);
$twitter_author_username = get_user_meta($user_id, 'amt_twitter_author_username', true);
if (!empty($twitter_author_username)) {
$metadata_arr['sameAs'][] = 'https://twitter.com/' . esc_attr($twitter_author_username);
}
// Google+
//$googleplus_author_url = get_the_author_meta('amt_googleplus_author_profile_url', $wp_user_obj);
$googleplus_author_url = get_user_meta($user_id, 'amt_googleplus_author_profile_url', true);
if (!empty($googleplus_author_url)) {
$metadata_arr['sameAs'][] = esc_url($googleplus_author_url, array('http', 'https'));
}
// Determines if Extended Profiles component is active.
if (!bp_is_active('xprofile')) {
// Website
//$website_url = get_user_meta($user_id, 'amt_googleplus_author_profile_url', true);
$website_url = get_the_author_meta('user_url', $user_id);
if (!empty($website_url)) {
$metadata_arr['sameAs'][] = esc_url($website_url, array('http', 'https'));
}
// Description
$author_description = sanitize_text_field(amt_sanitize_description($wp_user_obj->description));
if (empty($author_description)) {
$metadata_arr['description'] = esc_attr(__('Profile of', 'add-meta-tags') . ' ' . $wp_user_obj->display_name);
} else {
$metadata_arr['description'] = esc_attr($author_description);
}
// Profile Image
$author_email = sanitize_email($wp_user_obj->user_email);
$avatar_size = apply_filters('amt_bp_avatar_size', array('width' => 50, 'height' => 50));
$avatar_url = '';
// First try to get the avatar link by using get_avatar().
// Important: for this to work the "Show Avatars" option should be enabled in Settings > Discussion.
$avatar_img = get_avatar(get_the_author_meta('ID', $wp_user_obj->ID), $avatar_size, '', get_the_author_meta('display_name', $wp_user_obj->ID));
if (!empty($avatar_img)) {
if (preg_match("#src=['\"]([^'\"]+)['\"]#", $avatar_img, $matches)) {
$avatar_url = $matches[1];
}
} elseif (!empty($author_email)) {
// If the user has provided an email, we use it to construct a gravatar link.
$avatar_url = "http://www.gravatar.com/avatar/" . md5($author_email) . "?s=" . $avatar_size;
}
if (!empty($avatar_url)) {
//$avatar_url = html_entity_decode($avatar_url, ENT_NOQUOTES, 'UTF-8');
$metadata_arr['image'] = esc_url($avatar_url);
}
// familyName
$last_name = $wp_user_obj->last_name;
if (!empty($last_name)) {
$metadata_arr['familyName'] = esc_attr($last_name);
}
// givenName
$first_name = $wp_user_obj->first_name;
if (!empty($first_name)) {
$metadata_arr['givenName'] = esc_attr($first_name);
}
// Extended Profiles
} else {
// https://codex.buddypress.org/themes/guides/displaying-extended-profile-fields-on-member-profiles/
$xprofile_field_map = amt_buddypress_get_xprofile_field_map();
// Get list of IDs of public fields
$xprofile_public_fields = bp_xprofile_get_fields_by_visibility_levels($user_id, array('public'));
//.........这里部分代码省略.........
示例11: devb_aawire_post_update
function devb_aawire_post_update()
{
global $bp;
$is_wire_post = false;
/* Check the nonce */
check_admin_referer('post_update', '_wpnonce_post_update');
if (!is_user_logged_in()) {
echo '-1';
exit(0);
}
if (empty($_POST['content'])) {
echo '-1<div id="message"><p>' . __('Please enter some content to post.', 'buddypress') . '</p></div>';
exit(0);
}
if (empty($_POST['object']) && function_exists('bp_activity_post_update')) {
//this is what I have changed
if (!bp_is_my_profile() && bp_is_user()) {
$content = '@' . bp_get_displayed_user_username() . ' ' . $_POST['content'];
$is_wire_post = true;
} else {
$content = $_POST['content'];
}
//let us get the last activity id, we will use it to reset user's last activity
$last_update = bp_get_user_meta(bp_loggedin_user_id(), 'bp_latest_update', true);
if ($is_wire_post) {
add_filter('bp_activity_new_update_action', 'devb_aawire_filter_action');
}
$activity_id = bp_activity_post_update(array('content' => $content));
if ($is_wire_post) {
remove_filter('bp_activity_new_update_action', 'devb_aawire_filter_action');
//add activity meta to remember that it was a wire post and we may use it in future
if ($activity_id) {
bp_activity_update_meta($activity_id, 'is_wire_post', 1);
}
//let us remember it for future
//for 2.0 Let us add the mentioned user in the meta, so in future if we plan eo extend the wall beyond mention, we can do that easily
bp_activity_update_meta($activity_id, 'wire_user_id', bp_displayed_user_id());
//let us remember it for future
}
//reset the last update
bp_update_user_meta(get_current_user_id(), 'bp_latest_update', $last_update);
//end of my changes
} elseif ($_POST['object'] == 'groups') {
if (!empty($_POST['item_id']) && function_exists('groups_post_update')) {
$activity_id = groups_post_update(array('content' => $_POST['content'], 'group_id' => $_POST['item_id']));
}
} else {
$activity_id = apply_filters('bp_activity_custom_update', $_POST['object'], $_POST['item_id'], $_POST['content']);
}
if (!$activity_id) {
echo '-1<div id="message"><p>' . __('There was a problem posting your update, please try again.', 'buddypress') . '</p></div>';
exit(0);
}
if (bp_has_activities('include=' . $activity_id)) {
?>
<?php
while (bp_activities()) {
bp_the_activity();
?>
<?php
bp_locate_template(array('activity/entry.php'), true);
?>
<?php
}
?>
<?php
}
exit(0);
}
示例12: define
define('BP_DISABLE_ADMIN_BAR', true);
define('BP_DTHEME_DISABLE_CUSTOM_HEADER', true);
add_filter('bp_core_fetch_avatar_no_grav', '__return_true');
remove_action('wp_print_styles', 'bp_tpack_enqueue_styles');
remove_filter('wp_nav_menu', 'remove_ul');
// Stop the theme from killing WordPress if BuddyPress is not enabled.
if (!class_exists('BP_Core_User')) {
return false;
}
// Load the AJAX functions for the theme
require_once WP_PLUGIN_DIR . '/buddypress/bp-themes/bp-default/_inc/ajax.php';
// Load the javascript for the theme
wp_enqueue_script('dtheme-ajax-js', get_template_directory_uri() . '/_inc/global.js', array('jquery'));
// Add words that we need to use in JS to the end of the page so they can be translated and still used.
$params = array('my_favs' => __('My Favorites', 'buddypress'), 'accepted' => __('Accepted', 'buddypress'), 'rejected' => __('Rejected', 'buddypress'), 'show_all_comments' => __('Show all comments for this thread', 'buddypress'), 'show_all' => __('Show all', 'buddypress'), 'comments' => __('comments', 'buddypress'), 'close' => __('Close', 'buddypress'), 'mention_explain' => sprintf(__("%s is a unique identifier for %s that you can type into any message on this site. %s will be sent a notification and a link to your message any time you use it.", 'buddypress'), '@' . bp_get_displayed_user_username(), bp_get_user_firstname(bp_get_displayed_user_fullname()), bp_get_user_firstname(bp_get_displayed_user_fullname())));
wp_localize_script('dtheme-ajax-js', 'BP_DTheme', $params);
/**
* Add the JS needed for blog comment replies
*
* @package BuddyPress Theme
* @since 1.2
*/
function bp_dtheme_add_blog_comments_js()
{
if (is_singular()) {
wp_enqueue_script('comment-reply');
}
}
add_action('template_redirect', 'bp_dtheme_add_blog_comments_js');
/**
示例13: array
// Add the new warning to the array
$warnings[] = array('points' => $points, 'reason' => trim($reason), 'moderator' => $moderator, 'date' => $date);
// Make sure there was no error
if (empty($error)) {
// Update user meta
update_user_meta($user->id, 'infraction_history', $warnings);
bp_core_add_message('Warning successfully issued!', 'success');
// Maybe ban the user
if ($level + $points == 5) {
$u = new WP_User($user->id);
$u->set_role('banned');
}
// Email people
if ($_POST['email-user'] || $_POST['email-mods']) {
// Set the email headers
$name = bp_get_displayed_user_username();
$subject = "[Tamriel Foundry] Warning Issued to {$name}";
$headers = "From: Foundry Discipline Bot <noreply@tamrielfoundry.com>\r\n";
$headers .= "Content-Type: text/html; charset=UTF-8";
// Construct the message
$body = '<p>Your user account, ' . $name . ', has been issued a warning for ' . $points . ' point(s) by the moderation team at Tamriel Foundry for the following reason:</p>';
$body .= ' ';
$body .= '<p><strong>' . $reason . '</strong></p>';
$body .= ' ';
$body .= '<p>Please review the Tamriel Foundry <a href="http://tamrielfoundry.com/topic/tamriel-foundry-code-of-conduct/" title="Read the Code of Conduct" target="_blank">Code of Conduct</a> to better understand the expectations we have of our users.';
$body .= 'You may review your current infractions on your user profile using the following link:</p>';
$body .= '<p><a href="' . $action_url . '" title="View Your Infractions" target="_blank">' . $action_url . '</a>';
// Send the message
if ($_POST['email-user']) {
$emailto = bp_get_displayed_user_email();
wp_mail($emailto, $subject, $body, $headers);
示例14: bp_get_send_public_message_link
/**
* Returns the public message link for displayed user
*
* @since BuddyPress (1.2)
*
* @global object $bp BuddyPress global settings
* @uses bp_is_my_profile()
* @uses is_user_logged_in()
* @uses wp_nonce_url()
* @uses bp_loggedin_user_domain()
* @uses bp_get_activity_slug()
* @uses bp_core_get_username()
* @uses apply_filters() To call the 'bp_get_send_public_message_link' hook
*
* @return string The public message link for displayed user
*/
function bp_get_send_public_message_link()
{
global $bp;
if (bp_is_my_profile() || !is_user_logged_in()) {
return false;
}
return apply_filters('bp_get_send_public_message_link', wp_nonce_url(bp_get_activity_directory_permalink() . '?r=' . bp_core_get_username(bp_displayed_user_id(), bp_get_displayed_user_username(), $bp->displayed_user->userdata->user_login)));
}
示例15: setup_globals
/**
* Set some globals
*
* @package WP Idea Stream
* @subpackage buddypress/screens
*
* @since 2.0.0
*
* @uses bp_displayed_user_id() to get displayed user ID
* @uses bp_get_displayed_user_username() to get displayed user nicename
*/
public function setup_globals()
{
$this->screen = '';
$this->user_id = bp_displayed_user_id();
$this->username = bp_get_displayed_user_username();
}