• Resolved michel.b

    (@michelb-1)


    I like your plugin but there is a limitation due to the way Worpress treats Private Posts in menus : it ignores them for authorized users as well as for non authorized. It is even worse when a given category or a given month has only Private Posts : that category or that month is completely missing from the menus in the widgets. It becomes very difficult to access the correponding private posts for authorized users.
    Is there a way to add a filter in the theme functions.php file to force the widget to display thoses categories or those months with only Private Posts in the menus. I have fond in the forum such a filter ( for categories ) but for some reason it does not work :

    add_filter( 'widget_categories_args', 'show_private_post_in_widget' );
    function show_private_post_in_widget( $cat_args ) {
    
      if( current_user_can( 'read_private_posts' ) ) {
    	$cat_args['hide_empty'] = 0;
      }
    
      return $cat_args;
    }

    I am a beginner in programing so I am unable to see what’s wrong. Could you please have a look and supply us with a filter that would work both for categories and months. Thank you for you help.

    There is something similar here :
    https://www.ads-software.com/support/topic/showing-private-pages-in-default-page-menu?replies=5

    Regards

    https://www.ads-software.com/plugins/wp-jv-post-reading-groups/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Janos Ver

    (@janosver)

    Hi michel.b,

    I had tested this issue and I can see that there are some issues with the WP default ‘Recent Posts’ widget. When it is used on the page which displays your posts in reverse order it works fine according to my tests. Only when you select a page/post it starts displaying recent posts oddly (some private posts are missing). I’ll look into this issue and will try to fix it with a later release.

    With respect the issues with the menu I couldn’t reproduce any such issues. I think the menu works fine (it displays the private pages and posts to those users who are added to the proper Reading Groups), maybe it depends on which theme you use. I tested with Twenty Fourteen and MH Magazine lite and menu worked just fine for me. Maybe I am missing some important detail regarding your configuration, so if you can think of anything please share with me. Until I can reproduce the issue you are facing with it is very unlikely I can fix it.

    Best Regards,
    Janos

    Thread Starter michel.b

    (@michelb-1)

    Thank you for your answer.
    The theme I am using is MAKE.
    The problem is with the widgets :
    I have a category widget in the left sidebar and one of my categories, with 100% private posts, does not appear in this widget no matter the user permissions, even the admin. If I add one public post, it appears in the category widget.
    The same is true for the widget monthly archives : if for a given month I have only private posts it does not appear in the list, but if I add one public post then that month appears.

    If you can try this theme MAKE with these widgets in the right sidebar maybe you can reproduce the problem. I have fond temporary solutions :
    For the category widget I use the following trick : I created a public post with a publish date year 1900 that says “no more post” and I gave it all the categories. That way all my categories appear in the menu.
    For the date widget I replaced it with a template page which list the posts month by month, using your function “wp_jv_prg_user_can_see_a_post(get_current_user_id()”
    to filter the posts and it works : a post appears on the list only if the user has permission.

    Plugin Author Janos Ver

    (@janosver)

    Hi michel.b,

    I misunderstood your issue at first and I have found a completely different one with ‘Recent Posts’ widget which I commented above. Now that I had a second look at your issue I see what is the problem and I have found a solution for this. I tested the fix with the MAKE theme (which you use) as well and it works fine.

    The fix for your original issue will be released in a few days with v2.0, so stay tuned. I allow a bit more time for myself to find a solution for the other issue with ‘Recent Posts’ widget and might be able to add some more fixes/features to the release.

    Thread Starter michel.b

    (@michelb-1)

    Hi Janos,

    I tested your new version : I could not make it work with the option “dropdown menu” of the default categories widget. It does not display categories with private posts only. When I choose the standard display of the widget, it works fine. Could you please try to reproduce this and let me know. Thank you.
    Do you have plans to fix the same problem with the tags ? with the dates ?

    Plugin Author Janos Ver

    (@janosver)

    Hi michel.b,

    I’m glad it works fine with the standard display for you as well.

    Yes, you are correct. I haven’t tested it with the dropdown menu option. That is something to do for a future release. I have plans to fix the same issue with tags as well. As the winter approaches fast it might bring me more time as well to spend on plugin development.

    Regards,
    Janos

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Private posts in menus’ is closed to new replies.