{"id":21893732,"url":"https://github.com/micc83/wp-heartbeat-notify","last_synced_at":"2025-04-15T15:22:40.565Z","repository":{"id":151341462,"uuid":"10814367","full_name":"micc83/wp-heartbeat-notify","owner":"micc83","description":"Based on WordPress 3.6 heartbeat API, Wp Hearbeat Notify, display a realtime custom message to your visitor each time a new post is published with a link redirecting to it. Still in beta version, this plugin has been full tested only on WordPress 3.6-beta3.","archived":false,"fork":false,"pushed_at":"2014-04-17T06:56:07.000Z","size":211,"stargazers_count":51,"open_issues_count":2,"forks_count":10,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-06T19:07:22.610Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/micc83.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-06-20T07:18:50.000Z","updated_at":"2024-04-12T03:15:31.000Z","dependencies_parsed_at":"2023-04-05T22:17:38.390Z","dependency_job_id":null,"html_url":"https://github.com/micc83/wp-heartbeat-notify","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micc83%2Fwp-heartbeat-notify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micc83%2Fwp-heartbeat-notify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micc83%2Fwp-heartbeat-notify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micc83%2Fwp-heartbeat-notify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/micc83","download_url":"https://codeload.github.com/micc83/wp-heartbeat-notify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249095345,"owners_count":21211906,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-28T13:16:25.409Z","updated_at":"2025-04-15T15:22:40.546Z","avatar_url":"https://github.com/micc83.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# wp-heartbeat-notify\n\n#### WordPress realtime new post notifications based on heartbeat API\n\nBased on **WordPress 3.6 heartbeat API**, Wp Heartbeat Notify, display a realtime custom message to your visitor each time a new post is published with a link redirecting to it. Still in beta version, this plugin has been **full tested only on WordPress 3.6-beta3**.\n\n![wp-heartbeat-notify screenshot](https://github.com/micc83/wp-heartbeat-notify/raw/master/wp-heartbeat-notify/screenshot-1.jpg)\n\n## Install\n\nJust upload `wp-heartbeat-notify` to your WordPress `wp-content/plugin/` folder. Go to *Plugins-\u003eInstalled plugins* WordPress menu and activate it. That's it... You just have to write a new article to see it in action (Clearly, the notification will not be displayed to the user who created the event. So, for the purposes of testing, I suggest you open another browser where you're not logged in).\n\n## Purpose\n\nThis is probably the first, or at least one of the first WordPress plugin that makes use of the Heartbeat API. Its purpose is almost purely didactic and I hope that the solution that I have implemented it can be useful for developing new ideas.\n\nThe plugin, however, is fully functional and can increase the functionality with a few lines of code, as described below.\n\n## Under the hood\n\nThe functioning of the plugin is quite simple.\n\n* All scripts and styles necessary for the functioning of heartbeat are queued\n* To generate a notification you hook onto an action or a filter of WordPress and you create a transient that match the length of the heartbeat rate\n* wp-heartbeat-notify, every few seconds, check the presence of transient and output the content as a notification\n\nEasy... Isn't it?\n\n## Add new notice\n\nTo add a new notice, as stated before, you just have to hook into an action or filter and run `Wp_Heartbeat_Notify::notify( $args )` as in the following example:\n\n### Add a notice on registered users comments \n\n```php\n\n// Let's hook into Comment publication\nadd_filter ( 'comment_post', 'notify_new_comment' );\nfunction notify_new_comment( $comment_id ) {\n  \n  // Retrieve the comment\n  $comment = get_comment( $comment_id );\n\n  // Check if the user is registered\n  if ( ! $comment-\u003euser_id \u003e 0 )\n\t\treturn;\n  \n  // Get the comment link\n  $comment_link = get_comment_link( $comment_id ); \n\n  // Here's the magic\n\tWp_Heartbeat_Notify::notify( array(\n\t\t'title'\t\t=\u003e\t\t'New Comment by ' . $comment-\u003ecomment_author,\n\t\t'content'\t=\u003e\t \t'There\\'s a new comment, why don\\'t you \u003ca href=\"' . $comment_link . '\"\u003egive it\u003c/a\u003e a look?',\n\t\t'type'\t\t=\u003e\t\t'info'\n\t) );\n\t\n}\n```\n\n## Support and contacts\n\nIf you need support you can find me on [twitter](https://twitter.com/Micc1983) or comment on the dedicated page on my [website](http://codeb.it/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicc83%2Fwp-heartbeat-notify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicc83%2Fwp-heartbeat-notify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicc83%2Fwp-heartbeat-notify/lists"}