Plugin Directory

Changeset 512333


Ignore:
Timestamp:
02/29/2012 01:24:13 PM (14 years ago)
Author:
sushkov
Message:

Introducing COURSEWARE_PRIVATE_UPLOADS constant
for disabling private uploads in responses or allover the courseware editors are used.
If this is set to false, uploaded files will not be filtered anymore by it owner.

Location:
buddypress-courseware/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • buddypress-courseware/trunk/groups/groups.class.php

    r498795 r512333  
    3131        add_action( 'groups_admin_tabs', array( &$this, 'group_admin_tab' ), 10, 2 );
    3232        add_action( 'wp', array( &$this, 'group_admin_screen' ), 4 );
    33         add_filter( 'media_upload_form_url', array( __CLASS__, 'bpsp_media_library_tab' ) );
     33        add_filter( 'media_upload_form_url', array( __CLASS__, 'media_library_tab' ) );
    3434    }
    3535   
     
    304304     * and will add to the current query currently logged in author ID
    305305     */
    306     function bpsp_restrict_uploads( $wp_the_query ) {
     306    function restrict_uploads( $wp_the_query ) {
    307307        // Check if current user is admin or sort of
    308308        if ( !current_user_can( 'manage_options' ) )
     
    313313    /**
    314314     * Media library displays all the uploads,
    315      * bpsp_media_library_tab() will do some checks and try to hide
     315     * media_library_tab() will do some checks and try to hide
    316316     * attachments that are not owned by current user
    317317     */
    318     function bpsp_media_library_tab( $action_url ) {
    319         // Try to catch Courseware uploads page
    320         if ( isset( $_REQUEST['bpsp-upload'] ) && isset( $_REQUEST['tab'] ) )
    321             // Check if the user is on the current tab
    322             if ( $_REQUEST['tab'] == 'library' )
    323                 // Do some checks before displaying attachments
    324                 add_action( 'pre_get_posts', array( __CLASS__, 'bpsp_restrict_uploads' ) );
     318    function media_library_tab( $action_url ) {
     319        // Check if private uploads are disabled
     320        if ( defined( 'COURSEWARE_PRIVATE_UPLOADS' ) && !COURSEWARE_PRIVATE_UPLOADS )
     321          return;
     322
     323        // Check if the user is on the current tab
     324        if ( $_REQUEST['tab'] == 'library' )
     325            // Do some checks before displaying attachments
     326            add_action( 'pre_get_posts', array( __CLASS__, 'restrict_uploads' ) );
    325327       
    326328        return $action_url;
  • buddypress-courseware/trunk/readme.txt

    r511842 r512333  
    6565
    6666== Changelog ==
     67
     68= 0.9.6 =
     69
    6770
    6871= 0.9.5 =
Note: See TracChangeset for help on using the changeset viewer.