Manol Posted May 20, 2014 Share Posted May 20, 2014 Hello guys. I would like some help on where to start to create a button that publishes from a processwire page ( title, text and image ) to the facebook wall. The idea is that the user writes some news in a processwire page and then I will use the facebook api graph to publish on that user's wall. My idea was to develop a module to make it as reusable as possible ( and include google+ and tweeter ). I've got some ideas on how to do it, but maybe some of you have done something similar or face problems I haven't think about yet that could help. Thank you. Link to comment Share on other sites More sharing options...
adrian Posted May 20, 2014 Share Posted May 20, 2014 The easy way out would be to generate an RSS feed of PW pages: http://modules.processwire.com/modules/markup-rss/ http://modules.processwire.com/modules/markup-rssenhanced/ and push them to FB, Twitter etc using any number of services: https://dlvr.it/ https://hootsuite.com/ or my current favorite - IFTTT https://ifttt.com/recipes/search?q=rss+to+facebook&ac=false https://ifttt.com/recipes/search?q=rss+to+twitter&ac=false 1 Link to comment Share on other sites More sharing options...
Martijn Geerts Posted May 20, 2014 Share Posted May 20, 2014 If you want to push an image to you better use the enhanced as that one support enclosures. (images, files) 2 Link to comment Share on other sites More sharing options...
Manol Posted June 19, 2014 Author Share Posted June 19, 2014 Hello. I've created a rss template and is working, now I'm trying to push those to facebook with IFTTT https://ifttt.com/re...cebook&ac=false https://ifttt.com/re...witter&ac=false but results aren't triggering, I pasted the url directly into the browser but no changes at all. Thank you. Link to comment Share on other sites More sharing options...
adrian Posted June 19, 2014 Share Posted June 19, 2014 Sorry, when you say: but results aren't triggering, I pasted the url directly into the browser but no changes at all. do you mean that the rss feed itself is not updating, or that IFTTT is not sending the changes to FB? Link to comment Share on other sites More sharing options...
Manol Posted June 20, 2014 Author Share Posted June 20, 2014 Hi Adrian. I used the enhanced rss module, created a template with this code: $rss = $modules->get("MarkupRSSEnhanced"); $items = $pages->find("limit=10, sort=-modified"); // $items, PageArray of Pages $rss = $modules->get("MarkupRSSEnhanced"); // load the module $rss->render($items); and when I call the a page creates with that template htt://mypage/rss I can see the xml, but IFTTT doesn't detect the changes. I think I'm missing some very basic stuff. Link to comment Share on other sites More sharing options...
Martijn Geerts Posted June 20, 2014 Share Posted June 20, 2014 @Manol, Regarding the Feed Module: 1. Could you validate your feed. It should say: "Congratulations!" 2. It can be that the ttl (time to live) is to high. 1 Link to comment Share on other sites More sharing options...
Manol Posted June 20, 2014 Author Share Posted June 20, 2014 Hi Martijn It says congratullations and also: This feed is valid, but interoperability with the widest range of feed readers could be improved by implementing the following recommendations. line 31, column 0: Missing atom:link with rel="self" <link>http://casergi.com/noticias/comida-de-empresa-para-navidad/</link> <guid>http://casergi.com/noticias/comida-de-empresa-para-navidad/</guid> </item> 31 </channel> </rss> I'm trying to understand the help file provided. Link to comment Share on other sites More sharing options...
Martijn Geerts Posted June 20, 2014 Share Posted June 20, 2014 That should not a problem I guess. What about the time to live? If you didn't set it, it is an hour. ( 60 minutes) 2 Link to comment Share on other sites More sharing options...
Manol Posted June 20, 2014 Author Share Posted June 20, 2014 Yes I changed to 1 minute but no results. My original idea was to publish some stuff to facebook wall after saving a page in the admin area, title, description and images. I got and external php that does exactly that and works: <?php include_once 'inc/facebook.php'; $appId = '703738********'; $secret = 'd30530a5dcd*************'; $returnurl = 'http://myweb.es/facebook/post.php'; $permissions = 'manage_pages, publish_stream'; $fb = new Facebook(array('appId'=>$appId, 'secret'=>$secret)); $fbuser = $fb->getUser(); if($fbuser){ try{ $message = array( 'message' => 'foo' ); $result = $fb->api('/me/feed/','POST',$message); if($result){ echo 'Published'; } }catch(FacebookApiException $e){ echo $e->getMessage(); } }else{ $fbloginurl = $fb->getLoginUrl(array('redirect-uri'=>$returnurl, 'scope'=>$permissions)); echo '<a href="'.$fbloginurl.'">Login with Facebook</a>'; } ?> I'm trying to implement that in a hook, there is a checkbox, if is on then publish to facebook $this->pages->addHookAfter('save', $this, 'fb'); ..... if($page->facebook==1) { include_once 'fb/facebook.php'; $appId = '70373825******'; $secret = 'd30530a5dcd4e5829e6c8b********'; // $returnurl = 'http://indinet.es/facebook/post.php'; $returnurl = 'http://pwpage.com'; $permissions = 'manage_pages, publish_stream'; $fb = new Facebook(array('appId'=>$appId, 'secret'=>$secret)); $fbuser = $fb->getUser(); $this->message("user " . $fbuser); } // facebook .... I'm trying first to check the user id, but the result is just 0, whereas in the original file outside pw I get the user id without problems. Any ideas, Why? 2 Link to comment Share on other sites More sharing options...
Manol Posted June 23, 2014 Author Share Posted June 23, 2014 works changing time lo live. 1 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