?> ,<?php echo $c; ?> ,'<a href="<?php echo esc_url(add_query_arg(array('frm_action' => 'edit', 'entry' => $entry->id), $permalink) . $anchor); ?> "><?php echo addslashes($edit_link); ?> </a>'); <?php } $c++; } if ($delete_link && FrmProEntriesHelper::user_can_delete($entry)) { ?> data.setCell(<?php echo $i; ?> ,<?php echo $c; ?> ,'<a href="<?php echo esc_url(add_query_arg(array('frm_action' => 'destroy', 'entry' => $entry->id))); ?> " class="frm_delete_link" onclick="return confirm(\'<?php echo esc_attr($confirm); ?> \')"><?php echo addslashes($delete_link);
function user_can_delete($entry, $form = false) { _deprecated_function(__FUNCTION__, '1.07.05', 'FrmProEntriesHelper::user_can_delete'); return FrmProEntriesHelper::user_can_delete($entry, $form); }
public static function maybe_delete_entry($entry) { FrmEntry::maybe_get_entry($entry); if (!$entry || !FrmProEntriesHelper::user_can_delete($entry)) { $message = __('There was an error deleting that entry', 'formidable'); return $message; } $result = FrmEntry::destroy($entry->id); return $result; }
<a href="<?php echo esc_url(add_query_arg(array('frm_action' => 'edit', 'entry' => $entry->id), $atts['permalink']) . $atts['anchor']); ?> "><?php echo $atts['edit_link']; ?> </a><?php } ?> </td> <?php } if ($atts['delete_link']) { ?> <td><?php if (FrmProEntriesHelper::user_can_delete($entry)) { ?> <a href="<?php echo esc_url(add_query_arg(array('frm_action' => 'destroy', 'entry' => $entry->id))); ?> " class="frm_delete_link" data-frmconfirm="'<?php echo esc_attr($atts['confirm']); ?> "><?php echo $atts['delete_link']; ?> </a><?php } ?> </td> <?php
public static function ajax_destroy($form_id = false, $ajax = true, $echo = true) { global $wpdb, $frm_vars; $entry_key = FrmAppHelper::get_param('entry'); if (!$form_id) { $form_id = FrmAppHelper::get_param('form_id'); } if (!$entry_key) { return; } if (isset($frm_vars['deleted_entries']) && is_array($frm_vars['deleted_entries']) && in_array($entry_key, $frm_vars['deleted_entries'])) { return; } if (is_numeric($entry_key)) { $where = $wpdb->prepare('id = %d', $entry_key); } else { $where = $wpdb->prepare('item_key = %s', $entry_key); } $entry = $wpdb->get_row("SELECT id, form_id, is_draft, user_id FROM {$wpdb->prefix}frm_items WHERE {$where}"); unset($where); if (!$entry || $form_id && $entry->form_id != (int) $form_id) { return; } if (!FrmProEntriesHelper::user_can_delete($entry)) { $message = __('There was an error deleting that entry', 'formidable'); if ($echo) { echo '<div class="frm_message">' . $message . '</div>'; } return; } $entry_id = $entry->id; global $frm_entry; $frm_entry->destroy($entry_id); if (!isset($frm_vars['deleted_entries']) || empty($frm_vars['deleted_entries'])) { $frm_vars['deleted_entries'] = array(); } $frm_vars['deleted_entries'][] = $entry_id; if ($ajax && $echo) { echo $message = 'success'; } else { if (!$ajax) { $message = apply_filters('frm_delete_message', __('Your entry was successfully deleted', 'formidable'), $entry); if ($echo) { echo '<div class="frm_message">' . $message . '</div>'; } } } return $message; }