Security problem – Doesn't observe user capabilities.
-
The default install doesn’t observe the standard WordPress user capabilities for the capability “edit-posts”.
A User with the capability “edit-posts” should be able to add and edit their own posts. Users without this role obviously shouldn’t be able to do this.
In the standard install of WordPress the only user besides non-logged in users that are not permitted to add or edit their own posts are users with the role “Subscriber”
However the default install of WP User Frontend allows users with the standard WordPress role “Subscriber” which doesn’t have this capability to add their own posts.
Note non-logged in users are prohibited from adding posts in WP User Frontend so this flaw exists only for users with the “Subscriber” role.
So far I have only examined the Add Post functionality of WP User Frontend so it is presently unknown if this is the same for Edit Post.
Whilst this is only a minor flaw it needs to be fixed in the standard WP User Frontend install to conform to the standard WordPress install.
To fix manually changed the following code in the file wpuf-add-post.php
function post_form( $post_type ) { .... $can_post = 'yes'; $info = apply_filters( 'wpuf_addpost_notice', $info ); $can_post = apply_filters( 'wpuf_can_post', $can_post ); ....
to
function post_form( $post_type ) { .... $can_post = 'yes'; $info = apply_filters( 'wpuf_addpost_notice', $info ); if (!current_user_can( 'edit_posts' )) $can_post = 'no'; $can_post = apply_filters( 'wpuf_can_post', $can_post ); ....
If you want to change this default functionality you can use the wpuf_can_post filter.
Cheers
TheProfessorhttps://www.ads-software.com/extend/plugins/wp-user-frontend/
- The topic ‘Security problem – Doesn't observe user capabilities.’ is closed to new replies.