• Resolved Oazar

    (@oazar)


    Hello Joachim,

    I like very much your plugin, so easy to use, thanks !
    still I am having an issue with posts that won’t be restricted

    I need to restrict acces to posts by category ; the category archive page is restricted, but not the single posts in it.

    I checked in “settings” tant both single and archive were checked, and they are.

    On this website, I am also using content aware sidebar which looks like your plugin, and it does work, although I had the exact same problem to begin with.
    Content aware sidebar plugin comes with some box in each post BO where you can manually choose the sidebar to be displayed with the post in case your rule does not work (or you want to overrive the rule). I used this feature a couple of times in each category, and suddenly it just started working dynamically.

    So well, I thought maybe you could offer this possiblity as well ? Or help me understand what’s wrong… thanks for your help

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Joachim Jensen

    (@intoxstudio)

    Thank you for reporting this.

    Unfortunately the plugin does currently not support hiding posts from archives, lists or widgets. This is a highly requested feature, but there is no ETA on when it will be implemented.

    I do have a snippet you can insert in your theme’s functions.php that will hide restricted posts from any list. However, it only works for posts selected directly as conditions, not for posts in categories.

    add_action( 'pre_get_posts', function($query) {
    	if (!is_admin() && !$query->is_singular() && (!isset($query->query["post_type"]) || $query->query["post_type"] != RUA_App::TYPE_RESTRICT)) {
    		global $wpdb;
    		$other_levels = array_diff(
    			array_keys(RUA_App::instance()->get_levels()),
    			RUA_App::instance()->level_manager->get_user_levels()
    		);
    		$result = $wpdb->get_col("SELECT m.meta_value FROM $wpdb->postmeta m INNER JOIN $wpdb->posts p ON m.post_id = p.ID WHERE m.meta_key = '_ca_post_type' AND p.post_parent IN ('".implode("','", $other_levels)."')");
    		if($result) {
    			$query->set('post__not_in', $result);
    		}
    	}
    	return $query;
    } );
    violetta

    (@violetta)

    Hi there,

    I am very confused. I’ve been using your plugin for months, thinking that I was restricting access to my content. Now it seems I’m not…

    Is it true what I read above?

    When one selects

    “Content that meets the following conditions will only be accessible by this level or higher:
    Categories … ”

    One is only restricting the category archive page and NOT the single posts within that category???

    Because It seems that none of my content is successfully protected. Yet, in the description of your plugin it says that it’s possible to restrict content according to its category?

    RESOLVED.

    Plugin Author Joachim Jensen

    (@intoxstudio)

    Hi @violetta

    Apologies for the delayed reply. I am glad you found a solution! If you run into more problems, do not hesitate opening a new support thread here.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Posts not being hidden’ is closed to new replies.