Jump to content

Nico Knoll

PW-Moderators
  • Posts

    1,835
  • Joined

  • Last visited

  • Days Won

    21

Everything posted by Nico Knoll

  1. Ehm... could you add/update the following lines to the default "Page Name" module: ä=ae ö=oe ü=ue ß=ss That are german symbols and it's better if it would be like this
  2. @Ryan: I'm using the $event->return way right now, but the problem is that the original function throws a 404 header. (It's because I'm changing the URLs with my module).
  3. Well I know strato.de but never really worked with it. (I guess one client of mine does). But I'll always recommend UD-Media... (and if you maybe like UD-Media, too, some time, please use this link (https://www.udmedia.de/r12210) when you're register new domains/accounts ).
  4. Some and I thought about this to. And we created this module, which works like a file/image manager. Just have a look at it:
  5. I saw it My Code isn't that huge right now (waited for you ). it's like this: <?php /** * Social Share * * By Nico Knoll (http://www.nico-knoll.de/) * */ class SocialShare extends Process implements Module { public static function getModuleInfo() { return array( 'title' => 'Social Share', 'version' => '1.01', 'summary' => 'Let you see a preview of a page.', 'autoload' => true ); } private $facebookUser = ''; private $facebookToken = ''; private $twitterUser = ''; private $twitterToken = ''; public function init() { parent::init(); //$this->addHook('ProcessPageEdit::buildForm', $this, 'addButton'); $this->addHookBefore('ProcessPageEdit::execute', $this, 'saveAfter'); } public function saveAfter(HookEvent $event) { //var_dump($event->object); //var_dump($this->pages); //var_dump($this->config->input->post->id, $_POST ); if($this->input->post->id > 0 && count($_POST)) { $db_page = wire('process')->getPage(); if(!$db_page || !$db_page->id || !$db_page->editable()) return; if($this->input->post->submit_publish && (bool)$db_page->is(Page::statusUnpublished)) { if($this->facebookUser && $this->facebookToken) { $this->shareFacebook('http://www.stadtpirat.net/'); } } } } public function shareFacebook($share_url, $msg = '') { if(!$this->facebookUser || !$this->facebookToken) return false; $url = "https://graph.facebook.com/".$this->facebookUser."/links"; $attachment = array( 'access_token' => $this->facebookToken, 'message' => $msg, 'link' => $share_url ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $attachment); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($ch); curl_close ($ch); return $result; } }
  6. Hi, is there a way to stop the execution of a function via hook? / Nico
  7. Uploaded a new version to GitHub. Should work much better right now.
  8. ProcessWire reached a new point on the map: Indonesia Welcome Viking!
  9. Both. You can add account-IDs and and page-IDs.
  10. Here it is: The delete link in the page list Download: https://github.com/N...ocessPageDelete
  11. I guess that would be great. And in ProcessWire deleting is, like you said, not deleting but moving a page to trash. So the quick link doesn't have to be called "delete" but "move to trash". / Nico
  12. The "delete link" in the page list is absolutely something I would love to have in 2.2. Wrote a post over this, too, sometime ago.
  13. Looks nice - kind of organic
  14. Hey, my blog (http://stadtpirat.net) runs with ProcessWire, too. So I'll write my way here in a couple of moments. edit: I guess it's solved right now. But Maybe it's interesting for you do read the answers to this post about how to work with categories in a ProcesssWire blog. / Nico
  15. How can Pete have zero posts (the counter under his picture)?
  16. And I like the new reply function!
  17. Well it looks a lot different. But nice
  18. Well, I solved this like this: public function init() { parent::init(); $this->addHookBefore('ProcessPageEdit::execute', $this, 'saveAfter'); } public function saveAfter(HookEvent $event) { if($this->input->post->id > 0 && count($_POST)) { $db_page = (($this->pages->get('id='.$_GET['id']) instanceof NullPage) ? false : $this->pages->get('id='.$_GET['id'])); if($this->input->post->submit_publish && (bool)$db_page->is(Page::statusUnpublished)) { if($this->facebookUser && $this->facebookToken) { $this->shareFacebook('http://www.example.com/'); } } } } The Facebook part is working right now. So if you would create the twitter part it would be great. / Nico
  19. (Maybe this topic belongs to "General support")
  20. Hi, I'm writing a module which needs to hook to the page publish process. (It should post a link on facebook and a link on twitter if a page is published). So is there a hook for this already? And if yes, then which? Greets, Nico
  21. I think there's something like "$page->httpUrl"...
×
×
  • Create New...