BP_Messages_Notices_Admin::admin_index()

Generate content for the bp-notices admin screen.

Description

Source

File: bp-messages/classes/class-bp-messages-notices-admin.php

	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__( 'Site Notices', 'buddyboss' ); ?></h1>
				<hr class="wp-header-end">

			<?php else : ?>

				<h1><?php echo esc_html__( 'Site Notices', 'buddyboss' ); ?></h1>

			<?php endif; ?>

			<p class="bp-notice-about"><?php esc_html_e( 'Manage notices shown on the front end of your site to all logged-in members. Use this to quickly notify all members.', 'buddyboss' ); ?></p>

			<div class="bp-new-notice-panel">

				<h2 class="bp-new-notice"><?php esc_html_e( 'Add New Notice', 'buddyboss' ); ?></h2>

				<form action="<?php echo esc_url( wp_nonce_url( $this->url, 'new-notice', 'ns-nonce' ) ); ?>" method="post">

					<div>
						<label for="bp_notice_subject"><?php esc_html_e( 'Subject', 'buddyboss' ); ?></label>
						<input type="text" class="bp-panel-input" id="bp_notice_subject" name="bp_notice[subject]"/>

						<label for="bp_notice_content"><?php esc_html_e( 'Content', 'buddyboss' ); ?></label>
						<textarea class="bp-panel-textarea" id="bp_notice_content" name="bp_notice[content]"></textarea>
					</div>

					<input type="submit" value="<?php esc_attr_e( 'Publish Notice', 'buddyboss' ); ?>" name="bp_notice[send]" class="button button-primary save alignleft">

				</form>

			</div>

			<?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'] ) ) {
							if ( 'create' === $_GET['error'] ) {
								esc_html_e( 'Notice was not created. Please try again.', 'buddyboss' );
							} else {
								esc_html_e( 'Notice was not updated. Please try again.', 'buddyboss' );
							}
						 } else {
							if ( 'create' === $_GET['success'] ) {
								esc_html_e( 'Notice successfully created.', 'buddyboss' );
							} else {
								esc_html_e( 'Notice successfully updated.', 'buddyboss' );
							}
						}
						?>
					</p>

				</div>

			<?php endif; ?>

			<h2 class="bp-notices-list"><?php esc_html_e( 'Notices List', 'buddyboss' ); ?></h2>

			<?php $this->list_table->display(); ?>

		</div>
		<?php
	}

Changelog

Changelog
Version Description
BuddyPress 3.0.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.