The MU forums have moved to WordPress.org

hacking post_status to add new levels (6 posts)

  1. easysleeper
    Member
    Posted 15 years ago #

    Hello gang,
    Let me try to briefly explain what I am doing. I have added to edit-form-advanced two additional check boxes along with the "private" check box. With these I am setting the post_status to either 'friend' or 'loggedin'. You may have guessed that the reason I am doing this is to hide posts from users that are either "not logged in" or not on the owners "friends list" the friends thing comes from a buddypress plugin.

    Here is what I need to find, and what I plan to do.
    I need to find where the post determines that it is private and does the check to see if current user has permissions to see the private post.

    what I plan to do is to add that if the post_status is friend then I'll check if current user is friend OR is owner... and if the post_status is 'loggedin' then I'll check to see if the user is logged in.

    I know how to do my checks I just don't know where in the code to find this 'private' check.
    I have been through MANY lines of code! and I'll continue to keep at it I only hope this might speed up my progress.

    Thanks!

  2. andrea_r
    Moderator
    Posted 15 years ago #

    Check out the more privacy options plugin. It'll have it all in there.

  3. easysleeper
    Member
    Posted 15 years ago #

    andrea_r you have saved me time and time again!!!

    thanks!

  4. easysleeper
    Member
    Posted 15 years ago #

    I spoke too soon, although accurate andrea, you have helped me tons!

    What I am trying to accomplish would be on a post by post basis not on a blog by blog...

    unfortunately I don't know how to ask the right question. I have searched around and sort of have a clue, but unfortunately I don't have all the answers. It looks like post-template.php under function get_the_title is where the distinction of 'private' is being made but I don't understand how if it is private it skips to the next post when you are not the logged in admin of the blog.

    hopefully once I find the answer to my problem, I will also know better how to state it, and it will help others in the future!

  5. andrea_r
    Moderator
    Posted 15 years ago #

    Use the custom fields area to flag for post privacy.

    Actually, I think there's a number of plugin out there for single WP that have various levels of post visibility.

    http://wordpress.org/extend/plugins/social-privacy/
    http://wordpress.org/extend/plugins/absolute-privacy/

  6. easysleeper
    Member
    Posted 15 years ago #

    I did find what I needed in WP_Query class adding fields to $where, depending on my new post_status fileds (i.e. 'friend' and 'loggedin')

    I know this is probably completely different than anyone else would do it, but it works for me and makes sense finally.

    I do have one issue, I am doing a compare and using $current_user->ID I get the logged in users ID, I want to compare that to the Author's Id and so far I tried using $wpdb->posts.post_author... however there is a problem, first it returns a string like wp_X_postspost_author, where X= the blog ID... the problem is I need to return something where I can get the AUTHOR's USERID not the blog ID. even if it comes with wp_AUTHORID_blah blah, that's fine I can always strip that out easily, but I need the USER ID of the author NOT the blog ID... I've searched for this and haven't found it so any help would be AWESOME

    thanks in advance.

About this Topic

  • Started 15 years ago by easysleeper
  • Latest reply from easysleeper