status of a file that was uploaded in wordpress(in progress,rejected,approved)

25 Views Asked by At

I want to use a file upload field in gravity form that has a status tag above that which describes its status . Its status are in progress, approved ,rejected depending on website`s admin opinion after reviewing the picture of a wanted certificate picture ,for example a graduating certificate. After uploading and before reviewing by admin its status tag must be In progress. But after reviewing the file by admin its status tag must be changed to Rejected or Approved . How can I implement this form.

Please help me

I tried gravity view and gravity flow .But I cant resolve it.

1

There are 1 best solutions below

0
M Fahad Aziz On

According to your statement, to create a Gravity Forms upload field with a status tag that can be updated by an admin after reviewing the uploaded file, you can use Gravity Forms along with some custom code and possibly some other plugins like Gravity View or Gravity Flow for a more streamlined workflow.

Please take a look at this code. You can modify this according to your need,

add_action('gform_after_submission', 'update_status_field', 10, 2);
function update_status_field($entry, $form) {
  // Check if the form has the field for status
  $status_field_id = 1; // Replace with the actual field ID
  $status = 'In Progress'; // Default status

  if (rgar($entry, 'status_field')) {
    $status = rgar($entry, 'status_field');
  }

  // Check if the admin has reviewed and updated the status
  if (current_user_can('manage_options')) { // Adjust the capability as needed
    // Update the status field based on admin's decision
    $new_status = 'Approved'; // Change this based on your logic
    
    // Update the entry's status field
    GFAPI::update_entry_field($entry['id'], $status_field_id, $new_status);
  }
}