Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function streamtube_child_check_limit_uploads( $errors ){
- $max_allowed = 10;
- $current_user_total_posts = count_user_posts( get_current_user_id(), 'video' );
- // Check roles ... etc
- // This limitation should not apply to administrator and editor, maybe.
- if( ! current_user_can( 'administrator' ) ){
- if( $current_user_total_posts > $max_allowed ){
- $errors->add(
- 'not_allowed',
- esc_html__( 'You have reached the maximum allowed number of uploads.', 'streamtube-child' )
- );
- }
- }
- return $errors;
- }
- add_filter( 'streamtube/core/upload/video/errors', 'streamtube_child_check_limit_uploads', 100, 1 );
- add_filter( 'streamtube/core/upload_chunks/video/errors', 'streamtube_child_check_limit_uploads', 100, 1 );
- add_filter( 'streamtube/core/post/import_embed/errors', 'streamtube_child_check_limit_uploads', 100, 1 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement