public static function maybe_create_private_note() { if (!isset($_REQUEST['security'])) { wp_send_json_error(array('message' => self::__('Forget something?'))); } $nonce = $_REQUEST['security']; if (!wp_verify_nonce($nonce, self::NONCE)) { wp_send_json_error(array('message' => self::__('Not going to fall for it!'))); } if (!current_user_can('edit_sprout_invoices')) { return; } $record_id = (int) SC_Internal_Records::new_record($_REQUEST['notes'], SC_Controller::PRIVATE_NOTES_TYPE, $_REQUEST['associated_id'], sprintf(self::__('Note from %s'), sc_get_users_full_name(get_current_user_id())), 0, false); $error = $record_id ? '' : sc__('Private note failed to save, try again.'); $data = array('id' => $record_id, 'content' => esc_html($_REQUEST['notes']), 'type' => sc__('Private Note'), 'post_date' => sc__('Just now'), 'error' => $error); if (self::DEBUG) { header('Access-Control-Allow-Origin: *'); } wp_send_json_success($data); }
?> </th> </tr> </thead> <tbody> <tr> <td><span class="history_status created"><?php self::_e('Created'); ?> </span></td> <td><?php echo date_i18n(get_option('date_format') . ' @ ' . get_option('time_format'), strtotime($post->post_date)); ?> </td> <td><?php printf(self::__('Authored by %1$s.'), sc_get_users_full_name($post->post_author)); ?> </td> <td> </td> </tr> <?php if (!empty($history)) { ?> <?php foreach ($history as $time => $data) { ?> <tr class="record-<?php echo (int) (int) $data['id']; ?> type_<?php esc_attr($data['type']);
/** * Display the content for the column * * @param string $column_name * @param int $id post_id * @return string */ public static function column_display($column_name, $id) { $client = Sprout_Client::get_instance($id); if (!is_a($client, 'Sprout_Client')) { return; // return for that temp post } switch ($column_name) { case 'sc_client_type': sc_type_select($id); break; case 'sc_client_status': sc_status_select($id); break; case 'lead_info': echo '<p>'; $address = si_format_address($client->get_address(), 'string', '<br/>'); print $address; if ('' !== $address) { echo '<br/>'; } echo make_clickable(esc_url($client->get_website())); echo '</p>'; break; case 'contacts': $associated_users = $client->get_associated_users(); echo '<p>'; printf('<b>%s</b>: ', sc__('User Contacts')); if (!empty($associated_users)) { $users_print = array(); foreach ($associated_users as $user_id) { $user = get_userdata($user_id); if (!is_a($user, 'WP_User')) { $client->remove_associated_user($user_id); continue; } $users_print[] = sprintf('<span class="associated_user"><a href="%s">%s</a></span>', get_edit_user_link($user_id), sc_get_users_full_name($user_id)); } } if (!empty($users_print)) { print implode(', ', $users_print); } else { sc_e('No associated people/users.'); } echo '</p>'; break; default: // code... break; } }