mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-20 07:04:06 +09:00
first sync
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
class UM_Admin_Notices {
|
||||
|
||||
function __construct() {
|
||||
|
||||
add_action('admin_notices', array(&$this, 'admin_notices'));
|
||||
|
||||
add_action('admin_notices', array(&$this, 'um_admin_notices'));
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @For core admin notices
|
||||
***/
|
||||
function admin_notices(){
|
||||
|
||||
if ( !isset($_REQUEST['update']) ) return;
|
||||
|
||||
$update = $_REQUEST['update'];
|
||||
|
||||
switch($update) {
|
||||
|
||||
case 'user_updated':
|
||||
$messages[0]['content'] = __('User has been updated.','ultimatemember');
|
||||
break;
|
||||
|
||||
case 'users_updated':
|
||||
$messages[0]['content'] = __('Users have been updated.','ultimatemember');
|
||||
break;
|
||||
|
||||
case 'err_users_updated':
|
||||
$messages[0]['err_content'] = __('Super administrators cannot be modified.','ultimatemember');
|
||||
$messages[1]['content'] = __('Other users have been updated.','ultimatemember');
|
||||
|
||||
}
|
||||
|
||||
if ( !empty( $messages ) ) {
|
||||
foreach( $messages as $message ) {
|
||||
if ( isset($message['err_content'])) {
|
||||
echo '<div id="message" class="error"><p>' . $message['err_content'] . '</p></div>';
|
||||
} else {
|
||||
echo '<div id="message" class="updated"><p>' . $message['content'] . '</p></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*** @For custom-styled notices
|
||||
***/
|
||||
function um_admin_notices() {
|
||||
|
||||
$notices = get_option('um_admin_notices');
|
||||
if ( $notices ) {
|
||||
|
||||
foreach($notices as $notice){
|
||||
echo "<div class='um-admin-notice'>
|
||||
<div>$notice</div>
|
||||
</div>";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user