- Timestamp:
- 02/28/2018 07:25:32 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-messages/classes/class-bp-messages-notices-admin.php
r11869 r11870 115 115 */ 116 116 public function admin_load() { 117 $redirect_to = false; 118 119 // Catch new notice saves. 117 120 if ( ! empty( $_POST['bp_notice']['send'] ) ) { 118 121 … … 125 128 126 129 if ( messages_send_notice( $notice['subject'], $notice['content'] ) ) { 127 $redirect_to = add_query_arg( 'success', 1, $this->url );130 $redirect_to = add_query_arg( 'success', 'create', $this->url ); 128 131 129 132 // Notice could not be sent. 130 133 } else { 131 $redirect_to = add_query_arg( 'error', 1, $this->url );134 $redirect_to = add_query_arg( 'error', 'create', $this->url ); 132 135 } 133 136 } 137 138 // Catch activation/deactivation/delete requests 139 if ( ! empty( $_GET['notice_id'] ) && ! empty( $_GET['notice_action'] ) ) { 140 $notice_id = absint( $_GET['notice_id'] ); 141 142 check_admin_referer( 'messages-' . $_GET['notice_action'] . '-notice-' . $notice_id ); 143 144 $success = false; 145 switch ( $_GET['notice_action'] ) { 146 case 'activate': 147 $notice = new BP_Messages_Notice( $notice_id ); 148 $success = $notice->activate(); 149 break; 150 case 'deactivate': 151 $notice = new BP_Messages_Notice( $notice_id ); 152 $success = $notice->deactivate(); 153 break; 154 case 'delete': 155 $notice = new BP_Messages_Notice( $notice_id ); 156 $success = $notice->delete(); 157 break; 158 } 159 if ( $success ) { 160 $redirect_to = add_query_arg( 'success', 'update', $this->url ); 161 162 // Notice could not be updated. 163 } else { 164 $redirect_to = add_query_arg( 'error', 'update', $this->url ); 165 } 166 167 } 168 169 if ( $redirect_to ) { 134 170 wp_safe_redirect( $redirect_to ); 135 171 exit(); … … 191 227 <p> 192 228 <?php 193 if ( isset( $_GET['error'] ) ) : 194 esc_html_e( 'Notice was not created. Please try again.', 'buddypress' ); 195 else : 196 esc_html_e( 'Notice successfully created.', 'buddypress' ); 197 endif; 229 if ( isset( $_GET['error'] ) ) { 230 if ( 'create' === $_GET['error'] ) { 231 esc_html_e( 'Notice was not created. Please try again.', 'buddypress' ); 232 } else { 233 esc_html_e( 'Notice was not updated. Please try again.', 'buddypress' ); 234 } 235 } else { 236 if ( 'create' === $_GET['success'] ) { 237 esc_html_e( 'Notice successfully created.', 'buddypress' ); 238 } else { 239 esc_html_e( 'Notice successfully updated.', 'buddypress' ); 240 } 241 } 198 242 ?> 199 243 </p>
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)