• Resolved nymets1104

    (@nymets1104)


    I have been trying to utilize a refresh snippet

    header("Refresh: 5");

    Which I believe should auto refresh the website every 5 seconds. But this is not working

    I have also been trying this:

    if (!function_exists('wfu_before_file_upload_handler')) {
        function wfu_before_file_upload_handler($file_path, $file_unique_id) {
          $_SESSION['wfu_tempfiles'][$file_unique_id] = $file_path;
          return $file_path;
    	 // $message="TEST MESSAGE nymets1104";
    	 // wfu_debug_log($message);
      }
      add_filter('wfu_before_file_upload', 'wfu_before_file_upload_handler', 10, 2);
    }
    if (!function_exists('wfu_after_file_upload_handler')) {
      function wfu_after_file_upload_handler($changable_data, $additional_data) {
        if ($additional_data['upload_result'] == 'success' && isset($_SESSION['wfu_tempfiles'][$file_unique_id]) && $_SESSION['wfu_tempfiles'][$file_unique_id] != '') {
    	  $file_contents = file_get_contents($_SESSION['wfu_tempfiles'][$file_unique_id]);
    	  $changable_data['js_script'] = 'window.location.reload();';
    	}
    	return $changable_data;
      }
      add_filter('wfu_after_file_upload', 'wfu_after_file_upload_handler', 10, 2);
    }

    Which is a script that runs when my Upload Plugin succesfully uploads a file. This utilizes a javascript call inside the php to refresh the page, but this does not seem to get called either.

    Do you have any suggestions for me or am I doing something incorrectly?

    Website: http://onlineyogacoach.studio-seva.com/

    https://wordpress.org/plugins/code-snippets/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Shea Bunge

    (@bungeshea)

    Have you tried something like this (PHP 5.3+):

    add_action( 'wp_head', function () {
        echo '<meta http-equiv="refresh" content="5">';
    }, 0 );
    Thread Starter nymets1104

    (@nymets1104)

    I tried your code and still get nothing. I checked the source of my page and this meta tag is not on any webpage. I am running PHP 5.3 on a Fatcow Shared Hosting platform. I was able to get a Code Snippet to work on the back end:

    // replace WordPress Howdy in WordPress 3.3
    function replace_howdy( $wp_admin_bar ) {
        $my_account=$wp_admin_bar->get_node('my-account');
        $newtitle = str_replace( 'Howdy,', 'Welcome to OYC,', $my_account->title );
        $wp_admin_bar->add_node( array(
            'id' => 'my-account',
            'title' => $newtitle,
        ) );
    }
    add_filter( 'admin_bar_menu', 'replace_howdy',25 );

    as well as this snippet that allows shortcodes in widgets:

    add_filter('widget_text', 'do_shortcode');

    Are there certain codes that are not supported or should it be all valid PHP scripts?

    Plugin Author Shea Bunge

    (@bungeshea)

    All valid PHP scripts should be supported. It’s strange that these snippets aren’t working, because I could get both the snippet I posted as well as header("Refresh: 5"); working on my development site. Maybe another plugin or the theme is interfering in some way?

    Plugin Author Shea Bunge

    (@bungeshea)

    Any updates on this?

    Thread Starter nymets1104

    (@nymets1104)

    Shea, sorry for the delay in getting back to you. I got this all sorted out and I found that it had nothing to do with your plugin. I ended up migrating my site to a host with a much more robust support of PHP. I am currently running several valid PHP snippets with your plugin.

    Thanks for your work and response!

    David McCaran

    Plugin Author Shea Bunge

    (@bungeshea)

    Your new host sounds great. Hopefully it’s running a recent version of PHP! Glad you could get the issue sorted.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Basic Snippets not running’ is closed to new replies.