$options = get_option('bei_options'); add_action('admin_menu', 'instructions_admin_add_options'); // start 'er up! function instructions_admin_add_options() { add_options_page('Back End Instructions', 'Back End Instructions', 'manage_options', 'bei', 'bei_options_page'); } function bei_options_page() { // the actual page contents ?>

Back End Instructions

There aren't too many default settings for the Back End Instructions, but it makes life easier to have them here.

Choose the lowest level logged-in user to create/edit/delete Instructions.', 'bei_languages'); if(is_multisite()) { // test that this is a multi-site install echo ' Super Administrator (for multi-site only)
'; } echo ' Administrator'; echo '
Editor'; echo '
Author'; } function bei_setting_string_public() { global $options; $permalink = get_option("home") . '/wp-admin/options-permalink.php'; echo sprintf(__('Check "yes" if you\'d like to make your instructions viewable on the front end of the site.
PLEASE NOTE: The first time you change this option, you WILL have to re-save your permalink settings for this to take effect. You may not ever have to do it again, but if you find you have issues after swapping back and forth, then try resetting them again to see if it helps.
', 'bei_languages'), $permalink); if(!isset($options['public'])) $options['public'] = 'no'; echo ' Yes'; echo '     No'; } function bei_setting_string_private() { global $options; echo __('Check "yes" if you\'d like to make front-end instructions visible only to logged-in users.
PLEASE NOTE: if you check "yes" ANYONE can see ALL of these instructions. See the next option to help with that a bit.
', 'bei_languages'); echo ' Yes'; echo '     No'; } function bei_setting_string_view() { global $options; echo __('You only need to choose an option from this dropdown if you set "Show in front?" to "yes" AND "Logged-in users only?" to "no". If this option were not here, then ANY visitor to the site could see ALL instructions just by visiting the page. If the user is logged in, they would see only instructions that were available to their level, but if they aren\'t, they would see them for ALL levels. This option will allow you to treat a non-logged-in user as if they have a user level. The default is "Contributor."', 'bei_languages'); // setup array $choices = array(); if(is_multisite()) { // test that this is a multi-site install $choices['Super Administrator'] = 'manage_networks'; } $choices['Administrator'] = 'activate_plugins'; $choices['Editor'] = 'edit_others_posts'; $choices['Author'] = 'delete_published_posts'; $choices['Contributor'] = 'delete_posts'; $choices['Subscriber'] = 'read'; echo '

' . "\n"; } function bei_options_validate($input) { isset($input['admin']) ? $newinput['admin'] = trim($input['admin']) : $newinput['admin'] = ''; isset($input['public']) ? $newinput['public'] = trim($input['public']) : $newinput['public'] = ''; isset($input['registered']) ? $newinput['registered'] = trim($input['registered']) : $newinput['registered'] = ''; isset($input['view']) ? $newinput['view'] = trim($input['view']) : $newinput['view'] = ''; return $newinput; }