Support » Fixing WordPress » BUG: Private post not showing up when logged in

  • This has been posted before but misunderstood. My private posts do not show on the index.php even though I am logged in. There is code for this in wp-blog-header.php

    // Get private posts
    if (isset($user_ID) && ('' != intval($user_ID)))
    $where .= " OR post_author = $user_ID AND post_status != 'draft')";

    The problem though, is that $user_ID is not set at this point of execution for some reason. Yet $user_ID is set by the end of index.php. I don’t know where or how. I tested this by doing an echo right before the above code, another at the top of index.php and another at the end of index.php. Only the last one output my userID.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The above was posted by me. This was tested on the 1.0.2 and the latest nightly 20050509.

    Moderator Matt Mullenweg



    Private posts are not ever supposed to show up in index.php, whether you are logged in or not.

    get_currentuserinfo(); is the function that seems to set $user_ID, and the value for that is set when the condition as to whether or not the “edit this” link has to be displayed.
    Try putting get_currentuserinfo(); just above the line that decides whether or not to show private posts. Might work!
    general note: get_currentuserinfo() is in wp-admin/functions.php

    ^^ worked.

    Thanks 2fargon and allusion. The way the code is written, it looks like a bug. If current page was tested for edit.php right before testing for userID then it would look intended. I like my private posts on the front page. Maybe there should be an option for it? Thanks for a great app btw =)

    allusion tells me that private posts should not show on the blog, and that there are issues related to this. So please be advised that it might not be the best thing to do.

    what sort of issues? I’m curious now =)

    hey rpeeck, that was me, your curiosity ticked mine off! Sorry if that bothered you, I really didn’t mean to do any harm 🙂

    ^^ heheh, its cool. i was just wondering if it worked though. cuz i tried the same thing myself. 😛

    No, it did not.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘BUG: Private post not showing up when logged in’ is closed to new replies.