From 66c54be453aa688dfafd033dde5a22a33a8681d5 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Thu, 2 Mar 2017 08:43:01 -0500 Subject: [PATCH] Update the limit field. This is working for editor role vrs admin user. Updating so the field is hidden if non admin user. Uses default value in a define. --- controllers/Admin.php | 6 +++--- glm-simple-messageboard.php | 17 +++++++++-------- views/number.php | 7 +++++-- views/textArea.php | 8 ++++---- 4 files changed, 21 insertions(+), 17 deletions(-) diff --git a/controllers/Admin.php b/controllers/Admin.php index a58b565..f4ee7ff 100644 --- a/controllers/Admin.php +++ b/controllers/Admin.php @@ -160,9 +160,9 @@ class Glmsimplemessageboard_Admin_Controller 'type' => 'number' ), ); - + foreach ($fieldNames as $field) { - + $this->glmsimplemessageboardAddSettingField( $field['name'], $field['label'], @@ -228,7 +228,7 @@ class Glmsimplemessageboard_Admin_Controller wp_enqueue_style('messageboard-admin-css',plugins_url('glm-simple-messageboard/css/admin/admin.css' , $this->pluginDirName)); } public function load_script() - { + { wp_register_script( 'simple-messageboard-admin-js', plugins_url('glm-simple-messageboard/js/admin/admin.js' , $this->pluginDirName), diff --git a/glm-simple-messageboard.php b/glm-simple-messageboard.php index f7024d0..2669d56 100644 --- a/glm-simple-messageboard.php +++ b/glm-simple-messageboard.php @@ -9,13 +9,13 @@ */ /* - * USAGE: - * + * USAGE: + * This part goes into your functions.php - * + * This part goes where you want to display the data
- @@ -44,9 +44,10 @@ */ -define('GLM_SIMPLEMESSAGEBOARD_SETTINGS', 'glmsimplemessageboard_settings'); -define('GLM_SIMPLEMESSAGEBOARD_NEW_CAPABILITY', 'glmsimplemessageboard_edit_messageboard'); -define('GLM_SIMPLEMESSAGEBOARD_BUILT_IN_CAPABILITY', 'edit_posts'); +define( 'GLM_SIMPLEMESSAGEBOARD_SETTINGS', 'glmsimplemessageboard_settings' ); +define( 'GLM_SIMPLEMESSAGEBOARD_NEW_CAPABILITY', 'glmsimplemessageboard_edit_messageboard' ); +define( 'GLM_SIMPLEMESSAGEBOARD_BUILT_IN_CAPABILITY', 'edit_posts' ); +define( 'GLM_SIMPLEMESSAGEBOARD_TEXTAREA_LIMIT_DEFAULT', '250' ); register_activation_hook(__FILE__, array('Glmsimplemessageboard_Admin_Controller', 'activate_plugin')); register_deactivation_hook(__FILE__, array('Glmsimplemessageboard_Admin_Controller', 'deactivate_plugin')); diff --git a/views/number.php b/views/number.php index 9d565ad..05e7035 100644 --- a/views/number.php +++ b/views/number.php @@ -1,9 +1,12 @@ - "> + value="" /> + + + diff --git a/views/textArea.php b/views/textArea.php index fdd41e3..3079705 100644 --- a/views/textArea.php +++ b/views/textArea.php @@ -2,16 +2,16 @@ if ($options && array_key_exists( 'characterlimit', $options ) ) { $characterLimit = $options['characterlimit']; } else { - $characterLimit = "250"; + $characterLimit = GLM_SIMPLEMESSAGEBOARD_TEXTAREA_LIMIT_DEFAULT; } ?>
\ No newline at end of file + -- 2.17.1