• Resolved geoffdunhamphoto

    (@geoffdunhamcom)


    Hi Jordy,

    Thanks for your work on this, it looks like it could be another worthy addition to your app portfolio! Unfortunately, I’m having an issue with it where I can’t post to Twitter

    Here’s the Server Environment:
    Google Compute Engine
    Linux wordpress-1-vm 4.19.0-21-cloud-amd64 #1 SMP Debian 4.19.249-2 (2022-06-30) x86_64
    Debian 10.12
    WordPress 6.0.1
    Social Engine 0.2.8

    The Twitter developer side of things appears to be okay, when I verify the settings in the plugin, I get an information popup with “The connection was successful!” and an OK button.

    I can schedule posts but when the scheduled time passes, this appears in the logs:

    [19-Aug-2022 17:45:00 UTC] PHP Notice:  Undefined property: stdClass::$errors in /var/www/html/wp-content/plugins/social-engine/classes/services/twitter.php on line 77
    [19-Aug-2022 17:45:00 UTC] PHP Notice:  Trying to access array offset on value of type null in /var/www/html/wp-content/plugins/social-engine/classes/services/twitter.php on line 77
    [19-Aug-2022 17:45:00 UTC] PHP Notice:  Trying to get property 'message' of non-object in /var/www/html/wp-content/plugins/social-engine/classes/services/twitter.php on line 77
    [19-Aug-2022 17:45:00 UTC] PHP Notice:  Undefined property: stdClass::$errors in /var/www/html/wp-content/plugins/social-engine/classes/services/twitter.php on line 77
    [19-Aug-2022 17:45:00 UTC] PHP Notice:  Trying to access array offset on value of type null in /var/www/html/wp-content/plugins/social-engine/classes/services/twitter.php on line 77
    [19-Aug-2022 17:45:00 UTC] PHP Notice:  Trying to get property 'code' of non-object in /var/www/html/wp-content/plugins/social-engine/classes/services/twitter.php on line 77
    [19-Aug-2022 17:45:00 UTC] PHP Fatal error:  Uncaught Exception in /var/www/html/wp-content/plugins/social-engine/classes/services/twitter.php:77
    Stack trace:
    #0 /var/www/html/wp-content/plugins/social-engine/classes/core.php(156): Meow_SCLEGN_Services_Twitter->post()
    #1 /var/www/html/wp-content/plugins/social-engine/classes/core.php(99): Meow_SCLEGN_Core->post()
    #2 /var/www/html/wp-includes/class-wp-hook.php(307): Meow_SCLEGN_Core->transition_post_status()
    #3 /var/www/html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters()
    #4 /var/www/html/wp-includes/plugin.php(476): WP_Hook->do_action()
    #5 /var/www/html/wp-includes/post.php(5303): do_action()
    #6 /var/www/html/wp-includes/post.php(4835): wp_transition_post_status()
    #7 /var/www/html/wp-includes/post.php(4886): wp_publish_post()
    #8 /var/www/html/wp-includes/class-wp-hook.php(307): check_and_publish_future_post()
    #9 /var/www/html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters()
    #10 /var/www/html/wp-includes/plugin.php(524): WP_Hook->do_action()
    #11 /var/www/html/wp-cron.php(138): do in /var/www/html/wp-content/plugins/social-engine/classes/services/twitter.php on line 77

    If you need any more information please let me know.

    Cheers,

    Geoff

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Jordy Meow

    (@tigroumeow)

    Hi @geoffdunhamcom,

    Apparently, there is an error coming from Twitter, but my plugin is swallowing it completely (and go further by breaking on it even more haha).

    I published a new version (0.2.9), please try it. It will not fix the issue, but will provide better logs about the error ?? And we’ll find a way to fix it!

    Please try again ??

    Thread Starter geoffdunhamphoto

    (@geoffdunhamcom)

    Here we are ??

    Thanks for the help!

    [23-Aug-2022 11:50:00 UTC] PHP Notice:  Trying to get property 'errors' of non-object in /var/www/html/wp-content/plugins/social-engine/classes/services/twitter.php on line 91
    [23-Aug-2022 11:50:00 UTC] PHP Notice:  Trying to access array offset on value of type null in /var/www/html/wp-content/plugins/social-engine/classes/services/twitter.php on line 91
    [23-Aug-2022 11:50:00 UTC] PHP Notice:  Trying to get property 'message' of non-object in /var/www/html/wp-content/plugins/social-engine/classes/services/twitter.php on line 91
    [23-Aug-2022 11:50:00 UTC] PHP Notice:  Trying to get property 'errors' of non-object in /var/www/html/wp-content/plugins/social-engine/classes/services/twitter.php on line 91
    [23-Aug-2022 11:50:00 UTC] PHP Notice:  Trying to access array offset on value of type null in /var/www/html/wp-content/plugins/social-engine/classes/services/twitter.php on line 91
    [23-Aug-2022 11:50:00 UTC] PHP Notice:  Trying to get property 'code' of non-object in /var/www/html/wp-content/plugins/social-engine/classes/services/twitter.php on line 91
    [23-Aug-2022 11:50:00 UTC] 
    [23-Aug-2022 11:50:00 UTC] PHP Fatal error:  Uncaught Exception in /var/www/html/wp-content/plugins/social-engine/classes/services/twitter.php:91
    Stack trace:
    #0 /var/www/html/wp-content/plugins/social-engine/classes/services/twitter.php(66): Meow_SCLEGN_Services_Twitter->upload()
    #1 /var/www/html/wp-content/plugins/social-engine/classes/core.php(156): Meow_SCLEGN_Services_Twitter->post()
    #2 /var/www/html/wp-content/plugins/social-engine/classes/core.php(99): Meow_SCLEGN_Core->post()
    #3 /var/www/html/wp-includes/class-wp-hook.php(307): Meow_SCLEGN_Core->transition_post_status()
    #4 /var/www/html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters()
    #5 /var/www/html/wp-includes/plugin.php(476): WP_Hook->do_action()
    #6 /var/www/html/wp-includes/post.php(5303): do_action()
    #7 /var/www/html/wp-includes/post.php(4835): wp_transition_post_status()
    #8 /var/www/html/wp-includes/post.php(4886): wp_publish_post()
    #9 /var/www/html/wp-includes/class-wp-hook.php(307): check_and_publish_future_post()
    #10 /var/www/html/wp-includes/class-wp-hook.php(331): WP_Hook in /var/www/html/wp-content/plugins/social-engine/classes/services/twitter.php on line 91
    Plugin Author Jordy Meow

    (@tigroumeow)

    Hi @geoffdunhamcom,

    Just got back from my holiday. I have no idea why it doesn’t work, but it seems like I am retrieving the errors from Twitter in the wrong way.

    Can you actually edit the plugin directly? Would you mind doing it? If that’s okay, please find the line 91 in the classes/services/twitter.php file. Then replace this:

    throw new Exception( $media->errors[0]->message, $media->errors[0]->code );

    By

    
    error_log( "Error in Twitter Oauth:" );
    error_log( print_r( $media, 1 ) );
    

    Then try to post again, and look at the PHP Error Logs. That should help a lot… We are getting there!

    Thread Starter geoffdunhamphoto

    (@geoffdunhamcom)

    Hi @tigroumeow,

    Hope you had a good holiday! I changed line 91 as you asked, and…

    (
    [request] => /1.1/statuses/update.json
    [error] => Read-only application cannot POST.
    )

    I’ll have a look at the app setup on Twitter and update you when I’m done.

    Thread Starter geoffdunhamphoto

    (@geoffdunhamcom)

    Hi again @tigroumeow,

    I regenerated the access token and secret at Twitter and it now works as it should – I must have got the generation wrong initially but I’m not sure how it passed the initial check?

    Thank you for your help!

    Geoff

    Plugin Author Jordy Meow

    (@tigroumeow)

    Hi @geoffdunhamcom,

    Hope you had a good holiday! I changed line 91 as you asked, and…

    It’s strange, I don’t expect the function to return errors like this, but I will handle it better in the next version ??

    I regenerated the access token and secret at Twitter and it now works as it should

    If Twitter works the same as Facebook, it’s because the access token is linked to a specific state of the app; so if you generated the access token when the app was in read-only, it might have still been set in read-only via that access token.

    I am not sure it’s the actual explanation, but it’s part of it. But really super glad it works now!

    Don’t hesitate to give me feedback (and a review), I am trying to make Social Engine as good as I can ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Unable to post to Twitter’ is closed to new replies.