fauzanjeg

Restrict Upload Access for Users not paid

Apr 20th, 2021 (edited)
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.72 KB | None | 0 0
  1. /* Restrict Upload Access for Users not paid */
  2. function restrict_upload_access() {
  3.     if ( ! current_user_can( 'administrator' ) ) {
  4.         if ( get_user_option( 'jpw_subscribe_status', get_current_user_id() ) !== 'ACTIVE' ) {
  5.             $url          = $_SERVER['REQUEST_URI'];
  6.             $submit_post  = strpos( $url, '/editor/' );
  7.             $upload_video = strpos( $url, '/upload/' );
  8.             if ( $submit_post || $upload_video ) {
  9.                 wp_redirect( home_url() );
  10.                 exit();
  11.             }
  12.             add_action(
  13.                 'wp_head',
  14.                 function () {
  15.                     ?>
  16.             <style>
  17.                 .jeg_button_1,
  18.                 .jeg_nav_html,
  19.                 .frontend-submit-button {
  20.                     display: none;
  21.                 }
  22.             </style>
  23.                     <?php
  24.                 },
  25.                 99
  26.             );
  27.         }
  28.     }
  29. }
  30. add_action( 'init', 'restrict_upload_access' );
Add Comment
Please, Sign In to add comment