本文整理汇总了PHP中ap_user_display_name函数的典型用法代码示例。如果您正苦于以下问题:PHP ap_user_display_name函数的具体用法?PHP ap_user_display_name怎么用?PHP ap_user_display_name使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ap_user_display_name函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ap_get_all_parti
function ap_get_all_parti($avatar_size = 40, $post_id = false)
{
if (!$post_id) {
$post_id = get_the_ID();
}
$parti = ap_get_parti($post_id);
echo '<h3 class="ap-question-side-title">' . sprintf(_n('<span>1</span> Participant', '<span>%d</span> Participants', count($parti), 'ap'), count($parti)) . '</h3>';
echo '<ul class="ap-participants-list ap-inline-list clearfix">';
foreach ($parti as $p) {
?>
<li>
<?php
echo '<a title="' . ap_user_display_name($p->apmeta_userid, true) . '" href="' . ap_user_link($p->apmeta_userid) . '">';
?>
<?php
echo get_avatar($p->apmeta_userid, $avatar_size);
?>
<?php
echo '</a>';
?>
</li>
<?php
}
echo '</ul>';
}
示例2: answers_meta_box_content
/**
* Render Meta Box content.
*/
public function answers_meta_box_content()
{
$ans_args = array('post_type' => 'answer', 'post_status' => 'publish', 'post_parent' => get_the_ID(), 'showposts' => 10, 'orderby' => 'date', 'order' => 'DESC');
$ans_args = apply_filters('ap_meta_box_answers_query_args', $ans_args);
$answers = get_posts($ans_args);
if (!empty($answers)) {
foreach ($answers as $ans) {
?>
<div class="answer clearfix">
<div class="author">
<span><?php
echo get_avatar($ans->post_author, 30);
?>
</span>
<strong><?php
echo ap_user_display_name($ans->post_author);
?>
</strong>
</div>
<div class="answer-content">
<div class="submitted-on">
<?php
printf(__('%sAnswered about %s ago%s', 'ap'), '<span class="when">', '</span>', ap_human_time(get_the_time('U', $ans)));
?>
</div>
<p><?php
echo $ans->post_content;
?>
</p>
<div class="row-actions">
<span><a href="<?php
echo get_edit_post_link($ans->ID);
?>
"><?php
_e('Edit', 'ap');
?>
</a></span>
<span> | <a href="#"><?php
_e('Hide', 'ap');
?>
</a></span>
<span class="delete vim-d vim-destructive"> | <a href="<?php
echo get_delete_post_link($ans->ID);
?>
"><?php
_e('Trash', 'ap');
?>
</a></span>
</div>
</div>
</div>
<?php
}
} else {
_e('No answers yet', 'ap');
}
wp_reset_postdata();
}
示例3: ap_get_all_parti
/**
* Print all particpants of a question
* @param integer $avatar_size
* @param boolean $post_id
* @return void
* @since 0.4
*/
function ap_get_all_parti($avatar_size = 40, $post_id = false)
{
if (!$post_id) {
$post_id = get_question_id();
}
$parti = ap_get_parti($post_id);
echo '<span class="ap-widget-title">' . sprintf(_n('<span>1</span> Participant', '<span>%d</span> Participants', count($parti), 'ap'), count($parti)) . '</span>';
echo '<div class="ap-participants-list clearfix">';
foreach ($parti as $p) {
echo '<a title="' . ap_user_display_name($p->apmeta_userid, true) . '" href="' . ap_user_link($p->apmeta_userid) . '" class="ap-avatar">';
echo get_avatar($p->apmeta_userid, $avatar_size);
echo '</a>';
}
echo '</div>';
}
示例4: get_avatar
/**
* Override get_avatar
* @param string $avatar Avatar image.
* @param integar|string $id_or_email User id or email.
* @param string $size Avatar size.
* @param string $default Default avatar.
* @param string $alt Avatar image alternate text.
* @return string
*/
public function get_avatar($avatar, $id_or_email, $size, $default, $alt)
{
if (!empty($id_or_email)) {
if (is_object($id_or_email)) {
$allowed_comment_types = apply_filters('get_avatar_comment_types', array('comment'));
if (!empty($id_or_email->comment_type) && !in_array($id_or_email->comment_type, (array) $allowed_comment_types)) {
return $avatar;
}
if (!empty($id_or_email->user_id)) {
$id = (int) $id_or_email->user_id;
$user = get_userdata($id);
if ($user) {
$id_or_email = $user->ID;
}
} else {
$id_or_email = 0;
}
} elseif (is_email($id_or_email)) {
$u = get_user_by('email', $id_or_email);
$id_or_email = $u->ID;
}
$ap_avatar = ap_get_avatar_src($id_or_email, $size > 50 ? false : true);
if ($ap_avatar !== false) {
return "<img data-view='user_avatar_{$id_or_email}' alt='{$alt}' src='{$ap_avatar}' class='avatar avatar-{$size} photo' height='{$size}' width='{$size}' />";
}
}
if (strpos($avatar, 'ANSPRESS_AVATAR_SRC') !== false) {
$display_name = ap_user_display_name(array('user_id' => $id_or_email));
return '<img data-view="user_avatar_' . $id_or_email . '" alt="' . $alt . '" data-name="' . $display_name . '" data-height="' . $size . '" data-width="' . $size . '" class="avatar avatar-' . $size . ' photo ap-dynamic-avatar" />';
}
return $avatar;
}
示例5: ap_get_latest_history_html
function ap_get_latest_history_html($post_id, $avatar = false, $icon = false)
{
$history = ap_get_latest_history($post_id);
$html = '';
if ($history) {
if ($avatar) {
$html .= '<a class="ap-savatar" href="' . ap_user_link($history['user_id']) . '">' . get_avatar($history['user_id'], 20) . '</a>';
}
if ($icon) {
$html .= '<span class="' . ap_history_icon($history['type']) . ' ap-tlicon"></span>';
}
$html .= '<span class="ap-post-history">' . sprintf(__('%s %s about %s ago', 'ap'), ap_user_display_name($history['user_id']), ap_history_name($history['type']), ap_human_time(mysql2date('U', $history['date']))) . '</span>';
} elseif (!$icon) {
$html = '<span class="ap-post-history">' . sprintf(__('Asked by %s', 'ap'), ap_user_display_name()) . '</span>';
}
if ($html) {
return apply_filters('ap_latest_history_html', $html);
}
return false;
}
示例6: walker_nav_menu_start_el
/**
* Add user dropdown and notification menu
* @param string $o Menu html.
* @param object $item Menu item object.
* @param integer $depth Menu depth.
* @param object $args Menu args.
* @return string
*/
public function walker_nav_menu_start_el($o, $item, $depth, $args)
{
if (!is_user_logged_in() && (in_array('anspress-page-profile', $item->classes) || in_array('anspress-page-notification', $item->classes))) {
$o = '';
}
if (in_array('anspress-page-profile', $item->classes) && is_user_logged_in()) {
$menus = ap_get_user_menu(get_current_user_id());
$active_user_page = get_query_var('user_page') ? esc_attr(get_query_var('user_page')) : 'about';
$o = '<a id="ap-user-menu-anchor" class="ap-dropdown-toggle" href="#">';
$o .= get_avatar(get_current_user_id(), 80);
$o .= '<span class="name">' . ap_user_display_name(get_current_user_id()) . '</span>';
$o .= ap_icon('chevron-down', true);
$o .= '</a>';
$o .= '<ul id="ap-user-menu-link" class="ap-dropdown-menu ap-user-dropdown-menu">';
foreach ($menus as $m) {
$class = !empty($m['class']) ? ' ' . $m['class'] : '';
$o .= '<li' . ($active_user_page == $m['slug'] ? ' class="active"' : '') . '>';
$o .= '<a href="' . $m['link'] . '" class="ap-user-link-' . $m['slug'] . $class . '">';
$o .= esc_attr($m['title']) . '</a>';
$o .= '</li>';
}
$o .= '</ul>';
} elseif (in_array('anspress-page-notification', $item->classes) && is_user_logged_in()) {
$o = '<a id="ap-user-notification-anchor" class="ap-dropdown-toggle ' . ap_icon('globe') . '" href="#">' . ap_get_the_total_unread_notification(false, false) . '</a>';
global $ap_notifications;
ob_start();
$ap_notifications = ap_get_user_notifications(array('per_page' => 10));
ap_get_template_part('user/notification-dropdown');
$o .= ob_get_clean();
}
return $o;
}
示例7: ap_latest_post_activity_html
/**
* Get latest activity of question or answer.
* @param integer $post_id Question or answer ID.
* @return string
*/
function ap_latest_post_activity_html($post_id = false)
{
if (false === $post_id) {
$post_id = get_the_ID();
}
$post = get_post($post_id);
$activity = ap_post_activity_meta($post_id);
if (!$activity) {
$activity['date'] = get_the_time('c', $post_id);
$activity['user_id'] = $post->post_author;
$activity['type'] = 'new_' . $post->post_type;
}
$html = '';
if ($activity) {
$title = ap_activity_short_title($activity['type']);
$html .= '<span class="ap-post-history">';
$html .= sprintf(__(' %s %s %s ago', 'ap'), '<a href="' . ap_user_link($activity['user_id']) . '">' . ap_user_display_name($activity['user_id']) . '</a>', $title, '<a href="' . get_permalink($post) . '"><time datetime="' . mysql2date('c', $activity['date']) . '">' . ap_human_time($activity['date'], false) . '</time></a>');
$html .= '</span>';
}
if ($html) {
return apply_filters('ap_latest_post_activity_html', $html);
}
return false;
}
示例8: get_avatar
">
<?php
echo get_avatar(get_the_author_meta('user_email'), ap_opt('avatar_size_qquestion'));
?>
</a>
</div>
<div class="ap-content-inner no-overflow">
<div class="ap-qmainc">
<div class="ap-user-meta">
<div class="ap-single-vote"><?php
ap_vote_html();
?>
</div>
<div class="ap-meta">
<?php
printf(__('<a href="' . ap_user_link(get_the_author_meta('ID')) . '?rel=author" class="author"><span itemprop="author">%s</span></a> <span class="when">asked about %s ago</span>', 'ap'), ap_user_display_name(false, true), ap_human_time(get_the_time('U')));
?>
</div>
</div>
<div class="question-content" itemprop="text">
<?php
the_content();
?>
</div>
<ul class="ap-user-actions clearfix">
<li><?php
ap_edit_q_btn_html();
?>
</li>
示例9: ap_post_active_time
/**
* Get last active time
* @param integer $post_id Question or answer ID.
* @return string $html HTML formatted?
* @since 2.0.1
*/
function ap_post_active_time($post_id = false, $html = true)
{
if (false === $post_id) {
$post_id = get_the_ID();
}
$post = get_post($post_id);
$activity = ap_post_activity_meta($post_id);
if (!$activity) {
$activity['date'] = get_the_time('c', $post_id);
$activity['user_id'] = $post->post_author;
$activity['type'] = 'new_' . $post->post_type;
}
if (!$html) {
return $activity['date'];
}
$title = ap_activity_short_title($activity['type']);
$title = esc_html('<span class="ap-post-history">' . sprintf(__('%s %s %s', 'ap'), ap_user_display_name($activity['user_id']), $title, '<time datetime="' . mysql2date('c', $activity['date']) . '">' . ap_human_time(mysql2date('U', $activity['date'])) . '</time>') . '</span>');
return sprintf(__('Active %s', 'ap'), '<a class="ap-tip" href="#" title="' . $title . '"><time datetime="' . mysql2date('c', $activity['date']) . '">' . ap_human_time(mysql2date('U', $activity['date']))) . '</time></a>';
}
示例10: ap_comment
function ap_comment($comment)
{
$GLOBALS['comment'] = $comment;
$class = '0' == $comment->comment_approved ? ' pending' : '';
?>
<li <?php
comment_class('clearfix' . $class);
?>
id="li-comment-<?php
comment_ID();
?>
">
<!-- comment #<?php
comment_ID();
?>
-->
<div id="comment-<?php
comment_ID();
?>
" class="clearfix">
<div class="ap-avatar ap-pull-left">
<a href="<?php
echo ap_user_link($comment->user_id);
?>
">
<!-- TODO: OPTION - Avatar size -->
<?php
echo get_avatar($comment->user_id, 30);
?>
</a>
</div>
<div class="ap-comment-content no-overflow">
<div class="ap-comment-header">
<a href="<?php
echo ap_user_link($comment->user_id);
?>
" class="ap-comment-author"><?php
echo ap_user_display_name($comment->user_id);
?>
</a>
<?php
$a = " e ";
$b = " ";
$time = get_option('date_format') . $b . get_option('time_format') . $a . get_option('gmt_offset');
printf(' - <a title="%4$s" href="#li-comment-%5$s" class="ap-comment-time"><time datetime="%1$s">%2$s %3$s</time></a>', get_comment_time('c'), ap_human_time(get_comment_time('U')), __('ago', 'ap'), get_comment_time($time), $comment_id = get_comment_ID());
// Comment actions
ap_comment_actions_buttons();
?>
</div>
<div class="ap-comment-texts">
<?php
comment_text();
?>
</div>
<?php
/**
* ACTION: ap_after_comment_content
* Action called after comment content
* @since 2.0.1
*/
do_action('ap_after_comment_content', $comment);
?>
<?php
if ('0' == $comment->comment_approved) {
?>
<p class="comment-awaiting-moderation"><?php
_e('Your comment is awaiting moderation.', 'ap');
?>
</p>
<?php
}
?>
</div>
</div>
<?php
}
示例11: select_answer
public function select_answer($user_id, $question_id, $answer_id)
{
$post_url = get_permalink($question_id);
$post = get_post($post_id);
$subject = __('Your answer is selected as a best', 'ap');
$message = sprintf(__('Hello!, <br /><br /> You answer on %s is selected as best by %s <br />', 'ap'), $pos->post_title, ap_user_display_name($user_id, true));
$message .= "<br /><br /><a href='" . $post_url . "'>" . __('View question', 'ap') . "</a><br />";
$message .= '<p style="color:#777; font-size:11px">' . __('Powered by', 'ap') . ' <a href="http://open-wp.com">AnsPress</a></p>';
$emails = ap_get_email_to_notify($post->post_parent, $user_id);
if (!empty($emails)) {
foreach ($emails as $email) {
wp_mail($email, $subject, $message);
}
}
//sends email
wp_mail(get_option('admin_email'), $subject, $message);
}
示例12: walker_nav_menu_start_el
/**
* Add user dropdown and notification menu
* @param string $o Menu html.
* @param object $item Menu item object.
* @param integer $depth Menu depth.
* @param object $args Menu args.
* @return string
*/
public function walker_nav_menu_start_el($o, $item, $depth, $args)
{
if (!is_user_logged_in() && (ap_is_notification_menu($item) || ap_is_profile_menu($item))) {
$o = '';
}
if (!ap_is_profile_active() && (ap_is_notification_menu($item) || ap_is_profile_menu($item))) {
return '';
}
if (in_array('anspress-page-profile', $item->classes) && is_user_logged_in()) {
$menus = ap_get_user_menu(get_current_user_id());
$active_user_page = get_query_var('user_page') ? esc_attr(get_query_var('user_page')) : 'about';
$o = '<a id="ap-user-menu-anchor" class="ap-dropdown-toggle" href="#">';
$o .= get_avatar(get_current_user_id(), 80);
$o .= '<span class="name">' . ap_user_display_name(get_current_user_id()) . '</span>';
$o .= ap_icon('chevron-down', true);
$o .= '</a>';
$o .= '<ul id="ap-user-menu-link" class="ap-dropdown-menu ap-user-dropdown-menu">';
foreach ($menus as $m) {
$class = !empty($m['class']) ? ' ' . $m['class'] : '';
$o .= '<li' . ($active_user_page == $m['slug'] ? ' class="active"' : '') . '>';
$o .= '<a href="' . $m['link'] . '" class="ap-user-link-' . $m['slug'] . $class . '">';
$o .= $m['title'] . '</a>';
$o .= '</li>';
}
$o .= '</ul>';
} elseif (in_array('anspress-page-notification', $item->classes) && is_user_logged_in()) {
$o = '<a id="ap-user-notification-anchor" class="ap-dropdown-toggle ap-sidetoggle ' . ap_icon('globe') . '" href="#">' . ap_get_the_total_unread_notification(false, false) . '</a>';
global $ap_activities;
/**
* Dropdown notification arguments.
* Allow filtering of dropdown notification arguments.
* @since 2.4.5
* @var array
*/
$notification_args = apply_filters('ap_dropdown_notification_args', array('per_page' => 20, 'notification' => true, 'user_id' => ap_get_displayed_user_id()));
$ap_activities = ap_get_activities($notification_args);
ob_start();
ap_get_template_part('user/notification-dropdown');
$o .= ob_get_clean();
}
return $o;
}
示例13: ap_trash_answer
public function ap_trash_answer($post)
{
if (!ap_opt('notify_admin_trash_answer')) {
return;
}
$current_user = wp_get_current_user();
// don't bother if current user is admin
if (ap_opt('notify_admin_email') == $current_user->user_email) {
return;
}
$args = array('{user}' => ap_user_display_name(get_current_user_id()), '{question_title}' => $post->post_title, '{question_link}' => get_permalink($post->post_parent));
$args = apply_filters('ap_trash_answer_email_tags', $args);
$subject = $this->replace_tags(ap_opt('trash_answer_email_subject'), $args);
$message = $this->replace_tags(ap_opt('trash_answer_email_body'), $args);
// sends email
$this->send_mail(ap_opt('notify_admin_email'), $subject, $message);
}
示例14: _e
?>
"><?php
_e('Trash post', 'ap');
?>
</a></span>
</div>
<div class="post-content">
<?php
the_content();
?>
</div>
</div>
<?php
if (!empty($flags) && is_array($flags)) {
echo '<table class="ap-flagger-table"><tbody>';
foreach ($flags as $flag) {
echo '<tr class="flag-item">';
echo '<td class="ap-user-avatar">' . get_avatar($flag->apmeta_userid, 30) . '</td>';
echo '<td class="ap-when-flagged">' . sprintf(__('%s flagged this post %s ago', 'ap'), '<a href="' . get_edit_user_link($flag->apmeta_userid) . '">' . ap_user_display_name($flag->apmeta_userid) . '</a>', ap_human_time($flag->unix_date)) . '</td>';
echo '<td class="ap-remove-flag"><a href="__nonce=' . wp_create_nonce('flag_delete' . $flag->apmeta_id) . '&action=ap_delete_flag&id=' . $flag->apmeta_id . '" data-action="ap-delete-flag">' . __('Remove', 'ap') . '</a></td>';
echo '</tr>';
}
echo '</tbody></table>';
} else {
_e('No one flagged this post yet', 'ap');
}
?>
</div>
</div>
示例15: ap_get_latest_history_html
function ap_get_latest_history_html($post_id, $initial = false, $avatar = false, $icon = false)
{
$post = get_post($post_id);
$history = get_post_meta($post_id, '__ap_history', true);
if (!$history && $initial) {
$history['date'] = get_the_time('c', $post_id);
$history['user_id'] = $post->post_author;
$history['type'] = 'new_' . $post->post_type;
}
$html = '';
if ($history) {
if ($icon) {
$html .= '<span class="' . ap_icon($history['type']) . ' ap-tlicon"></span>';
}
if ($avatar) {
$html .= '<a class="ap-avatar" href="' . ap_user_link($history['user_id']) . '">' . get_avatar($history['user_id'], 22) . '</a>';
}
$title = ap_history_title($history['type']);
$html .= '<span class="ap-post-history">' . ap_icon('history', true) . sprintf(__(' %s %s %s ago', 'ap'), ap_user_display_name($history['user_id']), $title, '<time datetime="' . mysql2date('c', $history['date']) . '">' . ap_human_time($history['date'], false) . '</time>') . '</span>';
}
if ($html) {
return apply_filters('ap_latest_history_html', $html);
}
return false;
}