Advertisement
arie_cristianD

restrict subscriber to access frontend submit

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