WordPress.org

Make WordPress Core

Ticket #6802: discussion_options_action_hook.diff

File discussion_options_action_hook.diff, 4.8 KB (added by filosofo, 6 years ago)
  • wp-content/themes/default/functions.php

     
    77        'after_title' => '</h2>', 
    88    )); 
    99 
     10function kubrick_avatars() { 
     11        ?><h3><?php _e('Avatars') ?></h3> 
     12 
     13        <p><?php _e('By default WordPress uses <a href="http://gravatar.com/">Gravatars</a> &#8212; short for Globally Recognized Avatars &#8212; for the pictures that show up next to comments. Plugins may override this.'); ?></p> 
     14 
     15        <?php // the above would be a good place to link to codex documentation on the gravatar functions, for putting it in themes. anything like that? ?> 
     16 
     17        <table class="form-table"> 
     18        <tr valign="top"> 
     19        <th scope="row"><?php _e('Avatar display') ?></th> 
     20        <td> 
     21        <?php 
     22                $yesorno = array(0 => __("Don&#8217;t show Avatars"), 1 => __('Show Avatars')); 
     23                foreach ( $yesorno as $key => $value) { 
     24                        $selected = (get_option('show_avatars') == $key) ? 'checked="checked"' : ''; 
     25                        echo "\n\t<label><input type='radio' name='show_avatars' value='$key' $selected> $value</label><br />"; 
     26                } 
     27        ?> 
     28        </td> 
     29        </tr> 
     30        <tr valign="top"> 
     31        <th scope="row"><?php _e('Maximum Rating') ?></th> 
     32        <td> 
     33 
     34        <?php 
     35        $ratings = array( 'G' => __('G &#8212; Suitable for all audiences'), 'PG' => __('PG &#8212; Possibly offensive, usually for audiences 13 and above'), 'R' => __('R &#8212; Intended for adult audiences above 17'), 'X' => __('X &#8212; Even more mature than above')); 
     36        foreach ($ratings as $key => $rating) : 
     37                $selected = (get_option('avatar_rating') == $key) ? 'checked="checked"' : ''; 
     38                echo "\n\t<label><input type='radio' name='avatar_rating' value='$key' $selected> $rating</label><br />"; 
     39        endforeach; 
     40        ?> 
     41 
     42        </td> 
     43        </tr> 
     44 
     45        </table><?php  
     46 
     47} 
     48 
     49add_action('discussion_options', 'kubrick_avatars'); 
     50add_filter('discussion_page_options', create_function('$a','return array_unique(array_merge($a, array("show_avatars","avatar_rating")));')); 
     51 
    1052function kubrick_head() { 
    1153        $head = "<style type='text/css'>\n<!--"; 
    1254        $output = ''; 
  • wp-admin/options-discussion.php

     
    11<?php 
    22require_once('admin.php'); 
    33 
     4$discussion_page_options = apply_filters('discussion_page_options', array('default_pingback_flag','default_ping_status','default_comment_status','comments_notify','moderation_notify','comment_moderation','require_name_email','comment_whitelist','comment_max_links','moderation_keys','blacklist_keys')); 
     5 
    46$title = __('Discussion Settings'); 
    57$parent_file = 'options-general.php'; 
    68 
     
    7678</tr> 
    7779</table> 
    7880 
    79 <h3><?php _e('Avatars') ?></h3> 
     81<?php do_action('discussion_options'); ?> 
    8082 
    81 <p><?php _e('By default WordPress uses <a href="http://gravatar.com/">Gravatars</a> &#8212; short for Globally Recognized Avatars &#8212; for the pictures that show up next to comments. Plugins may override this.'); ?></p> 
    82  
    83 <?php // the above would be a good place to link to codex documentation on the gravatar functions, for putting it in themes. anything like that? ?> 
    84  
    85 <table class="form-table"> 
    86 <tr valign="top"> 
    87 <th scope="row"><?php _e('Avatar display') ?></th> 
    88 <td> 
    89 <?php 
    90         $yesorno = array(0 => __("Don&#8217;t show Avatars"), 1 => __('Show Avatars')); 
    91         foreach ( $yesorno as $key => $value) { 
    92                 $selected = (get_option('show_avatars') == $key) ? 'checked="checked"' : ''; 
    93                 echo "\n\t<label><input type='radio' name='show_avatars' value='$key' $selected> $value</label><br />"; 
    94         } 
    95 ?> 
    96 </td> 
    97 </tr> 
    98 <tr valign="top"> 
    99 <th scope="row"><?php _e('Maximum Rating') ?></th> 
    100 <td> 
    101  
    102 <?php 
    103 $ratings = array( 'G' => __('G &#8212; Suitable for all audiences'), 'PG' => __('PG &#8212; Possibly offensive, usually for audiences 13 and above'), 'R' => __('R &#8212; Intended for adult audiences above 17'), 'X' => __('X &#8212; Even more mature than above')); 
    104 foreach ($ratings as $key => $rating) : 
    105         $selected = (get_option('avatar_rating') == $key) ? 'checked="checked"' : ''; 
    106         echo "\n\t<label><input type='radio' name='avatar_rating' value='$key' $selected> $rating</label><br />"; 
    107 endforeach; 
    108 ?> 
    109  
    110 </td> 
    111 </tr> 
    112  
    113 </table> 
    114  
    115  
    11683<p class="submit"> 
    11784<input type="hidden" name="action" value="update" /> 
    118 <input type="hidden" name="page_options" value="default_pingback_flag,default_ping_status,default_comment_status,comments_notify,moderation_notify,comment_moderation,require_name_email,comment_whitelist,comment_max_links,moderation_keys,blacklist_keys,show_avatars,avatar_rating" /> 
     85<input type="hidden" name="page_options" value="<?php echo implode(', ', $discussion_page_options); ?>" /> 
    11986<input type="submit" name="Submit" value="<?php _e('Save Changes') ?>" /> 
    12087</p> 
    12188</form>