How to Hide "add-listing" Page from Users

This topic contains 3 replies, has 2 voices, and was last updated by  Kor 7 years, 1 month ago.

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

Open Support Ticket
  • Author
    Posts
  • #373242

    Leslie
    Expired Member
    Post count: 7

    Hi,

    I need help to hide the “add_listing” page so that it is only accessible by a “premium” group of users that is setup in WordPress.

    I purchased the entire GeoDirectory for my membership website and for the most part it works well. However, I use the popular Itthinx Groups plugin within my WordPress because it works with Groups WooCommerce, so that I can hide pages/posts/products from users who are not part of a “premium” paid group. Everything works well with any WordPress page that I try to hide with a Groups restriction, except I cannot hide any of the GeoDirectory pages from any user or group, no matter what I do. I can hide the “add-listing” page from the menu, but I cannot hide the “add-listing” page from being accessed by the public. Groups restrictions somehow do not apply. I also tried many other page/post/product restriction plugins and they do not hide anything inside GeoDirectory. Please help.

    Thank you

    #373270

    Kor
    Moderator
    Post count: 16516

    Hi Leslie,

    I’ve just consulted this matter with a developer and what you needed there requires customization which we do not provide, unfortunately. But he shared a short script below that would probably give you some idea how this is going to work. If you don’t have much experience in PHP, you’ll find this difficult and we’ll suggest that you look for a freelance developer that would help you out. Or check out this article and see if it helps https://herothemes.com/blog/restricting-access-wordpress-pages-creating-members-area/

    
    
    function gd_check_allowed_to_add_listing() {
        $allowed = true;
        
        // Write code here to detect add-listing page and validate with current logged user with membership
        
        if ( !$allowed )
            wp_redirect( home_url() ); // Redirect to home if now allowed to add listing page
            exit;
        }
    }
    add_action( 'init', 'gd_check_allowed_to_add_listing', 10);

    Thanks!

    #373346

    Leslie
    Expired Member
    Post count: 7
    This reply has been marked as private.
    #373348

    Kor
    Moderator
    Post count: 16516

    Hi Leslie,

    That script is incomplete and it’s just a sample that we work out to give you an idea how it works.

    Thanks!

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

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

Open Support Ticket