How can I change what can be uploaded?

WordPress Business Themes Forums Responsive Themes Dating Theme How can I change what can be uploaded?

How can I change what can be uploaded?

February 15, 2019
 Robert

  • Robert
    Newbie 12 points

    I prefer to have some control of the size and type of files uploaded. IE… don’t want video uploaded. How can I make that change? Will it need to be changed in the code?

    Attachments:
    You must be logged in to view attached files.
    February 15, 2019 at 5:55 pm

  • Robert
    Newbie 12 points

    In addition, I am finding it difficult to update items for the base V9 Dating template. Would using a child theme make it any easier? So many of the pages are not accessible to do custom work.

    February 15, 2019 at 6:00 pm
  • JamesD
    JamesD
    Super Guru 1,289 points

    Hello Robert,

    I prefer to have some control of the size and type of files uploaded. IE… don’t want video uploaded. How can I make that change? Will it need to be changed in the code?

    Place the following near the bottom of your ‘_functions.php’ file:

    add_filter('wp_handle_upload_prefilter', 'custom_media_filter' );
    function custom_media_filter( $file ){
        // Filter set of allowed file extensions
        $aAllowedFiles = [ 'jpg', 'gif', 'png' ];
    
        // Get file extension
        $ext = pathinfo( $file['name'], PATHINFO_EXTENSION );
    
        // Verify file extension
        if ( !in_array($ext, $aAllowedFiles) ) {
            // Message to display if not a valid file.
            $file['error'] = __( 'Sorry, We do not accept this type of file.' );
        }
        return $file;
    }

    Note: The line $aAllowedFiles = [ 'jpg', 'gif', 'png' ]; is where you’ll place the file extensions of the types authorized to be uploaded. For dimension settings, take a look under Settings > Media

    Would using a child theme make it any easier?

    I don’t believe so.

    February 15, 2019 at 9:15 pm
  • Mark Fail
    Mark Fail
    Super Guru 12,812 points

    All pages can be overwritten and re-coded if you customise them manually via a child theme.

    Unfortunately it’s not possible to edit a lot of the inner account page options using the Elementor plugin.

    February 16, 2019 at 2:55 am

  • Robert
    Newbie 12 points

    Updating the code works nice. Thank you. Can you tell me where I find text like on the listing page, “FLV, MP4, MPEG, MOV and AVI videos up to 2M and a minimum resolution of 800×640 pixels. ” I have looked through the files on the server but cannot find where this is generated. Actually it would be helpful to know where all the core files that generate the page data are so I can tweak when needed. I like the theme but it needs some tweaks for my use.

    Again, thanks for the help.

    February 19, 2019 at 5:03 pm
  • Marie
    Marie
    Super Guru 1,706 points

    hi Robert,

    try checking the files:

    \framework\new_class\ppt_core.php
    \framework\new_class\ppt_3_media.php

    February 20, 2019 at 3:52 am

  • Robert
    Newbie 12 points

    I have the mime types set but now I need to edit the area in the screenshot attached. I want to edit that text and cannot find it.

    Attachments:
    You must be logged in to view attached files.
    February 20, 2019 at 4:23 pm
  • JamesD
    JamesD
    Super Guru 1,289 points

    @Robert

    Note:: I think theoretically it suppose to work using the Loco translation plugin. I always get a file size error so don’t even mess with it anymore.

    The file you’re looking for is a CORE file and will be overwritten each time the theme is updated. Be careful if you’re unfamiliar:
    /DA9/framework/parts/add-form-media.php and this file is called from /DA9/framework/parts/add-form-main.php

    Remember to always make a back-up of the files first!

    February 21, 2019 at 12:33 am
  • JamesD
    JamesD
    Super Guru 1,289 points

    @Robert,

    You should be able to re-create/copy some of the template files & directories in order to make custom changes.

    I’ve tried to come up with a quick/easier/safer way that one could accomplish tasks like this with core template files. This process should work with other themes as well.

    This method will not be overwritten when the theme updates. You’ll just need to make sure to update your custom template pages whenever the default theme template is updated (only if the default template file had changed).

    The easiest way would probably be something like this….
    Note: The attached file contains the folders/files created from the above steps. You can unzip and then upload them directly in your child theme directory or create them manually. This will not work by placing them in the default child theme directory.

    You’ll need the minimal files to accomplish this. First, create a similar directory structure in your child theme directory. I’ll refer to this as YOUR_CHILDTHEME in the example.

    1. /YOUR_CHILDTHEME/framework/parts/
      create a framework directory.
      Once created add a sub-directory parts inside the /YOUR_CHILDTHEME/framework directory you just created.
    2. Place a copy of two files, /DA9/framework/parts/add-form-main.php and /DA9/framework/parts/add-form-media.php, into the /YOUR_CHILDTHEME/framework/parts/ sub-directory you just created. The add-form-media.php is the one you want to edit to change the text.
    3. Now, create a templates directory:
      /YOUR_CHILDTHEME/templates
      Place a copy of the /DA9/templates/tpl-add.php file into the parts sub-directory you just created.

    *** Note ***
    In order to achieve this “easier” method, the child theme must be an actual child theme and not the built-in default child theme (i.e. ‘_dating’ for DA9). It is possible to do, but additional changes would be required and may not be worth extra headaches.

    Keep in mind that this is just the basic setup for it and additional changes (i.e. re-styling some sections) may be required if anything breaks after a change is made.

    Attachments:
    You must be logged in to view attached files.
    February 21, 2019 at 6:10 am
Viewing 9 posts - 1 through 9 (of 9 total)

Didn't find what you were after?

Chat with us now

or contact our support team