-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
class-tkt-maintenance-admin #21
Comments
Those are not booleans, those are checkbox 1 or 0. Thus, I created this custom function that does exactly what I need (the options API supports a custom validation callback). Is this wrong? I wanted to avoid creating 2 different validation methods. The template must feature script tags, this is a bug of mine, I am fixing that in the template. I disagree with
Would be good to put there why it actually is discouraged, but, anyway. |
Uh, last I checked, that is a boolean.
I pointed you to the
"stereo"? I think I mentioned in another issue that core uses
Yes! So you could give that one capability to a lesser(or custom) role. Since you can also remove capabilities from an admin user, it's best to always check the capability instead of the role. |
Keeping this open for the checkbox. The problem I encountered with validating like that is that the check box option does not store booleans. It stores 0 or 1 as numeric string. I need to revise this as maybe I either did something wrong or looked wrong, and use your suggested approach. The rest here became obsolete as JS and CSS are gone. PS: |
I think the settings should be one array instead of individual fields.
But what is going on with
$this->plugin_short . '_active',
and$this->plugin_short . '_dequeue_styles_scripts',
using
validate_number
as a sanitization callback? They look like booleans.https://developer.wordpress.org/reference/functions/wp_validate_boolean/
Also, for non-negative integers: https://developer.wordpress.org/reference/functions/absint/
https://github.com/TukuToi/tkt-maintenance/blob/18c552f0089296be71e39d1c9521a61df0f6d6e1/admin/class-tkt-maintenance-admin.php#L224-L227
In the template, there are no script tags output, so the user would have to put them in here, but then they would be escaped.
The CSS field doesn't have that problem, but the
esc_html
function is probably not the right one for sanitizing.https://github.com/TukuToi/tkt-maintenance/blob/18c552f0089296be71e39d1c9521a61df0f6d6e1/admin/class-tkt-maintenance-admin.php#L507
This should be
current_user_can( 'manage_options' )
and/or'unfiltered_upload'
or'manage_network_options'
.The text was updated successfully, but these errors were encountered: