Support

Home Forums Event Espresso Premium Access Control

Access Control

Posted: March 4, 2014 at 12:00 pm


Roy Hildestad

March 4, 2014 at 12:00 pm

Hi guys, well basically i need to implement some access control logic to allow/restric users to the content on the website, on the features you guys say this can be achieved doing hooks, but i was just wondering, where are the main classes that control the user access? i would like to take a look at them and see how they work :D,

can anyone point me in the right direction, I’m using EE v4 πŸ˜€

thanks!


Josh

  • Support Staff

March 4, 2014 at 3:23 pm

Hi Roy,

Are you asking about front-end content? If so, Event Espresso’s classes do not have the hooks you’re looking for. They are within WordPress itself. A review of some of the more popular WordPress plugins may help you find what you’re looking for:

http://wplift.com/plugins-to-restrict-content


Roy Hildestad

March 5, 2014 at 6:23 am

Hi Josh, im thinking both, basically im trying to achieve the functionality of the Permission Control for EE3 in EE4, i tried using groups (https://wordpress.org/plugins/groups/)

but the i realized that you guys have you own implementation of “edit_post.php” so the creation of events its protected by EE.

do you know of a plugin thats compatible with EE and that would let me achieve what i want?

Here’s a brief explanation of the project

Organizations:
have: Admins – Users
Admins:
can: use EE, but only affect/see the information of assigned to them.
Users:
can: register for events that are available from the organizations assigned to them.

With groups i create the relationship between User – Organization, and their role.

does that make sense?

thanks


Roy Hildestad

March 5, 2014 at 6:26 am

forgot to say, they shouldn’t have access to any other functionality inside wordpress


Josh

  • Support Staff

March 5, 2014 at 3:17 pm

Hi Roy,
I’m not aware of a plugin that can do this. I can recommend contacting one of the developers on this page, they may be able to build a custom solution that extends Event Espresso to have it have specific access control like how you’ve described:

https://eventespresso.com/developers/event-espresso-pros/


Roy Hildestad

March 6, 2014 at 6:18 am

I’m not looking for someone to do it, i already have a capable developer, I’m just looking for support, all i need to know is, where does the user control happens in EE4, where’s the class that polls the DB looking for the user’s permissions?

that’s all i need to know to get started.

( i just dont want to spend hours looking for it, if you guys could tell where it is would be great! πŸ˜€ )


Josh

  • Support Staff

March 6, 2014 at 8:53 am

You’ll want to look at EE_Admin_Page_Init where you’ll find this filter hook:

apply_filters( 'FHEE_' . $this->menu_slug . '_capability', $capability )

where menu_slug corresponds to the menu slug for the page system (i.e. espresso_events) that affects the menu being shown

It also uses the built in WordPress current_user_can() function. If you do a project search across the Event Espresso plugin folder for “current_user_can” you’ll find each instance where it’s used.


Roy Hildestad

March 6, 2014 at 11:38 am

awesome! thank you for your help!!


Josh

  • Support Staff

March 6, 2014 at 4:44 pm

You’re welcome.


Roy Hildestad

March 15, 2014 at 4:19 pm

Hi Josh, i’m back again :P. so thanks to you i was able to achieve access to the pages, and manage it “properly”, now i’m trying to filer the content the admin sees, but i haven’t been able to find the proper filter :\

I found the function that loads the events but i don’t really know how to filter the admin table, without modifying the main code.

wanna i want to do its pretty much filter this table (i will also need to filter all the other objects -venues, registered users, etc- so any tips about that too will be gladly appreciated πŸ˜€ )

thank you!


Roy Hildestad

March 15, 2014 at 4:20 pm

heres the image, it got removed from the last post

http://screencast.com/t/ssjJUw35


Josh

  • Support Staff

March 17, 2014 at 12:20 pm

Hi Roy,

The Event Espresso admin tables use wp-list-table, so it may help to check out this guide:

http://wpengineer.com/2426/wp_list_table-a-step-by-step-guide/

If you find a spot in EE4 where your customizations would benefit from a filter hook, the dev team welcomes your pull requests via the Event Espresso 4 project on github:

https://eventespresso.com/developers/request-repo-access/

The support post ‘Access Control’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso