added ability to dismiss the tagline admin notice (thx http://wptheming.com/2011/08/admin-notices-in-wordpress/), made the htaccess notice only show for admins

This commit is contained in:
Ben Word
2011-08-28 14:41:54 -06:00
parent 031a886bb5
commit daff3bcb0b
2 changed files with 20 additions and 4 deletions

View File

@@ -392,15 +392,29 @@ add_filter('comment_id_fields', 'roots_remove_self_closing_tags');
// show an admin notice to update if it hasn't been changed
// you want to change this or remove it because it's used as the description in the RSS feed
function roots_notice_tagline() {
echo '<div class="error">';
echo '<p>', sprintf(__('Please update your <a href="%s">site tagline</a>', 'roots'), admin_url('options-general.php')), '</p>';
echo '</div>';
global $current_user;
$user_id = $current_user->ID;
if (!get_user_meta($user_id, 'ignore_tagline_notice')) {
echo '<div class="error">';
echo '<p>', sprintf(__('Please update your <a href="%s">site tagline</a> <a href="%s" style="float: right;">Hide Notice</a>', 'roots'), admin_url('options-general.php'), '?tagline_notice_ignore=0'), '</p>';
echo '</div>';
}
}
if (get_option('blogdescription') === 'Just another WordPress site') {
add_action('admin_notices', 'roots_notice_tagline');
}
function roots_notice_tagline_ignore() {
global $current_user;
$user_id = $current_user->ID;
if (isset($_GET['tagline_notice_ignore']) && '0' == $_GET['tagline_notice_ignore']) {
add_user_meta($user_id, 'ignore_tagline_notice', 'true', true);
}
}
add_action('admin_init', 'roots_notice_tagline_ignore');
// set the post revisions to 5 unless the constant
// was set in wp-config.php to avoid DB bloat
if (!defined('WP_POST_REVISIONS')) define('WP_POST_REVISIONS', 5);

View File

@@ -3,7 +3,9 @@
if (stristr($_SERVER['SERVER_SOFTWARE'], 'apache') !== false) {
function roots_htaccess_writable() {
if (!is_writable(get_home_path() . '.htaccess')) {
add_action('admin_notices', create_function('', "echo '<div class=\"error\"><p>" . sprintf(__('Please make sure your <a href="%s">.htaccess</a> file is writeable ', 'roots'), admin_url('options-permalink.php')) . "</p></div>';"));
if (current_user_can('administrator')) {
add_action('admin_notices', create_function('', "echo '<div class=\"error\"><p>" . sprintf(__('Please make sure your <a href="%s">.htaccess</a> file is writable ', 'roots'), admin_url('options-permalink.php')) . "</p></div>';"));
}
};
}