[Plugin: Front-end Editor] Restrict editing to post author
-
I’m using a few of your Actions and Filters to limit what can be edited and by whom.
I’ve adapted the following code:
function fee_restrict_post_types( $allow, $data ) { $allowed_post_types = array( 'lesson-plans' ); $current_post_type = get_post_type( $data['post_id'] ); return $allow && in_array( $current_post_type, $allowed_post_types ); } add_filter( 'front_end_editor_allow_post', 'fee_restrict_post_types', 10, 2 );
I want to only allow the posts author to edit, so I made this:
function fee_specific_author( $allow, $data ) { $allowed_authors = array( get_the_author_id() ); $current_author = get_post( $data['post_id'] )->post_author; return $allow && in_array( $current_author, $allowed_authors ); } add_filter( 'front_end_editor_allow_post', 'fee_specific_author', 10, 2 );
It returns 1, just as the previous function, but when I click “edit”, I get this error:
Uncaught TypeError: Cannot read property 'error' of null
Any idea what might be the issue?
Thanks!
-Jacob
Viewing 13 replies - 1 through 13 (of 13 total)
Viewing 13 replies - 1 through 13 (of 13 total)
- The topic ‘[Plugin: Front-end Editor] Restrict editing to post author’ is closed to new replies.