Show "add event button" only to premium user

This topic contains 5 replies, has 3 voices, and was last updated by  Alex Rollin 4 years, 2 months ago.

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

Open Support Ticket
  • Author
    Posts
  • #529772

    periwinkle
    Expired Member
    Post count: 29

    Hi,
    on my website users can add their listing and they can choose a free package or a premium package. After this I would like the ONLY users that have already subscribed a premium packgage can see some element on the website like for example the “add event” button or the “add event” page.

    I added on my function.php this script that should assign a category to each package

    // add the package id to the body
    add_filter( 'body_class', 'my_add_package_class',10,1 );
    function my_add_package_class($class){
        global $post;
        if (geodir_is_page('detail') && isset($post->package_id)) {
            $class[] = "gd-package-id-".$post->package_id;
        }
        return $class;
    }

    Then I added a category .evento to the “add event” button and I wrote this css rules

    .gd-package-id-25 .evento {
    	display: block !important;
    }
    .evento {
    	display: none;
    }

    In order tho hide the button for everyone but to show it for users that have the premium package (with the id #25).

    But it doesn’t work, I don’t know why.

    #529783

    Kor
    Moderator
    Post count: 16516

    Hi there,

    Thanks for your post. Are you able to see this class “gd-package-id-25” on the page that you’re trying to display the add event button?

    #529805

    periwinkle
    Expired Member
    Post count: 29

    No

    #529826

    Alex Rollin
    Moderator
    Post count: 27815

    Package class is only output on the details and archive item templates.

    You will need your own custom code to do that on other pages.

    #529829

    periwinkle
    Expired Member
    Post count: 29

    So how can I do this? How can I allow only premum users to publish event?

    #529840

    Alex Rollin
    Moderator
    Post count: 27815

    GeoDirectory doesn’t have a feature for that, yet, but the developers do plan to add something like it in the future, they just haven’t started work on it yet.

    For now that would require your own custom code.

    If you are looking for help to create the functionality you can contact GD Experts here:

    https://geodirectoryexperts.com/

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