Make WordPress Core

Ticket #3176: 3176.diff

File 3176.diff, 2.7 KB (added by Sewar, 18 years ago)

Using if and tell the user if the category is default for both posts and links

  • admin-functions.php

     
    735735        $pad = str_repeat('— ', $level);
    736736        if ( current_user_can('manage_categories') ) {
    737737                $edit = "<a href='categories.php?action=edit&amp;cat_ID=$category->cat_ID' class='edit'>".__('Edit')."</a></td>";
    738                 $default_cat_id = get_option('default_category');
     738                $default_post_cat_id = get_option('default_category');
    739739                $default_link_cat_id = get_option('default_link_category');
    740740
    741                 if ( ($category->cat_ID != $default_cat_id) && ($category->cat_ID != $default_link_cat_id) )
    742                         $edit .= "<td><a href='" . wp_nonce_url("categories.php?action=delete&amp;cat_ID=$category->cat_ID", 'delete-category_' . $category->cat_ID ) . "' onclick=\"return deleteSomething( 'cat', $category->cat_ID, '" . sprintf(__("You are about to delete the category &quot;%s&quot;.\\nAll of its posts will go into the default category of &quot;%s&quot;\\nAll of its bookmarks will go into the default category of &quot;%s&quot;.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), js_escape($category->cat_name), js_escape(get_catname($default_cat_id)), js_escape(get_catname($default_link_cat_id))) . "' );\" class='delete'>".__('Delete')."</a>";
    743                 else
    744                         $edit .= "<td style='text-align:center'>".__("Default");
    745         } else
     741                if (($category->cat_ID == $default_post_cat_id) && ($category->cat_ID == $default_link_cat_id)) {
     742                        $edit .= "<td style='text-align:center'>".__("Default posts and links category");
     743                } elseif ($category->cat_ID == $default_post_cat_id) {
     744                        $edit .= "<td style='text-align:center'>".__("Default posts category");
     745                } elseif ($category->cat_ID == $default_link_cat_id) {
     746                        $edit .= "<td style='text-align:center'>".__("Default links category");
     747                } else {
     748                        $edit .= "<td style='text-align:center'><a href='" . wp_nonce_url("categories.php?action=delete&amp;cat_ID=$category->cat_ID", 'delete-category_' . $category->cat_ID ) . "' onclick=\"return deleteSomething( 'cat', $category->cat_ID, '" . sprintf(__("You are about to delete the category &quot;%s&quot;.\\nAll of its posts will go into the default category of &quot;%s&quot;\\nAll of its bookmarks will go into the default category of &quot;%s&quot;.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), js_escape($category->cat_name), js_escape(get_catname($default_post_cat_id)), js_escape(get_catname($default_link_cat_id))) . "' );\" class='delete'>".__('Delete')."</a>";
     749                }
     750        } else {
    746751                $edit = '';
     752        }
    747753
    748754        $class = ( ( defined('DOING_AJAX') && DOING_AJAX ) || " class='alternate'" == $class ) ? '' : " class='alternate'";
    749755