I want to restrict S2 Member Access To A Specific Tab

This topic contains 5 replies, has 4 voices, and was last updated by  Guust 6 years ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #427283

    Bob Fine
    Full Member
    Post count: 19

    Hi,

    I’ve been using GeoDirectory for a couple of years, but we haven’t completely rolled out yet, because there is an important aspect we’d like to be able to configure.

    We use S2 Member in order to create a membership platform and restrict access to particular parts of the website.

    We would like to have our directory open to the public, but want to restrict access to one information tab for each listing in which they would have to be a paid member. Please see the image attached.

    The tab itself does have a unique URL.

    Is there a way we can configure the S2 access to be applied to that specific tab for all the listings?

    Can this be custom coded?

    Installed:

    GeoDirectory v1.6.25
    GeoDirectory Custom Post Types v1.3.6
    GeoDirectory Location Manager v1.5.61
    s2Member Pro Framework v170722
    Wordpress v4.9.5

    Thank you,

    Bob

    #427330

    Paolo
    Site Admin
    Post count: 31206

    Being a tab it is part of content, that is not a unique URL, it’s the detail page URL + an ID variable.
    I don’t think S2 can protect just 1 tab of the content.

    If S2 provides a shortcode that protects content inside the shortcode, probably we can help you with a snippet.

    example of shortcode:

    [protect-content]content between the opening and closing shortcode is only be visible to paid memnbers[/protect-content]

    That’s a question for S2 support though.

    Let us know what they say.

    Thanks

    #427331

    Alex Rollin
    Moderator
    Post count: 27815

    It may be possible to wrap the contents of the tab in a shortcode that had to do with member/role visibility.

    This would be considered a customization, and you would need to contact a GD Expert: https://geodirectoryexperts.com

    You could start by looking here to learn about tabs on the detail page: https://wpgeodirectory.com/re-order-tabs-in-a-listing-detail-page/

    #427397

    Guust
    Moderator
    Post count: 29970

    Try this [not tested]

    
    
    add_filter('geodir_detail_page_tab_list_extend','__my_exclude_tabs',10,1);
    function __my_exclude_tabs($tabs){
     global $post;
      
      //print_r($tabs);
      if( isset($tabs['geodir_employees']) && $post->post_author != get_current_user_id()  && !current_user_can('access_s2member_level2') ){
    	unset($tabs['geodir_employees']);
      }
      
      return $tabs;
    }
    #427425

    Bob Fine
    Full Member
    Post count: 19

    Guust,

    Thank you very much.

    Where should I add this code exactly?

    Bob

    #427441

    Guust
    Moderator
    Post count: 29970

    You can use the code snippets plugin for that: https://wpgeodirectory.com/docs/useful-plugins/#snippets

Viewing 6 posts - 1 through 6 (of 6 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket