error on new version 5.4.2

Discussion in 'Installation' started by bennyuk1, Feb 8, 2018.

  1. bennyuk1

    bennyuk1 aMember Pro Customer

    Joined:
    Jan 12, 2012
    Messages:
    200
    Just updated from 5.4.1

    The update stopped revolution slider on homepage from working.

    On my site I want the ajax popup login links to work on everypage, but for this to happen on non amember pages, I need to include the following files manually in the header.

    if (!defined('ROOT_URL'))
    {
    // Enqueue the style
    wp_enqueue_style('amember','/amember/application/default/views/public/css/amember.css',array(), null, 'all');
    // Enqueue the scripts
    wp_enqueue_script('amember1', '/amember/application/default/views/public/js/jquery/jquery.validate.js');
    wp_enqueue_script('amember2', '/amember/application/default/views/public/js/jquery/jquery.ui.js');
    wp_enqueue_script('amember3', '/amember/application/default/views/public/js/upload.js');
    // wp_enqueue_script('amember4', '/amember/application/default/views/public/js/user.js');
    }

    But after the upgrade this was making revolution slider not work with the following error:-

    Uncaught TypeError: jQuery(...).magicSelect is not a function
    at initElements (user.js:442)
    at HTMLDocument.<anonymous> (user.js:382)
    at i (jquery.js:2)
    at Object.fireWith [as resolveWith] (jquery.js:2)
    at Function.ready (jquery.js:2)
    at HTMLDocument.K (jquery.js:2)

    When I remove the link to the following file the slider work ok, but the ajax popup login box no longer works

    /amember/application/default/views/public/js/user.js

    Is there a way to get the modal popup login box to work without it interferring with other things like revolution slider?

    Thanks
    Ben
  2. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    2,295
    Hello Ben,

    You need to enqueue one additional script before user.js:
    /amember/application/default/views/public/js/magicselect.js

    Best Regards.
  3. bennyuk1

    bennyuk1 aMember Pro Customer

    Joined:
    Jan 12, 2012
    Messages:
    200
    Thanks, thats getting better.
    Only console error now is:-
    Code:
    SCRIPT5009: 'am_i18n' is not defined
    
    user.js (291,12)
  4. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    2,295
    You need to define it with this code:
    Code:
    am_i18n = {"toggle_password_visibility":"Toggle Password Visibility","password_strength":"Password Strength","upload_browse":"browse","upload_upload":"upload","upload_files":"Uploaded Files","upload_uploading":"Uploading...","ms_please_select":"-- Please Select --","ms_select_all":"Select All"};
  5. bennyuk1

    bennyuk1 aMember Pro Customer

    Joined:
    Jan 12, 2012
    Messages:
    200
    Great thanks, its all working now, and rev slider is also working. Thanks for you help.

    Questions:-
    1. I added the var via functions.php using this code:-
    Code:
    // Add scripts to wp_head()
    function child_theme_head_script() {
        if (!defined('ROOT_URL'))  {
    ?>
    <script type="text/javascript">
        var am_i18n = {"toggle_password_visibility":"Toggle Password Visibility","password_strength":"Password Strength","upload_browse":"browse","upload_upload":"upload","upload_files":"Uploaded Files","upload_uploading":"Uploading...","ms_please_select":"-- Please Select --","ms_select_all":"Select All"};
        </script>
    <?php } }
    add_action( 'wp_head', 'child_theme_head_script' );
    However is there a better way to add it maybe using "wp_localize_script" ?

    2. I'm doing all this so that the popup modal login links work but is there a better way to achieve this, or is this approach the best way?

    Many thanks
    Ben

Share This Page