WordPress.org

Forums

WP User Frontend
Private Posts for Author's Eyes Only (6 posts)

  1. evanferrell
    Member
    Posted 2 years ago #

    I love this plugin, but for my purposes I need a small tweak

    I'm using this to put together an art competition site. Users are registered as "Authors" and can submit entries (as posts) that will later be viewed and judged by the "Editor" users.

    I don't want the Author users to be able to be able to read or see a list of other user posts - only their own. They should be able to log in and modify their own posts, but should be completely unaware of other users.

    This is easily done by setting all posts to "Private", but I've had to modify the core files "wpuf-dashboard.php" and "wpuf-functions.php" to display Private posts in the dashboard properly.
    - I can live with that, but would love a solution that doesn't hack the core files.

    MOST IMPORTANTLY, I have not figured out a way to set the posts to "Private" by default. I tried a plugin, but it only works from the WP admin, not for posts made from the front end.

    I think if you were to add the option to the "WP User Frontend: Settings -> Frontend Posting -> Post Status", to allow post defaults to be "Private", my issue would be solved.

    Any thoughts on how to do this? Much appreciated.

    http://wordpress.org/extend/plugins/wp-user-frontend/

  2. writegnj
    Member
    Posted 2 years ago #

    I had a same problem with that. wish this plugin supports private and public post from users at front-end.

    I ended up adding couple codes in "wpuf-dashboard.php" file to make this work. please advise if this has any potential problems in my code cause I'm not a programmer lol but for now it works ok.

    1. I added custom field from dashboard.Field Name: cf_visibility. Type: Dropbox. Values: Private, Public.

    2. Then I added below code above line 422.

    $post_stat_value = trim( $_POST['cf_visibility'] );
    if ($post_stat_value == "Public"){
    $post_stat = "publish";
    } else {
    $post_stat = "private";
    }

    3. Added same code in "wpuf-edit-post.php". (for changing post status)

    btw! awesome plugin thanks for making this for everyone :D

  3. evanferrell
    Member
    Posted 2 years ago #

    Thanks for the tip, but I wanted to make all posts Private by default. I actually don't want my users to have a choice.

    I found another hack solution that does work.
    I edited the admin code to add "Private" to the list of post statuses

    admin/settings-options.php
    Line 157:
    'private' => 'Private',

  4. bennyjammin
    Member
    Posted 2 years ago #

    Thank you GoodNightJournal for sharing your code. If I waned to add the option of a password protected post, could you advise me please how I would have to amend the code? I am not sure what is the field form the database that I need to accept the post password,

    add a custom field from dashboard. Field Name: ????????. Type: Text.

  5. writegnj
    Member
    Posted 2 years ago #

    I believe password protected post contains value of "post_password"
    so I'm assuming

    1. add input field for password on dashboard.
    2. insert that password value into database (wpuf-edit-post.php)

    Since I'm not a programer, I can't really give you exact code for that but I believe this concept should work for your situation. hope this helps.

  6. bennyjammin
    Member
    Posted 2 years ago #

    Great job, worked like a charm except for one thing. The password protection doesn't hide the custom fields from displaying so I wrapped the contents of the single.php file from my theme in this code:

    [ Moderator Note: Please post code or markup snippets between backticks or use the code button. ]

    <?php
           if ( post_password_required() ) {
                  echo get_the_password_form();
           }
           else {
    ?>

    .. your custom php code or whatever ..

    <?php
    }
    ?>

    I found the solution here

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP User Frontend
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic