Forum Replies Created

Viewing 15 replies - 1 through 15 (of 22 total)
  • Thread Starter layza

    (@layza)

    Hi there,

    thanks for your reply. Eventualy I realized that wasn’t a MMM file and that it wasn’t necessary, so I dequed it. But, apparently, someone still have the issue.

    Could it be some compatibility problem with the theme? I’m using Underscores.

    Thanks

    Thread Starter layza

    (@layza)

    Thanks @mdshak, but it’s not what I wanted to do ??

    @ikaring I thought so. So, do you think if I try with some js would it work? Tnx

    Thread Starter layza

    (@layza)

    I thinks there’s something like that, but to be really honest, I wouldn’t know how to find it out.

    I tried the hardcoding already in local and changing all the paths on every .js file called in scripts. And eventually the damn chat showed up everywhere just…It worked only in homepage and in non-homepage was behaving strange. I fix one thing, I break another! That it’s working on homepage it’s a total fluke, for sure…ahahaahah That’s it, I give up.

    Once again, thanks a lot for your help! ??

    Thread Starter layza

    (@layza)

    Thank you for your patience @bcworkz ??

    But I’m not sure I understood what you say, this is going waaay too far from my knowledge of WP, php, etc. (for now, at least).

    I looked inside chat files, and apparently (not sure) json and jquery are called in the snippet.js, this way:

     if (SP.tenantUrl && SP.appId) {
            loadScripts(['js/json2.min.js', 'js/jquery-1.11.0.min.js'], function() {
    
                loadScripts(['js/jQuery.XDomainRequest.min.js', 'js/jquery-ui-1.11.1.min.js'], function() {
    
                    $ = jQuery.noConflict(true);
                    SP.$ = $;
                    $.support.cors = true;
    
                    loadScripts(['js/chat-api-session.js'], function() {
                        SP.cp = {
                            url: SP.apiUrl,
                            crossDomain: true,
                            tenantUrl: SP.tenantUrl,
                            appId: SP.appId,
                            clientId: 'WebChat',
                            phoneNumber: SP.phoneNumber,
                            parameters: SP.parameters,
                            onFormShow: SP.onFormShow,
                            onAddStream: SP.onAddStream,
                            onAddLocalStream: SP.onAddLocalStream
                        };
    
                        onInitialize();
                    });
                });

    But I guess it’s normal, no?

    I also tried to deregister jquery and register it again. Aaaand…this is the result from the console:

    Errore console

    Thread Starter layza

    (@layza)

    So, I went through the chat files, and find out this: there’s a .html file placed in the root that, in the header calls all the scripts I’m already calling in functions.php like this:

    <!DOCTYPE html>
    <html>
    <head>
    <title>Chat</title>
    
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    
    <link href="css/wrong.css" rel="stylesheet" type="text/css">
    <link href="css/override.css" rel="stylesheet" type="text/css">
    <!--link href="js/perfect-scrollbar/perfect-scrollbar.min.css" rel="stylesheet" type="text/css"-->
    
    <script type="text/javascript" src="js/json2.min.js"></script>
    <script type="text/javascript" src="js/jquery-1.11.0.min.js"></script>
    <script type="text/javascript" src="js/datetime.min.js"></script>
    <script type="text/javascript" src="js/perfect-scrollbar/perfect-scrollbar.min.js"></script>
    <script type="text/javascript" src="js/jQuery.XDomainRequest.min.js"></script>
    <script type="text/javascript" src="js/chat-api-session.js"></script>
    <script type="text/javascript" src="js/jquery-ui-1.11.1.min.js"></script>
    <script type="text/javascript" src="js/client-chat-ui.js"></script>
    <script type="text/javascript" src="js/autosize.min.js"></script>
    <script type="text/javascript"> (function(){
    
        var cp = {};....

    So, what I tried to do was to place all chat’s files in the root, call the scripts with get_bloginfo instead of get_template_uri. But I had no success.

    Would it be possible that this .html file create some sort of conflict? Would it explain the double scripts in homepage?

    Thread Starter layza

    (@layza)

    Nothing seems to work out :/

    I tried what you suggest but had no luck. This is the code I used:

      function add_chat_scripts() {
            wp_register_script ('chat-api', get_template_directory_uri() . '/js/chat-api-session.js');
            wp_enqueue_script ('chat-api');
            wp_register_script ('jqueryx', get_template_directory_uri() . '/js/jQuery.XDomainRequest.min.js');
            wp_enqueue_script ('jqueryx');
            wp_enqueue_script ('jquery-ui-core');
            wp_register_script ('chat-json', get_template_directory_uri() . '/js/json2.min.js');
            wp_enqueue_script  ('chat-json');
            wp_register_script( 'chat', get_template_directory_uri() . '/js/chat.js' , array(), true );
            wp_enqueue_script  ('chat');
            wp_register_script( 'chat-snippet', get_template_directory_uri() . '/js/snippet.js', array('chat'));
            wp_enqueue_script('chat-snippet');
           }
            add_action( 'wp_enqueue_scripts', 'add_chat_scripts' );

    It does charge everything, but it still tries to charge files from the page itself and I can’t see the chat. In homepage instead, it charges every script twice, one with the template path and one with just e.g. “js/snippet.js”.

    Thread Starter layza

    (@layza)

    Nothing seems to work out :/

    I tried what you suggest but had no luck. This is the code I used:

      function add_chat_scripts() {
            wp_register_script ('chat-api', get_template_directory_uri() . '/js/chat-api-session.js');
            wp_enqueue_script ('chat-api');
            wp_register_script ('jqueryx', get_template_directory_uri() . '/js/jQuery.XDomainRequest.min.js');
            wp_enqueue_script ('jqueryx');
            wp_enqueue_script ('jquery-ui-core');
            wp_register_script ('chat-json', get_template_directory_uri() . '/js/json2.min.js');
            wp_enqueue_script  ('chat-json');
            wp_register_script( 'chat', get_template_directory_uri() . '/js/chat.js' , array(), true );
            wp_enqueue_script  ('chat');
            wp_register_script( 'chat-snippet', get_template_directory_uri() . '/js/snippet.js', array('chat'));
            wp_enqueue_script('chat-snippet');
           }
            add_action( 'wp_enqueue_scripts', 'add_chat_scripts' );

    It does charge everything, but it still tries to charge files from the page itself and I can’t see the chat. In homepage instead, it charges every script twice, one with the template path and one with just e.g. “js/snippet.js”.

    So, I went through the chat files, and find out this: there’s a .html file placed in the root that, in the header calls all the scripts I’m already calling in functions.php like this:

    <!DOCTYPE html>
    <html>
    <head>
    <title>Chat</title>
    
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    
    <link href="css/wrong.css" rel="stylesheet" type="text/css">
    <link href="css/override.css" rel="stylesheet" type="text/css">
    <!--link href="js/perfect-scrollbar/perfect-scrollbar.min.css" rel="stylesheet" type="text/css"-->
    
    <script type="text/javascript" src="js/json2.min.js"></script>
    <script type="text/javascript" src="js/jquery-1.11.0.min.js"></script>
    <script type="text/javascript" src="js/datetime.min.js"></script>
    <script type="text/javascript" src="js/perfect-scrollbar/perfect-scrollbar.min.js"></script>
    <script type="text/javascript" src="js/jQuery.XDomainRequest.min.js"></script>
    <script type="text/javascript" src="js/chat-api-session.js"></script>
    <script type="text/javascript" src="js/jquery-ui-1.11.1.min.js"></script>
    <script type="text/javascript" src="js/client-chat-ui.js"></script>
    <script type="text/javascript" src="js/autosize.min.js"></script>
    <script type="text/javascript"> (function(){
    
        var cp = {};....

    So, what I tried to do was to place all chat’s files in the root, call the scripts with get_bloginfo instead of get_template_uri. But I had no success.

    Would it be possible that this .html file create some sort of conflict? Would it explain the double scripts in homepage?

    Thread Starter layza

    (@layza)

    Ok, super thanks!

    I registered and add everything as dependencies. Result: I now have the right scripts in the right place BUT I still get the “not found https://becloudsolutions.com/resources/js/jquery-1.11.0.min.js&#8221; error (also for json) even though they’re now charged. AND I can’t see the chat in non-home page.

    It keeps looking for them in the wrong place.

    I’m losing my hope ??

    Thread Starter layza

    (@layza)

    Ok, so. I checked the code and I noticed that in homepage, in the header there are some script that are missing in non-working pages.

    While the header of homepage contains:

    <script src="js/chat-api-session.js" async=""></script>
    <script src="js/jQuery.XDomainRequest.min.js" async=""></script>
    <script src="js/jquery-ui-1.11.1.min.js" async=""></script>
    <script src="//www.google-analytics.com/analytics.js" async=""></script>
    <script src="js/json2.min.js" async=""></script>
    <script src="js/jquery-1.11.0.min.js" async=""></script>

    While in non-working pages “Cht-api”, “jQuery.Xdomain” and “jquery-ui” are missing. Is it possible this is the cause of the problem? Is there a way to fix it?

    Tnx

    Thread Starter layza

    (@layza)

    Ah…oops!

    So, the correct function would be something like:

    //CHAT SNIPPET
        function add_chat_scripts() {
            wp_enqueue_script  ('jquery');
            wp_enqueue_script  ('json2');
            wp_register_script( 'chat', get_template_directory_uri() . '/js/chat.js' , array(), true );
            wp_enqueue_script  ('chat');
            wp_register_script( 'chat-snippet', get_template_directory_uri() . '/js/snippet.js', array('chat', 'json2', 'jquery'));
            wp_enqueue_script('chat-snippet');
           }
            add_action( 'wp_enqueue_scripts', 'add_chat_scripts' );

    Or to put them in the array of (‘chat’) would be enough?

    Tnx

    Thread Starter layza

    (@layza)

    Ok, thank you. So, now my function it like this, but it doesn’t get the json and jquery anyway.

    //CHAT SNIPPET
        function add_chat_scripts() {
            wp_register_script ('jquery', get_template_directory_uri() . '/js/jquery-1.11.0.min.js', array(), true );
            wp_enqueue_script  ('jquery');
            wp_register_script ('json', get_template_directory_uri() . '/js/json2.min.js', array(), true );
            wp_enqueue_script  ('json');
            wp_register_script( 'chat', get_template_directory_uri() . '/js/chat.js' , array(), true );
            wp_enqueue_script  ('chat');
            wp_register_script( 'chat-snippet', get_template_directory_uri() . '/js/snippet.js', array('chat', 'json', 'jquery'));
            wp_enqueue_script('chat-snippet');
           }
            add_action( 'wp_enqueue_scripts', 'add_chat_scripts' );

    What have i done wrong?

    Thread Starter layza

    (@layza)

    Ok, now I don’t have any js error in the console except 2 for the chat.

    The server has not found anything matching the requested URI (Uniform Resource Identifier).

    Apparently is not able to get https://becloudsolutions.com/resources/js/json2.min.js and https://becloudsolutions.com/resources/js/jquery-1.11.0.min.js.

    Thread Starter layza

    (@layza)

    Also, I just realized that on non-homepage pages there are a lot of syntax error, also for plugins and stuff it’s not in chat js folder.
    Image and video hosting by TinyPic

    https://i63.tinypic.com/2zdt5ab.jpg

    • This reply was modified 7 years, 9 months ago by layza.
    • This reply was modified 7 years, 9 months ago by layza.
    • This reply was modified 7 years, 9 months ago by layza.
    • This reply was modified 7 years, 9 months ago by layza.
    Thread Starter layza

    (@layza)

    At line 151 there’s nothing, but I guess that was the problem. I deleted every empty space after the end of the code and now I don’t get that error anymore.

    Also, I tried to deactivate all the plugins, and the path is now correct in non-homepage pages too, but I still can’t see the chat. :/

    • This reply was modified 7 years, 9 months ago by layza.
    Thread Starter layza

    (@layza)

    Hi there (@bcworkz)

    thanks. I haven’t try deactivation plugins yet, but now if I try to enter the backend I get this error:

    Warning: Cannot modify header information - headers already sent by (output started at /home/content/n3pnexwpnas02_data01/42/2910242/html/wp-content/themes/thekeynote-v1-07/functions.php:151) in /home/content/n3pnexwpnas02_data01/42/2910242/html/wp-includes/pluggable.php on line 1179

    I checked the code, and apperntly there aren’t empty space or strange thing in the functions.php.

Viewing 15 replies - 1 through 15 (of 22 total)