Support » Plugin: WP Customer Area » Cannot assign a user to a private file or upload a private file?

  • Resolved allmyhoney

    (@allmyhoney)


    Hi there, I have installed this plugin alongside my woocommerce plugin to try and allow the customers have a download file specific to the user itself. However when I go to add a private file like so: http://recordit.co/dsE3n5s7rq I basically cannot assign a user to the file and I cannot upload a file. I have done the usual and deactivated all other plugins for conflicts etc and no joy. I have also checked the capabilities and the main admin user should have the rights to upload private files I believe.

    Any ideas on what might be wrong here? Thanks in advance. James

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Vincent Mimoun-Prat

    (@vprat)

    Hi,

    You have a javascript error in that page. That prevents loading the user assignment controls as well as the file upload controls.

    You need to check what is that error, and why it happens (usually a conflict with the theme or with a plugin).

    allmyhoney

    (@allmyhoney)

    Ah yes I can see the conflict is with the Avada theme. I have contacted the theme developers now. Because avada is such a popular theme I am thinking is there any fix to make the plugin and theme work together?

    Thanks in advance.

    allmyhoney

    (@allmyhoney)

    Hi there, I have asked the theme developers of the Avada theme to look into the javascript error and it is coming from this file here which is in the plugin itself:

    https://www.jamjosandbox.com/glanacotest/wp-content/plugins/customer-area/libs/js/bower/select2/select2.min.js?ver=7.6.0

    They have asked me to ask your goodself (the plugin author) if you can modify the select2 library and resolve the issue.

    Hope you can help.
    Thanks

    allmyhoney

    (@allmyhoney)

    So as way of a follow up here. There is a problem with select2.min.js causing the Javascript error visible in the Chrome console. Means the drop down for selecting users to share with file with does not load and also the upload file area is not functional.

    Error shown here: https://www.dropbox.com/s/8s7k44gwuq42ghr/Screenshot%202019-02-05%2012.32.01.png?dl=0

    I have fixed it by

    placing in the select2.full.js fill into the plugin and

    See screen: https://www.dropbox.com/s/fslit74cvq71wu9/Screenshot%202019-02-05%2012.25.36.png?dl=0

    changing the reference to select2.min.js to select2.full.js in customer-area/src/php/core-classes/plugin.class.php . Checked line 812:

    See screen: https://www.dropbox.com/s/cc36oxdgapglz5i/Screenshot%202019-02-05%2012.25.09.png?dl=0

    Note the select2.full.js was taken from the Github repo here for bower: https://github.com/select2/select2/tree/d1a57156f79ae7e614c0b2fa6158aad84f0d6955/dist/js

    This now works. Can you please let us know when you have got this on the main plugin and we will revert to your version.

    For now we are running this patch for the plugin here.

    Hope this helps.

    Plugin Author Vincent Mimoun-Prat

    (@vprat)

    Hi,

    No need for us to change the select2 version we are using.

    You can however tell our plugin not to load it.

    See https://wp-customerarea.com/support/topic/cannot-assign-users-to-a-page-or-file/#post-358342

    allmyhoney

    (@allmyhoney)

    Hi there, ah ok so you can stop it from loading with a function like the below right? Sorry I am not so good with wordpress functions so just trying to figure out how exactly not to load it?:

    /**
    * Dequeue customer area select2.
    */
    function my_dequeue_script() {
    wp_dequeue_script( ‘jquery.select2.locale’ );
    wp_dequeue_script( ‘jquery.select2’ );
    wp_deregister_script( ‘jquery.select2.locale’ );
    wp_deregister_script( ‘jquery.select2’ );
    }
    add_action( ‘admin_enqueue_scripts’, ‘my_dequeue_script’, 99999 );

    Plugin Author Vincent Mimoun-Prat

    (@vprat)

    Yes, that will fix the admin. You can create a small plugin of your own (see tutorials about that on Internet) and paste that code in there:

    
    
    /**
     * Dequeue AVADA select2 outdated version
     */
    function custom_cuar_avada_select2_compatibility_admin()
    {
        if (!defined('CUAR_PLUGIN_DIR')) return;
    
        wp_dequeue_script('jquery.select2.locale');
        wp_dequeue_script('jquery.select2');
        wp_deregister_script('jquery.select2.locale');
        wp_deregister_script('jquery.select2');
    }
    
    add_action('admin_enqueue_scripts', 'custom_cuar_avada_select2_compatibility_admin', 9999);
    
    /**
     * Dequeue AVADA select2 outdated version
     */
    function custom_cuar_avada_select2_compatibility_frontend()
    {
        if (!defined('CUAR_PLUGIN_DIR')) return;
    
        if (cuar_is_customer_area_page(get_queried_object_id()) || cuar_is_customer_area_private_content(get_the_ID())) {
            wp_dequeue_script('selectwoo-js');
        }
    }
    
    add_action('wp_enqueue_scripts', 'custom_cuar_avada_select2_compatibility_frontend', 9999);
    
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Cannot assign a user to a private file or upload a private file?’ is closed to new replies.