Membership not recoconizing Taxonomies

i was wondering if there is a fix so that membership plugin would show my taxonomies in the privilege area. I have built in taxonomies in my template for my portfolio.
when i activate membership plugin my portfolio does not show on the front page for my visitors. I have been trying to figure it out but i cant get a fix on it.
any help will be greatful.

  • aecnu

    Greetings majaluk,

    As you are probably aware of by now that membership plugin takes over the entire site which is actually necessary for it to perform its protect duties of the site thereof.

    Now of course the question is can you indeed get those taxonomies back while Membership is enabled and in which I do not have an answer for directly.

    Therefore I am going to see if I can get the invaluable insight of the lead developer in here to offer his advice/advise us as to a way to possibly overcome this issue.

    This may take a bit longer then a normal ticket but I will try to get him in here asap.

    Cheers, Joe

  • majaluk

    you may be on to something. The template i am using (Kreis_Angular) has a template builder for the pages. this allows for custom modules to inserted. I have kinda taking the long approach by tryin to mod this to work for me and the code is difficult to navigate, but i love the look.

    I have check my rules and all my pages are set to positive. The portfolio is actually custom postypes embeded into the page thru the template builder. If you would like i can give you access to see what i mean. how can i send you login info?

    what i noticed is that the categories i have setup for the cutom post type doesnot show up in membership. could this be the problem?

  • Cole

    potentially, but it looks like the theme is being dealing with the query as a page and then subsequently making another query for your "portfolio" custom post type. But before this can happen the page content is overridden. At least I think.

    If your comfortable with this could you send an email to cole@incsub.com with some temporary login credentials so I can figure out if its the theme or membership ( or maybe both ).

    Thanks

    Cole

  • S H Mohanjith

    Please look into membershipincludes/includes/default.rules.php for the default rules. Bellow you will find the rules class used to control which pages are shown.

    class M_Pages extends M_Rule {
    
    	var $name = 'pages';
    	var $label = 'Pages';
    
    	var $rulearea = 'public';
    
    	function admin_main($data) {
    		if(!$data) $data = array();
    
    		?>
    		<div class='level-operation' id='main-pages'>
    			<h2 class='sidebar-name'><?php _e('Pages', 'membership');?><span><a href='#remove' id='remove-pages' class='removelink' title='<?php _e("Remove Pages from this rules area.",'membership'); ?>'><?php _e('Remove','membership'); ?></a></span></h2>
    			<div class='inner-operation'>
    				<p><?php _e('Select the Pages to be covered by this rule by checking the box next to the relevant pages title.','membership'); ?></p>
    				<?php
    					$args = array(
    						'numberposts' => MEMBERSHIP_PAGE_COUNT,
    						'offset' => 0,
    						'orderby' => 'post_date',
    						'order' => 'DESC',
    						'post_type' => 'page',
    						'post_status' => 'publish'
    					);
    
    					$posts = get_posts($args);
    
    					// to remove bp specified pages - should be listed on the bp pages group
    					$posts = apply_filters( 'staypress_hide_protectable_pages', $posts );
    
    					if($posts) {
    						?>
    						<table cellspacing="0" class="widefat fixed">
    							<thead>
    							<tr>
    								<th style="" class="manage-column column-cb check-column" id="cb" scope="col"><input type="checkbox"></th>
    								<th style="" class="manage-column column-name" id="name" scope="col"><?php _e('Page title', 'membership'); ?></th>
    								</tr>
    							</thead>
    
    							<tfoot>
    							<tr>
    								<th style="" class="manage-column column-cb check-column" id="cb" scope="col"><input type="checkbox"></th>
    								<th style="" class="manage-column column-name" id="name" scope="col"><?php _e('Page title', 'membership'); ?></th>
    								</tr>
    							</tfoot>
    
    							<tbody>
    						<?php
    						foreach($posts as $key => $post) {
    
    							?>
    							<tr valign="middle" class="alternate" id="post-<?php echo $post->ID; ?>">
    								<th class="check-column" scope="row">
    									<input type="checkbox" value="<?php echo $post->ID; ?>" name="pages[]" <?php if(in_array($post->ID, $data)) echo 'checked="checked"'; ?>>
    								</th>
    								<td class="column-name">
    									<strong><?php echo esc_html($post->post_title); ?></strong>
    								</td>
    						    </tr>
    							<?php
    						}
    						?>
    							</tbody>
    						</table>
    						<?php
    					}
    
    				?>
    				<p class='description'><?php echo sprintf(__("Only the most recent %d pages are shown above.",'membership'), MEMBERSHIP_PAGE_COUNT); ?></p>
    			</div>
    		</div>
    		<?php
    	}
    
    	function on_positive($data) {
    
    		$this->data = $data;
    
    		add_action('pre_get_posts', array(&$this, 'add_viewable_pages'), 2 );
    		add_filter('get_pages', array(&$this, 'add_viewable_pages_menu'), 1);
    
    		add_filter( 'the_posts', array(&$this, 'check_positive_pages'));
    
    	}
    
    	function on_negative($data) {
    
    		$this->data = $data;
    
    		add_action('pre_get_posts', array(&$this, 'add_unviewable_pages'), 2 );
    		add_filter('get_pages', array(&$this, 'add_unviewable_pages_menu'), 1);
    
    		add_filter( 'the_posts', array(&$this, 'check_negative_pages'));
    
    	}
    
    	function redirect() {
    
    		global $M_options;
    
    		if(defined('MEMBERSHIP_GLOBAL_TABLES') && MEMBERSHIP_GLOBAL_TABLES === true ) {
    			if(function_exists('switch_to_blog')) {
    				switch_to_blog(MEMBERSHIP_GLOBAL_MAINSITE);
    			}
    		}
    
    		$url = get_permalink( (int) $M_options['nocontent_page'] );
    
    		wp_safe_redirect( $url );
    		exit;
    
    	}
    
    	function get_group() {
    
    		global $wpdb;
    
    		$sql = $wpdb->prepare( "SELECT id FROM " . membership_db_prefix($wpdb, 'urlgroups') . " WHERE groupname = %s", '_pages-' . $this->level_id );
    
    		$results = $wpdb->get_var( $sql );
    
    		if(!empty($results)) {
    			return $results;
    		} else {
    			return false;
    		}
    	}
    
    	function add_viewable_pages($wp_query) {
    
    		global $M_options;
    
    		if(!$wp_query->is_single && !empty($wp_query->query_vars['post__in'])) {
    			// We are not on a single page - so just limit the viewing
    			foreach( (array) $this->data as $key => $value ) {
    				$wp_query->query_vars['post__in'][] = $value;
    			}
    
    			$wp_query->query_vars['post__in'] = array_unique($wp_query->query_vars['post__in']);
    		} else {
    			// We are on a single page - so check for restriction on the_posts
    		}
    
    	}
    
    	function add_viewable_pages_menu($pages) {
    
    		$override_pages = apply_filters( 'membership_override_viewable_pages_menu', array() );
    
    		foreach( (array) $pages as $key => $page ) {
    			if(!in_array($page->ID, (array) $this->data) && !in_array($page->ID, (array) $override_pages)) {
    				unset($pages[$key]);
    			}
    		}
    
    		return $pages;
    
    	}
    
    	function add_unviewable_pages($wp_query) {
    
    		global $M_options;
    
    		return;
    
    	}
    
    	function add_unviewable_pages_menu($pages) {
    		foreach( (array) $pages as $key => $page ) {
    			if(in_array($page->ID, (array) $this->data)) {
    				unset($pages[$key]);
    			}
    		}
    
    		return $pages;
    	}
    
    	function check_negative_pages( $posts ) {
    
    		global $wp_query, $M_options;
    
    		if(!$wp_query->is_singular || count($posts) > 1) {
    			return $posts;
    		}
    
    		//print_r($wp_query);
    
    		if(!empty($posts) && count($posts) == 1) {
    			// we may be on a restricted post so check the URL and redirect if needed
    
    			$redirect = false;
    			$url = '';
    
    			$exclude = array();
    			if(!empty($M_options['registration_page'])) {
    				$exclude[] = get_permalink( (int) $M_options['registration_page'] );
    				$exclude[] = untrailingslashit(get_permalink( (int) $M_options['registration_page'] ));
    			}
    
    			if(!empty($M_options['account_page'])) {
    				$exclude[] = get_permalink( (int) $M_options['account_page'] );
    				$exclude[] = untrailingslashit(get_permalink( (int) $M_options['account_page'] ));
    			}
    
    			if(!empty($M_options['nocontent_page'])) {
    				$exclude[] = get_permalink( (int) $M_options['nocontent_page'] );
    				$exclude[] = untrailingslashit(get_permalink( (int) $M_options['nocontent_page'] ));
    			}
    
    			if(!empty($wp_query->query_vars['protectedfile']) && !$forceviewing) {
    				$exclude[] = $host;
    				$exclude[] = untrailingslashit($host);
    			}
    
    			foreach($posts as $post) {
    				if($post->post_type != 'page') {
    					continue;
    				}
    
    				if(!in_array(strtolower( get_permalink($post->ID) ), $exclude)) {
    					$url = get_permalink($post->ID);
    				}
    			}
    
    			// Check if we have a url available to check
    			if(empty($url)) {
    				return $posts;
    			}
    
    			// we have the current page / url - get the groups selected
    			$group_id = $this->get_group();
    
    			if($group_id) {
    				$group = new M_Urlgroup( $group_id );
    
    				if( $group->url_matches( $url ) ) {
    					$redirect = true;
    				}
    			}
    
    			if($redirect === true && !empty($M_options['nocontent_page'])) {
    				// we need to redirect
    				$this->redirect();
    			} else {
    				return $posts;
    			}
    
    		}
    
    		return $posts;
    
    	}
    
    	function check_positive_pages( $posts ) {
    
    		global $wp_query, $M_options;
    
    		if(!$wp_query->is_singular || count($posts) > 1) {
    			return $posts;
    		}
    
    		if(!empty($posts) && count($posts) == 1) {
    			// we may be on a restricted post so check the URL and redirect if needed
    
    			$redirect = false;
    			$url = '';
    
    			$exclude = array();
    			if(!empty($M_options['registration_page'])) {
    				$exclude[] = get_permalink( (int) $M_options['registration_page'] );
    				$exclude[] = untrailingslashit(get_permalink( (int) $M_options['registration_page'] ));
    			}
    
    			if(!empty($M_options['account_page'])) {
    				$exclude[] = get_permalink( (int) $M_options['account_page'] );
    				$exclude[] = untrailingslashit(get_permalink( (int) $M_options['account_page'] ));
    			}
    
    			if(!empty($M_options['nocontent_page'])) {
    				$exclude[] = get_permalink( (int) $M_options['nocontent_page'] );
    				$exclude[] = untrailingslashit(get_permalink( (int) $M_options['nocontent_page'] ));
    			}
    
    			if(!empty($wp_query->query_vars['protectedfile']) && !$forceviewing) {
    				$exclude[] = $host;
    				$exclude[] = untrailingslashit($host);
    			}
    
    			foreach($posts as $post) {
    				if($post->post_type != 'page') {
    					continue;
    				}
    
    				if(!in_array(strtolower( get_permalink($post->ID) ), $exclude)) {
    					$url = get_permalink($post->ID);
    				}
    			}
    
    			// Check if we have a url available to check
    			if(empty($url)) {
    				return $posts;
    			}
    
    			// we have the current page / url - get the groups selected
    			$group_id = $this->get_group();
    
    			if($group_id) {
    				$group = new M_Urlgroup( $group_id );
    
    				if( !$group->url_matches( $url ) ) {
    					$redirect = true;
    				}
    			}
    
    			if($redirect === true && !empty($M_options['nocontent_page'])) {
    				// we need to redirect
    				$this->redirect();
    			} else {
    				return $posts;
    			}
    
    		}
    
    		return $posts;
    
    	}
    
    }
    M_register_rule('pages', 'M_Pages', 'main');

    Rules class to control visibility of Listings pages adapted from M_Pages in default.rules.php

    class M_Listings extends M_Rule {
    
    	var $name = 'directory_listing';
    	var $label = 'Listings';
    
    	var $rulearea = 'public';
    
    	function admin_main($data) {
    		if(!$data) $data = array();
    
    		?>
    		<div class='level-operation' id='main-directory_listing'>
    			<h2 class='sidebar-name'><?php _e('Listings', 'membership');?><span><a href='#remove' id='remove-directory_listing' class='removelink' title='<?php _e("Remove Listings from this rules area.",'membership'); ?>'><?php _e('Remove','membership'); ?></a></span></h2>
    			<div class='inner-operation'>
    				<p><?php _e('Select the Listings to be covered by this rule by checking the box next to the relevant listings title.','membership'); ?></p>
    				<?php
    					$args = array(
    						'numberposts' => MEMBERSHIP_PAGE_COUNT,
    						'offset' => 0,
    						'orderby' => 'post_date',
    						'order' => 'DESC',
    						'post_type' => 'directory_listing',
    						'post_status' => 'publish'
    					);
    
    					$posts = get_posts($args);
    
    					// to remove bp specified listings - should be listed on the bp pages group
    					$posts = apply_filters( 'staypress_hide_protectable_directory_listing', $posts );
    
    					if($posts) {
    						?>
    						<table cellspacing="0" class="widefat fixed">
    							<thead>
    							<tr>
    								<th style="" class="manage-column column-cb check-column" id="cb" scope="col"><input type="checkbox"></th>
    								<th style="" class="manage-column column-name" id="name" scope="col"><?php _e('Page title', 'membership'); ?></th>
    								</tr>
    							</thead>
    
    							<tfoot>
    							<tr>
    								<th style="" class="manage-column column-cb check-column" id="cb" scope="col"><input type="checkbox"></th>
    								<th style="" class="manage-column column-name" id="name" scope="col"><?php _e('Page title', 'membership'); ?></th>
    								</tr>
    							</tfoot>
    
    							<tbody>
    						<?php
    						foreach($posts as $key => $post) {
    
    							?>
    							<tr valign="middle" class="alternate" id="post-<?php echo $post->ID; ?>">
    								<th class="check-column" scope="row">
    									<input type="checkbox" value="<?php echo $post->ID; ?>" name="directory_listing[]" <?php if(in_array($post->ID, $data)) echo 'checked="checked"'; ?>>
    								</th>
    								<td class="column-name">
    									<strong><?php echo esc_html($post->post_title); ?></strong>
    								</td>
    						    </tr>
    							<?php
    						}
    						?>
    							</tbody>
    						</table>
    						<?php
    					}
    
    				?>
    				<p class='description'><?php echo sprintf(__("Only the most recent %d listings are shown above.",'membership'), MEMBERSHIP_PAGE_COUNT); ?></p>
    			</div>
    		</div>
    		<?php
    	}
    
    	function on_positive($data) {
    
    		$this->data = $data;
    
    		add_action('pre_get_posts', array(&$this, 'add_viewable_directory_listing'), 2 );
    		add_filter('get_pages', array(&$this, 'add_viewable_directory_listing_menu'), 1);
    
    		add_filter( 'the_posts', array(&$this, 'check_positive_directory_listing'));
    
    	}
    
    	function on_negative($data) {
    
    		$this->data = $data;
    
    		add_action('pre_get_posts', array(&$this, 'add_unviewable_directory_listing'), 2 );
    		add_filter('get_pages', array(&$this, 'add_unviewable_directory_listing_menu'), 1);
    
    		add_filter( 'the_posts', array(&$this, 'check_negative_directory_listing'));
    
    	}
    
    	function redirect() {
    
    		global $M_options;
    
    		if(defined('MEMBERSHIP_GLOBAL_TABLES') && MEMBERSHIP_GLOBAL_TABLES === true ) {
    			if(function_exists('switch_to_blog')) {
    				switch_to_blog(MEMBERSHIP_GLOBAL_MAINSITE);
    			}
    		}
    
    		$url = get_permalink( (int) $M_options['nocontent_page'] );
    
    		wp_safe_redirect( $url );
    		exit;
    
    	}
    
    	function get_group() {
    
    		global $wpdb;
    
    		$sql = $wpdb->prepare( "SELECT id FROM " . membership_db_prefix($wpdb, 'urlgroups') . " WHERE groupname = %s", '_directory_listing-' . $this->level_id );
    
    		$results = $wpdb->get_var( $sql );
    
    		if(!empty($results)) {
    			return $results;
    		} else {
    			return false;
    		}
    	}
    
    	function add_viewable_directory_listing($wp_query) {
    
    		global $M_options;
    
    		if(!$wp_query->is_single && !empty($wp_query->query_vars['post__in'])) {
    			// We are not on a single page - so just limit the viewing
    			foreach( (array) $this->data as $key => $value ) {
    				$wp_query->query_vars['post__in'][] = $value;
    			}
    
    			$wp_query->query_vars['post__in'] = array_unique($wp_query->query_vars['post__in']);
    		} else {
    			// We are on a single page - so check for restriction on the_posts
    		}
    
    	}
    
    	function add_viewable_directory_listing_menu($pages) {
    
    		$override_pages = apply_filters( 'membership_override_viewable_directory_listing_menu', array() );
    
    		foreach( (array) $pages as $key => $page ) {
    			if(!in_array($page->ID, (array) $this->data) && !in_array($page->ID, (array) $override_pages)) {
    				unset($pages[$key]);
    			}
    		}
    
    		return $pages;
    
    	}
    
    	function add_unviewable_directory_listing($wp_query) {
    
    		global $M_options;
    
    		return;
    
    	}
    
    	function add_unviewable_directory_listing_menu($pages) {
    		foreach( (array) $pages as $key => $page ) {
    			if(in_array($page->ID, (array) $this->data)) {
    				unset($pages[$key]);
    			}
    		}
    
    		return $pages;
    	}
    
    	function check_negative_directory_listing( $posts ) {
    
    		global $wp_query, $M_options;
    
    		if(!$wp_query->is_singular || count($posts) > 1) {
    			return $posts;
    		}
    
    		//print_r($wp_query);
    
    		if(!empty($posts) && count($posts) == 1) {
    			// we may be on a restricted post so check the URL and redirect if needed
    
    			$redirect = false;
    			$url = '';
    
    			$exclude = array();
    			if(!empty($M_options['registration_page'])) {
    				$exclude[] = get_permalink( (int) $M_options['registration_page'] );
    				$exclude[] = untrailingslashit(get_permalink( (int) $M_options['registration_page'] ));
    			}
    
    			if(!empty($M_options['account_page'])) {
    				$exclude[] = get_permalink( (int) $M_options['account_page'] );
    				$exclude[] = untrailingslashit(get_permalink( (int) $M_options['account_page'] ));
    			}
    
    			if(!empty($M_options['nocontent_page'])) {
    				$exclude[] = get_permalink( (int) $M_options['nocontent_page'] );
    				$exclude[] = untrailingslashit(get_permalink( (int) $M_options['nocontent_page'] ));
    			}
    
    			if(!empty($wp_query->query_vars['protectedfile']) && !$forceviewing) {
    				$exclude[] = $host;
    				$exclude[] = untrailingslashit($host);
    			}
    
    			foreach($posts as $post) {
    				if($post->post_type != 'page') {
    					continue;
    				}
    
    				if(!in_array(strtolower( get_permalink($post->ID) ), $exclude)) {
    					$url = get_permalink($post->ID);
    				}
    			}
    
    			// Check if we have a url available to check
    			if(empty($url)) {
    				return $posts;
    			}
    
    			// we have the current page / url - get the groups selected
    			$group_id = $this->get_group();
    
    			if($group_id) {
    				$group = new M_Urlgroup( $group_id );
    
    				if( $group->url_matches( $url ) ) {
    					$redirect = true;
    				}
    			}
    
    			if($redirect === true && !empty($M_options['nocontent_page'])) {
    				// we need to redirect
    				$this->redirect();
    			} else {
    				return $posts;
    			}
    
    		}
    
    		return $posts;
    
    	}
    
    	function check_positive_directory_listing( $posts ) {
    
    		global $wp_query, $M_options;
    
    		if(!$wp_query->is_singular || count($posts) > 1) {
    			return $posts;
    		}
    
    		if(!empty($posts) && count($posts) == 1) {
    			// we may be on a restricted post so check the URL and redirect if needed
    
    			$redirect = false;
    			$url = '';
    
    			$exclude = array();
    			if(!empty($M_options['registration_page'])) {
    				$exclude[] = get_permalink( (int) $M_options['registration_page'] );
    				$exclude[] = untrailingslashit(get_permalink( (int) $M_options['registration_page'] ));
    			}
    
    			if(!empty($M_options['account_page'])) {
    				$exclude[] = get_permalink( (int) $M_options['account_page'] );
    				$exclude[] = untrailingslashit(get_permalink( (int) $M_options['account_page'] ));
    			}
    
    			if(!empty($M_options['nocontent_page'])) {
    				$exclude[] = get_permalink( (int) $M_options['nocontent_page'] );
    				$exclude[] = untrailingslashit(get_permalink( (int) $M_options['nocontent_page'] ));
    			}
    
    			if(!empty($wp_query->query_vars['protectedfile']) && !$forceviewing) {
    				$exclude[] = $host;
    				$exclude[] = untrailingslashit($host);
    			}
    
    			foreach($posts as $post) {
    				if($post->post_type != 'page') {
    					continue;
    				}
    
    				if(!in_array(strtolower( get_permalink($post->ID) ), $exclude)) {
    					$url = get_permalink($post->ID);
    				}
    			}
    
    			// Check if we have a url available to check
    			if(empty($url)) {
    				return $posts;
    			}
    
    			// we have the current page / url - get the groups selected
    			$group_id = $this->get_group();
    
    			if($group_id) {
    				$group = new M_Urlgroup( $group_id );
    
    				if( !$group->url_matches( $url ) ) {
    					$redirect = true;
    				}
    			}
    
    			if($redirect === true && !empty($M_options['nocontent_page'])) {
    				// we need to redirect
    				$this->redirect();
    			} else {
    				return $posts;
    			}
    
    		}
    
    		return $posts;
    
    	}
    
    }
    M_register_rule('directory_listing', 'M_Listings', 'main');

    Hope this helps.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.