Siderbar Widget display on posts with group restrict access

Posted in: Newsmag
Post count: 5

Hi guys,

Im using groups restrict access for a subscription website. i have allowed excerpts, images to display on pages until clicked on using the following code:

// If the unsubscribed user is looking at any of the page's listed the user will be able to view the list of post excerpts
if ( is_page('page-name-1') || is_page ('page-name-2') || is_page ('page-name-3') || is_page ('page-name-4') || is_page ('page-name-5') || is_page ('page-name-6') || is_page ('page-name-7') || is_page ('page-name-8') || is_page ('page-name-9') || is_page ('page-name-10') || is_page ('page-name-11') || is_page ('page-name-12') || is_page ('page-name-1') || is_category ('category-1') || is_category ('category-2') ) {

// Remove the Groups_Post_Access filters
remove_filter( 'posts_where', array( 'Groups_Post_Access', 'posts_where' ), 10, 2 );
remove_filter( 'the_posts', array( 'Groups_Post_Access', 'the_posts' ), 1, 2 );
remove_filter( 'get_the_excerpt', array( 'Groups_Post_Access', 'get_the_excerpt' ), 1 );
remove_filter( 'the_content', array( 'Groups_Post_Access', 'the_content' ), 1 );
remove_filter( 'posts_where', array( 'Groups_Restrict_Categories', 'posts_where' ), 10 );
remove_filter( 'get_pages', array( 'Groups_Restrict_Categories', 'get_pages' ) );
remove_filter( 'the_posts', array( 'Groups_Restrict_Categories', 'the_posts' ), 1 );
remove_filter( 'get_the_excerpt', array( 'Groups_Restrict_Categories', 'get_the_excerpt' ) );
remove_filter( 'the_content', array( 'Groups_Restrict_Categories', 'the_content' ) );
}
}

However this does not include the sidebar widgets that I have on posts. Is it possible to include widgets in the above code, for example I tried is_active_widget ('widget-id') and the_widget ('widget-id') but neither worked. Is there a theme widget tag that can be used?

Any help would be appreciated… its a real humdinger! 🙁

Thanks

Post count: 780

Hi,

I don’t really understand what you are trying to achieve… On specific pages you want to remove the widgets? Or the entire sidebar? We don’t have hooks on widgets 🙁

Please give me more details.

Post count: 5

Hi Radu,

I have restrict access for categories. For example: full access will allow the user to view everything. The next level allows the user to view the categories assigned to that level. The above code allows a non subscribed user to view the content on pages but if they click on an article/post they will be redirected to a subscribe page (if the above code was not added the non subscribed user wouldnt be able to view any of the content). The problem is that the sidebar widget on the posts pages will not display unless the user has full access. Ideally I want the unsubscribed user to be able to see the sidebar posts and if clicked they would be redirected to the subscription page similar to what ive implemented for the actual pages (as described above).

Please see screenshot link below to help explain:

http://mntest.net/mudge/restricted-access.jpg

Post count: 1291

Hi,

The restrictions are set by the plugin and you removed them for certain pages. Unfortunately we didn’t do any tests with this plugin so i cannot say what filter is missing, sorry. Try to ask on the plugin developer for details on this, also check the plugin documentation, you may find some clues in there.

Thank you!

Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic.