WordPress Apple Push Notifications Plugin Documentation

What did you get?

About

Thank you for usign the WordPress Apple Push Notifications Plugin.

This plugin gives you an API to send Apple Push Notifications from your WordPress site.

You can send unlimited number of Push Notifications.

All sent notifications and all attempts are saved as posts of custom post type.

More about Apple Push Notifications

Features

  • API for sending single Push Notifcations.
  • Separate CPT for Notifications.
  • Logging.
  • Certificates uploading support.
  • Development/Production modes support.
  • Developer-friendly (used OOP paradigm).
  • Well-documented.
  • Fully translatable to any language using .po files.

What next?

Check Installation section to know how to install the plugin.

Installation

How to install?

Installation steps

Regular installation

  1. Get the package Ok, you got the plugin package :)
  2. Upload plugin package with WordPress http://yoursite.com/wp-admin/plugin-install.php?tab=upload or WordPress Multisite http://yoursite.com/wp-admin/network/plugin-install.php?tab=upload
  3. Activate WordPress Apple Push Notifications Plugin on the WordPress Plugins page http://yoursite.com/wp-admin/plugins.php
  4. That's all! You can start from Quick start guide
  5. After plugin activation please go to plugin's settings on the page http://yoursite.com/wp-admin/options-general.php?page=wp-apn to Set Up the plugin.

cPanel installation

  1. Upload plugin package through the cPanel File Manager to the /wp-content/plugins/
  2. Extract plugin package contents to the /wp-content/plugins/ folder
  3. Activate WordPress Apple Push Notifications Plugin on the WordPress Plugins page http://yoursite.com/wp-admin/plugins.php
  4. That's all! You can start from Quick start guide
  5. After plugin activation please go to plugin's settings on the page http://yoursite.com/wp-admin/options-general.php?page=wp-apn to Set Up the plugin.

FTP installation

  1. Unpack the plugin package with any archiving tool, which supports ZIP file format
  2. Upload files folder to the /wp-content/plugins/ to the server with any FTP client application, for example FileZilla
  3. Activate WordPress Apple Push Notifications Plugin on the WordPress Plugins page http://yoursite.com/wp-admin/plugins.php
  4. That's all! You can start from Quick start guide
  5. After plugin activation please go to plugin's settings on the page http://yoursite.com/wp-admin/options-general.php?page=wp-apn to Set Up the plugin.
More about WordPress Plugins Management

Plugin file structure


				

What next?

Check Quick start guide section to see quick examples of plugin's usage.

Quick start guide

How to hit the ground running?

First of all you need to check plugin requirements.

Requirements

  • PHP is 5.2 or higher
  • Writable logs folder wp-content/uploads/wp-apn-logs
More about Apple requirements

After activation plugin will create new post type for Push notifications wp_apn_notification.

Activation

You can find WordPress Apple Push Notifications Plugin settings page by following url address like this one http://yoursite.com/wp-admin/options-general.php?page=wp-apn

If some requirement is not met, you will see it on settings page:

Error notification

What next?

Check Set Up section to know more about plugin global settings.

Check Troubleshooting if you face some troubles.

Troubleshooting

Is something going wrong?

The theme of APNs is deeper and is out of scope of the documentation of our plugin.

On your way to succeed with APNs you may face some annoying troubles.

Do not despite! We all faced them too :)

Here are some links, which may help you in your business:

If you faced the following error:


	stream_socket_client(): unable to connect to ssl://gateway.push.apple.com:2195 (Permission denied)

Try to check the following things (examples for CentOS):

  • Add/check rule in your server's firewall (e.g. /etc/sysconfig/iptables)

    
    	-A INPUT -p tcp --dport 2195 - J ACCEPT
    

    Do not forget to restart firewall:

    
    	[root]# service iptables restart
    	[root]# service httpd restart
    
  • Check if output network connections allowed on your server:

    
    	[root]# setsebool -P httpd_can_network_connect 1
    

What next?

Check Set Up section to know more about plugin global settings.

Set up

Where to start?

You can find WordPress Apple Push Notifications Plugin settings, requirements and documentation on the page http://yoursite.com/wp-admin/options-general.php?page=wp-apn

In settings you can hide the new post type from the admin menu. This is useful, when you do not want to unnecessary item to take the space of the screen.

You can turn it on again at any moment.

Settings

You can set APN Mode to Sandbox or Production. The certificate and the certificate's password (if set), will be used from the section respectivly.

What next?

Check Usage section to know more about use cases.

Usage

How to use?

Sending
The process of sending push notifications is programmatic. There is no user interface for sending. Please check Advanced Usage section to find how send notifications.
Notifications

You can go to APNs menu item to see the list of sent notifications.

Notifications

What next?

Check Advanced Usage section to get full control on the plugin functionality and look and feel.

Advanced Usage

Are you developer?

So you're developer. We take care about you, no matter, whether you get our plugin from the client or bought it for your purposes. You don't need to change anything inside the plugin (at least we hope so).

You will have full control on the plugin right from other plugin, or theme, or whatever you use in your wordpress.

Code control

You can override any of plugins classes somewhere before the after_setup_theme action:

  • WPAPN_Plugin - some main functions
  • WPAPN_AssetsController - css and js assets including
  • WPAPN_AdminController - admin functions
  • WPAPN_NotificationController - custom APN post type and related functions
  • WPAPN_ApiController - few API functions
  • WPAPN_MyApiController - dummy api class, which extends WPAPN_ApiController. This file is made to be replaced by your own.
We do not store users' device tokens. We assume you'll store device tokens in the wp_usermeta table

To send simple push notifications to the user:


// $user_id - some WordPress user id
// $order_id - some integer
// $Order - some example model
// the key '_ios_device_token' will be searched in the user meta of the user with ID=$user_id; you can
$message = sprintf(__('Your order %s is being made'),'#'.$order_id);
$result = WPAPN_MyApiController::simpleSendToUser($user_id, '_ios_device_token', $message);
if (!$result) {
	$Order->clientNotified($order_id);
}

To send some additional data with push notification:


$notification_id = WPAPN_MyApiController::advancedSendToUser(
	$user_id,
	'_ios_device_token',
	$message,
	array(
		'place_id' => $place_id
	)
);

What next?

Check Support section to get in touch with our support team.

Support

Need support?

Once again, thank you so much for getting our plugin. We would be glad to help you in any questions related to this plugin.

We want to make your plugin usage as much easier as we could.

If you want, you can contact us, you can do this by email: support@teamlead.pw or through the support forum at http://support.wp.teamlead.pw (coming soon)

This plugin is free and we will appreciate any donations from you - Donate us.

Also please find us on CodeCanyon: http://codecanyon.net/user/antongorodezkiy/portfolio

The plugin is Open Source, so feel free to fork us on Guthib: https://github.com/antongorodezkiy/wp-apn

Credits

Sources used

Changelog

Version 1.0

  • The plugin released