Plugin Directory

Changeset 1967164


Ignore:
Timestamp:
11/01/2018 01:10:11 PM (7 years ago)
Author:
wordgenie
Message:

Added filter for renaming file name and tested plugin with latest WordPress and Event Espresso versions

Location:
files-addon-for-event-espresso-4
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • files-addon-for-event-espresso-4/trunk/EE_File.class.php

    r1793549 r1967164  
    6565    $table = $wpdb->prefix.'esp_question_allowed_ext';
    6666    $question_id = $args['QST_ID'];
    67    
    68     $count = $wpdb->get_var("SELECT COUNT(id) FROM $table WHERE qst_id='{$question_id}'");
    69     $ext = $_POST['question_ext'];
    70    
    71    
    72     if ($count > 0) {
    73        
    74           $wpdb->update(
    75               $table,
    76               array('ext'=>$ext),
    77               array('qst_id'=>$question_id),
    78               array('%s'),
    79               array('%d')
    80           );
    81     } else {
    82        
    83          $wpdb->insert(
    84              $table,
    85              array('ext'=>$ext,
    86                     'qst_id'=>$question_id),
    87              array( '%s',
    88                     '%d')
    89          );
     67    if($_POST['QST_type'] == 'file')
     68    {
     69      $count = $wpdb->get_var("SELECT COUNT(id) FROM $table WHERE qst_id='{$question_id}'");
     70      $ext = $_POST['question_ext'];
     71     
     72     
     73      if ($count > 0) {
     74         
     75            $wpdb->update(
     76                $table,
     77                array('ext'=>$ext),
     78                array('qst_id'=>$question_id),
     79                array('%s'),
     80                array('%d')
     81            );
     82      } else {
     83         
     84           $wpdb->insert(
     85               $table,
     86               array('ext'=>$ext,
     87                      'qst_id'=>$question_id),
     88               array( '%s',
     89                      '%d')
     90           );
     91      }
    9092    }
    9193 
  • files-addon-for-event-espresso-4/trunk/eea-file.php

    r1793549 r1967164  
    66 * Author URI: http://aparnascodex.com/
    77 * License: GPL2
    8  * Version: 1.0.7
     8 * Version: 1.0.8
    99 * TextDomain:  wordfile
    1010 */
     
    104104        }
    105105       
    106         $upload_overrides = array( 'test_form' => false );
     106        $upload_overrides = array( 'test_form' => false ,'unique_filename_callback' => 'ssa_change_filename'  );
    107107
    108108        add_filter('upload_dir', 'ssa_change_uploads_directory_path');
     
    124124    echo json_encode($data);
    125125    die();
     126}
     127
     128//override filename
     129function ssa_change_filename($dir, $name, $ext){
     130    $filename = $name.$ext;
     131    $filename = apply_filters('ssa_override_filename',$filename);
     132    return $filename;
    126133}
    127134
  • files-addon-for-event-espresso-4/trunk/readme.txt

    r1793549 r1967164  
    33Tags: Event espresso, file , upload file, questions, form, events
    44Requires at least: 4.1
    5 Tested up to: WordPress 4.9.1
    6 Stable tag: 1.0.7
     5Tested up to: WordPress 4.9.8
     6Stable tag: 1.0.8
    77License: GPL2
    88
     
    2727Following steps should be followed to install plugin manually
    2828
    29 1. Upload 'files-addon-for-event-espresso-4' folder to the '/wp-content/plugins/' directory or upload 'files-addon-for-event-espresso-4.1.0.7.zip' through WordPress admin panel
     291. Upload 'files-addon-for-event-espresso-4' folder to the '/wp-content/plugins/' directory or upload 'files-addon-for-event-espresso-4.1.0.8.zip' through WordPress admin panel
    30302. Activate the plugin through the 'Plugins' menu in WordPress
    31313. You are ready to create file type question.
     
    6060
    6161== Changelog ==
     62= 1.0.8 =
     63
     641. Added filter to rename file before uploading - Filter - ssa_override_filename
     652. Tested plugin with latest WordPress and Event Espresso version
     66
    6267= 1.0.7 =
    6368
Note: See TracChangeset for help on using the changeset viewer.