Coder Social home page Coder Social logo

hookpress's Introduction

=== HookPress ===
Contributors: mitchoyoshitaka, automattic
Author: mitcho (Michael Yoshitaka Erlewine)
Author URI: http://mitcho.com/
Plugin URI: http://mitcho.com/code/
Donate link: http://tinyurl.com/donatetomitcho
Tags: hook, filter, action, plugin, webhook, webhooks, notification, internal
Requires at least: 3.6
Tested up to: 4.1
Stable tag: 1.14

HookPress turns your WordPress-internal hooks into webhooks. Possible uses include generating push notifications or extending WordPress with non-PHP.

== Description ==

Webhooks are a simple paradigm for developing instant notifications and mashups based on simple HTTP requests. With HookPress you can set up webhooks so that a specified URL (a public service or something you set up) is requested when certain WordPress actions occur. Possible uses include generating push notifications or using non-PHP web technology to extend WordPress.

[vimeo 5905102]
A tutorial video is available [on WordPress.tv](http://wordpress.tv/2009/09/13/introduction-to-hookpress/).

**[As seen on WordPress.com!](http://en.blog.wordpress.com/2010/04/14/hook-line-and-sinker/)**

**To learn about the various hooks WordPress provides**, please consult the WordPress Plugin API's [Action Reference](http://codex.wordpress.org/Plugin_API/Action_Reference) and [Filter Reference](http://codex.wordpress.org/Plugin_API/Filter_Reference). Not all hooks are supported yet, but more are in the works.

**To learn more about webhooks**, take a look at the [wikipedia page](https://en.wikipedia.org/wiki/Webhook) and also [The Pushbutton Web](http://dashes.com/anil/2009/07/the-pushbutton-web-realtime-becomes-real.html) by Anil Dash. Webhooks champion Jeff Lindsay's [excellent slides](http://www.slideshare.net/progrium/using-web-hooks) are a particularly good place to start.

**To write and host a target script** The easiest option is to set up a script on your own server to catch POST requests and act on them. [Requestbin](http://requestb.in/) is a nice, free service which will host an endpoint, collect all requests, and let you inspect them, which is a great way to test requests generated by your webhooks. There is also a PHP script which does a simple version of this, `test.php`, included with HookPress.

== Installation ==

Upload the HookPress plugin to your blog's `wp-content/plugins/` directory and activate. In the admin section, go to Settings > Webhooks to add new webhooks.

== Frequently Asked Questions ==

If you have a feature request or question, please use the [HookPress support forum](http://wordpress.org/tags/hookpress).

= How does HookPress affect performance? =

HookPress currently makes requests synchronously so can measurably affect performance. I highly recommend using a caching plugin such as [WP-SuperCache](http://ocaoimh.ie/wp-super-cache/) to stem the performance hit. If your filters' results are time-sensitive or dependent on external data sources as well, make sure to set an appropriate cache expiration time.

== Changelog ==

= 1.14 =
* Additional security hardening for `test.php`, now no longer bundled as a `.php`

= 1.13 =
* Important security fix to the test endpoint, `test.php`.
* Code cleanup, fix bugs introduced in previous version.

= 1.12 =
* Upgraded to work properly with jQuery 1.9+. [Props liquidgecha](https://github.com/mitcho/hookpress/commit/0b21dfec8136d51971a21fb6cbdd4ff2b8d60753).
* Dropped the initial 0. in the version number, as that was just ridiculous. :)

= 0.1.11 =
* Fix to register the right number of incoming arguments for actions.
= 0.1.10 =
* No longer depends on the Snoopy library; uses `wp_remote_post()` instead. Note that the HTTP referer may no longer be sent correctly.
* Added the `hookpress_request` filter.
* Code cleanup
= 0.1.9 =
* New snazzy options screen, with [help from Automattic](http://en.blog.wordpress.com/2010/04/14/hook-line-and-sinker/)
	* added webhook editing
* Various miscellaneous features: added nonces for security, modularized the code a bit, etc.
= 0.1.8 =
* Added more filtersÑnow covers basic + comment filters
* Marking as compatible through 2.9.9, because it should be.
* Added version checking and beta offers to the options screen.
= 0.1.7 =
* Now supports basically all actions. (Still no actions with no arguments.)
* Added more filter optionsÑnow covers all basic database read filters.
= 0.1.6 =
* Added another batch of actions. (Still no actions with no arguments, though... something to consider.)
* Fixed hooks which referred to the users and links tables.
= 0.1.5 =
* Now enforces sending the first field in filters and highlights the first field.
* Added FAQ note on performance concerns and caching.
= 0.1.4 =
* Bugfix: hooks with ID 0 can now be deleted
* Made HookPress fully localizable - please email before you start localizing to claim your language.
= 0.1.3 =
* A small bugfix to the filters list for `save_pre`
* Initial support for filters with an short list of supported filters
* Updated `test.php` to return first parameter (to trivially support filters)
= 0.1.2 =
* Added support for the `post_url` field
* Added support for `parent_*` post fields for `save_post` which are sent in case the post is a revision of a previous draft.
* Fixes a PHP error which displayed on install
* Disallowed redirects on the webhook - corrects duplicate records when used with PostBin
= 0.1.1 =
* Fixed namespace collision with [Yet Another Related Posts Plugin](http://mitcho.com/code/yarpp/).
* Minor documentation changes.
= 0.1 =
* Initial release
	* supports webhooks based on WP actions

= Future plans =

* Editing webhooks (rather than deleting and adding)
* More custmization on a per-webhook basis

If you have a feature request or question, please use the <a href='http://wordpress.org/tags/hookpress'>HookPress support forum</a>.

hookpress's People

Contributors

mitcho avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

hookpress's Issues

Add fields to hooks

I'm interested in adding fields to publish_post and edit_post such as related objects like post_thumbnail and terms.

I have used the XMLRPC API in the past to request this attributes, but would like to have them sent along in a hook.

In this case I'm hoping to add what would effectively be nested attributes to the attribute array. This is an example of the type of data I would like to be able to add.

What would it take to add these? Or how could they be added?

"post_thumbnail": {
  "attachment_id": "24",
  "date_created_gmt": "2015-10-05 22:07:01",
  "parent": 19,
  "link": "https://foo.files.wordpress.com/2015/04/foo.jpg",
  "title": "foo",
  "caption": "",
  "description": "",
  "metadata": {
    "width": 1280,
    "height": 960,
    "file": "/home/wpcom/public_html/wp-content/blogs.dir/453/88434674/files/2015/04/foo.jpg",
    "sizes": [

    ],
    "image_meta": {
      "aperture": 2.4,
      "credit": "",
      "camera": "iPhone 5",
      "caption": "",
      "created_timestamp": 1424101192,
      "copyright": "",
      "focal_length": "2.18",
      "iso": "32",
      "shutter_speed": "0.0024271844660194",
      "title": "",
      "orientation": 1
    }
  },
  "thumbnail": "https://foo.files.wordpress.com/2015/04/foo.jpg?w=150"
}
"terms": [
  {
    "term_id": "1",
    "name": "Uncategorized",
    "slug": "uncategorized",
    "term_group": "0",
    "term_taxonomy_id": "1",
    "taxonomy": "category",
    "description": "",
    "parent": "0",
    "count": 6,
    "filter": "raw"
  }
]

Blank mutliselect fields after selecting actions or filters --ereg() deprecated PHP7.0..

When adding a Webhook, no fields items are displaying after selecting actions or filters .

The following error is logged:

PHP Fatal error: Uncaught Error: Call to undefined function ereg() in /path/wp-content/plugins/hookpress/services.php:13

Two possible solutions:

Solution 1
// changing the deprecated ereg() function to mb_ereg()
from: if (ereg('[A-Z]+',$arg))
to: if (mb_ereg('[A-Z]+',$arg))

Solution 2 (seems to be more recommended):

// changing the deprecated ereg() function to preg_match()
from: if (ereg('[A-Z]+',$arg))
to: if (preg_match('/[A-Z]+/',$arg))

adding other webhooks: what's the preferred way?

While the plugin is really super-useful for anything "blog related" it could do really more if we only could add other webhooks.
I can see that the "list" of actions and hooks is filterable here https://github.com/mitcho/hookpress/blob/master/hooks.php#L139 and here https://github.com/mitcho/hookpress/blob/master/hooks.php#L243
so we can add more options, but I'm not sure if and how we can then hooks in other plugin parts to manage arguments and so on.
Any hint on hooks to be used or other strategies will be useful.
I can then work to make a pull request to address this

Stefano

Getting post_content with <p> tags

Hi Mitcho,
Thanks for the plugin. I'm using it with Zapier integration and noticed that post_content comes without

tags which makes it really hard to repost content on other platforms with proper formatting. I'm reposting wordpress blogs to medium through zapier and would like to keep formatting as it was in WP post.
I found this StackOverflow answer could be useful to create an extra field post_content_formatted.
I'll submit PR in the next couple of days to add the change unless you prefer to do it yourself.

Fields list is empty

On a completely fresh installation of Wordpress (via Bitnami) on Amazon Lightsail, the only plugin I installed is HookPress, and when I try to add a webhook I see this:

2018-04-18-211007_1286x848_scrot

... so I can't add any webhooks at all. Apologies for the newbie question but it seems like it ought to work?

Prevent spam from getting through?

We use Akismet for spam collecting, but I don't see a way to prevent HookPress from firing off the spam to the endpoints. So we're constantly getting updates in our team chat with leads on where to find cheap lebron james shoes and where to buy viagra in bulk.

User_email field

I'm currently using this version of hookpress - https://github.com/Willemdumee/hookpress

I noticed that user_email field is missing in the actions dropdown (even though we had this field in the original plugin).

Is there any way to add this field to the current version of plugin (by Willem Dumee)?

Custom Post Types

I'm using the 'Custom Post Type UI' plugin, and was wondering if I might be able to specify which custom post type to call the hook, as it only seems to work with the out of the box 'POST' type.

Errors on hook creation

Hello.
On creation of a new hook, two errors are generated. (wp 4.4.1, php 5.4.45)


This is the first:
Deprecated: Function split() is deprecated in /home/devredpupmedia/public_html/client/brand/wp-content/plugins/hookpress/services.php on line 60

I was able to resolve it by editing line 60 in /services.php as follows:

'fields'=>explode(',',$_POST['fields']),

Also edited line 49 in the same file with the same edit.


The second:
Strict Standards: Only variables should be passed by reference in /home/devredpupmedia/public_html/client/brand/wp-content/plugins/hookpress/hookpress.php on line 68
edit_post

I was able to resolve it by editing line 68 in /hookpress.php as follows:

$tmp = array_keys($webhooks);  
return end($tmp);

I'm not polished in PHP so I'm asking if these changes are acceptable for use in the plugin.
Thanks

Were webhooks added to core?

Hi Mitcho,

I'm checking out your plugin because I'm needing a way to export actions to a django app.

Have webhooks been added to wordpress core?

I found this support article that seemed to suggest that it's default behavior on wordpress.com, but I guess not in open-source wordpress?

https://en.support.wordpress.com/webhooks/

Featured image

Hey, great work with this plugin, one thing I've noticed is that it's not returning the featured image in the post information, is there a way to get it?

Category Details in Hook Body

Hi,

Thanks for this plugin - I can now extend Wordpress for my requirement.

I seems to have one problem though - I have created 3 webhooks for create, edit & delete categories (create_category, edit_category, delete_category). The webhooks are fired correctly - but the data inside the Body seems to have only the hook name. Other details are missing. I tried selecting all fields/few fields/ID field alone for the webhook - nothing seem to work.

Request bin link to view the payload : http://requestb.in/ryja6wry?inspect

Also, attaching the screenshot of the hook, for reference.

hookpress_category

Would be great if I could get any help on this. Even if I get the category ID, that would be fine.

We stopped using Hookpress 😭

Hello!

This is for anybody who's coming here after Hookpress stops working, or they are looking for an alternative.

I had to change my webhook URL from Zapier to API Gateway. Hookpress completely stopped working. I debugged for a couple of hours but sadly couldn't get it working again...

Hookpress bravely soldiered on for all these years but I'm finally saying goodbye to it. There is actually an alternative for sending Webhooks from Wordpress now: https://wordpress.org/plugins/wp-webhooks/

Thanks for making this amazing plugin, I know there are a lot of people out there who got as much or more value out of it than me.

Bye!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.