Make WordPress Core

Changeset 3772


Ignore:
Timestamp:
05/11/2006 11:13:35 PM (19 years ago)
Author:
ryan
Message:

Remove private posts from front page query. Aadd private posts and page caps. fixes #2613

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/upgrade-functions.php

    r3734 r3772  
    174174        upgrade_160();
    175175
    176     if ( $wp_current_db_version < 3672 )
     176    if ( $wp_current_db_version < 3767 )
    177177        upgrade_210();
    178178
     
    493493    }
    494494
    495     if ( $wp_current_db_version < 3513 ) {
     495    if ( $wp_current_db_version < 3767 ) {
    496496        populate_roles_210();
    497497    }
  • trunk/wp-admin/upgrade-schema.php

    r3690 r3772  
    353353        $role->add_cap('delete_others_posts');
    354354        $role->add_cap('delete_published_posts');
     355        $role->add_cap('delete_private_posts');
     356        $role->add_cap('edit_private_posts');
     357        $role->add_cap('read_private_posts');
     358        $role->add_cap('delete_private_pages');
     359        $role->add_cap('edit_private_pages');
     360        $role->add_cap('read_private_pages');
    355361    }
    356362
  • trunk/wp-includes/capabilities.php

    r3705 r3772  
    297297            if ($post->post_status == 'publish')
    298298                $caps[] = 'delete_published_posts';
     299            else if ($post->post_status == 'private')
     300                $caps[] = 'delete_private_posts';
    299301        }
    300302        break;
     
    319321            if ($page->post_status == 'publish')
    320322                $caps[] = 'delete_published_pages';
     323            else if ($page->post_status == 'private')
     324                $caps[] = 'delete_private_pages';
    321325        }
    322326        break;
     
    347351            if ($post->post_status == 'publish')
    348352                $caps[] = 'edit_published_posts';
     353            else if ($post->post_status == 'private')
     354                $caps[] = 'edit_private_posts';
    349355        }
    350356        break;
     
    369375            if ($page->post_status == 'publish')
    370376                $caps[] = 'edit_published_pages';
     377            else if ($page->post_status == 'private')
     378                $caps[] = 'edit_private_pages';
    371379        }
    372380        break;
  • trunk/wp-includes/query.php

    r3767 r3772  
    829829            $where .= " AND (post_type = '$post_type' AND (post_status = 'publish'";
    830830
    831             if ( is_admin() )
     831            if ( is_admin() ) {
    832832                $where .= " OR post_status = 'future' OR post_status = 'draft'";
    833833   
    834             if ( is_user_logged_in() )
    835                 $where .= " OR post_author = $user_ID AND post_status = 'private'))";
    836             else
    837                 $where .= '))';
     834                if ( is_user_logged_in() ) {
     835                    if ( 'post' == $post_type )
     836                        $cap = 'edit_private_posts';
     837                    else
     838                        $cap = 'edit_private_pages';
     839
     840                    if ( current_user_can($cap) )
     841                        $where .= "OR post_status = 'private'";
     842                    else
     843                    $where .= " OR post_author = $user_ID AND post_status = 'private'";
     844                }
     845            }
     846
     847            $where .= '))';
    838848        }
    839849
  • trunk/wp-includes/version.php

    r3678 r3772  
    44
    55$wp_version = '2.1-alpha1';
    6 $wp_db_version = 3672;
     6$wp_db_version = 3767;
    77
    88?>
Note: See TracChangeset for help on using the changeset viewer.