Code Monkey home page Code Monkey logo

remote-dashboard-notifications's Introduction

Remote Dashboard Notifications

Scrutinizer Code Quality

Developers, have you ever wanted to ask something to your users? Tried to get some feedback about your product? Want them to leave a comment on your site? This plugin will help you do that.

Remote Dashboard Notifications (RDN) is a plugin made for themes and plugins developers who want to send short notifications to their users. This plugin will allow a theme / plugin author to display a notice in the client's admin dashboard using the WordPress admin notices.

The plugin works on a server / client basis. The product author uses a WordPress install as the server (where the plugin has to be installed), and the user's WordPress site will be the client.

How it works

The plugin is meant to manage messages for multiple products. We call channels the different types of notifications. For instance, if I have 2 products, Product A and Product B, I will create 2 channels in the server: Channel A and Channel B.

Once a channel is created, the plugin will create an ID and a key used to authenticate the client requests. When integrating RDN to a theme or plugin, the client class will be instanciated with the desired channel ID and key.

When a client site will will check for new notifications, it will make an HTTP request (using WordPress HTTP API) to the server. If the requested channel exists and the key is valid, the server will return the latest notification (if any) in a JSON encoded array.

The client site will then cache this response and display it as an admin notice in the WordPress site dashboard until the user dismisses it.

Integration in a theme or plugin

Prerequisite

The following has to be understood before you can integrate this feature in your product:

  • Server: the WordPress site where the plugin is installed
  • Client: the WordPress site where the class in instantiated (through a theme or a plugin)

Integration steps

It is really easy to integrate this feature in a plugin or theme. Only four steps are required:

  1. Copy includes/class-remote-notification-client.php into the theme / plugin directory
  2. Create a new channel on the server
  3. Get the channel ID & key (in the term edit screen)
  4. Register the notification on the client with the server's URL (http://domain.com), the channel ID and key

Integration examples

Theme

Place this into functions.php.

require( 'class-remote-notification-client.php' );

if ( function_exists( 'rdnc_add_notification' ) ) {
    rdnc_add_notification( 35, 'f76714a0a97d1186', 'http://server.url' );
}

Privacy

The plugin does not collect any information about the client site. The server plugin is completely passive and its only job is to return messages to the requestor.

remote-dashboard-notifications's People

Contributors

julien731 avatar siamkreative avatar

Watchers

James Cloos avatar Dinesh Kesarwani avatar

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.