| 1 | <?php |
| 2 | /***************************************************************************************** |
| 3 | * Settings Sections |
| 4 | *******************************************************************************************/ |
| 5 | // Add a form section for the Gravatar Display |
| 6 | add_settings_section('dnxup_settings_gravatar_display', __('Gravatar setting', 'dnxup'), 'dnxup_settings_gravatar_section_text', 'dnxup_settings_sections'); |
| 7 | |
| 8 | // Add a form section for the Logged out Heading |
| 9 | add_settings_section('dnxup_settings_log_out_heading_display', __('Logged out Heading', 'dnxup'), 'dnxup_settings_log_out_heading_section_text', 'dnxup_settings_sections'); |
| 10 | |
| 11 | // Add a form section for the Logged in Heading |
| 12 | add_settings_section('dnxup_settings_log_in_heading_display', __('Logged in Heading', 'dnxup'), 'dnxup_settings_log_in_heading_section_text', 'dnxup_settings_sections'); |
| 13 | |
| 14 | // Add a form section for the Logged in Custom Links |
| 15 | add_settings_section('dnxup_settings_log_in_custom_links_display', __('Logged in Custom Links', 'dnxup'), 'dnxup_settings_log_in_custom_links_section_text', 'dnxup_settings_sections'); |
| 16 | |
| 17 | |
| 18 | /***************************************************************************************** |
| 19 | * Settings Fields |
| 20 | *******************************************************************************************/ |
| 21 | // Add Gravatar Display field to his section |
| 22 | add_settings_field('dnxup_setting_gravatar_display', __('Display Gravatar?', 'dnxup'), 'dnxup_setting_gravatar_display', 'dnxup_settings_sections', 'dnxup_settings_gravatar_display'); |
| 23 | |
| 24 | // Add Logged out Heading field to his section |
| 25 | add_settings_field('dnxup_setting_log_out_heading_display', __('Logged out Heading', 'dnxup'), 'dnxup_setting_log_out_heading_display', 'dnxup_settings_sections', 'dnxup_settings_log_out_heading_display'); |
| 26 | |
| 27 | // Add Logged in Heading field to his section |
| 28 | add_settings_field('dnxup_setting_log_in_heading_display', __('Logged in Heading', 'dnxup'), 'dnxup_setting_log_in_heading_display', 'dnxup_settings_sections', 'dnxup_settings_log_in_heading_display'); |
| 29 | |
| 30 | // Add Logged in Heading field to his section |
| 31 | add_settings_field('dnxup_setting_log_in_custom_links_display', __('Logged in Custom Links', 'dnxup'), 'dnxup_setting_log_in_custom_links_display', 'dnxup_settings_sections', 'dnxup_settings_log_in_custom_links_display'); |
| 32 | |
| 33 | |
| 34 | /***************************************************************************************** |
| 35 | * Fields text |
| 36 | *******************************************************************************************/ |
| 37 | // Gravatar Display Section |
| 38 | function dnxup_settings_gravatar_section_text() { ?> |
| 39 | <p><?php _e( 'Select this if you want to display the Gravatar image on the widget', 'dnxup' ); ?></p> |
| 40 | <?php } |
| 41 | |
| 42 | // Logged out Heading Display Section |
| 43 | function dnxup_settings_log_out_heading_section_text() { ?> |
| 44 | <p><?php _e( 'Heading for widget when user is logged out.', 'dnxup' ); ?></p> |
| 45 | <?php } |
| 46 | |
| 47 | // Logged in Heading Display Section |
| 48 | function dnxup_settings_log_in_heading_section_text() { ?> |
| 49 | <p><?php _e( 'Heading for widget when user is logged in.', 'dnxup' ); ?></p> |
| 50 | <?php } |
| 51 | |
| 52 | // Logged in Custom Links Display Section |
| 53 | function dnxup_settings_log_in_custom_links_section_text() { ?> |
| 54 | <p><?php _e( 'Custom Links to display when user is logged in.', 'dnxup' ); ?></p> |
| 55 | <?php } |
| 56 | |
| 57 | |
| 58 | /***************************************************************************************** |
| 59 | * Form display functions |
| 60 | *******************************************************************************************/ |
| 61 | // Display Gravatar?? |
| 62 | function dnxup_setting_gravatar_display() { |
| 63 | $dnxup_options = get_option( 'dnxup_options' ); ?> |
| 64 | <input type="checkbox" name="dnxup_options[show_gravatar]" <?php checked( $dnxup_options['show_gravatar'] ); ?> /> |
| 65 | <span class="description"><?php _e('Select this to display the Gravatar image for the current user', 'dnxup'); ?></span> |
| 66 | <?php } |
| 67 | |
| 68 | // Logged out Heading |
| 69 | function dnxup_setting_log_out_heading_display() { |
| 70 | $dnxup_options = get_option( 'dnxup_options' ); ?> |
| 71 | <input type="text" name="dnxup_options[logged_out_heading]" value="<?php echo $dnxup_options['logged_out_heading']; ?>" /> |
| 72 | <span class="description"><?php _e('This is the heading your users will see when they\'re not logged in to your site', 'dnxup'); ?></span> |
| 73 | <?php } |
| 74 | |
| 75 | // Logged in Heading |
| 76 | function dnxup_setting_log_in_heading_display() { |
| 77 | $dnxup_options = get_option( 'dnxup_options' ); ?> |
| 78 | <input type="text" name="dnxup_options[logged_in_heading]" value="<?php echo $dnxup_options['logged_in_heading']; ?>" /> |
| 79 | <span class="description"><?php _e('This is the heading your users will see when they\'re logged in. <code>%username%</code> shows username.', 'dnxup'); ?></span> |
| 80 | <?php } |
| 81 | |
| 82 | // Logged in Custom Links |
| 83 | function dnxup_setting_log_in_custom_links_display() { |
| 84 | $dnxup_options = get_option( 'dnxup_options' ); ?> |
| 85 | <textarea name="dnxup_options[logged_in_links]" rows="10" cols="80" /><?php echo wp_kses_data( $dnxup_options['logged_in_links'] ) ?></textarea> |
| 86 | <div class="description"> |
| 87 | <p> |
| 88 | <?php _e("<strong>One link per line</strong>. Note: Logout link will always show regardless. Tip: Add <code>|true</code> after a link to only show it to admin users or alternatively use a <code>|user_capability</code> and the link will only be shown to users with that capability. See <a href='http://codex.wordpress.org/Roles_and_Capabilities' target='_blank'>http://codex.wordpress.org/Roles_and_Capabilities</a> for more info on roles and Capabilities.<br/> You can also type <code>%USERNAME%</code> and <code>%USERID%</code> which will be replaced by the user info.<br />Example:",'dnxup'); |
| 89 | echo '<br /><code><a href="'.get_bloginfo('wpurl').'/wp-admin/">'. __('Dashboard', 'dnxup') . '</a><br/><a href="'.get_bloginfo('wpurl').'/wp-admin/profile.php">'. __('Profile', 'dnxup') .'</a></code>'; ?> |
| 90 | </p> |
| 91 | </div> |
| 92 | <?php } |
| 93 | |
| 94 | ?> |