function get_message() { check_ajax_referer('cpm_nonce'); $posted = $_POST; $message_id = isset($posted['message_id']) ? intval($posted['message_id']) : 0; $project_id = isset($posted['project_id']) ? intval($posted['project_id']) : 0; $message_obj = CPM_Message::getInstance(); $message = $message_obj->get($message_id); if ($message) { echo json_encode(array('success' => true, 'id' => $message_id, 'content' => cpm_message_form($project_id, $message))); exit; } echo json_encode(array('success' => false)); exit; }
_e('Messages', 'cpm'); ?> <a class="add-new-h2 cpm-new-message-btn" href="#"><?php _e('Add New', 'cpm'); ?> </a> </h3> <div class="cpm-new-message-form"> <h3><?php _e('Create a new message', 'cpm'); ?> </h3> <?php echo cpm_message_form($project_id); ?> </div> <table class="cpm-messages-table"> <?php $messages = $msg_obj->get_all($project_id); foreach ($messages as $message) { ?> <tr> <td class="author"> <span class="cpm-avatar"><?php echo cpm_url_user($message->post_author, true, 32); ?> </span> </td>