} ?> ><?php _e('Xem nhiều nhất', 'cm-answers'); ?> </li></a> </ul> </div> <div class="cma-clear"></div> <div class="detail-inner masonry-container"> <?php $args = array('post_type' => 'cma_thread'); $posttt = new WP_Query($args); while ($posttt->have_posts()) { $posttt->the_post(); $thread = CMA_AnswerThread::getInstance(get_the_ID()); ?> <div class="col-md-9 topic box"> <div class="article"> <div style="margin-left:10px;width:100%;float:left;margin-bottom:10px"> <div class="StatBox ViewsBox AnswersBox" style="background: #73a550;color: #FFF;"> <span>Bình luận</span> <?php $numberOfAnswers = $thread->getNumberOfAnswers(); echo $numberOfAnswers; ?> </div> <div class="StatBox ViewsBox"> <span>Xem</span> <?php
public static function adminColumnDisplay($columnName, $id) { $thread = CMA_AnswerThread::getInstance($id); if (!$thread) { return; } switch ($columnName) { case 'author': echo $thread->getAuthor()->display_name; break; case 'views': echo $thread->getViews(); break; case 'status': echo $thread->getStatus(); if (strtolower($thread->getStatus()) == strtolower(__('pending', 'cm-answers'))) { ?> <a href="<?php echo esc_attr(add_query_arg(array('cma-action' => 'approve', 'cma-id' => $id))); ?> ">(<?php _e('Approve', 'cm-answers'); ?> )</a> <?php } break; } }
public function getThread() { return CMA_AnswerThread::getInstance($this->getThreadId()); }
public static function notifyAllUsers() { global $wpdb; if (!empty($_GET['nonce']) and wp_verify_nonce($_GET['nonce'], CMA_BaseController::ADMIN_BP_NOTIFY)) { $usersIds = $wpdb->get_col("SELECT ID FROM {$wpdb->users}"); if (!empty($_GET['post_id']) and $thread = CMA_AnswerThread::getInstance($_GET['post_id'])) { $notification = array('item_id' => $thread->getId(), 'secondary_item_id' => 0, 'component_name' => 'cma_notifier', 'component_action' => self::ACTION_NOTIFICATION_THREAD, 'date_notified' => bp_core_current_time(), 'is_new' => 1, 'allow_duplicate' => true); foreach ($usersIds as $userId) { if ($thread->isVisible($userId)) { $notification['user_id'] = $userId; bp_notifications_add_notification($notification); } } } if (!empty($_GET['comment_id']) and $answer = CMA_Answer::getById($_GET['comment_id'])) { $notification = array('item_id' => $answer->getId(), 'secondary_item_id' => 0, 'component_name' => 'cma_notifier', 'component_action' => self::ACTION_NOTIFICATION_ANSWER, 'date_notified' => bp_core_current_time(), 'is_new' => 1, 'allow_duplicate' => true); foreach ($usersIds as $userId) { if ($answer->isVisible($userId)) { $notification['user_id'] = $userId; bp_notifications_add_notification($notification); } } } } wp_safe_redirect(CMA::getReferer()); exit; }