Advertisement
arie_cristianD

restrict subscriber to access frontend submit

Oct 22nd, 2024
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.57 KB | None | 0 0
  1. add_filter( 'jnews_account_page_endpoint', 'restrict_frontend_submit_menu', 99 );
  2.  
  3. add_filter( 'jnews_frontend_submit_user_subscription', 'restrict_frontend_submit' );
  4.  
  5.  
  6. function restrict_frontend_submit( $value ) {
  7.     $value = current_user_can( 'edit_posts' );
  8.     return $value;
  9. }
  10.  
  11. function restrict_frontend_submit_menu( $endpoint ) {
  12.  
  13.     if ( ! current_user_can( 'edit_posts' ) ) {
  14.         if ( $endpoint['post_view_stats'] ) {
  15.             unset( $endpoint['post_view_stats'] );
  16.         }
  17.         if ( $endpoint['my_post'] ) {
  18.             unset( $endpoint['my_post'] );
  19.         }
  20.     }
  21.     return $endpoint;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement