MyBB Community Forums

Full Version: MyBBPublisher v2.0
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
yes my wrong. i reconfigure the settings again in ACP
I ask again. how about when i try to Post also again into a Group.

its possible to post in both Facebook Group and Fan Page
the plugin supports only one "place" to publish to
In my board (www.linguisten.de), it stopped publishing to Twitter and FB all of a sudden, and without me having changed anything. Sad



Forget everything. After the upgrade to mybb 1.6.4 everything works fine again and I feel stupid.
So I've been reading a few tens of pages on this long thread and wanted to share my input Smile

First off, thanks for a cool plugin!

I'm having trouble getting Twitter to work, but I hope it's just their delay. All 3 ACP tests pass, I don't have any excluded forums, all forums are visible, I don't use any of the URL shorteners, the mybbpublisher_errors_tw cache is empty, there are no errors in the PHP log, and I've set the priority of the mybbpublisher_newthread hook to 1, as instructed here (I do have the automaticsubscriptions plugin installed, which adds a hook on datahandler_post_insert_thread_post as well). If Twitter is just slow (though it's been 15 minutes since I posted a new thread), then there should be 3 or more tweets by @QSForum.

(2011-06-03, 08:50 PM)lucasbytegenius Wrote: [ -> ]
(2011-06-03, 08:25 PM)pavemen Wrote: [ -> ]are the hash tags in your thread title? the current setup will convert words in the subject that match your hash tag list into tags (add the #). it will NOT insert the tags on their own

I see. I think it would be helpful if you added that feature as well as the ability to read the post and figure some out.

After reading the docs, I also thought that the plugin would add the hashtags specified in that setting, until it runs out of characters in the Tweet.

I understand you can add a fixed hashtag in the language file, but perhaps it would be good to update the README to mention that. Also, it would help if the README mentioned that the plugin can be partially tested from ACP -> Tools & Maintenance.

Another minor thing: the ACP setting "Publish new thread subjects that fit the forum ID criteria below?" should be reworded to "forum ID criteria above".Also, "Show Lastest Statuses (will verify app and settings are correct)"

BTW Pavemen, might you publish the plugin source code to GitHub? That way it would be really easy for others to submit patches, and you won't have to remember to fix little things (like the "disable" example).
(2011-08-01, 12:00 PM)dandv Wrote: [ -> ]So I've been reading a few tens of pages on this long thread and wanted to share my input Smile

First off, thanks for a cool plugin!
You are welcome, and thanks for reading first and supplying links to what you are talking about. Wish more folks would do that
(2011-08-01, 12:00 PM)dandv Wrote: [ -> ]I'm having trouble getting Twitter to work, but I hope it's just their delay. All 3 ACP tests pass, I don't have any excluded forums, all forums are visible, I don't use any of the URL shorteners, the mybbpublisher_errors_tw cache is empty, there are no errors in the PHP log, and I've set the priority of the mybbpublisher_newthread hook to 1, as instructed here (I do have the automaticsubscriptions plugin installed, which adds a hook on datahandler_post_insert_thread_post as well). If Twitter is just slow (though it's been 15 minutes since I posted a new thread), then there should be 3 or more tweets by @QSForum.
Twitter's server replication process seems to have gremlins or something. The delay between posts can be large, trying to remove a status too quickly after adding it can result in a "not found" situation, etc.

But to confirm, are you sure teh forum you posted to is set to publish? If you set the icon path to the default value (or any valid image) does it show up in the forum description on the index page? That is how you can validate that the forum will be published.
(2011-08-01, 12:00 PM)dandv Wrote: [ -> ]
(2011-06-03, 08:50 PM)lucasbytegenius Wrote: [ -> ]
(2011-06-03, 08:25 PM)pavemen Wrote: [ -> ]are the hash tags in your thread title? the current setup will convert words in the subject that match your hash tag list into tags (add the #). it will NOT insert the tags on their own

I see. I think it would be helpful if you added that feature as well as the ability to read the post and figure some out.

After reading the docs, I also thought that the plugin would add the hashtags specified in that setting, until it runs out of characters in the Tweet.

I understand you can add a fixed hashtag in the language file, but perhaps it would be good to update the README to mention that. Also, it would help if the README mentioned that the plugin can be partially tested from ACP -> Tools & Maintenance.
Thanks. To avoid "hashtag spam" I purposely left the plugin the way it is. I personally don't feel that a status full of hash tags would properly represent the content of a thread and make it appealing to followers, or to search engines for that matter.
(2011-08-01, 12:00 PM)dandv Wrote: [ -> ]Another minor thing: the ACP setting "Publish new thread subjects that fit the forum ID criteria below?" should be reworded to "forum ID criteria above".Also, "Show Lastest Statuses (will verify app and settings are correct)"

BTW Pavemen, might you publish the plugin source code to GitHub? That way it would be really easy for others to submit patches, and you won't have to remember to fix little things (like the "disable" example).
I am going to work on the typo's for the next version. I am already using my own SVN on my home network, I'd rather not have to maintain a second one or move to Github.

I am more than glad to accept replies to this thread or PM's with requested changes/fixes. I may have time next week to submit an update.

Also, I appreciate the feedback on the docs. Its hard to write them when you have written the code and just know how it works. Harder to make it more general for those that are using it for the first time.
So I traced the execution flow with Komodo and it turned out that in mybbpublisher_tw_post_update(), after $tmhOAuth->request('POST', $tmhOAuth->url('1/statuses/update'), array('status' => $message)); there was no check for an error. I'm not sure how that happened, since this is where Twitter posting errors (e.g. authentication) would be caught. Anyway, would be great to have an update after you put this check in.

The if($tmhOAuth->response['code'] == 200) should have an "else" branch, which should essentially dump $tmhOAuth->response['response'] into mybbpublisher_errors_tw. In my case, doing that revealed that the error was "Read-only application cannot POST".

Why that happened is a bit odd:

In OAuth settings, "Access level" was set to "Read and write" (BTW, this should be documented in the README as well, because by default the Access level is Read-only, IIRC).

But in the "Your access token" section, "Access level" was Read-only, and there was no obvious way in the Twitter UI to change it. I clicked "Recreate my access token" twice, and that created a new token (had to copy it into the plugin settings), with "Read and write" access. Odd how that worked, but now the plugin posts to Twitter correctly.

Another thing: usually plugins add their settings in ACP after the last plugin. This reflects the fact that the last installed plugin will have the settings listed last. It would be nice if MybbPublisher did that too in _install():

	$result = $db->simple_select('settinggroups', 'MAX(disporder) AS max_disporder');
	$max_disporder = $db->fetch_field($result, 'max_disporder');
	$settings_group = array(
		"gid" => "",
		"name" => "MyBBpublisher",
		"title" => "MyBBpublisher",
		"description" => "Settings for the MyBBpublisher feature.",
		"disporder" => $max_disporder +1,  // instead of 50
		"isdefault" => "0",
        );

Another one: the comment "//get initial status update" looks mis-matched. The code there tests if the message is an announcement, or a new thread.

Another one: $l['mybbpublisher_new_thread_tw'] = "{msg} {urlbit}"; suggests that that's the format of the Tweet. However, the code inserts $l['mybbpublisher_at'] into the message by replacing {urlbit} with the actual URL, preceded by the $l['mybbpublisher_at'] string. Would it be clearer if the Twitter message were simply $l['mybbpublisher_new_thread_tw'] = "{msg} at {urlbit}."; (same for announcements) and then users could easily format it in ways that would not include the "at" string? For instance, my forum tweets like this:

Quote:New thread on #quantifiedself forum: The Quantified Self Forum now posts new threads to Twitter - http://bit.ly/q2bkpk

IMO, format specifiers should replace variables verbatim, and not introduce extra text. What I mean is that {urlbit} should be replaced with just the URL, no "at" string prefix, and no "." suffix. This also helps with localization in Eastern languages - in proper Chinese, the period needs to be replaced with IDEOGRAPHIC FULL STOP (U+3002).
The need for read/write is in the README

2) register an application on the Twitter dev site (browser type with read/write access)

I can't do much about Twitter and how it works (or does not work). I am unsure why they have such trouble keeping their servers in sync and getting proper configurations to work. At least its setup correctly now and finally working.

Thanks for catching the error trap w.r.t the ELSE statement

Regarding the display order, you are correct that is how it is often done, but I think that all of my plugins are set to use 50, just to keep them together. i am lazy in that regard.
Oh well, here's the modified mybbpublisher.php, with all the suggestions above, plus much simpler code for truncating the Twitter message. It also adds an ellipsis, to distinguish between truncated messages and not-truncated ones.
thanks. i will take a look at it
I get redirected to the dashboard when clicking in Tools and Maintenance link -> Mybb Publisher, the link show tools-mybbpublisher in the address bar but it shows the dashboard. Also I have the facebook connect plugin that's working already installed.