Ferdi Derksen Posted March 25, 2016 Share Posted March 25, 2016 Hi all, Just in front of the Easterweekend, my first contribution to the modules section of ProcessWire. I created a module to send Tweets when selected at the page editor. From version 0.8.3 up the module is only to use in v3.x. When using ProcessWire v2.x you should use version 0.8.2. In short this module offers an option to publish a page to Twitter when the date for publishing is past/scheduled. After filling out the Twitter credentials, select your preferable template(s) which should have the option added to Tweet the pages using it. Additional select the field to use as publicationdate to check if the Tweet should be send now or later, a field which contains the page title. Optional you can fill out the name of the website which will be added after the title (in case space is available). Optional you can select the field where the page image(s) are placed (only one will be tweeted). Optional you can fill out Bit.ly credentials for shortening URLs. Includes instructions to set a cron (template or LazyCron), returns log in assets folder. Uses (included) TwitterOAuth PHP library written by abraham. http://modules.processwire.com/modules/publish-to-twitter/ https://github.com/FerdiAgrio/PublishToTwitter Enjoy! 14 Link to comment Share on other sites More sharing options...
Martijn Geerts Posted March 25, 2016 Share Posted March 25, 2016 Thanks Ferdi ! 2 Link to comment Share on other sites More sharing options...
netcarver Posted March 25, 2016 Share Posted March 25, 2016 Ferdi, thank you!! Always good to see new module authors writing for PW. 2 Link to comment Share on other sites More sharing options...
flydev Posted August 16, 2016 Share Posted August 16, 2016 To get the module working out of the box on ProcessWire 3.0.x, just add to PublishToTwitter.module before installing it : namespace ProcessWire; Just tested this morning, it works like a charm 1 Link to comment Share on other sites More sharing options...
LostKobrakai Posted August 16, 2016 Share Posted August 16, 2016 Didn't it work without? The compiler should normally take care of this automatically. 1 Link to comment Share on other sites More sharing options...
flydev Posted August 16, 2016 Share Posted August 16, 2016 Without the namespace, this error is triggered : Session: error setting certificate verify locations: CAfile: [...]\site\assets\cache\FileCompiler\site\modules\PublishToTwitter\TwitterOAuth\Abraham\TwitterOAuth\cacert.pem CApath: none In TwitterOAuth.php line 353: CURLOPT_CAINFO => __DIR__ . DIRECTORY_SEPARATOR . 'cacert.pem', Link to comment Share on other sites More sharing options...
Ferdi Derksen Posted September 14, 2016 Author Share Posted September 14, 2016 Updated the module to version 0.8.3 for working with PW 3.x (use version 0.8.2 for PW 2.x). 4 Link to comment Share on other sites More sharing options...
netcarver Posted September 14, 2016 Share Posted September 14, 2016 Thanks for the update Ferdi! Any chance you could include the PW modules repository link (http://modules.processwire.com/modules/publish-to-twitter/) in your opening post? 2 Link to comment Share on other sites More sharing options...
Ferdi Derksen Posted September 14, 2016 Author Share Posted September 14, 2016 4 minutes ago, netcarver said: Thanks for the update Ferdi! Any chance you could include the PW modules repository link (http://modules.processwire.com/modules/publish-to-twitter/) in your opening post? done that 2 Link to comment Share on other sites More sharing options...
adrian Posted September 14, 2016 Share Posted September 14, 2016 4 minutes ago, netcarver said: Thanks for the update Ferdi! Any chance you could include the PW modules repository link (http://modules.processwire.com/modules/publish-to-twitter/) in your opening post? And of course update the module compatibility to include 3.x 1 Link to comment Share on other sites More sharing options...
Ferdi Derksen Posted September 22, 2016 Author Share Posted September 22, 2016 0.8.5: Due to the recent Twitter update changes are made to remove the limitation of media-URLs. In addition there is an option to set the maximum number of images you want to add to the Tweet (when the images-field is set to multiple). Enjoy! 4 Link to comment Share on other sites More sharing options...
HueyGeek Posted November 23, 2016 Share Posted November 23, 2016 (edited) Hi Ferdi, Good work, great stuff, Thanks. About ProcessWire 2.x, where do I get the 0.8.2 version ? To get the 0.8.2 version: https://github.com/FerdiAgrio/PublishToTwitter/tree/19a7f3d7777915641a13a018659c151a17bc017a Edited November 23, 2016 by HueyGeek Self answered ... Link to comment Share on other sites More sharing options...
Ferdi Derksen Posted November 28, 2016 Author Share Posted November 28, 2016 0.8.6 : Optional set a prepend text Find out which Twitter-account is connected when saving module 0.8.7 : Supports FieldtypeCroppableImage3 1 Link to comment Share on other sites More sharing options...
DL7 Posted March 13, 2017 Share Posted March 13, 2017 Hi @Ferdi Derksen, I installed your module on our test location and it works like a charm. Just one additional question. Would it be possible to execute the same code when a page is created and saved via the (API) $page->save. I added $p->publish_to_twitter = 1; before the $page->save and removed the wire()->input->post->id, but when I open the page just created, the check box is checked, but the page is not (yet) tweeted. Only if I click on save manually again its tweeted. Any idea what I need to amend in the code to get this working? Cheers Link to comment Share on other sites More sharing options...
Ferdi Derksen Posted March 14, 2017 Author Share Posted March 14, 2017 Hi @DL7, First of all I assume you are using the module for version 3.x I think the first thing to change is the 'autoload' option in the getModuleInfo() method to 'autoload' => true (or add another template you are using for the creation of pages). Please let me know if that's working for you. Cheers! 1 Link to comment Share on other sites More sharing options...
DL7 Posted March 14, 2017 Share Posted March 14, 2017 Hi @Ferdi Derksen, Thanks. Tried it, and its still not working. I also checked the code and concluded that the somehow the addHookAfter is not triggered, when using the $page->save via the API. I work when using the backend save. Not sure if this is expected behaviour? Link to comment Share on other sites More sharing options...
adrian Posted March 14, 2017 Share Posted March 14, 2017 @DL7 I haven't used this module, but I see that it's not autoload in templates so try this before you save the page via the API: $modules->get("PublishToTwitter"); 2 Link to comment Share on other sites More sharing options...
DL7 Posted March 15, 2017 Share Posted March 15, 2017 Hi @adrian, Thanks! That did the trick. Cheers 1 Link to comment Share on other sites More sharing options...
loukote Posted May 23, 2017 Share Posted May 23, 2017 Hello @Ferdi Derksen, i just installed the module on a pw3.0.62 and set it up, adding a template as the template whose pages should be tweeted, saved. The module settings "page title field" and the "datefield to check for publication" contain both a drop-down with fields of another template, both drop-downs are slightly different, first being a subset of the other. Would you have an idea of what went wrong? I would appreciate any help. Link to comment Share on other sites More sharing options...
Ferdi Derksen Posted May 23, 2017 Author Share Posted May 23, 2017 Hi @loukote, There is no limitation/filtering in fields of the selected template(s). Therefore those drop-downs are selecting fields with type "Text" for "page title field" and type "Datetime" for "datefield to check for publication" so the checks when Tweeting (or selecting which to Tweet) can be done properly. Cheers, Ferdi Link to comment Share on other sites More sharing options...
benbyf Posted July 7, 2017 Share Posted July 7, 2017 not really sure by the docs how to implement this module after adding the settings in the admin. any extra guidance? sorry. Just saw the Tweet this page check box... and now works, not sure this is mentioned on github however. Link to comment Share on other sites More sharing options...
Ferdi Derksen Posted July 10, 2017 Author Share Posted July 10, 2017 Hi @benbyf, I'll check for the mention and when needed add it, when you need any extra support, let me know! Link to comment Share on other sites More sharing options...
loukote Posted September 14, 2017 Share Posted September 14, 2017 On 5/23/2017 at 9:56 AM, Ferdi Derksen said: There is no limitation/filtering in fields of the selected template(s). Therefore those drop-downs are selecting fields with type "Text" for "page title field" and type "Datetime" for "datefield to check for publication" so the checks when Tweeting (or selecting which to Tweet) can be done properly. @Ferdi Derksen Let me come back with the earlier reported issue. I do not know what and how happens but: no matter which template is selected on the PublishToTwitter configuration page in the "Publish to twitter template" field, the "page title" and "datefield to check for publication" fields contain a subset of fields used only in the "user" template like "username", "date joined"... (the user template has few more fields that the standard installation.) The "datefield to check for publication" offers items that are not of a date type. The "page images" field gives only one line, images, which is OK. No matter what template is selected in the "publish to twitter templates" field, the misbehaving fields offer the same items. Would you have any idea what should I check to correct this issue? Would screenshots help? Link to comment Share on other sites More sharing options...
Ferdi Derksen Posted September 15, 2017 Author Share Posted September 15, 2017 Hi @loukote, Maybe a stupid question, but you did save the module after selecting a template, right? The list of fields available is depending on the template(s) you selected at the first place. This should indicate the "user" template is selected now. On the other hand, the "date" field is build with a selector for fields of type FieldtypeDatetime or FieldtypeText. Otherwise send/place some screenshots, happy to help! Link to comment Share on other sites More sharing options...
loukote Posted September 16, 2017 Share Posted September 16, 2017 Help would be appreciated, so here are the screenshots. To make sure, I uninstalled the module and installed a fresh from github. Here is how the the config window looks: before selecting any template, the Page title and Datefield to check... are already pre-filled with values that apparently come from the user template. When the needed template is selected, the options of these two selects do not change. After the config page is submitted/saved, nothing changes -- same old fields as options in the two selects. And they stay the same even when another template is entered and the config page is saved. Does it help you to help me? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now