Great plugin. We are making good use of it while we build

Great plugin. We are making good use of it while we build the community of bloggers on our new multisite.

Is it possible to make the inbox w/ # of new messages appear in the top admin nav menu so it can be seen from the front-end?

Thanks

  • DavidM

    Hi Andrew ,

    Going with the method of adding items to the WP toolbar, as the plugin Zyniker mentioned does, you could potentially go right to code and add a toolbar item of your own using something like the following.

    add_action( 'admin_bar_menu', 'toolbar_messaging', 999 );
    
    function toolbar_messaging( $wp_admin_bar ) {
    	global $wpdb, $user_ID;
    	$blog_url = get_bloginfo( 'wpurl' );
    	$tmp_unread_message_count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM " . $wpdb->base_prefix . "messages WHERE message_to_user_ID = %d AND message_status = %s", $user_ID, 'unread'));
    	$args = array(
    		'id'    => 'messaging',
    		'title' => 'Messages: ' . $tmp_unread_message_count,
    		'href'  => $blog_url . '/wp-admin/admin.php?page=messaging',
    		'meta'  => array( 'class' => 'messaging-toolbarr' )
    	);
    	$wp_admin_bar->add_node( $args );
    }

    That just adds a new "node" to the toolbar using the add_node method.

    And it uses the bit of code that Messaging uses to display the current user's unread message count to display that count in the toolbar. It then links right to the Messaging plugin's message page.

    You can easily add that to your site with the Code Snippets plugin:
    http://wordpress.org/plugins/code-snippets/

    Just paste it in as a new Snippet, give it a name, Save and Activate it. :slight_smile:

    Cheers,
    DavidM

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.