Comments (8)
I'm reopening this because I think Editors should be allowed to manage the Business Profile options by default. The manage_options
capability should be changed to edit_posts
.
from business-profile.
Would a filter in https://github.com/NateWr/business-profile/blob/master/includes/Settings.class.php#L88 allow for this to happen?
from business-profile.
The capability is defined in the big settings object here, which is filtered here. So you could do something like this:
$sap = apply_filters( 'bpfwp_settings_page', $sap );
add_filter( 'bpfwp_settings_page', 'yourcustom_settings' );
function yourcustom_settings( $sap ) {
// Inspect the $sap object here. The capability will be somewhere there.
// Just modify it to the cap you'd prefer and then return it.
//
// $sap->page->wherever->i->cant->remember['capability'] = 'edit_posts';
return $sap;
}
from business-profile.
Yeah, that whole big $sap
is filtered. You'll need to dig in to figure out precisely where the cap gets stored, though.
from business-profile.
I've tried with the following:
$sap = apply_filters( 'bpfwp_settings_page', $sap );
add_filter( 'bpfwp_settings_page', 'yourcustom_settings' );
function yourcustom_settings( $sap ) {
$sap->pages['bpfwp-settings']->capability = 'edit_theme_options';
return $sap;
}
This does make the option available to non-admin users, but when I try to save any changes I get a screen saying "Cheatin’ uh?". Is this to be expected?
from business-profile.
Hmm, that does sound familiar. It's probably something internal to the simple-admin-pages lib.
Yeah, it looks like I fixed a problem like this back in December. It looks like Business Profile is using the latest version of that lib, so it should work.
Sorry, I don't have time to look into this further right now, as I'm coming up on a big deadline. But in theory it ought to work. Have you tried some other caps? Maybe it has to do with the distinction between meta caps and individual caps....
from business-profile.
Oh, the obvious thing to check is to make sure you're hooked in really early. The lib actually kicks in registers the page pretty early (admin_init
I think), so make sure you're jumping in early.
Also, you can get rid of this line as it's not needed:
$sap = apply_filters( 'bpfwp_settings_page', $sap );
from business-profile.
Were you ever able to solve this problem? I tracked down the source of the issue with the Simple Admin Pages library and fixed it there. I've updated the library in the plugin and the fix should go out with the next update -- likely tonight or tomorrow.
Once that fix goes out, you should be able to use code like this to edit the capability, as long as it's executed before admin_init
:
add_filter( 'bpfwp_settings_page', 'bp_allow_editor_access' );
function bp_allow_editor_access( $sap ) {
$sap->pages['bpfwp-settings']->capability = 'edit_pages';
return $sap;
}
from business-profile.
Related Issues (20)
- New post type labels in 4.7
- Contact card should only return data for published locations
- Contact page should not appear when it's the same as the current page
- Update simple-admin-pages for new $args setting support HOT 1
- Switch over to JSON-LD HOT 2
- Moving translations to translate.wordpress.org? HOT 2
- Help link in plugins list is broken
- Image buttons are not translatable HOT 2
- Selected image way too big in backend HOT 2
- Check on possible syntax error with parentOrganization
- Research usage of OpeningHoursSpecification to handle seasonal and holiday hours HOT 4
- Dutch translations
- Misspelled Swedish translation for word 'Get Direction' HOT 2
- German translations
- Display confirmation of changes to settings
- Add priceRange schema
- Add support for non-address businesses HOT 1
- Get Directions link doesn't work when device language is different
- adding other defaults
- Allow to add exceptions for opening hours HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from business-profile.