diff --git a/admin/admin.php b/admin/admin.php index 92775eec..70c77536 100644 --- a/admin/admin.php +++ b/admin/admin.php @@ -20,6 +20,32 @@ function __construct() { add_action('create_asgarosforum-category', array($this, 'save_category_form_fields')); add_action('edit_asgarosforum-category', array($this, 'save_category_form_fields')); add_action('delete_asgarosforum-category', array($this, 'delete_category'), 10, 3); + + // Moderator stuff + add_action('edit_user_profile', array($this, 'moderator_profile_fields')); + add_action('edit_user_profile_update', array($this, 'moderator_profile_fields_update')); + } + + function moderator_profile_fields($user) { + if (!current_user_can('manage_options')) { + return false; + } + + echo '

'.__('Forum', 'asgaros-forum').'

'; + echo ''; + echo ''; + echo ''; + echo '
'; + echo 'ID ), '1', false).' />'; + echo '
'; + } + + function moderator_profile_fields_update($user_id) { + if (!current_user_can('manage_options')) { + return false; + } + + update_usermeta(absint($user_id), 'asgarosforum_moderator', wp_kses_post($_POST['asgarosforum_moderator'])); } function set_current_menu($parent_file) { diff --git a/admin/views/options.php b/admin/views/options.php index 1986017b..357701e3 100644 --- a/admin/views/options.php +++ b/admin/views/options.php @@ -25,7 +25,7 @@

options['highlight_admin'])); ?> /> - +

options['show_edit_date'])); ?> /> diff --git a/includes/forum.php b/includes/forum.php index 6994ec89..ffcf470f 100644 --- a/includes/forum.php +++ b/includes/forum.php @@ -525,7 +525,14 @@ function get_username($user_id, $wrap = false, $widget = false) { if ($user) { $username = ($wrap) ? wordwrap($user->display_name, 22, "-
", true) : $user->display_name; - $username = ($this->options['highlight_admin'] && user_can($user_id, 'manage_options') && !$widget) ? ''.$username.'' : $username; + + if ($this->options['highlight_admin'] && !$widget) { + if (user_can($user_id, 'manage_options')) { + $username = ''.$username.''; + } else if (get_user_meta($user_id, 'asgarosforum_moderator', true) == 1) { + $username = ''.$username.''; + } + } return $username; } else { @@ -627,7 +634,7 @@ function count_posts_in_forum($forum_id) { function is_moderator() { global $user_ID; - if ($user_ID && is_super_admin($user_ID)) { + if ($user_ID && (is_super_admin($user_ID) || get_user_meta($user_ID, 'asgarosforum_moderator', true) == 1)) { return true; } diff --git a/readme.txt b/readme.txt index 6d5a2048..f055ef4e 100644 --- a/readme.txt +++ b/readme.txt @@ -14,6 +14,7 @@ Asgaros Forum is the perfect WordPress plugin for you if you want to extend your = Features = * Topic/post management (Remove/Edit/Close/Sticky/Move) +* Moderators * Powerful editor * File uploads * Recent Forum Posts Widget @@ -31,6 +32,7 @@ Asgaros Forum is the perfect WordPress plugin for you if you want to extend your * Hungarian * Italian * Russian +* Spanish == Installation == * Download Asgaros Forum. @@ -42,6 +44,8 @@ Asgaros Forum is the perfect WordPress plugin for you if you want to extend your * Done! == Frequently Asked Questions == += Where can I add moderators? = +Moderators can be added via the user edit screen in the WordPress administration interface. = I want help to translate Asgaros Forum = You can help to translate Asgaros Forum on this site: [https://translate.wordpress.org/projects/wp-plugins/asgaros-forum](https://translate.wordpress.org/projects/wp-plugins/asgaros-forum) @@ -55,6 +59,8 @@ You can help to translate Asgaros Forum on this site: 6. Manage general options. == Changelog == +* Added: Moderator functionality +* Added: Spanish translation (thanks to QuqurUxcho) = 1.0.7 = * Fixed: Prevent the creation of empty content * Fixed: Hide widget for guests when access is limited to logged in users diff --git a/skin/style.css b/skin/style.css index 45084380..3806feb5 100644 --- a/skin/style.css +++ b/skin/style.css @@ -23,6 +23,9 @@ #af-wrapper .highlight-admin { color: #e00000; } +#af-wrapper .highlight-moderator { + color: #099922; +} /* EDITOR */ #af-wrapper .editor-row { diff --git a/uninstall.php b/uninstall.php index 8e5c144d..d17f1d80 100644 --- a/uninstall.php +++ b/uninstall.php @@ -15,6 +15,7 @@ // Delete user meta data delete_metadata('user', 0, 'asgarosforum_lastvisit', '', true); +delete_metadata('user', 0, 'asgarosforum_moderator', '', true); // Delete terms $terms = $wpdb->get_results('SELECT t.term_id FROM '.$wpdb->terms.' AS t INNER JOIN '.$wpdb->term_taxonomy.' AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy = "asgarosforum-category";');