$30,00

Category:

Description

Blog Messages is a fast and lightweight WordPress plugin that brings private messaging functionality and features to the users of your WordPress blog.

Main Features

  • Permit your subscribed blog users to search for other users and send them messages on the go
  • Messaging utilities such as read receipts, user blocking, archives, search and more.
  • Customizable email notifications
  • Works with 10 shortcodes available to easily insert content to any section of your website, e.g when using a page builder
  • Fully extensible with hooks and child theme/custom plugin support
  • Loads faster so you wouldn’t have to worry about the performance
  • Loads only when needed, and cached
  • Clean code and responsive design

Blog Messages Customization

Add Chat Link to Comments

The following snippet of code will allow you to place a contact link button after the comment text, to permit the current user to easily navigate to chat with the comment author. The button will also include an unread count if this user has unread messages from the comment author

Add the following code to your child theme’s functions file (functions.php) or with a custom plugin:

add_filter("comment_text", function( $text, $comment = null ) { 
global $current_user;
if ( empty( $current_user->ID ) || !class_exists('BM\Includes\Core\Loader') ) return $text;
$comment->user_id = (int) $comment->user_id;
if ( !empty($comment->user_id) && $comment->user_id !== $current_user->ID ) {
      $user = get_userdata( $comment->user_id );
      if ( empty( $user->ID ) ) return $text;
      $count = (int) do_shortcode( "[bm-chat-unread-count recipient={$user->ID}]" ); // unread count
      $text .= sprintf(
          '

<a href="%s" title="Contact %s" class="btn btn-primary">Send Me a Message!%s</a>

  ',
             do_shortcode( "[bm-chat-link recipient={$user->ID}]" ), // chat link
             $user->display_name, // contact name
             $count ? " (+{$count})" : '' // add unread count if any
           ); 
}
  return $text;
 }, 10, 2);

 

Blog Messages Shortcodes

[blog_messages]

Loads the blog messages template. It is necessary to have this shortcode added to the page content which you set as the messaging page.

[bm-messages-link]

Returns the messages link (URL), where any user can consult their messages or compose new ones.

[bm-chat-link]

Attributes:

recipient: required, user ID for the recipient

Returns a link to the chat shared between the current user and the selected recipient. In other words, directs this user to the chat with the selected target recipient.

[bm-recent-unread-count]

Attributes:

unique: optional,  count one unread message per chat, defaults to true

This will return the count of unread messages which the current user has received. It does not include the ones that were read and marked unread. If the unique property is set to false (e.g unique=0) for the shortcode, it will count the unread chats and not the unread messages.

[bm-unread-count]

Attributes:

unique: optional,  count one unread message per chat, defaults to true

This will return the count of unread messages which the current user has received, and it does include the ones that were read and marked unread. If the unique property is set to false (e.g unique=0) for the shortcode, it will count the unread chats and not the unread messages.

[bm-chat-messages-count]

Attributes:

recipient: required, the  contact user ID
part: optional, defaults to false (all messages)

This counts the messages per chat. The subject chat will be the one shared between the current user and the selected recipient. Set the part property to `received` to count the received messages, `sent` for the sent ones, or leave it empty for the total (sent+received) count.

[bm-chat-unread-count]

Attributes:

recipient: required, user ID for the recipient

Returns the number of unread messages in the chat with a selected recipient.

[bm-chats-count]

Counts all the chats this user has, not including archives.

[bm-archives-count]

Counts all the archived chats this user has.

[bm-all-chats-count]

Counts all the chats this user has, archives included.

[bm-messages-count]

Attributes:

user_id: optional, target user ID, defaults to current user.

Counts all the messages (sent and received) by a given user. If you set the user_id property, it will count messages for that user. Otherwise, if a user is logged in, the count will be for the current logged-in user.

Changelog

v. 0.1 – November 2016

  • Initial “Blog Messages” plugin release