Support » Plugins » [Plugin: Groups] I need help with showing the post thumbnail but hiding content

  • I will try and explain my issue as in depth as possible. So I am using the groups plugin. My theme has a custom post type called portfolio. So on the Portfolio page it displays all of the portfolio posts in a grid.

    When I make a portfolio post only accessible to a group, it even removes the featured image of that post on the portfolio page for anyone not in that group. This is a problem because someone not logged in will have no desire to sign up because it looks like there are no portfolio posts.

    What I am trying to do is, always have that portfolio featured image display on the portfolio page even if you don’t have access to view the post content. Then if the user does not have the permission to view it, it displays the “you do not have permission to access this content” on the page.

    I’ve tried asking for help on the plugin page support but I’m lost. The plugin author said to create a template for the custom post type and read the API. I have gone through it and I am still confused. If someone could help me by providing a little more information on how this could be achieved I would really appreciate it.

    I am not sure but I think this is the section that I need to change.

    /**
    	 * Filter posts by access capability.
    	 *
    	 * @param array $posts list of posts
    	 * @param WP_Query $query
    	 */
    	public static function the_posts( $posts, &$query ) {
    		$result = array();
    		$user_id = get_current_user_id();
    		foreach ( $posts as $post ) {
    			if ( self::user_can_read_post( $post->ID, $user_id ) ) {
    				$result[] = $post;
    			}else {
    
    			}
    		}
    		return $result;
    	}
  • The topic ‘[Plugin: Groups] I need help with showing the post thumbnail but hiding content’ is closed to new replies.