Support » Plugins » Critique on my minor ‘Private posts’ hack, pleas

  • Hello,
    I noticed that if I make a private post, the post would not show on the publicly accessible pages, even if I was logged in.
    There seemed to be no solution in the forums, so I scratched around and made a minor change to wp-blog-header.php, to include the wp-includes/functions.php file.
    This allows wp-blog-header.php to call the get_currentuserinfo() function, which in turn sets the
    $user_ID variable which was not being set otherwise.
    The result is that wp-blog-header.php now correctly allows private entries to be shown, if the private posts author is logged in.
    I’m a total WordPress (& php) newbie, so I’d appreciate any feedback on whether including functions.php was actually a good idea… I’d hate to compromise my site by including a file I shouldn’t have.
    (I downloaded and installed the 2004-11-23.tgz wordpress tarball just to check whether this issue was resolved, but it appears not to be).
    Any thoughts or comments gratefully received.

Viewing 4 replies - 1 through 4 (of 4 total)
  • BB,
    I’m really interested in this idea – as a newbie to php myself, I can’t make any determinations on whether it’s a good idea – but I can tell you that it didn’t work for me! 🙁 (I’m running 1.3a4) Hopefully a sage php person can pop in and let us know! Kudos to you for jumping in and giving it a go.

    This seems like a bug that you fixed and not a hack–did you try submitting a patch into CVS, or talking to a dev?

    I’m running 1.3 alpha 4 and the Private Posts code to insert your code before isn’t in the wp-blog-header.php file – it is in the 1.2 version.
    I couldn’t get it to work. 🙁

    I have been playing around with this, and also can’t get private posts to show.
    One thing I have discovered, at least in 1.3 alpha 5:
    If your main index.php file is not in the same directory as the main wordpress directory, then the variable $user_ID is not defined. If it is in the same directory, that value IS defined (as the ID of the currently logged in user). This certainly doesn’t seem right.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Critique on my minor ‘Private posts’ hack, pleas’ is closed to new replies.