Advertisement
Guest User

Untitled

a guest
Mar 1st, 2015
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. function my_files_only( $wp_query ) {
  2. if ( strpos( $_SERVER[ 'REQUEST_URI' ], '/wp-admin/upload.php' ) !== false ) {
  3. if ( !current_user_can( 'level_5' ) ) {
  4. global $current_user;
  5. $wp_query->set( 'author', $current_user->id );
  6. }
  7. }
  8. }
  9.  
  10. add_filter('parse_query', 'my_files_only' );
  11.  
  12. //Remove Media Library Tab
  13. function remove_medialibrary_tab($tabs) {
  14. if ( !current_user_can( 'administrator' ) ) {
  15. unset($tabs['library']);
  16. return $tabs;
  17. }
  18. else
  19. {
  20. return $tabs;
  21. }
  22. }
  23. add_filter('media_upload_tabs','remove_medialibrary_tab');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement