コード例 #1
0
-from-<?php 
    bp_activity_comment_id();
    ?>
"><?php 
    _e('Comment', 'buddypress');
    ?>
</a>
			<?php 
    $likes = cjtheme_activity_comment_likes(bp_get_activity_comment_id());
    ?>
			<?php 
    $user_like = cjtheme_activity_comment_user_like(bp_get_activity_comment_id());
    ?>

			<?php 
    $thanks = cjtheme_activity_comment_thanks(bp_get_activity_comment_id());
    ?>
			<?php 
    $user_thank = cjtheme_activity_comment_user_thank(bp_get_activity_comment_id());
    ?>
			<a href="#" class="acomment-reply like-comment" id="like-<?php 
    bp_activity_comment_id();
    ?>
" data-comment-id="<?php 
    bp_activity_comment_id();
    ?>
" data-user-id="<?php 
    echo $current_user->ID;
    ?>
"><?php 
    echo $user_like;
コード例 #2
0
function cjtheme_update_bp_acmeta_thanks()
{
    global $wpdb;
    $table_bp_acmeta = $wpdb->prefix . 'cjtheme_likes_thanks';
    $check_existing = $wpdb->get_row("SELECT * FROM {$table_bp_acmeta} WHERE user_id = '{$_POST['user_id']}' AND comment_id = '{$_POST['comment_id']}'");
    if (is_null($check_existing)) {
        $acmeta_data = array('comment_id' => $_POST['comment_id'], 'user_id' => $_POST['user_id'], 'thanks' => 1);
        cjtheme_insert($table_bp_acmeta, $acmeta_data);
        $comment_thanks = cjtheme_activity_comment_thanks($_POST['comment_id']);
        $comment_thanks = !is_null($comment_thanks) ? ' ' . $comment_thanks : '';
        $comment = get_comment($_POST['comment_id']);
        if ($comment->user_id != $_POST['user_id']) {
            gamf_add_points(cjtheme_user_info($comment->user_id, 'ID'), '3', 'thank-answer', 'You received a thanks on your answer.');
        }
        echo ' ' . $comment_thanks;
    } elseif ($check_existing->thanks == 0) {
        $acmeta_data = array('comment_id' => $_POST['comment_id'], 'user_id' => $_POST['user_id'], 'thanks' => 1);
        cjtheme_update($table_bp_acmeta, $acmeta_data, 'id', $check_existing->id);
        $comment_thanks = cjtheme_activity_comment_thanks($_POST['comment_id']);
        $comment_thanks = !is_null($comment_thanks) ? ' ' . $comment_thanks : '';
        $comment = get_comment($_POST['comment_id']);
        if ($comment->user_id != $_POST['user_id']) {
            gamf_add_points(cjtheme_user_info($comment->user_id, 'ID'), '3', 'thank-answer', 'You received a thanks on your answer.');
            $nmessage = '<a href="' . site_url(cjtheme_user_info($_POST['user_id'], 'user_login')) . '">' . cjtheme_user_info($_POST['user_id'], 'display_name') . '</a> said thanks for your <a href="' . get_permalink($comment->comment_post_ID) . '#answer-' . $comment->comment_ID . '">answer</a>.';
            cjtheme_notification_add(cjtheme_user_info($comment->user_id, 'ID'), $nmessage);
        }
        echo ' ' . $comment_thanks;
    } else {
        $acmeta_data = array('comment_id' => $_POST['comment_id'], 'user_id' => $_POST['user_id'], 'thanks' => 0);
        cjtheme_update($table_bp_acmeta, $acmeta_data, 'id', $check_existing->id);
        $comment_thanks = cjtheme_activity_comment_thanks($_POST['comment_id']);
        $comment_thanks = !is_null($comment_thanks) ? ' ' . $comment_thanks : '';
        $comment = get_comment($_POST['comment_id']);
        if ($comment->user_id != $_POST['user_id']) {
            gamf_add_points(cjtheme_user_info($comment->user_id, 'ID'), '-3', 'unthank-answer', 'You received a Thanks  on your answer.');
            $nmessage = '<a href="' . site_url(cjtheme_user_info($_POST['user_id'], 'user_login')) . '">' . cjtheme_user_info($_POST['user_id'], 'display_name') . '</a> unthanked your <a href="' . get_permalink($comment->comment_post_ID) . '#answer-' . $comment->comment_ID . '">answer</a>.';
            cjtheme_notification_add(cjtheme_user_info($comment->user_id, 'ID'), $nmessage);
        }
        echo '' . $comment_thanks;
    }
    die;
}
コード例 #3
0
    function cartoq_comment_template($comment, $args, $depth)
    {
        global $current_user;
        $GLOBALS['comment'] = $comment;
        $classes = array('comment', 'answer', 'clearfix');
        switch ($comment->comment_type) {
            case '':
                ?>
				<li <?php 
                comment_class($classes);
                ?>
 id="li-comment-<?php 
                comment_ID();
                ?>
">
					<?php 
                if ($comment->user_id) {
                    $user = get_userdata($comment->user_id);
                    $username = $user->user_nicename;
                    $profile_url = site_url('members/') . $username . '/';
                }
                ?>

					<div id="comment-<?php 
                comment_ID();
                ?>
" class="comment-body clearfix">
			
			
						<figure class="comment-avatar">
							<a href="<?php 
                echo $profile_url;
                ?>
">
								<?php 
                echo get_avatar($comment, 70);
                ?>
							</a>

							<figcaption>
								<span class="user-stats">
									<span class="stat"><i class="fa fa-thumbs-up"></i> <?php 
                echo cjtheme_user_likes_count($user->ID, 'likes');
                ?>
</span>
									<span class="stat"><i class="fa fa-star"></i> <?php 
                echo cjtheme_user_likes_count($user->ID, 'thanks');
                ?>
</span>
									<span class="stat"><i class="fa fa-crown"></i> <span class="label label-info"><?php 
                echo cjtheme_user_role_display($user->ID);
                ?>
</span></span>
								</span>
							</figcaption>
						</figure>
			
			
						<div class="comment-main">
			
							<header class="vcard clearfix">
								<?php 
                printf(__('<cite class="fn">%s answers:</cite>', 'cartoq'), get_comment_author_link());
                ?>
								
								<aside class="comm-edit">
									<a class="comment-date" href="<?php 
                echo htmlspecialchars(get_comment_link($comment->comment_ID));
                ?>
">
										<?php 
                echo cjtheme_time_ago(strtotime($comment->comment_date));
                ?>
									</a>
									<?php 
                edit_comment_link(__('Edit', 'cartoq'), '  ', '');
                ?>
								</aside>
							</header>
			
							<div class="comment-text">
								<?php 
                comment_text();
                ?>

								<?php 
                if ($comment->comment_approved == '0') {
                    ?>
									 <em><?php 
                    _e('Your comment is awaiting moderation.', 'cartoq');
                    ?>
</em>
									 <br />
								<?php 
                }
                ?>
							</div>

							<?php 
                $likes = cjtheme_activity_comment_likes($comment->comment_ID);
                $thanks = cjtheme_activity_comment_thanks($comment->comment_ID);
                ?>

							<a href="#" class="like-thanks btn btn-link <?php 
                echo cjtheme_login_class('like-comment', 'cjfm-show-login-form');
                ?>
" data-redirect="<?php 
                echo cjtheme_current_url();
                ?>
" id="like-<?php 
                echo $comment->comment_ID;
                ?>
" data-comment-id="<?php 
                echo $comment->comment_ID;
                ?>
" data-user-id="<?php 
                echo $current_user->ID;
                ?>
">
								<i class="fa fa-thumbs-up"></i>
								<span class="likes-value">
									<?php 
                echo $likes > 0 ? $likes : '0';
                ?>
								</span>
							</a>

							<a href="#" class="like-thanks btn btn-link <?php 
                echo cjtheme_login_class('thank-comment', 'cjfm-show-login-form');
                ?>
" data-redirect="<?php 
                echo cjtheme_current_url();
                ?>
" id="thanks-<?php 
                echo $comment->comment_ID;
                ?>
" data-comment-id="<?php 
                echo $comment->comment_ID;
                ?>
" data-user-id="<?php 
                echo $current_user->ID;
                ?>
">
								<i class="fa fa-heart"></i> 
								<span class="thanks-value">
									<?php 
                echo $thanks > 0 ? $thanks : '0';
                ?>
								</span>
							</a>
							
							<?php 
                comment_reply_link(array_merge($args, array('depth' => $depth, 'before' => '<footer class="reply">', 'after' => '</footer>', 'max_depth' => $args['max_depth'])));
                ?>
							
						</div>
			 
					</div><!-- #comment-<?php 
                comment_ID();
                ?>
  -->
				</li><?php 
                break;
            case 'pingback':
                ?>
				<li <?php 
                comment_class();
                ?>
 id="li-pingback-<?php 
                comment_ID();
                ?>
">
					<?php 
                _e('Pingback:', 'cartoq');
                ?>
 <?php 
                echo get_comment_author_link();
                ?>
 <small class="ping-edit"><?php 
                ac_icon('edit');
                edit_comment_link(__('Edit', 'cartoq'), '  ', '');
                ?>
</small>
				</li><?php 
            case 'trackback':
                ?>
				<li <?php 
                comment_class();
                ?>
 id="li-trackback-<?php 
                comment_ID();
                ?>
">
					<?php 
                _e('Trackback:', 'cartoq');
                ?>
 <?php 
                echo get_comment_author_link();
                ?>
 <small class="ping-edit"><?php 
                ac_icon('edit');
                edit_comment_link(__('Edit', 'cartoq'), '  ', '');
                ?>
</small>
				</li><?php 
        }
    }
コード例 #4
0
											</div><!-- /.user-info -->

											<div class="answer-content">
												<span class="arrow"></span>
												<?php 
                echo wpautop($answer->comment_content);
                ?>

												<?php 
                $likes = cjtheme_activity_comment_likes($answer->comment_ID);
                ?>
												<?php 
                $user_like = cjtheme_activity_comment_user_like($answer->comment_ID);
                ?>
												<?php 
                $thanks = cjtheme_activity_comment_thanks($answer->comment_ID);
                ?>
												<?php 
                $user_thank = cjtheme_activity_comment_user_thank($answer->comment_ID);
                ?>

												<a href="#" class="btn like-thanks btn-warning <?php 
                echo cjtheme_login_class('like-comment', 'cjfm-show-login-form');
                ?>
" data-redirect="<?php 
                echo cjtheme_current_url();
                ?>
" id="like-<?php 
                echo $answer->comment_ID;
                ?>
" data-comment-id="<?php