コード例 #1
0
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
0
ファイル: functions.php プロジェクト: jessor/anspress
    function ap_comment($comment)
    {
        $GLOBALS['comment'] = $comment;
        ?>
		<li <?php 
        comment_class();
        ?>
 id="li-comment-<?php 
        comment_ID();
        ?>
">
			<article id="comment-<?php 
        comment_ID();
        ?>
" class="comment">
				<div class="ap-avatar">
					<a href="<?php 
        echo ap_user_link($comment->user_id);
        ?>
">
					<?php 
        echo get_avatar($comment, ap_opt('avatar_size_qcomment'));
        ?>
					</a>
				</div>
				<div class="comment-content">
					<?php 
        if ('0' == $comment->comment_approved) {
            ?>
						<p class="comment-awaiting-moderation"><?php 
            _e('Your comment is awaiting moderation.', 'ap');
            ?>
</p>
					<?php 
        }
        ?>
										
					<p class="ap-comment-texts">
						<?php 
        echo get_comment_text();
        ?>
						<?php 
        printf(' - <time datetime="%1$s">%2$s %3$s</time>', get_comment_time('c'), ap_human_time(get_comment_time('U')), __('ago', 'ap'));
        ?>
					</p>
					<div class="comment-meta">
						<?php 
        if (ap_user_can_edit_comment(get_comment_ID())) {
            echo '<a class="comment-edit-btn" href="#" data-button="ap-edit-comment" data-args="' . get_comment_ID() . '-' . wp_create_nonce('comment-' . get_comment_ID()) . '"><i class="aicon-pencil"></i> ' . __('Edit', 'ap') . '</a>';
        }
        if (ap_user_can_delete_comment(get_comment_ID())) {
            echo '<a class="comment-delete-btn" href="#" data-button="ap-delete-comment" data-confirm="' . __('Are you sure? It cannot be undone!', 'ap') . '" data-args="' . get_comment_ID() . '-' . wp_create_nonce('delete-comment-' . get_comment_ID()) . '"><i class="aicon-close"></i> ' . __('Delete', 'ap') . '</a>';
        }
        ?>
					</div>					
				</div>
			</article>
		<?php 
    }
コード例 #3
0
ファイル: participants.php プロジェクト: Byrlyne/anspress
/**
 * 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
0
function ap_question_subscribers($action_id = false, $type = '', $avatar_size = 30)
{
    global $question_category, $question_tag;
    if (!$action_id) {
        if (is_question()) {
            $action_id = get_question_id();
        } elseif (is_question_category()) {
            $action_id = $question_category->term_id;
        } elseif (is_question_tag()) {
            $action_id = $question_tag->term_id;
        }
    }
    if ($type == '') {
        $type = is_question() ? '' : 'term';
    }
    $subscribe_type = $type != '' && $type != 'subscriber' ? $type : 'subscriber';
    $subscribers = ap_get_subscribers($action_id, $subscribe_type);
    if ($subscribers) {
        echo '<div class="ap-question-subscribers clearfix">';
        echo '<div class="ap-question-subscribers-inner">';
        foreach ($subscribers as $subscriber) {
            echo '<a href="' . ap_user_link($subscriber->apmeta_userid) . '"';
            ap_hover_card_attributes($subscriber->apmeta_userid);
            echo '>' . get_avatar($subscriber->apmeta_userid, $avatar_size) . '</a>';
        }
        echo '</div>';
        echo '</div>';
    }
}
コード例 #5
0
ファイル: question.php プロジェクト: coollog/theboola
">
								<?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>					
コード例 #6
0
 public function the_pagination()
 {
     $base = ap_user_link($this->args['user_id'], 'notification') . '/%_%';
     ap_pagination($this->paged, $this->total_pages, $base);
 }
コード例 #7
0
ファイル: history.php プロジェクト: haythameyd/powrly
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;
}
コード例 #8
0
ファイル: answer-loop.php プロジェクト: troe/anspress
/**
 * Return the author profile link
 * @return string
 * @since 2.1
 */
function ap_answer_get_the_author_link()
{
    return ap_user_link(ap_answer_get_author_id());
}
コード例 #9
0
ファイル: theme.php プロジェクト: haythameyd/powrly
function ap_get_breadcrumbs()
{
    $current_page = get_query_var('ap_page');
    $title = ap_page_title();
    $a = array();
    $a['base'] = array('title' => ap_opt('base_page_title'), 'link' => ap_base_page_link(), 'order' => 0);
    if (is_question_tag()) {
        $a['tag'] = array('title' => __('Tags', 'ap'), 'link' => '', 'order' => 10);
    } elseif (is_question()) {
        $a['page'] = array('title' => substr($title, 0, 30) . (strlen($title) > 30 ? __('..', 'ap') : ''), 'link' => get_permalink(get_question_id()), 'order' => 10);
    } elseif ($current_page != 'base' && $current_page != '') {
        if ($current_page == 'user') {
            $a['page'] = array('title' => __('User', 'ap'), 'link' => ap_user_link(ap_get_displayed_user_id()), 'order' => 10);
            $a['user_page'] = array('title' => substr($title, 0, 30) . (strlen($title) > 30 ? __('..', 'ap') : ''), 'link' => ap_user_link(ap_get_displayed_user_id(), get_query_var('user_page')), 'order' => 10);
        } else {
            $a['page'] = array('title' => substr($title, 0, 30) . (strlen($title) > 30 ? __('..', 'ap') : ''), 'link' => ap_get_link_to($current_page), 'order' => 10);
        }
    }
    $a = apply_filters('ap_breadcrumbs', $a);
    return ap_sort_array_by_order($a);
}
コード例 #10
0
ファイル: activity.php プロジェクト: Krl4/anspress
/**
 * 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;
}
コード例 #11
0
ファイル: comment.php プロジェクト: deepakd92/anspress
" 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><!-- close .ap-avatar -->
		<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="%3$s" href="#li-comment-%4$s" class="ap-comment-time"><time datetime="%1$s">%2$s</time></a>', get_comment_time('c'), ap_human_time(get_comment_time('U')), get_comment_time($time), get_comment_ID());
// Comment actions
ap_comment_actions_buttons();
?>
			</div><!-- close .ap-comment-header -->
コード例 #12
0
ファイル: user.php プロジェクト: VLabsInc/WordPressPlatforms
function ap_user_link_avatar($user_id, $size = 30)
{
    echo '<a href="' . ap_user_link($user_id) . '"';
    ap_hover_card_attributes($user_id);
    echo '>';
    echo get_avatar($user_id, $size);
    echo '</a>';
}
コード例 #13
0
ファイル: hooks.php プロジェクト: deepakd92/anspress
 /**
  * Update AnsPress pages URL dynimacally
  * @param  array $items Menu item.
  * @return array
  */
 public function update_menu_url($items)
 {
     // If this is admin then we dont want to update url.
     if (is_admin()) {
         return $items;
     }
     /**
      * Define default AnsPress pages
      * So that default pages should work properly after
      * Changing categories page slug.
      * @var array
      */
     $default_pages = array('profile' => array('title' => __('My profile', 'anspress-question-answer'), 'show_in_menu' => true, 'logged_in' => true), 'notification' => array('title' => __('My notification', 'anspress-question-answer'), 'show_in_menu' => true, 'logged_in' => true), 'ask' => array(), 'question' => array(), 'users' => array(), 'user' => array());
     /**
      * FILTER: ap_default_pages
      * @var array
      */
     $this->pages = array_merge(anspress()->pages, apply_filters('ap_default_pages', $default_pages));
     $this->page_urls();
     if (!empty($items) && is_array($items)) {
         foreach ($items as $key => $item) {
             $slug = array_search(str_replace(array('http://', 'https://'), '', $item->url), $this->page_url);
             if (false !== $slug) {
                 if (isset($this->pages[$slug]['logged_in']) && $this->pages[$slug]['logged_in'] && !is_user_logged_in()) {
                     unset($items[$key]);
                 }
                 if (!ap_is_profile_active() && ('profile' == $slug || 'notification' == $slug)) {
                     unset($items[$key]);
                 }
                 if ('profile' == $slug) {
                     $item->url = is_user_logged_in() ? ap_user_link(get_current_user_id()) : wp_login_url();
                 } else {
                     $item->url = ap_get_link_to($slug);
                 }
                 $item->classes[] = 'anspress-page-link';
                 $item->classes[] = 'anspress-page-' . $slug;
                 if (get_query_var('ap_page') == $slug) {
                     $item->classes[] = 'anspress-active-menu-link';
                 }
             }
         }
     }
     return $items;
 }
コード例 #14
0
ファイル: anspress-messages.php プロジェクト: jessor/anspress
function ap_message_btn_html($userid, $display_name)
{
    echo '<a class="btn ap-btn ap-follow-btn ap-icon-paperplane" href="' . ap_user_link(get_current_user_id(), 'messages/?to=' . $userid . '&dname=' . $display_name) . '">' . __('Message', 'ap') . '</a>';
}
コード例 #15
0
 /**
  * Update AnsPress pages URL dynimacally
  * @param  array $items
  * @return array
  */
 public function update_menu_url($items)
 {
     if (is_admin()) {
         return $items;
     }
     $pages = anspress()->pages;
     $pages['profile'] = array('title' => __('My profile', 'ap'), 'show_in_menu' => true, 'logged_in' => true);
     $pages['notification'] = array('title' => __('My notification', 'ap'), 'show_in_menu' => true, 'logged_in' => true);
     $pages['ask'] = array();
     $pages['question'] = array();
     $pages['users'] = array();
     $pages['user'] = array();
     $page_url = array();
     foreach ($pages as $slug => $args) {
         $page_url[$slug] = 'ANSPRESS_PAGE_URL_' . strtoupper($slug);
     }
     if (!empty($items) && is_array($items)) {
         foreach ($items as $key => $item) {
             if (false !== ($slug = array_search(str_replace(array('http://', 'https://'), '', $item->url), $page_url))) {
                 $page = $pages[$slug];
                 if (isset($page['logged_in']) && $page['logged_in'] && !is_user_logged_in()) {
                     unset($items[$key]);
                 }
                 if ($slug == 'profile') {
                     $item->url = is_user_logged_in() ? ap_user_link(get_current_user_id()) : wp_login_url();
                 } else {
                     $item->url = ap_get_link_to($slug);
                 }
                 $item->classes[] = 'anspress-page-link';
                 $item->classes[] = 'anspress-page-' . $slug;
                 if (get_query_var('ap_page') == $slug) {
                     $item->classes[] = 'anspress-active-menu-link';
                 }
             }
         }
     }
     return $items;
 }
コード例 #16
0
ファイル: user.php プロジェクト: Byrlyne/anspress
/**
 * @param string $user_id
 */
function ap_user_link_anchor($user_id, $echo = true)
{
    $name = ap_user_display_name($user_id);
    if ($user_id < 1) {
        if ($echo) {
            echo $name;
        } else {
            return $name;
        }
    }
    $html = '<a href="' . ap_user_link($user_id) . '"' . ap_hover_card_attributes($user_id, false) . '>';
    $html .= $name;
    $html .= '</a>';
    if ($echo) {
        echo $html;
    }
    return $html;
}
コード例 #17
0
ファイル: users-widget.php プロジェクト: Byrlyne/anspress
        ?>
				<div class="apw-user-summary clearfix">
					<?php 
        ap_follow_button($f->ID);
        ?>
					<a class="ap-user-avatar" href="<?php 
        echo ap_user_link($f->ID);
        ?>
">
						<?php 
        echo get_avatar($f->ID, 40);
        ?>
					</a>
					<div class="no-overflow">
						<a class="user-name" href="<?php 
        echo ap_user_link($f->ID);
        ?>
"><?php 
        echo $data->display_name;
        ?>
</a>
						<?php 
        echo ap_get_rank_title($f->ID);
        ?>
					</div>
				</div>
				<?php 
    }
} else {
    _e('No users found.', 'ap');
}
コード例 #18
0
"><b data-view="ap-followers"><?php 
echo ap_get_current_user_meta('followers');
?>
</b><span><?php 
_e('Followers', 'ap');
?>
</span></a></li>
			<li><a href="<?php 
echo ap_user_link($f->ID, 'following');
?>
"><b data-view="ap-following"><?php 
echo ap_get_current_user_meta('following');
?>
</b><span><?php 
_e('Following', 'ap');
?>
</span></a></li>
			<li><a href="<?php 
echo ap_user_link($f->ID, 'points');
?>
"><b data-view="ap-points"><?php 
echo ap_get_points($f->ID, true);
?>
</b><span><?php 
_e('Points', 'ap');
?>
</span></a></li>
		</ul>
	</div>
</div>
コード例 #19
0
ファイル: anspress-user.php プロジェクト: coollog/theboola
function ap_user_template()
{
    $userid = ap_get_user_page_user();
    $user_meta = (object) array_map('ap_meta_array_map', get_user_meta($userid));
    if (is_ap_followers()) {
        $total_followers = ap_get_current_user_meta('followers');
        // how many users to show per page
        $users_per_page = ap_opt('followers_limit');
        // grab the current page number and set to 1 if no page number is set
        $paged = get_query_var('paged') ? get_query_var('paged') : 1;
        // calculate the total number of pages.
        $total_pages = 1;
        $offset = $users_per_page * ($paged - 1);
        $total_pages = ceil($total_followers / $users_per_page);
        $args = array('ap_followers_query' => true, 'number' => $users_per_page, 'userid' => ap_get_user_page_user(), 'offset' => $offset);
        // The Query
        $followers_query = new WP_User_Query($args);
        $followers = $followers_query->results;
        $base = ap_user_link(ap_get_user_page_user(), 'followers') . '/%_%';
    } elseif (ap_current_user_page_is('following')) {
        $total_following = ap_get_current_user_meta('following');
        // how many users to show per page
        $users_per_page = ap_opt('following_limit');
        // grab the current page number and set to 1 if no page number is set
        $paged = get_query_var('paged') ? get_query_var('paged') : 1;
        // calculate the total number of pages.
        $total_pages = 1;
        $offset = $users_per_page * ($paged - 1);
        $total_pages = ceil($total_following / $users_per_page);
        $args = array('ap_following_query' => true, 'number' => $users_per_page, 'userid' => ap_get_user_page_user(), 'offset' => $offset);
        // The Query
        $following_query = new WP_User_Query($args);
        $following = $following_query->results;
        $base = ap_user_link(ap_get_user_page_user(), 'following') . '/%_%';
    } elseif (ap_current_user_page_is('questions')) {
        $order = get_query_var('sort');
        $label = sanitize_text_field(get_query_var('label'));
        if (empty($order)) {
            $order = 'active';
        }
        //ap_opt('answers_sort');
        if (empty($label)) {
            $label = '';
        }
        $paged = get_query_var('paged') ? get_query_var('paged') : 1;
        $question_args = array('author' => ap_get_user_page_user(), 'post_type' => 'question', 'post_status' => 'publish', 'showposts' => ap_opt('question_per_page'), 'paged' => $paged);
        if ($order == 'active') {
            $question_args['orderby'] = 'meta_value';
            $question_args['meta_key'] = ANSPRESS_UPDATED_META;
        } elseif ($order == 'voted') {
            $question_args['orderby'] = 'meta_value_num';
            $question_args['meta_key'] = ANSPRESS_VOTE_META;
        } elseif ($order == 'answers') {
            $question_args['orderby'] = 'meta_value_num';
            $question_args['meta_key'] = ANSPRESS_ANS_META;
        } elseif ($order == 'unanswered') {
            $question_args['orderby'] = 'meta_value';
            $question_args['meta_key'] = ANSPRESS_ANS_META;
            $question_args['meta_value'] = '0';
        } elseif ($order == 'oldest') {
            $question_args['orderby'] = 'date';
            $question_args['order'] = 'ASC';
        }
        if ($label != '') {
            $question_args['tax_query'] = array(array('taxonomy' => 'question_label', 'field' => 'slug', 'terms' => $label));
        }
        $question_args = apply_filters('ap_user_question_args', $question_args);
        $question = new WP_Query($question_args);
    } elseif (ap_current_user_page_is('answers')) {
        $paged = get_query_var('paged') ? get_query_var('paged') : 1;
        $order = get_query_var('sort');
        if (empty($order)) {
            $order = ap_opt('answers_sort');
        }
        if ($order == 'voted') {
            $ans_args = array('author' => ap_get_user_page_user(), 'ap_query' => 'answer_sort_voted', 'post_type' => 'answer', 'post_status' => 'publish', 'showposts' => ap_opt('answers_per_page'), 'paged' => $paged, 'orderby' => 'meta_value_num', 'meta_key' => ANSPRESS_VOTE_META, 'meta_query' => array('relation' => 'OR', array('key' => ANSPRESS_BEST_META, 'compare' => '=', 'value' => '1'), array('key' => ANSPRESS_BEST_META, 'compare' => 'NOT EXISTS')));
        } elseif ($order == 'oldest') {
            $ans_args = array('author' => ap_get_user_page_user(), 'ap_query' => 'answer_sort_newest', 'post_type' => 'answer', 'post_status' => 'publish', 'showposts' => ap_opt('answers_per_page'), 'paged' => $paged, 'orderby' => 'meta_value date', 'meta_key' => ANSPRESS_BEST_META, 'order' => 'ASC', 'meta_query' => array('relation' => 'OR', array('key' => ANSPRESS_BEST_META, 'compare' => 'NOT EXISTS')));
        } else {
            $ans_args = array('author' => ap_get_user_page_user(), 'ap_query' => 'answer_sort_newest', 'post_type' => 'answer', 'post_status' => 'publish', 'showposts' => ap_opt('answers_per_page'), 'paged' => $paged, 'orderby' => 'meta_value date', 'meta_key' => ANSPRESS_BEST_META, 'order' => 'DESC', 'meta_query' => array('relation' => 'OR', array('key' => ANSPRESS_BEST_META, 'compare' => 'NOT EXISTS')));
        }
        $ans_args = apply_filters('ap_user_answers_args', $ans_args);
        $answer = new WP_Query($ans_args);
    } elseif (ap_current_user_page_is('favorites')) {
        $paged = get_query_var('paged') ? get_query_var('paged') : 1;
        $args = array('author' => ap_get_user_page_user(), 'ap_query' => 'user_favorites', 'post_type' => 'question', 'post_status' => 'publish', 'showposts' => ap_opt('answers_per_page'), 'paged' => $paged, 'orderby' => 'date', 'order' => 'DESC');
        $args = apply_filters('ap_user_favorites_args', $args);
        $question = new WP_Query($args);
    } elseif (ap_current_user_page_is('messages')) {
        if (ap_get_user_page_user() != get_current_user_id()) {
            _e('You do not have access here', 'ap');
            return;
        }
    } elseif (ap_current_user_page_is('message')) {
        if (ap_get_user_page_user() != get_current_user_id()) {
            _e('You do not have access here', 'ap');
            return;
        }
        $message_id = get_query_var('message_id');
    } elseif (ap_current_user_page_is('badges')) {
        $user_badges = ap_get_users_all_badges(ap_get_user_page_user());
        $count_badges = ap_user_badge_count_by_badge(ap_get_user_page_user());
    }
    global $user;
    global $current_user_meta;
    include ap_get_theme_location(ap_get_current_user_page_template());
    // Restore original Post Data
    if (ap_current_user_page_is('questions') || ap_current_user_page_is('answers') || ap_current_user_page_is('favorites')) {
        wp_reset_postdata();
    }
}
コード例 #20
0
ファイル: activity-hooks.php プロジェクト: erashu212/anspress
 /**
  * Insert activity about new follower
  * @param  integer $user_to_follow  Whom to follow.
  * @param  integer $current_user_id Current user ID.
  */
 public function follower($user_to_follow, $current_user_id)
 {
     $activity_arr = array('user_id' => $current_user_id, 'type' => 'follower', 'secondary_user' => $user_to_follow, 'item_id' => $user_to_follow, 'parent_type' => 'user', 'permalink' => ap_user_link($user_to_follow), 'content' => sprintf(__('%s started following %s', 'anspress-question-answer'), ap_activity_user_name($current_user_id), ap_activity_user_name($user_to_follow)));
     $activity_id = ap_new_activity($activity_arr);
     ap_new_notification($activity_id, $user_to_follow);
 }
コード例 #21
0
							</a>
						</div>
						
					</div>
					<?php 
        $noti_ids[] = ap_activity_noti_id();
        ?>
				<?php 
    }
    ?>
				<input type="hidden" name="ap_loaded_notifications" value="<?php 
    echo implode(',', $noti_ids);
    ?>
" />
				<div class="ap-notification-more clearfix"><a href="<?php 
    echo ap_user_link(get_current_user_id(), 'notification');
    ?>
"><?php 
    _e('View all notifications', 'anspress-question-answer');
    ?>
</a></div>
			</div>
		</div>
	<?php 
} else {
    ?>
		<div class="ap-no-notification"><?php 
    _e('No notification', 'anspress-question-answer');
    ?>
</div>
	<?php 
コード例 #22
0
ファイル: ask.php プロジェクト: VLabsInc/WordPressPlatforms
 * @link http://anspress.io
 * @since 0.1
 *
 * @package AnsPress
 */
?>

<div id="ap-ask-page" class="clearfix">
	<?php 
if (ap_user_can_ask()) {
    ?>

		<div id="answer-form-c">
			<div class="ap-avatar ap-pull-left">
				<a href="<?php 
    echo ap_user_link(get_current_user_id());
    ?>
"<?php 
    ap_hover_card_attributes(get_current_user_id());
    ?>
>
					<?php 
    echo get_avatar(get_current_user_id(), ap_opt('avatar_size_qquestion'));
    ?>

				</a>
			</div>
			<div class="ap-a-cells clearfix">
				<div class="ap-form-head">
					<a href="#" class="apicon-screen-full pull-right ap-btn-fullscreen" data-action="ap_fullscreen_toggle"><?php 
    _e('Toggle fullscreen', 'ap');
コード例 #23
0
ファイル: hooks.php プロジェクト: kevinfodness/anspress
 /**
  * Update AnsPress pages URL dynimacally
  * @param  array $items Menu item.
  * @return array
  */
 public function update_menu_url($items)
 {
     // If this is admin then we dont want to update url.
     if (is_admin()) {
         return $items;
     }
     $this->pages = array_merge(anspress()->pages, array('profile' => array('title' => __('My profile', 'ap'), 'show_in_menu' => true, 'logged_in' => true), 'notification' => array('title' => __('My notification', 'ap'), 'show_in_menu' => true, 'logged_in' => true), 'ask' => array(), 'question' => array(), 'users' => array(), 'user' => array()));
     $this->page_urls();
     if (!empty($items) && is_array($items)) {
         foreach ($items as $key => $item) {
             $slug = array_search(str_replace(array('http://', 'https://'), '', $item->url), $this->page_url);
             if (false !== $slug) {
                 if (isset($this->pages[$slug]['logged_in']) && $this->pages[$slug]['logged_in'] && !is_user_logged_in()) {
                     unset($items[$key]);
                 }
                 if ('profile' == $slug) {
                     $item->url = is_user_logged_in() ? ap_user_link(get_current_user_id()) : wp_login_url();
                 } else {
                     $item->url = ap_get_link_to($slug);
                 }
                 $item->classes[] = 'anspress-page-link';
                 $item->classes[] = 'anspress-page-' . $slug;
                 if (get_query_var('ap_page') == $slug) {
                     $item->classes[] = 'anspress-active-menu-link';
                 }
             }
         }
     }
     return $items;
 }
コード例 #24
0
ファイル: followers.php プロジェクト: haythameyd/powrly
	<ul class="ap-ul-inline clearfix">
		<?php 
while ($followers->users()) {
    $followers->the_user();
    ?>
			<li>
				<a class="ap-users-avatar" href="<?php 
    ap_user_the_link();
    ?>
" title="<?php 
    ap_user_the_display_name();
    ?>
">
					<?php 
    ap_user_the_avatar($avatar_size);
    ?>
				</a>
			</li>
		<?php 
}
?>
		
	</ul>
	<a class="ap-widget-all-link" href="<?php 
echo ap_user_link(ap_get_displayed_user_id(), 'followers');
?>
"><?php 
_e('View all followers &rarr;', 'ap');
?>
</a>
</div>
コード例 #25
0
ファイル: anspress-history.php プロジェクト: jessor/anspress
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;
}
コード例 #26
0
ファイル: question-loop.php プロジェクト: haythameyd/powrly
/**
 * Return the author profile link
 * @return string
 * @since 2.1
 */
function ap_question_get_the_author_link()
{
    return ap_user_link(ap_question_get_author_id());
}
コード例 #27
0
    ?>

		<div class="private-question-label clearfix">
			<span><?php 
    _e('Private Answer', 'ap');
    ?>
</span>
		</div>
	<?php 
}
?>

	<div class="ap-questions-inner">
		<div class="ap-avatar ap-pull-left">
			<a href="<?php 
echo ap_user_link();
?>
">
				<!-- TODO: OPTION - avatar size in question list -->
				<?php 
echo get_avatar(get_the_author_meta('ID'), 45);
?>

			</a>
		</div>
		<div class="ap-list-counts">
			<?php 
if (!ap_opt('disable_voting_on_question')) {
    ?>

				<span class="ap-questions-count ap-questions-vcount">
コード例 #28
0
ファイル: notification.php プロジェクト: Krl4/anspress
    ?>
		<div class="ap-notification-list">
			<?php 
    while (ap_activities()) {
        ap_the_activity();
        ?>
					<div id="ap-notification-<?php 
        ap_activity_the_id();
        ?>
" class="ap-notification-item clearfix<?php 
        //echo ap_notification_is_unread() ? ' unread' : '';
        ?>
">
						<div class="ap-avatar ap-pull-left">
							<a href="<?php 
        echo ap_user_link(ap_activity_user_id());
        ?>
"><?php 
        echo get_avatar(ap_activity_user_id(), 40);
        ?>
</a>
						</div>
						
						<!-- <a href="<?php 
        ap_activity_the_permalink();
        ?>
" class="ap-notification-icon <?php 
        ap_activity_the_type();
        ?>
"><?php 
        ap_activity_the_icon();
コード例 #29
0
/**
 * Retrive active user link
 * @return string Link to user profile
 */
function ap_user_get_the_link()
{
    return ap_user_link(ap_user_get_the_ID());
}
コード例 #30
0
ファイル: about.php プロジェクト: kevinfodness/anspress
    while (ap_questions()) {
        ap_the_question();
        ?>
					<?php 
        ap_get_template_part('user/list-question');
        ?>
				<?php 
    }
    ?>

				<div class="ap-user-posts-footer">
					<?php 
    printf(__('More questions by %s', 'ap'), ap_user_get_the_display_name());
    ?>
					<a href="<?php 
    echo ap_user_link(ap_get_displayed_user_id(), 'questions');
    ?>
"><?php 
    _e('view', 'ap');
    ?>
&rarr;</a>
				</div>
			<?php 
} else {
    ?>

				<?php 
    _e('No question asked yet!', 'ap');
    ?>

			<?php