Esempio n. 1
0
 /**
  * Delete all GravityView-generated entry notes
  * @since 1.15
  * @return void
  */
 private function delete_entry_notes()
 {
     global $wpdb;
     $notes_table = class_exists('GFFormsModel') ? GFFormsModel::get_lead_notes_table_name() : $wpdb->prefix . 'rg_lead_notes';
     $disapproved = __('Disapproved the Entry for GravityView', 'gravityview');
     $approved = __('Approved the Entry for GravityView', 'gravityview');
     $sql = $wpdb->prepare("\n\t\t\tDELETE FROM {$notes_table}\n            WHERE (\n                `note_type` = 'gravityview' OR\n\t\t\t\t`value` = %s OR\n\t\t\t\t`value` = %s\n            );\n        ", $approved, $disapproved);
     $wpdb->query($sql);
 }
 public static function is_valid_table($table_name)
 {
     global $wpdb;
     $tables = array(GFFormsModel::get_form_table_name(), GFFormsModel::get_form_view_table_name(), GFFormsModel::get_meta_table_name(), GFFormsModel::get_lead_table_name(), GFFormsModel::get_lead_notes_table_name(), GFFormsModel::get_lead_details_table_name(), GFFormsModel::get_lead_details_long_table_name(), GFFormsModel::get_lead_meta_table_name(), GFFormsModel::get_incomplete_submissions_table_name(), "{$wpdb->prefix}gf_addon_feed", "{$wpdb->prefix}gf_addon_payment_transaction", "{$wpdb->prefix}gf_addon_payment_callback");
     return in_array($table_name, $tables);
 }
 /**
  * Get a single note by note ID
  *
  * @since 1.17
  *
  * @param int $note_id The ID of the note in the `{prefix}_rg_lead_notes` table
  *
  * @return object|bool False if not found; note object otherwise.
  */
 public static function get_note($note_id)
 {
     global $wpdb;
     $notes_table = GFFormsModel::get_lead_notes_table_name();
     $results = $wpdb->get_results($wpdb->prepare(" 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\n\t              FROM {$notes_table} n\n\t              LEFT OUTER JOIN {$wpdb->users} u ON n.user_id = u.id\n\t              WHERE n.id=%d", $note_id));
     return $results ? $results[0] : false;
 }