<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[BuddyPress][11868] trunk/src: Move Notices Admin from Nouveau to Messages component.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://buddypress.trac.wordpress.org/changeset/11868">11868</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://buddypress.trac.wordpress.org/changeset/11868","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>dcavins</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2018-02-28 19:25:21 +0000 (Wed, 28 Feb 2018)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Move Notices Admin from Nouveau to Messages component.

As part of Nouveau template development, a nice interface
for managing site-wide notifications was created. This commit
moves that interface into BuddyPress proper so it is available
for use with any template.

Props imath, hnla, djpaul, dcavins.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcbpmessagesclassesclassbpmessagescomponentphp">trunk/src/bp-messages/classes/class-bp-messages-component.php</a></li>
<li><a href="#trunksrcbptemplatesbpnouveauincludesmessagesloaderphp">trunk/src/bp-templates/bp-nouveau/includes/messages/loader.php</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunksrcbpmessagesbpmessagesadminphp">trunk/src/bp-messages/bp-messages-admin.php</a></li>
<li><a href="#trunksrcbpmessagesclassesclassbpmessagesnoticesadminphp">trunk/src/bp-messages/classes/class-bp-messages-notices-admin.php</a></li>
<li><a href="#trunksrcbpmessagesclassesclassbpmessagesnoticeslisttablephp">trunk/src/bp-messages/classes/class-bp-messages-notices-list-table.php</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunksrcbptemplatesbpnouveauincludesmessagesclassesphp">trunk/src/bp-templates/bp-nouveau/includes/messages/classes.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcbpmessagesbpmessagesadminphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/src/bp-messages/bp-messages-admin.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-messages/bp-messages-admin.php                               (rev 0)
+++ trunk/src/bp-messages/bp-messages-admin.php 2018-02-28 19:25:21 UTC (rev 11868)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,14 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * BuddyPress Members component admin screens.
+ *
+ * @package BuddyPress
+ * @subpackage Messages
+ * @since 3.0.0
+ */
+
+// Exit if accessed directly.
+defined( 'ABSPATH' ) || exit;
+
+// Load the Sitewide Notices Admin
+add_action( bp_core_admin_hook(), array( 'BP_Messages_Notices_Admin', 'register_notices_admin' ), 9 );
</ins></span></pre></div>
<a id="trunksrcbpmessagesclassesclassbpmessagescomponentphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-messages/classes/class-bp-messages-component.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-messages/classes/class-bp-messages-component.php     2018-02-28 14:48:30 UTC (rev 11867)
+++ trunk/src/bp-messages/classes/class-bp-messages-component.php       2018-02-28 19:25:21 UTC (rev 11868)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -73,6 +73,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">                if ( bp_is_active( $this->id, 'star' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        $includes[] = 'star';
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                if ( is_admin() ) {
+                       $includes[] = 'admin';
+               }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                parent::includes( $includes );
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span></span></pre></div>
<a id="trunksrcbpmessagesclassesclassbpmessagesnoticesadminphpfromrev11867trunksrcbptemplatesbpnouveauincludesmessagesclassesphp"></a>
<div class="copfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: trunk/src/bp-messages/classes/class-bp-messages-notices-admin.php (from rev 11867, trunk/src/bp-templates/bp-nouveau/includes/messages/classes.php)</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-messages/classes/class-bp-messages-notices-admin.php                         (rev 0)
+++ trunk/src/bp-messages/classes/class-bp-messages-notices-admin.php   2018-02-28 19:25:21 UTC (rev 11868)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,207 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * BuddyPress messages component Site-wide Notices admin screen.
+ *
+ *
+ * @package BuddyPress
+ * @subpackage Messages
+ * @since 3.0.0
+ */
+
+// Exit if accessed directly.
+defined( 'ABSPATH' ) || exit;
+
+class BP_Messages_Notices_Admin {
+
+       /**
+        * The ID returned by `add_users_page()`.
+        *
+        * @since 3.0.0
+        * @var string
+        */
+       public $screen_id = '';
+
+       /**
+        * The URL of the admin screen.
+        *
+        * @since 3.0.0
+        * @var string
+        */
+       public $url = '';
+
+       /**
+        * The current instance of the BP_Messages_Notices_List_Table class.
+        *
+        * @since 3.0.0
+        * @var object
+        */
+       public $list_table = '';
+       
+
+       /**
+     * Create a new instance or access the current instance of this class.
+     *
+     * @since 3.0.0
+     */
+       public static function register_notices_admin() {
+
+               if ( ! is_admin() || ! bp_is_active( 'messages' ) || ! bp_current_user_can( 'bp_moderate' ) ) {
+                       return;
+               }
+
+               $bp = buddypress();
+
+               if ( empty( $bp->messages->admin ) ) {
+                       $bp->messages->admin = new self;
+               }
+
+               return $bp->messages->admin;
+       }
+
+       /**
+        * Constructor method.
+        *
+        * @since 3.0.0
+        */
+       public function __construct() {
+               $this->setup_globals();
+               $this->setup_actions();
+       }
+
+       /**
+        * Populate the classs variables.
+        *
+        * @since 3.0.0
+        */
+       protected function setup_globals() {
+               $this->url = add_query_arg( array( 'page' => 'bp-notices' ), bp_get_admin_url( 'users.php' ) );
+       }
+
+       /**
+        * Add action hooks.
+        *
+        * @since 3.0.0
+        */
+       protected function setup_actions() {
+               add_action( bp_core_admin_hook(), array( $this, 'admin_menu' ) );
+       }
+
+       /**
+        * Add the 'All Member Notices' admin menu item.
+        *
+        * @since 3.0.0
+        */
+       public function admin_menu() {
+               // Bail if current user cannot moderate community.
+               if ( ! bp_current_user_can( 'bp_moderate' ) || ! bp_is_active( 'messages' ) ) {
+                       return false;
+               }
+
+               $this->screen_id = add_users_page(
+                       _x( 'All Member Notices', 'Notices admin page title', 'buddypress' ),
+                       _x( 'All Member Notices', 'Admin Users menu', 'buddypress' ),
+                       'manage_options',
+                       'bp-notices',
+                       array( $this, 'admin_index' )
+               );
+
+               add_action( 'load-' . $this->screen_id, array( $this, 'admin_load' ) );
+       }
+
+       /**
+        * Catch save/update requests or load the screen.
+        *
+        * @since 3.0.0
+        */
+       public function admin_load() {
+               if ( ! empty( $_POST['bp_notice']['send'] ) ) {
+                       $notice = wp_parse_args( $_POST['bp_notice'], array(
+                               'subject' => '',
+                               'content' => ''
+                       ) );
+
+                       if ( messages_send_notice( $notice['subject'], $notice['content'] ) ) {
+                               $redirect_to = add_query_arg( 'success', 1, $this->url );
+
+                       // Notice could not be sent.
+                       } else {
+                               $redirect_to = add_query_arg( 'error', 1, $this->url );
+                       }
+
+                       wp_safe_redirect( $redirect_to );
+                       exit();
+               }
+
+               $this->list_table = new BP_Messages_Notices_List_Table( array( 'screen' => get_current_screen()->id ) );
+       }
+
+       /**
+        * Generate content for the bp-notices admin screen.
+        *
+        * @since 3.0.0
+        */
+       public function admin_index() {
+               $this->list_table->prepare_items();
+               ?>
+               <div class="wrap">
+                       <?php if ( version_compare( $GLOBALS['wp_version'], '4.8', '>=' ) ) : ?>
+
+                               <h1 class="wp-heading-inline"><?php echo esc_html_x( 'All Member Notices', 'Notices admin page title', 'buddypress' ); ?></h1>
+
+                                       <a id="add_notice" class="page-title-action" href="#"><?php esc_html_e( 'Add New Notice', 'buddypress' ); ?></a>
+
+                               <hr class="wp-header-end">
+
+                       <?php else : ?>
+
+                               <h1>
+                                       <?php echo esc_html_x( 'All Member Notices', 'Notices admin page title', 'buddypress' ); ?>
+                                       <a id="add_notice" class="add-new-h2" href="#"><?php esc_html_e( 'Add New Notice', 'buddypress' ); ?></a>
+                               </h1>
+
+                       <?php endif; ?>
+
+                       <form action=<?php echo esc_url( $this->url ); ?> method="post">
+                               <table class="widefat">
+                                       <tr>
+                                               <td><label for="bp_notice_subject"><?php esc_html_e( 'Subject', 'buddypress' ); ?></label></td>
+                                               <td><input type="text" class="widefat" id="bp_notice_subject" name="bp_notice[subject]"/></td>
+                                       </tr>
+                                       <tr>
+                                               <td><label for="bp_notice_content"><?php esc_html_e( 'Content', 'buddypress' ); ?></label></td>
+                                               <td><textarea class="widefat" id="bp_notice_content" name="bp_notice[content]"></textarea></td>
+                                       </tr>
+                                       <tr class="submit">
+                                               <td>&nbsp;</td>
+                                               <td style="float:right">
+                                                       <input type="reset" value="<?php esc_attr_e( 'Cancel Notice', 'buddypress' ); ?>" class="button-secondary">
+                                                       <input type="submit" value="<?php esc_attr_e( 'Save Notice', 'buddypress' ); ?>" name="bp_notice[send]" class="button-primary">
+                                               </td>
+                                       </tr>
+                               </table>
+                       <form>
+
+                       <?php if ( isset( $_GET['success'] ) || isset( $_GET['error'] ) ) : ?>
+
+                               <div id="message" class="<?php echo isset( $_GET['success'] ) ? 'updated' : 'error'; ?>">
+
+                                       <p>
+                                               <?php
+                                               if ( isset( $_GET['error'] ) ) :
+                                                       esc_html_e( 'Notice was not created. Please try again.', 'buddypress' );
+                                               else :
+                                                       esc_html_e( 'Notice successfully created.', 'buddypress' );
+                                               endif;
+                                               ?>
+                                       </p>
+
+                               </div>
+
+                       <?php endif; ?>
+
+                       <?php $this->list_table->display(); ?>
+
+               </div>
+               <?php
+       }
+}
</ins></span></pre></div>
<a id="trunksrcbpmessagesclassesclassbpmessagesnoticeslisttablephp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/src/bp-messages/classes/class-bp-messages-notices-list-table.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-messages/classes/class-bp-messages-notices-list-table.php                            (rev 0)
+++ trunk/src/bp-messages/classes/class-bp-messages-notices-list-table.php      2018-02-28 19:25:21 UTC (rev 11868)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,153 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * BuddyPress messages admin site-wide notices list table class.
+ *
+ * @package BuddyPress
+ * @subpackage Messages
+ * @since 3.0.0
+ */
+
+// Exit if accessed directly.
+defined( 'ABSPATH' ) || exit;
+
+// Include WP's list table class.
+if ( ! class_exists( 'WP_List_Table' ) ) {
+       require( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
+}
+
+class BP_Messages_Notices_List_Table extends WP_List_Table {
+       
+       /**
+        * Constructor
+        *
+        * @since 3.0.0
+        */
+       public function __construct( $args = array() ) {
+               parent::__construct(
+                       array(
+                               'plural'   => 'notices',
+                               'singular' => 'notice',
+                               'ajax'     => true,
+                               'screen'   => isset( $args['screen'] ) ? $args['screen'] : null,
+                       )
+               );
+       }
+
+       /**
+        * Checks the current user's permissions
+        *
+        * @since 3.0.0
+        */
+       public function ajax_user_can() {
+               return bp_current_user_can( 'bp_moderate' );
+       }
+
+       /**
+        * Set up items for display in the list table.
+        *
+        * Handles filtering of data, sorting, pagination, and any other data
+        * manipulation required prior to rendering.
+        *
+        * @since 3.0.0
+        */
+       public function prepare_items() {
+               $page     = $this->get_pagenum();
+               $per_page = $this->get_items_per_page( 'bp_notices_per_page' );
+
+               $this->items = BP_Messages_Notice::get_notices( array(
+                       'pag_num'  => $per_page,
+                       'pag_page' => $page
+               ) );
+
+               $this->set_pagination_args( array(
+                       'total_items' => BP_Messages_Notice::get_total_notice_count(),
+                       'per_page' => $per_page,
+               ) );
+       }
+
+       /**
+        * Get a list of columns. The format is:
+        * 'internal-name' => 'Title'
+        *
+        * @since 3.0.0
+        *
+        * @return array
+        */
+       public function get_columns() {
+               return apply_filters( 'bp_notices_list_table_get_columns', array(
+                       'subject'   => _x( 'Subject', 'Admin Notices column header', 'buddypress' ),
+                       'message'   => _x( 'Content', 'Admin Notices column header', 'buddypress' ),
+                       'date_sent' => _x( 'Created', 'Admin Notices column header', 'buddypress' ),
+               ) );
+       }
+
+       /**
+        * Generates content for a single row of the table
+        *
+        * @since 3.0.0
+        *
+        * @param object $item The current item
+        */
+       public function single_row( $item ) {
+               $class = '';
+
+               if ( ! empty( $item->is_active ) ) {
+                       $class = ' class="notice-active"';
+               }
+
+               echo "<tr{$class}>";
+               $this->single_row_columns( $item );
+               echo '</tr>';
+       }
+
+       /**
+        * Generates content for the "subject" column.
+        *
+        * @since 3.0.0
+        *
+        * @param object $item The current item
+        */
+       public function column_subject( $item ) {
+               $actions = array(
+                       'activate_deactivate' => '<a href="' . esc_url( wp_nonce_url( add_query_arg( array(
+                               'page' => 'bp-notices',
+                               'activate' => $item->id
+                       ), bp_get_admin_url( 'users.php' ) ) ), 'messages_activate_notice' ) . '" data-bp-notice-id="' . $item->id . '" data-bp-action="activate">' . esc_html__( 'Activate Notice', 'buddypress' ) . '</a>',
+                       'delete' => '<a href="' . esc_url( wp_nonce_url( add_query_arg( array(
+                               'page' => 'bp-notices',
+                               'delete' => $item->id
+                       ), bp_get_admin_url( 'users.php' ) ) ), 'messages_delete_thread' ) . '" data-bp-notice-id="' . $item->id . '" data-bp-action="delete">' . esc_html__( 'Delete Notice', 'buddypress' ) . '</a>',
+               );
+
+               if ( ! empty( $item->is_active ) ) {
+                       $actions['activate_deactivate'] = '<a href="' . esc_url( wp_nonce_url( add_query_arg( array(
+                               'page' => 'bp-notices',
+                               'deactivate' => $item->id
+                       ), bp_get_admin_url( 'users.php' ) ) ), 'messages_deactivate_notice' ) . '" data-bp-notice-id="' . $item->id . '" data-bp-action="deactivate">' . esc_html__( 'Deactivate Notice', 'buddypress' ) . '</a>';
+               }
+
+               echo '<strong>' . apply_filters( 'bp_get_message_notice_subject', $item->subject ) . '</strong> ' . $this->row_actions( $actions );
+       }
+
+       /**
+        * Generates content for the "message" column.
+        *
+        * @since 3.0.0
+        *
+        * @param object $item The current item
+        */
+       public function column_message( $item ) {
+               echo apply_filters( 'bp_get_message_notice_text', $item->message );
+       }
+
+       /**
+        * Generates content for the "date_sent" column.
+        *
+        * @since 3.0.0
+        *
+        * @param object $item The current item
+        */
+       public function column_date_sent( $item ) {
+               echo apply_filters( 'bp_get_message_notice_post_date', bp_format_time( strtotime( $item->date_sent ) ) );
+       }
+}
</ins></span></pre></div>
<a id="trunksrcbptemplatesbpnouveauincludesmessagesclassesphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: trunk/src/bp-templates/bp-nouveau/includes/messages/classes.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-templates/bp-nouveau/includes/messages/classes.php   2018-02-28 14:48:30 UTC (rev 11867)
+++ trunk/src/bp-templates/bp-nouveau/includes/messages/classes.php     2018-02-28 19:25:21 UTC (rev 11868)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,236 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-/**
- * Mesages classes
- *
- * @since 1.0.0
- */
-
-// Exit if accessed directly.
-defined( 'ABSPATH' ) || exit;
-
-if ( is_admin() && current_user_can( 'activate_plugins' ) ) :
-
-       class BP_Nouveau_Notices_List_Table extends WP_List_Table {
-               public function __construct( $args = array() ) {
-                       parent::__construct(
-                               array(
-                                       'plural'   => 'notices',
-                                       'singular' => 'notice',
-                                       'ajax'     => true,
-                                       'screen'   => isset( $args['screen'] ) ? $args['screen'] : null,
-                               )
-                       );
-               }
-
-               public function ajax_user_can() {
-                       return bp_current_user_can( 'bp_moderate' );
-               }
-
-               public function prepare_items() {
-                       $page     = $this->get_pagenum();
-                       $per_page = $this->get_items_per_page( 'bp_nouveau_notices_per_page' );
-
-                       $this->items = BP_Messages_Notice::get_notices( array(
-                               'pag_num'  => $per_page,
-                               'pag_page' => $page
-                       ) );
-
-                       $this->set_pagination_args( array(
-                               'total_items' => BP_Messages_Notice::get_total_notice_count(),
-                               'per_page' => $per_page,
-                       ) );
-               }
-
-               public function get_columns() {
-                       return apply_filters( 'bp_nouveau_notices_list_table_get_columns', array(
-                               'subject'   => _x( 'Subject', 'Admin Notices column header', 'buddypress' ),
-                               'message'   => _x( 'Content', 'Admin Notices column header', 'buddypress' ),
-                               'date_sent' => _x( 'Created', 'Admin Notices column header', 'buddypress' ),
-                       ) );
-               }
-
-               public function single_row( $item ) {
-                       $class = '';
-
-                       if ( ! empty( $item->is_active ) ) {
-                               $class = ' class="notice-active"';
-                       }
-
-                       echo "<tr{$class}>";
-                       $this->single_row_columns( $item );
-                       echo '</tr>';
-               }
-
-               public function column_subject( $item ) {
-                       $actions = array(
-                               'activate_deactivate' => '<a href="' . esc_url( wp_nonce_url( add_query_arg( array(
-                                       'page' => 'bp-notices',
-                                       'activate' => $item->id
-                               ), bp_get_admin_url( 'users.php' ) ) ), 'messages_activate_notice' ) . '" data-bp-notice-id="' . $item->id . '" data-bp-action="activate">' . esc_html__( 'Activate Notice', 'buddypress' ) . '</a>',
-                               'delete' => '<a href="' . esc_url( wp_nonce_url( add_query_arg( array(
-                                       'page' => 'bp-notices',
-                                       'delete' => $item->id
-                               ), bp_get_admin_url( 'users.php' ) ) ), 'messages_delete_thread' ) . '" data-bp-notice-id="' . $item->id . '" data-bp-action="delete">' . esc_html__( 'Delete Notice', 'buddypress' ) . '</a>',
-                       );
-
-                       if ( ! empty( $item->is_active ) ) {
-                               $actions['activate_deactivate'] = '<a href="' . esc_url( wp_nonce_url( add_query_arg( array(
-                                       'page' => 'bp-notices',
-                                       'deactivate' => $item->id
-                               ), bp_get_admin_url( 'users.php' ) ) ), 'messages_deactivate_notice' ) . '" data-bp-notice-id="' . $item->id . '" data-bp-action="deactivate">' . esc_html__( 'Deactivate Notice', 'buddypress' ) . '</a>';
-                       }
-
-                       echo '<strong>' . apply_filters( 'bp_get_message_notice_subject', $item->subject ) . '</strong> ' . $this->row_actions( $actions );
-               }
-
-               public function column_message( $item ) {
-                       echo apply_filters( 'bp_get_message_notice_text', $item->message );
-               }
-
-               public function column_date_sent( $item ) {
-                       echo apply_filters( 'bp_get_message_notice_post_date', bp_format_time( strtotime( $item->date_sent ) ) );
-               }
-       }
-endif;
-
-
-class BP_Nouveau_Admin_Notices {
-
-       public static function register_notices_admin() {
-               if ( ! is_admin() || ! bp_is_active( 'messages' ) ) {
-                       return;
-               }
-
-               $bp = buddypress();
-
-               if ( empty( $bp->messages->admin ) ) {
-                       $bp->messages->admin = new self;
-               }
-
-               return $bp->messages->admin;
-       }
-
-       /**
-        * Constructor method.
-        *
-        * @since 2.0.0
-        */
-       public function __construct() {
-               $this->setup_globals();
-               $this->setup_actions();
-       }
-
-       protected function setup_globals() {
-               $this->screen_id = '';
-               $this->url       = add_query_arg( array( 'page' => 'bp-notices' ), bp_get_admin_url( 'users.php' ) );
-       }
-
-       protected function setup_actions() {
-               add_action( bp_core_admin_hook(), array( $this, 'admin_menu' ) );
-       }
-
-       public function admin_menu() {
-               // Bail if current user cannot moderate community.
-               if ( ! bp_current_user_can( 'bp_moderate' ) || ! bp_is_active( 'messages' ) ) {
-                       return false;
-               }
-
-               $this->screen_id = add_users_page(
-                       _x( 'All Member Notices', 'Notices admin page title', 'buddypress' ),
-                       _x( 'All Member Notices', 'Admin Users menu', 'buddypress' ),
-                       'manage_options',
-                       'bp-notices',
-                       array( $this, 'admin_index' )
-               );
-
-               add_action( 'load-' . $this->screen_id, array( $this, 'admin_load' ) );
-       }
-
-       public function admin_load() {
-               if ( ! empty( $_POST['bp_notice']['send'] ) ) {
-                       $notice = wp_parse_args( $_POST['bp_notice'], array(
-                               'subject' => '',
-                               'content' => ''
-                       ) );
-
-                       if ( messages_send_notice( $notice['subject'], $notice['content'] ) ) {
-                               $redirect_to = add_query_arg( 'success', 1, $this->url );
-
-                       // Notice could not be sent.
-                       } else {
-                               $redirect_to = add_query_arg( 'error', 1, $this->url );
-                       }
-
-                       wp_safe_redirect( $redirect_to );
-                       exit();
-               }
-
-               $this->list_table = new BP_Nouveau_Notices_List_Table( array( 'screen' => get_current_screen()->id ) );
-       }
-
-       public function admin_index() {
-               $this->list_table->prepare_items();
-               ?>
-               <div class="wrap">
-                       <?php if ( version_compare( $GLOBALS['wp_version'], '4.8', '>=' ) ) : ?>
-
-                               <h1 class="wp-heading-inline"><?php echo esc_html_x( 'All Member Notices', 'Notices admin page title', 'buddypress' ); ?></h1>
-
-                                       <a id="add_notice" class="page-title-action" href="#"><?php esc_html_e( 'Add New Notice', 'buddypress' ); ?></a>
-
-                               <hr class="wp-header-end">
-
-                       <?php else : ?>
-
-                               <h1>
-                                       <?php echo esc_html_x( 'All Member Notices', 'Notices admin page title', 'buddypress' ); ?>
-                                       <a id="add_notice" class="add-new-h2" href="#"><?php esc_html_e( 'Add New Notice', 'buddypress' ); ?></a>
-                               </h1>
-
-                       <?php endif; ?>
-
-                       <form action=<?php echo esc_url( $this->url ); ?> method="post">
-                               <table class="widefat">
-                                       <tr>
-                                               <td><label for="bp_notice_subject"><?php esc_html_e( 'Subject', 'buddypress' ); ?></label></td>
-                                               <td><input type="text" class="widefat" id="bp_notice_subject" name="bp_notice[subject]"/></td>
-                                       </tr>
-                                       <tr>
-                                               <td><label for="bp_notice_content"><?php esc_html_e( 'Content', 'buddypress' ); ?></label></td>
-                                               <td><textarea class="widefat" id="bp_notice_content" name="bp_notice[content]"></textarea></td>
-                                       </tr>
-                                       <tr class="submit">
-                                               <td>&nbsp;</td>
-                                               <td style="float:right">
-                                                       <input type="reset" value="<?php esc_attr_e( 'Cancel Notice', 'buddypress' ); ?>" class="button-secondary">
-                                                       <input type="submit" value="<?php esc_attr_e( 'Save Notice', 'buddypress' ); ?>" name="bp_notice[send]" class="button-primary">
-                                               </td>
-                                       </tr>
-                               </table>
-                       <form>
-
-                       <?php if ( isset( $_GET['success'] ) || isset( $_GET['error'] ) ) : ?>
-
-                               <div id="message" class="<?php echo isset( $_GET['success'] ) ? 'updated' : 'error'; ?>">
-
-                                       <p>
-                                               <?php
-                                               if ( isset( $_GET['error'] ) ) :
-                                                       esc_html_e( 'Notice was not created. Please try again.', 'buddypress' );
-                                               else :
-                                                       esc_html_e( 'Notice successfully created.', 'buddypress' );
-                                               endif;
-                                               ?>
-                                       </p>
-
-                               </div>
-
-                       <?php endif; ?>
-
-                       <?php $this->list_table->display(); ?>
-
-               </div>
-               <?php
-       }
-}
-add_action( 'bp_init', array( 'BP_Nouveau_Admin_Notices', 'register_notices_admin' ) );
</del></span></pre></div>
<a id="trunksrcbptemplatesbpnouveauincludesmessagesloaderphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-templates/bp-nouveau/includes/messages/loader.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-templates/bp-nouveau/includes/messages/loader.php    2018-02-28 14:48:30 UTC (rev 11867)
+++ trunk/src/bp-templates/bp-nouveau/includes/messages/loader.php      2018-02-28 19:25:21 UTC (rev 11868)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -41,7 +41,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @since 1.0.0
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        protected function includes() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                require $this->dir . 'classes.php';
</del><span class="cx" style="display: block; padding: 0 10px">                 require $this->dir . 'functions.php';
</span><span class="cx" style="display: block; padding: 0 10px">                require $this->dir . 'template-tags.php';
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre>
</div>
</div>

</body>
</html>