function load_conversation()
 {
     if (!wp_verify_nonce(mmg()->post('_wpnonce'), 'mm_load_conversation')) {
         exit;
     }
     $id = mmg()->decrypt(mmg()->post('id'));
     $model = MM_Conversation_Model::model()->find($id);
     $html = $this->render_inbox_message($model);
     if (!$model->is_archive()) {
         $model->mark_as_read();
         do_action('mm_conversation_read', $model);
     }
     wp_send_json(array('html' => $html, 'count_unread' => MM_Conversation_Model::count_unread(true), 'count_read' => MM_Conversation_Model::count_read(true)));
     exit;
 }
    function notification_buttons($wp_admin_bar)
    {
        //create new menu
        $unread = MM_Conversation_Model::count_unread();
        $args = array('id' => 'mm-button', 'title' => __('<div class="ig-container mm-admin-bar"><i class="fa fa-envelope"></i>&nbsp;<span>' . $unread . '</span>
</div>', mmg()->domain), 'href' => '#');
        $wp_admin_bar->add_menu($args);
        //create group
        $args = array('id' => 'mm-buttons-group', 'parent' => 'mm-button');
        $wp_admin_bar->add_group($args);
        //add node send new message
        $args = array('id' => 'mm-compose-button', 'title' => __("Send New Message", mmg()->domain), 'href' => '#compose-form-container-admin-bar', 'parent' => 'mm-buttons-group', 'meta' => array('class' => 'mm-compose-admin-bar'));
        $wp_admin_bar->add_node($args);
        //add node inbox page
        $args = array('id' => 'mm-inbox-button', 'title' => __("View Inbox", mmg()->domain), 'href' => get_permalink(mmg()->setting()->inbox_page), 'parent' => 'mm-buttons-group', 'meta' => array('class' => 'mm-view-inbox-admin-bar'));
        $wp_admin_bar->add_node($args);
    }
Example #3
0
                        </a>
                        <a href="<?php 
    echo add_query_arg('box', 'unread', get_permalink(mmg()->setting()->inbox_page));
    ?>
"
                           class="mm-tooltip unread-count btn btn-default btn-sm <?php 
    echo mmg()->get('box') == 'unread' ? 'active' : null;
    ?>
"

                           data-text="<?php 
    _e("message(s)", mmg()->domain);
    ?>
"
                           title="<?php 
    echo MM_Conversation_Model::count_unread();
    ?>
 <?php 
    _e("message(s)", mmg()->domain);
    ?>
">
                            <i class="fa fa-envelope"></i> <?php 
    _e("Unread", mmg()->domain);
    ?>
                        </a>
                        <a href="<?php 
    echo add_query_arg('box', 'read', get_permalink(mmg()->setting()->inbox_page));
    ?>
"
                           class="mm-tooltip btn read-count btn-default btn-sm <?php 
    echo mmg()->get('box') == 'read' ? 'active' : null;