当前位置: 首页>>代码示例>>PHP>>正文


PHP GFAPI::delete_entry方法代码示例

本文整理汇总了PHP中GFAPI::delete_entry方法的典型用法代码示例。如果您正苦于以下问题:PHP GFAPI::delete_entry方法的具体用法?PHP GFAPI::delete_entry怎么用?PHP GFAPI::delete_entry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GFAPI的用法示例。


在下文中一共展示了GFAPI::delete_entry方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: prevent_entry_submission_save

function prevent_entry_submission_save($entry, $form)
{
    $form_id = $entry['form_id'];
    $forms_id = array(1, 2, 3, 4, 5, 6, 7, 8);
    /*the Id's you want entry not be save*/
    if (in_array($form_id, $forms_id)) {
        GFAPI::delete_entry($entry['id']);
    }
}
开发者ID:rrapuya,项目名称:Gravity-Form-Prevent-Entry-Save,代码行数:9,代码来源:functions.php

示例2: maybe_delete_entry

 /**
  * Delete entries
  * This function is used to delete entries with an ajax request
  * Could use better (or at least some) error handling
  */
 public function maybe_delete_entry()
 {
     if (isset($_POST["mode"]) && $_POST["mode"] == "delete" && isset($_POST["delete_id"]) && isset($_POST["form_id"])) {
         $form_id = $_POST["form_id"];
         $form = GFAPI::get_form($form_id);
         $settings = $this->get_form_settings($form);
         $enable_delete = $settings["enable_delete"];
         $delete_type = $settings["delete_type"];
         if ($enable_delete) {
             $delete_id = $_POST["delete_id"];
             $entry = GFAPI::get_entry($delete_id);
             if (!is_wp_error($entry)) {
                 if ($entry["created_by"] == $this->stickylist_get_current_user() || current_user_can('delete_others_posts') || current_user_can('stickylist_delete_entries')) {
                     if ($_POST["delete_post_id"] != null) {
                         $delete_post_id = $_POST["delete_post_id"];
                     } else {
                         $delete_post_id = "";
                     }
                     if ($delete_type == "trash") {
                         $entry["status"] = "trash";
                         $success = GFAPI::update_entry($entry, $delete_id);
                         if ($delete_post_id != "") {
                             wp_delete_post($delete_post_id, false);
                         }
                     }
                     if ($delete_type == "permanent") {
                         $success = GFAPI::delete_entry($delete_id);
                         if ($delete_post_id != "") {
                             wp_delete_post($delete_post_id, true);
                         }
                     }
                     if ($success) {
                         $notifications = $form["notifications"];
                         $notification_ids = array();
                         foreach ($notifications as $notification) {
                             $notification_type = $notification["stickylist_notification_type"];
                             if ($notification_type == "delete" || $notification_type == "all") {
                                 $id = $notification["id"];
                                 array_push($notification_ids, $id);
                             }
                         }
                         GFCommon::send_notifications($notification_ids, $form, $entry);
                     }
                 }
             }
         }
     }
 }
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:53,代码来源:class-sticky-list.php

示例3: delete_entries

 public function delete_entries($entry_ids)
 {
     $this->log_debug(__METHOD__ . '(): Running.');
     $capability = apply_filters('gform_web_api_capability_delete_entries', 'gravityforms_delete_entries');
     $this->authorize($capability);
     $count = 0;
     if (is_array($entry_ids)) {
         foreach ($entry_ids as $entry_id) {
             $this->log_debug(__METHOD__ . '(): Deleting entry id ' . $entry_id);
             $result = GFAPI::delete_entry($entry_id);
             if (is_wp_error($result)) {
                 break;
             }
             $count++;
         }
     } else {
         $result = GFAPI::delete_entry($entry_ids);
         $count++;
     }
     if (isset($result) && is_wp_error($result)) {
         $response = $this->get_error_response($result);
         $status = $this->get_error_status($result);
     } else {
         $status = 200;
         $response = sprintf(__('Entries deleted successfully: %d', 'gravityforms'), $count);
     }
     $this->end($status, $response);
 }
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:28,代码来源:webapi.php

示例4: aria_remove_all_music_from_nnmta_database

/**
 * This function will remove all of the music from the NNMTA music database.
 *
 * This function was created to support the scenario when the festival chariman needs
 * to update the music in the NNMTA music database. In order to do this, all of the existing
 * data is removed from the database prior to adding all of the new data. This ensures
 * that the new data is added appropriately without accidentally adding old, possibly
 * unwanted music data.
 *
 * @since 2.0.0
 * @author KREW
 */
function aria_remove_all_music_from_nnmta_database()
{
    $nnmta_music_database_form_id = aria_get_nnmta_database_form_id();
    $index = 0;
    $total_count = GFAPI::count_entries($nnmta_music_database_form_id);
    while ($index < $total_count) {
        $twenty_songs = GFAPI::get_entries($nnmta_music_database_form_id);
        for ($song_on_page = 0; $song_on_page < 20; $song_on_page++) {
            $deleted_song = GFAPI::delete_entry($twenty_songs[$song_on_page]['id']);
            if (is_wp_error($deleted_song)) {
                wp_die($deleted_song->get_error_message());
            }
        }
        $index += 20;
    }
    /*
    	foreach ($all_songs as $song) {
    		$deleted_song = GFAPI::delete_entry($song['id']);
    		if (is_wp_error($deleted_song)) {
    			wp_die($deleted_song->get_error_message());
    		}
    	}
    */
}
开发者ID:wesleykepke,项目名称:ARIA,代码行数:36,代码来源:aria_add_nnmta_music.php

示例5: delete_or_trash_entry

 /**
  * @since 1.13.1
  * @see GFAPI::delete_entry()
  * @return WP_Error|boolean GFAPI::delete_entry() returns a WP_Error on error
  */
 private function delete_or_trash_entry($entry)
 {
     $entry_id = $entry['id'];
     $mode = $this->get_delete_mode();
     if ('delete' === $mode) {
         do_action('gravityview_log_debug', __METHOD__ . ' Starting delete entry: ', $entry_id);
         // Delete the entry
         $delete_response = GFAPI::delete_entry($entry_id);
         if (!is_wp_error($delete_response)) {
             $delete_response = 'deleted';
             /**
              * @action `gravityview/delete-entry/deleted` Triggered when an entry is deleted
              * @since 1.16.4
              * @param  int $entry_id ID of the Gravity Forms entry
              * @param  array $entry Deleted entry array
              */
             do_action('gravityview/delete-entry/deleted', $entry_id, $entry);
         }
         do_action('gravityview_log_debug', __METHOD__ . ' Delete response: ', $delete_response);
     } else {
         do_action('gravityview_log_debug', __METHOD__ . ' Starting trash entry: ', $entry_id);
         $trashed = GFAPI::update_entry_property($entry_id, 'status', 'trash');
         new GravityView_Cache();
         if (!$trashed) {
             $delete_response = new WP_Error('trash_entry_failed', __('Moving the entry to the trash failed.', 'gravityview'));
         } else {
             /**
              * @action `gravityview/delete-entry/trashed` Triggered when an entry is trashed
              * @since 1.16.4
              * @param  int $entry_id ID of the Gravity Forms entry
              * @param  array $entry Deleted entry array
              */
             do_action('gravityview/delete-entry/trashed', $entry_id, $entry);
             $delete_response = 'trashed';
         }
         do_action('gravityview_log_debug', __METHOD__ . ' Trashed? ', $delete_response);
     }
     return $delete_response;
 }
开发者ID:mgratch,项目名称:GravityView,代码行数:44,代码来源:class-delete-entry.php

示例6: after_submission

 /**
  * This is the target for the gform_after_submission action hook.
  * Executed at the end of the submission process (after form validation, notification, and entry creation).
  *
  * @param array $entry The Entry Object containing the submitted form values
  * @param array $form  The Form Object containing all the form and field settings
  *
  * @return bool
  */
 function after_submission($entry, $form)
 {
     // Make sure the Gravity Forms Web API wrapper can be found in the includes folder of the add-on.
     // Download from here:
     // https://raw.githubusercontent.com/rocketgenius/webapiclient/master/includes/class-gf-web-api-wrapper.php
     require_once "includes/class-gf-web-api-wrapper.php";
     $addon_settings = $this->get_plugin_settings();
     if (!$addon_settings) {
         return;
     }
     $api_url = $addon_settings["site_url"];
     $public_key = $addon_settings["site_api_key"];
     $private_key = $addon_settings["site_private_key"];
     $identifier = !empty($addon_settings["identifier"]) ? $addon_settings["identifier"] : get_bloginfo();
     if (empty($api_url) || empty($public_key) || empty($private_key)) {
         return;
     }
     // Use the helper method to get the form settings and make sure it's enabled for this form
     $form_settings = $this->get_form_settings($form);
     if (!$form_settings || !$form_settings["isEnabled"]) {
         return;
     }
     $remote_form_id = $form_settings["site_form_id"];
     // Set up the Web API connection to the remote site
     $web_api = new GFWebAPIWrapper($api_url, $public_key, $private_key);
     // Create the form on the central server if no Form ID is currently set
     if (empty($remote_form_id)) {
         $remote_form_id = $web_api->create_form($form);
         // Save the remote Form ID in the settings
         $form_settings["site_form_id"] = $remote_form_id;
         $this->save_form_settings($form, $form_settings);
     }
     // Set the form_id for the entry to the remote Form ID
     $entry["form_id"] = $remote_form_id;
     // Set the entry meta so the remote site can identify that this entry is from this site
     $entry["gf_aggregator_id"] = $identifier;
     // Create the entry on the central server
     // Note: A better approach would be to spin this off into a wp_cron task.
     $web_api->create_entry($entry);
     // If the delete entries setting is activated then delete this entry.
     if ($form_settings["deleteEntries"]) {
         GFAPI::delete_entry($entry["id"]);
     }
 }
开发者ID:radon1284,项目名称:gravityformsaggregator,代码行数:53,代码来源:aggregator.php

示例7: delete_or_trash_entry

 /**
  * @since 1.13.1
  * @see GFAPI::delete_entry()
  * @return WP_Error|boolean GFAPI::delete_entry() returns a WP_Error on error
  */
 private function delete_or_trash_entry($entry_id)
 {
     $mode = $this->get_delete_mode();
     if ('delete' === $mode) {
         do_action('gravityview_log_debug', __METHOD__ . ' Starting delete entry: ', $entry_id);
         // Delete the entry
         $delete_response = GFAPI::delete_entry($entry_id);
         if (!is_wp_error($delete_response)) {
             $delete_response = 'deleted';
         }
         do_action('gravityview_log_debug', __METHOD__ . ' Delete response: ', $delete_response);
     } else {
         do_action('gravityview_log_debug', __METHOD__ . ' Starting trash entry: ', $entry_id);
         $trashed = GFAPI::update_entry_property($entry_id, 'status', 'trash');
         new GravityView_Cache();
         if (!$trashed) {
             $delete_response = new WP_Error('trash_entry_failed', __('Moving the entry to the trash failed.', 'gravityview'));
         } else {
             $delete_response = 'trashed';
         }
         do_action('gravityview_log_debug', __METHOD__ . ' Trashed? ', $delete_response);
     }
     return $delete_response;
 }
开发者ID:qqz,项目名称:GravityView,代码行数:29,代码来源:class-delete-entry.php

示例8: btc_remove_racer

function btc_remove_racer()
{
    if (isset($_POST) && isset($_POST['key']) && is_numeric($_POST['key'])) {
        $res = GFAPI::delete_entry($_POST['key']);
    } else {
        echo 'error ' . $_POST['key'];
    }
    wp_die();
}
开发者ID:rpavlovic,项目名称:btc-site,代码行数:9,代码来源:functions-custom.php

示例9: delete_entry

 /**
  * Delete entry
  */
 private function delete_entry($form_id)
 {
     $entry_id = isset($_SESSION['gform_sayg_entry_id_' . $form_id]) ? $_SESSION['gform_sayg_entry_id_' . $form_id] : NULL;
     $deleted_entry = GFAPI::delete_entry($entry_id);
     unset($_SESSION['gform_sayg_entry_id_' . $form_id]);
 }
开发者ID:shanooooon,项目名称:save-between-pages-for-gravityforms,代码行数:9,代码来源:class-save-between-page-for-gravityforms-api.php

示例10: sticky_set_post_content

function sticky_set_post_content($entry, $form)
{
    if ($form['isSticky']) {
        if (is_user_logged_in()) {
            $saved_option_key = sticky_getEntryOptionKeyForGF($form);
            $saved_option_value = get_option($saved_option_key);
            // Save the entry ID in wp_options if this is the first time the form is submitted by this user.
            // If we dont have a saved value, we save the entry ID
            if (!$saved_option_value) {
                update_option($saved_option_key, $entry['id']);
                //If we have a saved value, update and delete
            } else {
                // ...as long as the form doesnt allow multiple entries...
                if (!$form['isEnableMulipleEntry']) {
                    // We dont want to loose our starred and read status when we update
                    $original_entry = RGFormsModel::get_lead($saved_option_value);
                    $entry["is_starred"] = $original_entry["is_starred"];
                    // ...unless the user wants us to
                    if (!isset($form['isMarkUnread'])) {
                        $entry["is_read"] = $original_entry["is_read"];
                    }
                    $success = GFAPI::update_entry($entry, $saved_option_value);
                    $success = GFAPI::delete_entry($entry["id"]);
                    // ...and if it does, dont delete or update but save the new entry ID instead so that the sticky form is populated with the latest saved entry.
                } else {
                    update_option($saved_option_key, $entry['id']);
                }
            }
        }
    }
}
开发者ID:GaryJones,项目名称:gravity-forms-sticky-form,代码行数:31,代码来源:sticky-form.php

示例11: gform_after_submission

 public function gform_after_submission($entry, $form)
 {
     if (!rgempty('preventEntryCreation', $form)) {
         GFAPI::delete_entry($entry['id']);
     }
 }
开发者ID:jbeyta,项目名称:joelandsam,代码行数:6,代码来源:prevent-entry-creation.php

示例12: gfee_after_submission

 function gfee_after_submission($tmp_entry, $form)
 {
     // get the original entry we want to edit/update
     GFEE::set_entry_id($_POST['gfee_entry_id']);
     // NEED TO BEEF UP SECURITY HERE AS THIS VALUE CAN BE MODIFIED BY USER TO EDIT SOMEONE ELSE'S ENTRY
     $orig_entry_id = GFEE::$entry_id;
     $orig_entry = GFAPI::get_entry($orig_entry_id);
     // initialize deletefiles variable
     $deletefiles = array();
     // take care of certain fields that need special handling
     foreach ($form['fields'] as $field) {
         // don't touch admin-only fields since front-end can't modify those
         if (!$field['adminOnly']) {
             // handle file uploads
             if ($field['type'] == 'fileupload') {
                 // if user has deleted this file upload, save to list to delete later
                 if ($_POST['delete_file'] == $field['id']) {
                     $delete_file_path = get_file_path_from_gf_entry($orig_entry[$field['id']]);
                     $deletefiles[] = $delete_file_path;
                     // save new file upload field data
                     $orig_entry[$field['id']] = $tmp_entry[$field['id']];
                 }
                 // this currently only supports one file per field
                 if ($tmp_entry[$field['id']]) {
                     // new file(s) uploaded, we need to copy the files because the originals will be deleted with the temp entry by Gravity Forms
                     $file_path = get_file_path_from_gf_entry($tmp_entry[$field['id']]);
                     $tmp_file_path = $file_path . '.tmp';
                     copy($file_path, $tmp_file_path);
                     // save new file upload field data
                     $orig_entry[$field['id']] = $tmp_entry[$field['id']];
                 }
                 // handle checkboxes, address, and name fields
             } elseif ($field['type'] == 'checkbox' || $field['type'] == 'address' || $field['type'] == 'name') {
                 foreach ($field->inputs as $key => $input) {
                     // loop each field input and save it
                     $orig_entry[strval($input['id'])] = $tmp_entry[strval($input['id'])];
                 }
             } else {
                 // save updated field data to original entry
                 $orig_entry[$field['id']] = $tmp_entry[$field['id']];
             }
         }
     }
     // perform update entry with original entry data fields updated
     $update_success = GFAPI::update_entry($orig_entry);
     if ($update_success === true) {
         // delete temporary entry
         $delete_success = GFAPI::delete_entry($tmp_entry['id']);
         // delete any lingering files that shouldn't be around anymore
         foreach ($deletefiles as $filename) {
             if (file_exists($filename)) {
                 unlink($filename);
             }
         }
         // original file(s) should be deleted by Gravity Forms or us, need to rename temp file back to original name
         if ($tmp_file_path) {
             rename($tmp_file_path, $file_path);
         }
     }
 }
开发者ID:edirpedro,项目名称:gravity-forms-edit-entries,代码行数:60,代码来源:gravity-forms-edit-entries.php

示例13: ovr_delete_gf_entry

/**
 * Delete Gravity Forms entry specified
 * @global object $wpdb
 *@param string $lead_id, id of gravity form entry to remove
 */
function ovr_delete_gf_entry($lead_id)
{
    global $wpdb;
    // Prepare variables.
    $lead_table = RGFormsModel::get_lead_table_name();
    $lead_notes_table = RGFormsModel::get_lead_notes_table_name();
    $lead_detail_table = RGFormsModel::get_lead_details_table_name();
    $lead_detail_long_table = RGFormsModel::get_lead_details_long_table_name();
    // Delete from lead detail long.
    $sql = $wpdb->prepare("DELETE FROM {$lead_detail_long_table} WHERE lead_detail_id IN(SELECT id FROM {$lead_detail_table} WHERE lead_id = %d)", $lead_id);
    $wpdb->query($sql);
    // Delete from lead details.
    $sql = $wpdb->prepare("DELETE FROM {$lead_detail_table} WHERE lead_id = %d", $lead_id);
    $wpdb->query($sql);
    // Delete from lead notes.
    $sql = $wpdb->prepare("DELETE FROM {$lead_notes_table} WHERE lead_id = %d", $lead_id);
    $wpdb->query($sql);
    // Delete from lead.
    $sql = $wpdb->prepare("DELETE FROM {$lead_table} WHERE id = %d", $lead_id);
    $wpdb->query($sql);
    // Finally, ensure everything is deleted (like stuff from Addons).
    GFAPI::delete_entry($lead_id);
}
开发者ID:NerdyDillinger,项目名称:ovrride,代码行数:28,代码来源:ovr_functions.php

示例14: gform_disable_post_creation

function gform_disable_post_creation($entry, $form)
{
    GFAPI::delete_entry($entry['id']);
}
开发者ID:GermaineMills,项目名称:gm-subs,代码行数:4,代码来源:thefirm-gravity2zen.php

示例15: deleteAllMyEntries

function deleteAllMyEntries()
{
    // get current user info
    global $current_user;
    get_currentuserinfo();
    $user_id = $current_user->ID;
    // initialize
    $result = "";
    $my_lead_ids = array();
    $successes = 0;
    $failures = 0;
    $failure_msg = "";
    // find entries for this user in all forms that we want to wipe out
    $form_ids = array(1, 4, 7, 8, 10, 16, 18, 19, 20, 21, 22, 49);
    foreach ($form_ids as $form_id) {
        // reset running count of number of entries found
        $number_of_entries_f[$form_id] = 0;
        // get all leads for that form id
        $leads = RGFormsModel::get_leads($form_id);
        // get form meta and then user-login field id for each form
        $form_meta = RGFormsModel::get_form_meta($form_id);
        $form_title = $form_meta["title"];
        // get leads that match on user-login
        foreach ($leads as $lead) {
            if ($lead['created_by'] == $user_id) {
                array_push($my_lead_ids, $lead['id']);
                $number_of_entries_f[$form_id]++;
            }
        }
        $result .= $form_title . ": " . $number_of_entries_f[$form_id] . "<br/>";
    }
    // delete the entries
    foreach ($my_lead_ids as $lead_id) {
        $del_result = GFAPI::delete_entry($lead_id);
        //echo "dr: ".$del_result;
        if ($del_result == true) {
            $successes++;
        } else {
            $failures++;
            $failure_msg .= "<br>" . $del_result;
        }
    }
    $final_result = "<br><br><b>Reset of all forms is complete.</b><br/><br/>Details - Attempted to delete the following number of entries:<br/>" . $result;
    $final_result .= "<br/>Successes: " . $successes . "<br/>Failures: " . $failures . "<br>" . $failure_msg;
    return $final_result;
}
开发者ID:healthcommcore,项目名称:osnap,代码行数:46,代码来源:functions.php


注:本文中的GFAPI::delete_entry方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。