Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

onAfterWrite 500//There has been an error


Go to End


3 Posts   1315 Views

Avatar
Bambii7

Community Member, 254 Posts

13 December 2010 at 3:49pm

First off appologies for starting a new thread for this, I'm sure this has been covered.

I'm using onAfterWrite to auto tweet blog posts as follows.

function onAfterWrite() {
parent::onAfterWrite();
$this->Tweet();
}

function Tweet() {
$twitterObj = new EpiTwitter(
$TWITTER_CONSUMER_KEY="****",
$TWITTER_CONSUMER_SECRET="****",
$userToken="****",
$userSecret="****"
);
$twitterObj->post(
'/statuses/update.json',
array(
'status' => $this->Title.' '.Director::absoluteBaseURL().$this->Link()
)
);
}

The above code doesn't help much, altough it is working, it's just an error on saving which also doesn't help much. Does anyone know what would cause 500//There has been an error Failed to load source (found in the console of Fire Bug)

For any one thats interested I'm using jmathai's Outh which can be downloaded here https://github.com/jmathai/twitter-async there is good documentation here http://www.jaisenmathai.com/articles/twitter-async-documentation.html#methodnames

Avatar
Willr

Forum Moderator, 5523 Posts

13 December 2010 at 4:36pm

The above code doesn't help much, altough it is working, it's just an error on saving which also doesn't help much. Does anyone know what would cause 500//There has been an error

Put the site into devmode (or look at the error logs on your webserver) and you should get a much more useful error message. Could be a number of things.

Avatar
Bambii7

Community Member, 254 Posts

13 December 2010 at 5:32pm

cough cough, thanks again Willr, don't know why I didn't think of that.....

line 245 EpiTwitter was throughing Exception, looks like the EpiTwitter is trying to post the tweet twice. This Oauth has been giving me a head ache so I lazily commented out the Exceptions, tweeting nicly and no save error, yea! thanks again