Forum Replies Created

Viewing 15 replies - 1 through 15 (of 25 total)
  • Thread Starter Kermit524

    (@kermit524)

    Hi Drew – thanks!! All seems to work ok now. Many thanks again for your help.

    Thread Starter Kermit524

    (@kermit524)

    Thanks! I will wait for your update then. In the meantime – will it be safe to remove this check myself?
    Thanks again

    Thread Starter Kermit524

    (@kermit524)

    Ok, after a little bit more research apparently the first part of the condition already returns false:
    !isset($_POST[$tid]).
    Looks like $_POST[$tid] is not set.
    So I wonder what may cause this to happen.
    Thanks again!

    Thread Starter Kermit524

    (@kermit524)

    Thanks! My host is Siteground, and they don’t suggest any special settings on their part. I used some settings that were recommended here:
    https://blogs.msdn.microsoft.com/azureossds/2017/04/20/an-example-of-setting-wordpress-email-with-office-365-smtp/
    I wish I would have at least got an error message. The timeout issue is really hard to get around… :-\.
    Thanks anyway for your advice!

    Thread Starter Kermit524

    (@kermit524)

    Sorry – false alarm – my bad!! I had the scheduled function called directly on one of the website pages, and obviously it was fired off every time that page was visited… That’s what happend when you forget to remove your debug trace… :-\

    Thread Starter Kermit524

    (@kermit524)

    Further on this issue: Is there a way to verify that an event cannot be fired more than once daily, even if the hook is fired?
    For instance if, in the function that is fired up – I would be able to set a condition, that the mail is sent only if it was not already sent today?

    I have found this function: wp_schedule_single_event but I am not sure I understand what it means exactly.

    Thanks again!

    Thread Starter Kermit524

    (@kermit524)

    Thanks! Yes, no doubt that sleeping over things is always a good idea. ??

    Thread Starter Kermit524

    (@kermit524)

    Hey, so apparently the problem is resolved: in order for the scheduled task to reset and change from hourly to daily – I had to deactivate and then activate the plugin.

    Thread Starter Kermit524

    (@kermit524)

    Thanks bcworkz! In fact what I meant to ask is if there is a way for me to know that a scheduled task did not work due to an error – same way I as when I run the script manually and get an error message that prevents it from executing.
    Anyway – apparently – the task did perform – the problem lied with the actual sending the email message – which is fixed now.
    Thing is – now I have another issue: Having set the cron to fire “daily” – I keep getting “hourly” email messages about the task.
    Here’s my code:

    
    add_action( 'post_published_notification_action', 'new_content_notify' );
    
    function register_daily_post_published_notification() { 
    	if( !wp_next_scheduled( 'post_published_notification_action' ) ) {
    		wp_schedule_event( time(), 'daily', 'post_published_notification_action' );
    	}
    }
    
    register_activation_hook( __FILE__, 'register_daily_post_published_notification' );
    
    register_deactivation_hook( __FILE__, 'unregister_daily_post_published_notification' );
    function unregister_daily_post_published_notification() {
    	wp_clear_scheduled_hook( 'post_published_notification_action' );
    }

    Any idea where do I go wrong?

    Many thanks again and in advance

    Thread Starter Kermit524

    (@kermit524)

    Ok, having disabled the server cron and relying only on WP-cron, now I don’t get any mail messages at all… :-\
    Is there any way to tell if a schedule task didn’t go through?
    Thanks again!

    Thread Starter Kermit524

    (@kermit524)

    Update: the problem is resolved and the solution was satanically simple: I had a ‘space’ character printed out before the php opening tag on my script file. That was sent as header so no other headers could be sent, and therefore the script stopped before redirection. Indeed it printed a warning – but it was not displayed due to security settings on the server, and I got left with a blank page. What is still a mystery is how come it did work on my staging server, but anyway, it is resolved now.

    Thread Starter Kermit524

    (@kermit524)

    Thanks again for your reply!
    So going over your questions:
    – I have flushed and turned off all caches that I could think of – most of them were set by the host. I also went ahead and cleared the browser cache.
    – This is a production server, therefore – not really an option to deactivate plugins. I couldn’t duplicate the issue on a staging server :-\.
    – Same goes for switching to the default theme – no way for me to do it on a production server…
    Therefore I must find a way to debug this “under the radar”. Here are the things I already know:
    1. I can tell exactly when this happens: when I add a callback function on the post_save action.
    2. As I already mentioned – it looks like after hitting “update” on the post edit page, everything that’s in the post action is executed, but the page does not redirect back to the post edit page. So we are left with an empty white screen.
    3. There is no error message or any runtime error – even when I turn on debug mode. Nothing on the screen and nothing on the logs.
    I was trying to google “page is not redirecting after post update, blank screen at post update etc..” but couldn’t get anything.
    Thanks again!

    Thread Starter Kermit524

    (@kermit524)

    Yes. Nothing in there either.
    One more clue:
    Hitting submit on the post edit page, the page redirects to post.php (no querystring) – and there I stay, instead of being redirected to post.php?post=<ID>&action=edit.

    Thanks again!

    Thread Starter Kermit524

    (@kermit524)

    Thanks so much for your reply! I just wonder if you took the time to actually read my message before replying. As I already wrote down in my original message – already enabled debug mode – no error message. Also – it’s clear that the script runs all the way because I could echo a string just before the call back function returns. I just hope this makes the issue more clear now. Thanks again for any help.

    Thread Starter Kermit524

    (@kermit524)

    Yes thank you – apparently it was indeed an issue withe a missing Curl module. Once that was installed – the issue was solved.

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