本文整理汇总了PHP中bp_get_loggedin_user_username函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_get_loggedin_user_username函数的具体用法?PHP bp_get_loggedin_user_username怎么用?PHP bp_get_loggedin_user_username使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_get_loggedin_user_username函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bp_activity_format_notifications
/**
* Format notifications related to activity.
*
* @since 1.5.0
*
* @uses bp_loggedin_user_domain()
* @uses bp_get_activity_slug()
* @uses bp_core_get_user_displayname()
* @uses apply_filters() To call the 'bp_activity_multiple_at_mentions_notification' hook.
* @uses apply_filters() To call the 'bp_activity_single_at_mentions_notification' hook.
* @uses do_action() To call 'activity_format_notifications' hook.
*
* @param string $action The type of activity item. Just 'new_at_mention' for now.
* @param int $item_id The activity ID.
* @param int $secondary_item_id In the case of at-mentions, this is the mentioner's ID.
* @param int $total_items The total number of notifications to format.
* @param string $format 'string' to get a BuddyBar-compatible notification, 'array' otherwise.
* @return string $return Formatted @mention notification.
*/
function bp_activity_format_notifications($action, $item_id, $secondary_item_id, $total_items, $format = 'string')
{
switch ($action) {
case 'new_at_mention':
$activity_id = $item_id;
$poster_user_id = $secondary_item_id;
$at_mention_link = bp_loggedin_user_domain() . bp_get_activity_slug() . '/mentions/';
$at_mention_title = sprintf(__('@%s Mentions', 'buddypress'), bp_get_loggedin_user_username());
$amount = 'single';
if ((int) $total_items > 1) {
$text = sprintf(__('You have %1$d new mentions', 'buddypress'), (int) $total_items);
$amount = 'multiple';
} else {
$user_fullname = bp_core_get_user_displayname($poster_user_id);
$text = sprintf(__('%1$s mentioned you', 'buddypress'), $user_fullname);
}
break;
}
if ('string' == $format) {
/**
* Filters the @mention notification for the string format.
*
* This is a variable filter that is dependent on how many items
* need notified about. The two possible hooks are bp_activity_single_at_mentions_notification
* or bp_activity_multiple_at_mentions_notification.
*
* @since 1.5.0
*
* @param string $string HTML anchor tag for the mention.
* @param string $at_mention_link The permalink for the mention.
* @param int $total_items How many items being notified about.
* @param int $activity_id ID of the activity item being formatted.
* @param int $poster_user_id ID of the user posting the mention.
*/
$return = apply_filters('bp_activity_' . $amount . '_at_mentions_notification', '<a href="' . esc_url($at_mention_link) . '" title="' . esc_attr($at_mention_title) . '">' . esc_html($text) . '</a>', $at_mention_link, (int) $total_items, $activity_id, $poster_user_id);
} else {
/**
* Filters the @mention notification for any non-string format.
*
* This is a variable filter that is dependent on how many items need notified about.
* The two possible hooks are bp_activity_single_at_mentions_notification
* or bp_activity_multiple_at_mentions_notification.
*
* @since 1.5.0
*
* @param array $array Array holding the content and permalink for the mention notification.
* @param string $at_mention_link The permalink for the mention.
* @param int $total_items How many items being notified about.
* @param int $activity_id ID of the activity item being formatted.
* @param int $poster_user_id ID of the user posting the mention.
*/
$return = apply_filters('bp_activity_' . $amount . '_at_mentions_notification', array('text' => $text, 'link' => $at_mention_link), $at_mention_link, (int) $total_items, $activity_id, $poster_user_id);
}
/**
* Fires right before returning the formatted activity notifications.
*
* @since 1.2.0
*
* @param string $action The type of activity item.
* @param int $item_id The activity ID.
* @param int $secondary_item_id @mention mentioner ID.
* @param int $total_items Total amount of items to format.
*/
do_action('activity_format_notifications', $action, $item_id, $secondary_item_id, $total_items);
return $return;
}
示例2: bp_loggedin_user_username
/**
* Output the username of the logged-in user.
*/
function bp_loggedin_user_username()
{
echo bp_get_loggedin_user_username();
}
示例3: setup_nav
/**
* Set up IdeaStream navigation.
*
* @package WP Idea Stream
* @subpackage buddypress/loader
*
* @since 2.0.0
*
* @uses buddypress() to get BuddyPress instance data
* @uses bp_loggedin_user_id() to get logged in user id
* @uses bp_get_loggedin_user_username() to get logged in user nicename
* @uses bp_loggedin_user_domain() to get logged in user domain
* @uses bp_is_user() to check if a user's profile is displayed
* @uses bp_displayed_user_id() to get the displayed user id
* @uses bp_get_displayed_user_username() to get displayed user nicename
* @uses bp_displayed_user_domain() to get displayed user profile link
* @uses wp_idea_stream_users_get_profile_nav_items() to get IdeaStream user nav items
* @uses sanitize_title(), sanitize_key() to sanitize datas
*/
public function setup_nav($main_nav = array(), $sub_nav = array())
{
$bp = buddypress();
// Default is current user.
$user_id = bp_loggedin_user_id();
$user_nicename = bp_get_loggedin_user_username();
$user_domain = bp_loggedin_user_domain();
// If viewing a user, set the user to displayed one
if (bp_is_user()) {
$user_id = bp_displayed_user_id();
$user_nicename = bp_get_displayed_user_username();
$user_domain = bp_displayed_user_domain();
}
// Build the user nav if we have an id
if (!empty($user_id)) {
// Build user's ideas BuddyPress profile link
$profile_link = trailingslashit($user_domain . $this->slug);
// Get Core User's profile nav
$user_core_subnav = wp_idea_stream_users_get_profile_nav_items($user_id, $user_nicename);
// Build BuddyPress user's Main nav
$main_nav = array('name' => $this->name, 'slug' => $this->slug, 'position' => 90, 'screen_function' => array('WP_Idea_Stream_Screens', 'user_ideas'), 'default_subnav_slug' => sanitize_title($user_core_subnav['profile']['slug'], 'ideas', 'save'));
// Init nav position & subnav slugs
$position = 10;
$this->idea_nav = array();
// Build BuddyPress user's Sub nav
foreach ($user_core_subnav as $key => $nav) {
$fallback_slug = sanitize_key($key);
if ('profile' == $fallback_slug) {
$fallback_slug = 'ideas';
}
// Register subnav slugs using the fallback title
// as keys to easily build urls later on.
$this->idea_nav[$fallback_slug] = array('name' => $nav['title'], 'slug' => sanitize_title($nav['slug'], $fallback_slug, 'save'));
$sub_nav[] = array('name' => $this->idea_nav[$fallback_slug]['name'], 'slug' => $this->idea_nav[$fallback_slug]['slug'], 'parent_url' => $profile_link, 'parent_slug' => $this->slug, 'screen_function' => array('WP_Idea_Stream_Screens', 'user_' . $fallback_slug), 'position' => $position);
// increment next nav position
$position += 10;
}
}
parent::setup_nav($main_nav, $sub_nav);
}
示例4: bp_activity_format_notifications
/**
* Format notifications related to activity.
*
* @since 1.5.0
*
* @param string $action The type of activity item. Just 'new_at_mention' for now.
* @param int $item_id The activity ID.
* @param int $secondary_item_id In the case of at-mentions, this is the mentioner's ID.
* @param int $total_items The total number of notifications to format.
* @param string $format 'string' to get a BuddyBar-compatible notification, 'array' otherwise.
* @param int $id Optional. The notification ID.
* @return string $return Formatted @mention notification.
*/
function bp_activity_format_notifications($action, $item_id, $secondary_item_id, $total_items, $format = 'string', $id = 0)
{
$action_filter = $action;
$return = false;
$activity_id = $item_id;
$user_id = $secondary_item_id;
$user_fullname = bp_core_get_user_displayname($user_id);
switch ($action) {
case 'new_at_mention':
$action_filter = 'at_mentions';
$link = bp_loggedin_user_domain() . bp_get_activity_slug() . '/mentions/';
$title = sprintf(__('@%s Mentions', 'buddypress'), bp_get_loggedin_user_username());
$amount = 'single';
if ((int) $total_items > 1) {
$text = sprintf(__('You have %1$d new mentions', 'buddypress'), (int) $total_items);
$amount = 'multiple';
} else {
$text = sprintf(__('%1$s mentioned you', 'buddypress'), $user_fullname);
}
break;
case 'update_reply':
$link = bp_get_notifications_permalink();
$title = __('New Activity reply', 'buddypress');
$amount = 'single';
if ((int) $total_items > 1) {
$link = add_query_arg('type', $action, $link);
$text = sprintf(__('You have %1$d new replies', 'buddypress'), (int) $total_items);
$amount = 'multiple';
} else {
$link = add_query_arg('nid', (int) $id, bp_activity_get_permalink($activity_id));
$text = sprintf(__('%1$s commented on one of your updates', 'buddypress'), $user_fullname);
}
break;
case 'comment_reply':
$link = bp_get_notifications_permalink();
$title = __('New Activity comment reply', 'buddypress');
$amount = 'single';
if ((int) $total_items > 1) {
$link = add_query_arg('type', $action, $link);
$text = sprintf(__('You have %1$d new comment replies', 'buddypress'), (int) $total_items);
$amount = 'multiple';
} else {
$link = add_query_arg('nid', (int) $id, bp_activity_get_permalink($activity_id));
$text = sprintf(__('%1$s replied to one your activity comments', 'buddypress'), $user_fullname);
}
break;
}
if ('string' == $format) {
/**
* Filters the activity notification for the string format.
*
* This is a variable filter that is dependent on how many items
* need notified about. The two possible hooks are bp_activity_single_at_mentions_notification
* or bp_activity_multiple_at_mentions_notification.
*
* @since 1.5.0
* @since 2.6.0 use the $action_filter as a new dynamic portion of the filter name.
*
* @param string $string HTML anchor tag for the interaction.
* @param string $link The permalink for the interaction.
* @param int $total_items How many items being notified about.
* @param int $activity_id ID of the activity item being formatted.
* @param int $user_id ID of the user who inited the interaction.
*/
$return = apply_filters('bp_activity_' . $amount . '_' . $action_filter . '_notification', '<a href="' . esc_url($link) . '" title="' . esc_attr($title) . '">' . esc_html($text) . '</a>', $link, (int) $total_items, $activity_id, $user_id);
} else {
/**
* Filters the activity notification for any non-string format.
*
* This is a variable filter that is dependent on how many items need notified about.
* The two possible hooks are bp_activity_single_at_mentions_notification
* or bp_activity_multiple_at_mentions_notification.
*
* @since 1.5.0
* @since 2.6.0 use the $action_filter as a new dynamic portion of the filter name.
*
* @param array $array Array holding the content and permalink for the interaction notification.
* @param string $link The permalink for the interaction.
* @param int $total_items How many items being notified about.
* @param int $activity_id ID of the activity item being formatted.
* @param int $user_id ID of the user who inited the interaction.
*/
$return = apply_filters('bp_activity_' . $amount . '_' . $action_filter . '_notification', array('text' => $text, 'link' => $link), $link, (int) $total_items, $activity_id, $user_id);
}
/**
* Fires right before returning the formatted activity notifications.
*
//.........这里部分代码省略.........
示例5: update_activity_ham_meta
/**
* Update activity meta after a manual ham change (user initiated)
*
* @param BP_Activity_Activity $activity The activity to check
* @since BuddyPress (1.6)
*/
public function update_activity_ham_meta($activity)
{
// By default, only handle activity updates and activity comments.
if (!in_array($activity->type, BP_Akismet::get_activity_types())) {
return;
}
$this->update_activity_history($activity->id, sprintf(__('%s reported this activity as not spam', 'buddypress'), bp_get_loggedin_user_username()), 'report-ham');
bp_activity_update_meta($activity->id, '_bp_akismet_user_result', 'false');
bp_activity_update_meta($activity->id, '_bp_akismet_user', bp_get_loggedin_user_username());
}
示例6: rendez_vous_single_get_the_dates
function rendez_vous_single_get_the_dates($view = 'single')
{
// First add organizer
$all_attendees = (array) rendez_vous()->item->attendees;
if (!in_array(rendez_vous()->item->organizer, $all_attendees)) {
$all_attendees = array_merge(array(rendez_vous()->item->organizer), $all_attendees);
}
// Then remove current_user as we want him to be in last position
if ('edit' != $view) {
if (!rendez_vous_single_date_set() && bp_loggedin_user_id()) {
$attendees = array_diff($all_attendees, array(bp_loggedin_user_id()));
} else {
$attendees = $all_attendees;
}
} else {
$attendees = $all_attendees;
}
$days = rendez_vous()->item->days;
if (empty($days)) {
return false;
}
ksort($days);
$header = array_keys($days);
$output = '<table id="rendez-vous-attendees-prefs">';
$output .= '<thead>';
$output .= '<tr><th> </th>';
foreach ($header as $date) {
$output .= '<th class="rendez-vous-date">';
if (is_long($date)) {
$output .= '<div class="date">' . date_i18n(get_option('date_format'), $date) . '</div>';
$output .= '<div class="time">' . date_i18n(get_option('time_format'), $date) . '</div>';
} else {
$output .= '<div class="none">' . esc_html__('None', 'rendez-vous') . '</div>';
}
$output .= '</th>';
}
$output .= '</tr></thead>';
$output .= '<tbody>';
//rows
foreach ($attendees as $attendee) {
$user_link = trailingslashit(bp_core_get_user_domain($attendee));
$user_name = bp_core_get_user_displayname($attendee);
$tr_class = $attendee == bp_loggedin_user_id() ? 'edited' : false;
$output .= '<tr class="' . $tr_class . '"><td>';
if ('edit' == $view) {
// Make sure the organizer is not removed from attendees
if ($attendee == rendez_vous()->item->organizer) {
$output .= '<input type="hidden" name="_rendez_vous_edit[attendees][]" value="' . $attendee . '"/>';
} else {
$output .= '<input type="checkbox" name="_rendez_vous_edit[attendees][]" value="' . $attendee . '" checked="true"/> ';
}
}
$output .= '<a href="' . esc_url($user_link) . '" title="' . esc_attr($user_name) . '">' . bp_core_fetch_avatar(array('object' => 'user', 'item_id' => $attendee, 'type' => 'thumb', 'class' => 'mini', 'width' => 20, 'height' => 20)) . ' ' . $user_name . '</a></td>';
foreach ($header as $date) {
$class = in_array($attendee, $days[$date]) ? 'active' : 'inactive';
if ('none' == $date) {
$class .= ' impossible';
}
$output .= '<td class="' . $class . '"> </td>';
}
$output .= '</tr>';
}
$ending_rows = array('total' => '<td>' . esc_html__('Total', 'rendez-vous') . '</td>');
if ('edit' != $view) {
$ending_rows['editable_row'] = '<td><a href="' . esc_url(bp_loggedin_user_domain()) . '" title="' . esc_attr(bp_get_loggedin_user_username()) . '">' . bp_core_fetch_avatar(array('object' => 'user', 'item_id' => bp_loggedin_user_id(), 'type' => 'thumb', 'class' => 'mini', 'width' => 20, 'height' => 20)) . ' ' . esc_html(bp_get_loggedin_user_fullname()) . '</a></td>';
// Set definitive date
} else {
$ending_rows['editable_row'] = '<td id="rendez-vous-set">' . esc_html__('Set date', 'rendez-vous') . '</td>';
}
foreach ($header as $date) {
$checked = checked(true, in_array(bp_loggedin_user_id(), $days[$date]), false);
$ending_rows['total'] .= '<td><strong>' . count($days[$date]) . '</strong></td>';
// Let the user set his prefs
if ('edit' != $view) {
$class = false;
if ('none' == $date) {
$class = ' class="none-resets-cb"';
}
$ending_rows['editable_row'] .= '<td><input type="checkbox" name="_rendez_vous_prefs[days][' . bp_loggedin_user_id() . '][]" value="' . $date . '" ' . $checked . $class . '/></td>';
// Let the organizer choose the definitive date
} else {
$def_date = !empty(rendez_vous()->item->def_date) ? rendez_vous()->item->def_date : false;
if ('none' != $date) {
$ending_rows['editable_row'] .= '<td><input type="radio" name="_rendez_vous_edit[def_date]" value="' . $date . '" ' . checked($date, $def_date, false) . '/></td>';
} else {
$ending_rows['editable_row'] .= '<td></td>';
}
}
}
if ('edit' != $view) {
// Date is set, changes cannot be done anymore
if (!rendez_vous_single_date_set()) {
if ('private' == rendez_vous()->item->privacy) {
// If private, display the row only if current user is an attendee or the author
if (bp_loggedin_user_id() == rendez_vous()->item->organizer || in_array(bp_loggedin_user_id(), $all_attendees)) {
$output .= '<tr class="edited">' . $ending_rows['editable_row'] . '</tr>';
}
} else {
if (current_user_can('subscribe_rendez_vous')) {
$output .= '<tr class="edited">' . $ending_rows['editable_row'] . '</tr>';
//.........这里部分代码省略.........
示例7: bp_record_vote_activity
function bp_record_vote_activity($site_id, $blog_id, $post_id, $vote)
{
if (!bp_loggedin_user_id()) {
return false;
}
$username = bp_get_loggedin_user_fullname();
$username = $username ? $username : bp_get_loggedin_user_username();
if (!$username) {
return false;
}
$user_link = bp_get_loggedin_user_link();
$link = get_blog_permalink($blog_id, $post_id);
$post = get_blog_post($blog_id, $post_id);
$title = $post->post_title;
$args = array('action' => sprintf(__('<a href="%s">%s</a> voted on <a href="%s">%s</a>', 'wdpv'), $user_link, $username, $link, $title), 'component' => 'wdpv_post_vote', 'type' => 'wdpv_post_vote', 'item_id' => $blog_id, 'secondary_item_id' => $post_id, 'hide_sitewide' => $this->data->get_option('bp_publish_activity_local'));
$res = bp_activity_add($args);
return $res;
}
示例8: bp_loggedin_user_domain
<a href="<?php
echo bp_loggedin_user_domain();
?>
">
<?php
bp_loggedin_user_avatar('width=150&height=150');
?>
</a>
</div>
<div class="col-xs-12 col-sm-12 col-lg-12" style="text-align: center">
<h4 style="font-size: 1.4em"><?php
echo bp_get_loggedin_user_fullname();
?>
</h4>
<span class="username">@<?php
echo bp_get_loggedin_user_username();
?>
</span>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<nav class="nav" role="navigation">
<div class="row">
<div class="navbar-header panel hidden-md hidden-lg" style="background-color: #fff; text-align: center">
<h4 class="no-margin">
<a class="collapsed" data-toggle="collapse" data-target="#navbar-user">
What's New
<i class="fa fa-caret-down"></i>
</a>
示例9: bp_activity_format_notifications
/**
* Formats notifications related to activity
*
* @since BuddyPress (1.5)
*
* @param string $action The type of activity item. Just 'new_at_mention' for now
* @param int $item_id The activity id
* @param int $secondary_item_id In the case of at-mentions, this is the mentioner's id
* @param int $total_items The total number of notifications to format
* @param string $format 'string' to get a BuddyBar-compatible notification, 'array' otherwise
*
* @uses bp_loggedin_user_domain()
* @uses bp_get_activity_slug()
* @uses bp_core_get_user_displayname()
* @uses apply_filters() To call the 'bp_activity_multiple_at_mentions_notification' hook
* @uses apply_filters() To call the 'bp_activity_single_at_mentions_notification' hook
* @uses do_action() To call 'activity_format_notifications' hook
*
* @return string $return Formatted @mention notification
*/
function bp_activity_format_notifications($action, $item_id, $secondary_item_id, $total_items, $format = 'string')
{
switch ($action) {
case 'new_at_mention':
$activity_id = $item_id;
$poster_user_id = $secondary_item_id;
$at_mention_link = bp_loggedin_user_domain() . bp_get_activity_slug() . '/mentions/';
$at_mention_title = sprintf(__('@%s Mentions', 'buddypress'), bp_get_loggedin_user_username());
if ((int) $total_items > 1) {
$text = sprintf(__('You have %1$d new mentions', 'buddypress'), (int) $total_items);
$filter = 'bp_activity_multiple_at_mentions_notification';
} else {
$user_fullname = bp_core_get_user_displayname($poster_user_id);
$text = sprintf(__('%1$s mentioned you', 'buddypress'), $user_fullname);
$filter = 'bp_activity_single_at_mentions_notification';
}
break;
}
if ('string' == $format) {
$return = apply_filters($filter, '<a href="' . $at_mention_link . '" title="' . $at_mention_title . '">' . $text . '</a>', $at_mention_link, (int) $total_items, $activity_id, $poster_user_id);
} else {
$return = apply_filters($filter, array('text' => $text, 'link' => $at_mention_link), $at_mention_link, (int) $total_items, $activity_id, $poster_user_id);
}
do_action('activity_format_notifications', $action, $item_id, $secondary_item_id, $total_items);
return $return;
}
示例10: kleo_pmpro_restrict_rules
/**
* Applies restrictions based on the Theme options -> Memberships
* @return void
* @since 2.0
*/
function kleo_pmpro_restrict_rules()
{
//if PMPRO is not activated
if (!function_exists('pmpro_url')) {
return;
}
//if buddypress is not activated
if (!function_exists('bp_is_active')) {
return;
}
//full current url
$actual_link = kleo_full_url();
//our request uri
$home_url = home_url();
//WPML support
if (defined('ICL_SITEPRESS_VERSION')) {
global $sitepress;
$home_url = $sitepress->language_url(ICL_LANGUAGE_CODE);
}
$home_url = str_replace("www.", "", $home_url);
$uri = str_replace(untrailingslashit($home_url), "", $actual_link);
//restriction match array
$final = array();
$allowed_chars = apply_filters('kleo_pmpro_allowed_chars', "a-z 0-9~%.:_\\-");
$restrict_options = kleo_memberships();
$members_slug = str_replace('/', '\\/', bp_get_members_root_slug());
/*-----------------------------------------------------------------------------------*/
/* Preg match rules
/*-----------------------------------------------------------------------------------*/
//members directory restriction rule
$final["/^\\/" . $members_slug . "\\/?\$/"] = array('name' => 'members_dir', 'type' => $restrict_options['members_dir']['type'], 'levels' => isset($restrict_options['members_dir']['levels']) ? $restrict_options['members_dir']['levels'] : array());
//members single profile restriction rule
$final["/^\\/" . $members_slug . "\\/[" . $allowed_chars . "\\/]+\\/?\$/"] = array('name' => 'view_profiles', 'type' => $restrict_options['view_profiles']['type'], 'levels' => isset($restrict_options['view_profiles']['levels']) ? $restrict_options['view_profiles']['levels'] : array());
if (function_exists('bp_get_groups_root_slug')) {
$groups_slug = str_replace('/', '\\/', bp_get_groups_root_slug());
//groups directory restriction rule
$final["/^\\/" . $groups_slug . "\\/?\$/"] = array('name' => 'groups_dir', 'type' => $restrict_options['groups_dir']['type'], 'levels' => isset($restrict_options['groups_dir']['levels']) ? $restrict_options['groups_dir']['levels'] : array());
//groups single page restriction rule
$final["/^\\/" . $groups_slug . "\\/[" . $allowed_chars . "\\/]+\\/?\$/"] = array('name' => 'view_groups', 'type' => $restrict_options['view_groups']['type'], 'levels' => isset($restrict_options['view_groups']['levels']) ? $restrict_options['view_groups']['levels'] : array());
}
if (function_exists('bp_get_activity_root_slug')) {
$activity_slug = str_replace('/', '\\/', bp_get_activity_root_slug());
//activity page restriction rule
$final["/^\\/" . $activity_slug . "\\/?\$/"] = array('name' => 'show_activity', 'type' => $restrict_options['show_activity']['type'], 'levels' => isset($restrict_options['show_activity']['levels']) ? $restrict_options['show_activity']['levels'] : array());
}
/* You can add extra restrictions using this filter */
$final = apply_filters('kleo_pmpro_match_rules', $final);
//no redirection for super-admin
if (is_super_admin()) {
return false;
} elseif (is_user_logged_in()) {
//restrict media
if (preg_match("/^\\/" . $members_slug . "\\/" . bp_get_loggedin_user_username() . "\\/media\\/?/", $uri) || preg_match("/^\\/" . $members_slug . "\\/" . bp_get_loggedin_user_username() . "\\/album\\/?/", $uri)) {
kleo_check_access('add_media', $restrict_options);
} elseif (preg_match("/^\\/" . $members_slug . "\\/" . bp_get_loggedin_user_username() . "\\/messages\\/compose\\/?/", $uri) || preg_match("/^\\/" . $members_slug . "\\/" . bp_get_loggedin_user_username() . "\\/messages\\/view\\/[" . $allowed_chars . "\\/]?\\/?/", $uri)) {
kleo_check_access('pm', $restrict_options);
}
/* Add other restrictions for own profile */
do_action('kleo_pmro_extra_restriction_before_my_profile', $restrict_options);
//allow me to view other parts of my profile
if (bp_is_my_profile()) {
return false;
}
}
//loop trought remaining restrictions
foreach ($final as $rk => $rv) {
if (preg_match($rk, $uri)) {
kleo_check_access($rv['name'], $restrict_options);
}
}
do_action('kleo_pmro_extra_restriction_rules', $restrict_options);
}
示例11: do_action
<?php
}
?>
<?php
do_action('bp_before_activity_type_tab_mentions');
?>
<li id="activity-mentions"><a href="<?php
echo bp_loggedin_user_domain() . BP_ACTIVITY_SLUG . '/mentions/';
?>
" title="<?php
_e('Activity that I have been mentioned in.', 'buddypress');
?>
"><?php
printf(__('@%s Mentions', 'buddypress'), bp_get_loggedin_user_username());
if (bp_get_total_mention_count_for_user(bp_loggedin_user_id())) {
?>
<strong><?php
printf(__('(%s new)', 'buddypress'), bp_get_total_mention_count_for_user(bp_loggedin_user_id()));
?>
</strong><?php
}
?>
</a></li>
<?php
}
?>
<?php
示例12: buddyboss_format_mention_notification
/**
* Format @mention notifications to redirect to the wall
* @param [type] $notification [description]
* @return [type] [description]
*/
function buddyboss_format_mention_notification($notification, $at_mention_link, $total_items, $activity_id, $poster_user_id)
{
global $wp_admin_bar, $bp;
$domain = $bp->loggedin_user->domain;
$activity_link = trailingslashit($domain . $bp->activity->slug);
$at_mention_link = bp_loggedin_user_domain() . bp_get_activity_slug() . '/mentions/';
$at_mention_title = sprintf(__('@%s Mentions', 'buddyboss'), bp_get_loggedin_user_username());
if ((int) $total_items > 1) {
$text = sprintf(__('You have %1$d new mentions', 'buddyboss'), (int) $total_items);
} else {
$user_fullname = bp_core_get_user_displayname($poster_user_id);
$text = sprintf(__('%1$s mentioned you', 'buddyboss'), $user_fullname);
}
if (is_array($notification)) {
$notification['link'] = $activity_link;
} else {
$notification = '<a href="' . $activity_link . '" title="' . $at_mention_title . '">' . $text . '</a>';
}
return $notification;
}
示例13: if
<?php if ( function_exists( 'bp_get_total_group_count_for_user' ) ) : ?>
<?php if ( bp_get_total_group_count_for_user( bp_loggedin_user_id() ) ) : ?>
<li id="activity-groups"><a href="<?php echo bp_loggedin_user_domain() . BP_ACTIVITY_SLUG . '/' . BP_GROUPS_SLUG . '/' ?>" title="<?php _e( 'The activity of groups I am a member of.', 'buddypress' ) ?>"><?php printf( __( 'My Groups (%s)', 'buddypress' ), bp_get_total_group_count_for_user( bp_loggedin_user_id() ) ) ?></a></li>
<?php endif; ?>
<?php endif; ?>
<?php do_action( 'bp_before_activity_type_tab_favorites' ) ?>
<?php if ( bp_get_total_favorite_count_for_user( bp_loggedin_user_id() ) ) : ?>
<li id="activity-favorites"><a href="<?php echo bp_loggedin_user_domain() . BP_ACTIVITY_SLUG . '/favorites/' ?>" title="<?php _e( "The activity I've marked as a favorite.", 'buddypress' ) ?>"><?php printf( __( 'My Favorites (<span>%s</span>)', 'buddypress' ), bp_get_total_favorite_count_for_user( bp_loggedin_user_id() ) ) ?></a></li>
<?php endif; ?>
<?php do_action( 'bp_before_activity_type_tab_mentions' ) ?>
<li id="activity-mentions"><a href="<?php echo bp_loggedin_user_domain() . BP_ACTIVITY_SLUG . '/mentions/' ?>" title="<?php _e( 'Activity that I have been mentioned in.', 'buddypress' ) ?>"><?php printf( __( '@%s Mentions', 'buddypress' ), bp_get_loggedin_user_username() ) ?><?php if ( bp_get_total_mention_count_for_user( bp_loggedin_user_id() ) ) : ?> <strong><?php printf( __( '(%s new)', 'buddypress' ), bp_get_total_mention_count_for_user( bp_loggedin_user_id() ) ) ?></strong><?php endif; ?></a></li>
<?php endif; ?>
<?php do_action( 'bp_activity_type_tabs' ) ?>
</ul>
</div><!-- .item-list-tabs -->
<div class="item-list-tabs no-ajax" id="subnav">
<ul>
<li class="feed"><a href="<?php bp_sitewide_activity_feed_link() ?>" title="<?php _e( 'RSS Feed', 'buddypress' ); ?>"><?php _e( 'RSS', 'buddypress' ) ?></a></li>
<?php do_action( 'bp_activity_syndication_options' ) ?>
<li id="activity-filter-select" class="last">
<select>
示例14: prepare_metadata
/**
* Prepare the metadata sent to Fedora and Solr from $_POST input.
*
* @param array $nextPids Array of fedora pids.
* @return array metadata content
*/
function prepare_metadata($nextPids)
{
global $fedora_api;
/**
* Prepare the metadata to be sent to Fedora and Solr.
*/
$metadata = array();
$metadata['id'] = $nextPids[0];
$metadata['pid'] = $nextPids[0];
$metadata['creator'] = 'HumCORE';
$metadata['title'] = wp_strip_all_tags(stripslashes($_POST['deposit-title-unchanged']));
$metadata['title_unchanged'] = wp_kses(stripslashes($_POST['deposit-title-unchanged']), array('b' => array(), 'em' => array(), 'strong' => array()));
$metadata['abstract'] = wp_strip_all_tags(stripslashes($_POST['deposit-abstract-unchanged']));
$metadata['abstract_unchanged'] = wp_kses(stripslashes($_POST['deposit-abstract-unchanged']), array('b' => array(), 'em' => array(), 'strong' => array()));
$metadata['genre'] = sanitize_text_field($_POST['deposit-genre']);
$metadata['committee_deposit'] = sanitize_text_field($_POST['deposit-on-behalf-flag']);
$metadata['committee_id'] = sanitize_text_field($_POST['deposit-committee']);
$metadata['submitter'] = bp_loggedin_user_id();
/**
* Get committee or author metadata.
*/
if ('yes' === $metadata['committee_deposit']) {
$committee = groups_get_group(array('group_id' => $metadata['committee_id']));
$metadata['organization'] = 'MLA';
$metadata['authors'][] = array('fullname' => $committee->name, 'given' => '', 'family' => '', 'uni' => $committee->slug, 'role' => 'creator', 'affiliation' => 'MLA');
} else {
$user_id = bp_loggedin_user_id();
$user_firstname = get_the_author_meta('first_name', $user_id);
$user_lastname = get_the_author_meta('last_name', $user_id);
$user_affiliation = bp_get_profile_field_data(array('field' => 2, 'user_id' => $user_id));
$metadata['organization'] = $user_affiliation;
$metadata['authors'][] = array('fullname' => bp_get_loggedin_user_fullname(), 'given' => $user_firstname, 'family' => $user_lastname, 'uni' => bp_get_loggedin_user_username(), 'role' => 'author', 'affiliation' => $user_affiliation);
}
if ((empty($metadata['committee_deposit']) || 'yes' !== $metadata['committee_deposit']) && (!empty($_POST['deposit-other-authors-first-name']) && !empty($_POST['deposit-other-authors-last-name']))) {
$other_authors = array_map(function ($first_name, $last_name) {
return array('first_name' => sanitize_text_field($first_name), 'last_name' => sanitize_text_field($last_name));
}, $_POST['deposit-other-authors-first-name'], $_POST['deposit-other-authors-last-name']);
foreach ($other_authors as $author_array) {
if (!empty($author_array['first_name']) && !empty($author_array['last_name'])) {
$mla_user = bp_activity_find_mentions($author_array['first_name'] . $author_array['last_name']);
if (!empty($mla_user)) {
foreach ($mla_user as $mla_userid => $mla_username) {
break;
}
// Only one, right?
$author_name = bp_core_get_user_displayname($mla_userid);
$author_firstname = get_the_author_meta('first_name', $mla_userid);
$author_lastname = get_the_author_meta('last_name', $mla_userid);
$author_affiliation = bp_get_profile_field_data(array('field' => 2, 'user_id' => $mla_userid));
$author_uni = $mla_username;
} else {
$author_firstname = $author_array['first_name'];
$author_lastname = $author_array['last_name'];
$author_name = trim($author_firstname . ' ' . $author_lastname);
$author_uni = '';
$author_affiliation = '';
}
$metadata['authors'][] = array('fullname' => $author_name, 'given' => $author_firstname, 'family' => $author_lastname, 'uni' => $author_uni, 'role' => 'author', 'affiliation' => $author_affiliation);
}
}
}
usort($metadata['authors'], function ($a, $b) {
return strcasecmp($a['family'], $b['family']);
});
/**
* Format author info for solr.
*/
$metadata['author_info'] = humcore_deposits_format_author_info($metadata['authors']);
if (!empty($metadata['genre']) && in_array($metadata['genre'], array('Dissertation', 'Technical Report', 'Thesis')) && !empty($_POST['deposit-institution'])) {
$metadata['institution'] = sanitize_text_field($_POST['deposit-institution']);
} else {
if (!empty($metadata['genre']) && in_array($metadata['genre'], array('Dissertation', 'Technical Report', 'Thesis')) && empty($_POST['deposit-institution'])) {
$metadata['institution'] = $metadata['organization'];
}
}
if (!empty($metadata['genre']) && ('Conference proceeding' == $metadata['genre'] || 'Conference paper' == $metadata['genre']) && !empty($_POST['deposit-conference-title'])) {
$metadata['conference_title'] = sanitize_text_field($_POST['deposit-conference-title']);
$metadata['conference_organization'] = sanitize_text_field($_POST['deposit-organization']);
}
$metadata['group'] = array();
if (!empty($_POST['deposit-group'])) {
foreach ($_POST['deposit-group'] as $group_id) {
$group = groups_get_group(array('group_id' => sanitize_text_field($group_id)));
$metadata['group'][] = $group->name;
$metadata['group_ids'][] = $group_id;
}
}
$metadata['subject'] = array();
if (!empty($_POST['deposit-subject'])) {
foreach ($_POST['deposit-subject'] as $subject) {
$metadata['subject'][] = sanitize_text_field(stripslashes($subject));
// Subject ids will be set later.
}
}
//.........这里部分代码省略.........