Esempio n. 1
0
/**
 * Display the notifications list.
 *
 * @since 0.0.2
 */
function vp_notifications_list()
{
    $user_id = get_current_user_id();
    $notifications = get_user_meta($user_id, 'v2press_notifications', true);
    if (!is_array($notifications) || empty($notifications)) {
        $notifications = array();
    }
    $notifications = array_reverse($notifications);
    $output = '';
    if (empty($notifications)) {
        $output .= '<p class="xlarge center fade">' . __('No notifications yet.', 'v2press') . '</p>';
    } else {
        $output .= '<ul class="notifications-list">';
        foreach ($notifications as $cmt_id) {
            $comment = get_comment($cmt_id);
            $comment_date = $comment->comment_date;
            $comment_content = $comment->comment_content;
            $user_id = $comment->user_id;
            $user_link = vp_get_user_profile_link($user_id, false);
            $user_avatar_link = vp_get_user_avatar_link(24, $user_id);
            $topic_id = $comment->comment_post_ID;
            $topic_title = get_the_title($topic_id);
            $topic_permalink = get_permalink($topic_id);
            $topic_link = '<a href="' . $topic_permalink . '" rel="bookmark">' . esc_attr($topic_title) . '</a>';
            $output .= '<li class="notification-item">' . $user_avatar_link;
            $output .= sprintf(__('%1$s mentioned you when reply %2$s at %3$s', 'v2press'), $user_link, $topic_link, $comment_date);
            $output .= '<div class="notification-content">' . $comment_content . '</div>';
            $output .= '<a class="notification-delete" href="?delete=' . $cmt_id . '">' . _x('delete', 'notification', 'v2press') . '</a></li>';
        }
        $output .= '</ul>';
    }
    echo $output;
}
Esempio n. 2
0
/**
 * Display the user's profile text link
 *
 * @since 0.0.1
 *
 * @param int $user_id Optional. The user's id. If false, the current user's id.
 * @return string The user's profile text link, if no $user_id the current user's.
 */
function vp_user_profile_link($user_id = false)
{
    echo vp_get_user_profile_link($user_id);
}
Esempio n. 3
0
/**
 * Retrieve the post author's avatar link to profile page, must use within the loop.
 *
 * @since 0.0.2
 *
 * @use vp_user_profile_link()
 */
function vp_get_the_author_profile_link()
{
    return vp_get_user_profile_link(get_the_author_meta('ID'));
}