28 add_filter(
'gform_notes_avatar', array(
'GravityView_Entry_Notes',
'filter_avatar' ), 10, 2 );
48 public static function add_note( $lead_id, $user_id, $user_name, $note =
'', $note_type =
'gravityview' ) {
51 $default_note = array(
56 'note_type' =>
'gravityview',
65 $note = apply_filters(
'gravityview/entry_notes/add_note', compact(
'lead_id',
'user_id',
'user_name',
'note',
'note_type' ) );
68 $note = wp_parse_args( $note, $default_note );
70 GFFormsModel::add_note( intval( $note[
'lead_id'] ), intval( $note[
'user_id'] ), esc_attr( $note[
'user_name'] ), $note[
'note'], esc_attr( $note[
'note_type'] ) );
73 if( empty( $wpdb->last_error ) ) {
74 $return = $wpdb->insert_id;
76 $return =
new WP_Error(
'gravityview-add-note', $wpdb->last_error );
88 GFFormsModel::delete_note( $note_id );
99 if( !is_array( $note_ids ) ) {
101 gravityview()->log->error(
'Note IDs not an array. Not processing delete request.', array(
'data' => $note_ids ) );
106 GFFormsModel::delete_notes( $note_ids );
119 $notes = GFFormsModel::get_lead_notes( $entry_id );
127 $notes = apply_filters(
'gravityview/entry_notes/get_notes',
$notes, $entry_id );
145 && method_exists(
'GFFormsModel',
'get_entry_notes_table_name' ) ) {
146 $notes_table = GFFormsModel::get_entry_notes_table_name();
148 $notes_table = GFFormsModel::get_lead_notes_table_name();
151 $results = $wpdb->get_results(
153 " SELECT n.id, n.user_id, n.date_created, n.value, n.note_type, ifnull(u.display_name,n.user_name) as user_name, u.user_email 155 LEFT OUTER JOIN $wpdb->users u ON n.user_id = u.id 156 WHERE n.id=%d", $note_id
160 return $results ? $results[0] :
false;
173 if(
'gravityview' === $note->note_type && -1 === (
int)$note->user_id ) {
174 $avatar = sprintf(
'<img src="%s" width="48" height="48" alt="GravityView" class="avatar avatar-48 gravityview-avatar" />', esc_url_raw( plugins_url(
'assets/images/floaty-avatar.png',
GRAVITYVIEW_FILE ) ) );
static delete_notes( $note_ids=array())
Delete an array of notes Alias for GFFormsModel::delete_notes()
__construct()
GravityView_Entry_Notes constructor.
static filter_avatar( $avatar='', $note=null)
Use the GravityView avatar for notes created by GravityView Note: The function is static so that it's...
static get_notes( $entry_id)
Alias for GFFormsModel::get_lead_notes()
const GRAVITYVIEW_FILE
Full path to the GravityView file "GRAVITYVIEW_FILE" "./gravityview.php".
static delete_note( $note_id)
Alias for GFFormsModel::delete_note()
static get_note( $note_id)
Get a single note by note ID.
Class GravityView_Entry_Notes.
static add_note( $lead_id, $user_id, $user_name, $note='', $note_type='gravityview')
Alias for GFFormsModel::add_note() with default note_type of 'gravityview'.
gravityview()
The main GravityView wrapper function.
new GravityView_Entry_Notes