Forum Replies Created

Viewing 15 replies - 1 through 15 (of 40 total)
  • Thread Starter troyeccles

    (@troyeccles)

    It doesn’t seem to be anything that will trigger a debug.log

    It’s a case that the css from the other plugin is taking precedence. Now, I’ve addressed this with them as well to ask if I can de-escalate the priority of their css but is there a way we can escalate yours?

    Below is a screenshot…

    https://i.ibb.co/dg0n4HW/Screen-Shot-2023-08-04-at-11-57-10-am.png

    Thread Starter troyeccles

    (@troyeccles)

    Sorry, one more thing…as I’m triggering your plugin programatically, is there any way of reproducing or hooking into your progress bar so that I can show this on a different webpage?

    As mentioned, I’m using a button on a page to trigger your plugin. Now it’s working, I’d love to be able to show the progress somehow. It seems that (maybe) you generate a unique ID each time in order to track the progress server-side – although I could be wrong. Can your progress bar be mirrored somehow?

    Thread Starter troyeccles

    (@troyeccles)

    That looks to have have worked perfectly! Thank you so much for your amazing support ?? ??

    Thread Starter troyeccles

    (@troyeccles)

    // Enqueue the script
    function enqueue_ajax_script() {
        wp_enqueue_script('my-ajax-script', plugin_dir_url(__FILE__) . 'js/my-ajax-script.js', array('jquery'), '1.0', true);
    
        // Make the AJAX URL available to the JS script
        wp_localize_script('my-ajax-script', 'my_ajax_object', array('ajax_url' => admin_url('admin-ajax.php')));
    }
    add_action('wp_enqueue_scripts', 'enqueue_ajax_script');
    
    // Handle the Ajax request on the server side
    function handle_my_clone_action() {
        // Include necessary WordPress files
        if (!function_exists('is_plugin_active')) {
            require_once(ABSPATH . '/wp-admin/includes/plugin.php');
        }
    
        // Check if NS Cloner is active
        if (is_plugin_active('ns-cloner-pro/ns-cloner-pro.php')) {
            // Get the current site's ID
            $current_site_id = get_current_blog_id();
    
            // Get the details of the current site
            $current_site_details = get_blog_details($current_site_id);
            
            // Get the site's URL and title
            $site_url = $current_site_details->siteurl;
            $current_site_title = get_bloginfo('name');
            
            $parsed_url = parse_url($site_url);
            $host_explode = explode('.', $parsed_url['host']);
            $subdomain = $host_explode[0];
    
    $request = array(
        'clone_mode' => 'clone_over',
        'source_id' => 92, // Specified subdomain ID to clone
            'target_name' => 'nstest', // Changed to a fixed target
        'target_title' => 'NSTest Site', // Changed to a fixed title
        'do_copy_posts' => 1, // or list of post types to clone
        'do_copy_files' => 1, // or list of files to clone
        'do_copy_users' => 1, // or 0 if you don't want to copy existing users
        'debug' => 1
    );
    
    
    
            // Trigger the cloning process using NS Cloner
            ns_cloner()->schedule->add($request, time(), 'Trigger for NS Cloner');
            
            // Send a success JSON response
            wp_send_json_success('Cloning process started.');
        } else {
            wp_send_json_error('NS Cloner is not active or not installed.');
        }
    }
    
    add_action('wp_ajax_my_clone_action', 'handle_my_clone_action', 20); // If the user is logged in
    add_action('wp_ajax_nopriv_my_clone_action', 'handle_my_clone_action', 20); // If the user is not logged in

    [ Please do not bump. ]

    Thread Starter troyeccles

    (@troyeccles)

    I’m using 7.4

    Thread Starter troyeccles

    (@troyeccles)

    Is the “Clone Over” functionality only available from the Network Admin interface? Because I have a plugin (code snippet above) that runs from a subsite. Could that be the issue here?

    Thread Starter troyeccles

    (@troyeccles)

    Sorry, I’m an idiot and was looking at the ‘banned email domains’ which was empty. I have the default ‘banned names’ in already.

    Thread Starter troyeccles

    (@troyeccles)

    I can also clone-over manually. So it doesn’t appear to be a plugin conflict or theme issue.

    Thread Starter troyeccles

    (@troyeccles)

    No, it’s clear.

    Thread Starter troyeccles

    (@troyeccles)

    Actually, upon checking, it’s throwing these errors in debug.log:

    [06-Jul-2023 04:07:49 UTC] PHP Warning: count(): Parameter must be an array or an object that implements Countable in /home/xxxxxxxx/xxxxxxxx/public_html/wp-content/plugins/ns-cloner-pro/sections/class-ns-cloner-section-clone-over.php on line 81
    [06-Jul-2023 04:07:49 UTC] PHP Warning: in_array() expects parameter 2 to be array, null given in /home/xxxxxxxxx/xxxxxx/public_html/wp-content/plugins/ns-cloner-pro/sections/class-ns-cloner-section-clone-over.php on line 84

    I don’t know if that helps you?

    Thread Starter troyeccles

    (@troyeccles)

    If it helps, I'm using (in part) this code snippet...
    
    // Check if NS Cloner is active
        if (is_plugin_active('ns-cloner-pro/ns-cloner-pro.php')) {
            // Get the current site's ID
            $current_site_id = get_current_blog_id();         // Get the details of the current site
            $current_site_details = get_blog_details($current_site_id);

            // Get the site's URL and title
            $site_url = $current_site_details->siteurl;
            $site_title = $current_site_details->blogname;

            $parsed_url = parse_url($site_url);
            $host_explode = explode('.', $parsed_url['host']);
            $subdomain = $host_explode[0]; $request = array(
                'clone_mode' => 'clone_over',
                'source_id' => 92, // Specified subdomain ID to clone
                'clone_over_target_ids' => $target_site_ids, // Target site ID(s) to clone over
                'target_name' => $subdomain, // Subdomain or subdirectory for the new site
                'target_title' => 'New Site Title', // Title for the new site
                'tables' => 'all', // Or list of tables to clone
                'post_types' => 'all', // Or list of post types to clone
                'create_new_admin' => false, // Or true if you want to create a new admin user
                'copy_users' => true, // Or false if you don't want to copy existing users
                'debug' => 1
            ); As mentioned, I'm triggering this code FROM the site I want to clone over.
    Maybe there's something horrible wrong with what I'm doing here but the process starts but then, for some reason just fails.
    Thread Starter troyeccles

    (@troyeccles)

    Thank you. Was a great start but, although I can clone manually, this isn’t working for me. The process starts and the logs just kind of stop. No errors either.

    Same with debug.log.

    I’m wondering…I’m triggering the clone process FROM a subsite (a basic theme I’ve made with a button to trigger the cloning process onto that very same site (and, obviously, overwrite it). Is it a case that the cloning process has be managed from the network admin site rather than a subsite?

    thank you for your help so far ??

    Forum: Plugins
    In reply to: [AI Engine] Avatar?
    Thread Starter troyeccles

    (@troyeccles)

    Forum: Plugins
    In reply to: [AI Engine] Avatar?
    Thread Starter troyeccles

    (@troyeccles)

    Hey Jordy. Sorry for the late response.
    That didn’t seem to work and I’m 100% sure that the problem is ME!
    Below is my shortcode. What have I done wrong because the avatar doesn’t show up…

    [mwai_chat context=”Assume that you are the greatest math teacher that ever lived and have knowledge of every math subject. Answer any questions in a conversational, factual tone unless instructed otherwise. Use markdown.” ai_name=”AI Chat Assistant: ” start_sentence=”” text_input_placeholder=”Type your request” mwai_chat icon=”/wp-content/uploads/2023/03/Ava.png” temperature=”0.8″ api_key: xxxxxxxxxxxx]

    • This reply was modified 1 year, 8 months ago by troyeccles.
    Forum: Plugins
    In reply to: [AI Engine] Custom Context?
    Thread Starter troyeccles

    (@troyeccles)

    Sorry, I missed the API key shortcode.

    Perfect. Thank you.

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