P2 is a popular Twitter inspired group blogging theme with hassle free front-end posting, live replies, tags and fully dynamic display with threaded comments etc. This tutorial is on new addon P2 plugin called P2 By Email, the plugin fully integrates your P2 theme with email and it makes it perfect for communicating with your team on the go.
With this plugin you can use P2 by email for:
- Getting instant notifications when posts or comments are published.
- Ensure you are always notified when your username is mentioned.
- Yon can reply to posts or comments by email.
- Create new posts with a secret email address.
Install and activate it, after activation by by default your all P2 blog users will start receiving all post and comment notifications.
But to enable post or reply via email, follow a few more steps:
- Register a Gmail or similar email account that supports IMAP.
- Add the code snippet below with account details to your theme’s functions.php file. It tells P2 By Email that you’re set up to use post or reply by email.
- Install wp-cli and set up a system cron job to regularly call
wp p2-by-email ingest-emails
.
add_filter( 'p2be_email_replies_enabled', '__return_true' );
add_filter( 'p2be_emails_reply_to_email', function( $email ) {
return 'YOURACCOUNT@gmail.com';
});
add_filter( 'p2be_imap_connection_details', function( $details ) {
$details['host'] = '{imap.gmail.com:993/imap/ssl/novalidate-cert}';
$details['username'] = 'YOURACCOUNT@gmail.com';
$details['password'] = 'PASSWORD';
return $details;
} );