WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Only allow MP3 uploads to Sermons

[Resolved] Only allow MP3 uploads to Sermons

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Vladimir Garagulya
    Participant

    @shinephp

    As Sermon Manager plugin doesn’t use any special capability to permit/prohibit attachment media types, URE plugin can not help you in this case.
    But You may use this code to limit upload by MP3 files only:

    <?php
    add_filter( 'wpfc_meta_boxes', 'modified_sermon_metaboxes', 9999 );
    // Define the metabox and field configurations.
    function modified_sermon_metaboxes( array $meta_boxes ) {
    
      unset($meta_boxes[1]['fields'][1]);  // switch off video
      unset($meta_boxes[1]['fields'][2]);  // switch off PDF
    
      return $meta_boxes;
    }
    ?>

    In order this code work for you create folder wp-content/mu-plugins
    “mu” – means “must use”
    create any php file there, e.g. sermon.php and place code above into it.

    Trishah
    Participant

    @trishahdee

    Very interesting. I see how that would work.

    Unfortunately, your suggestion is not going to work in the current situation. At this point limiting to MP3’s is less important then limiting to the Sermons Manager.

    Would you be so kind as to show me how to create a user account that would only be able to access the Sermons Manager admin pages and no others?

    Trishah
    Participant

    @trishahdee

    I’m sorry to have to ask again… I just can’t figure out how to set up your plugin to make one role only about to access the Sermons Manager plugin. http://wordpress.org/extend/plugins/sermon-manager-for-wordpress/

    I’ve looked through your website and can’t put it all together so it works. Can you give me some guidance please?

    Plugin Author Vladimir Garagulya
    Participant

    @shinephp

    It is impossible to achieve without modifying plugin code.
    Sermon Manager creates custom post type with Sermons, which needs capability ‘edit_posts’. “Setting” menu item is added to the same ‘Sermons’ menu with ‘manage_options’ capability.

    // Add menu page
    function wpfc_add_options_page() {
    	$page = add_submenu_page('edit.php?post_type=wpfc_sermon', __('Sermon Manager Settings', 'sermon-manager'), __('Settings', 'sermon-manager'), 'manage_options', __FILE__, 'wpfc_sermon_options_render_form');
    	add_action( 'admin_print_styles-' . $page, 'wpfc_sermon_admin_styles' );
    }

    If you change ‘manage_options’ to the custom created role, you still can not open ‘Settings’ page, as plugin calls it via ‘edit.php’ which requires that user has ‘edit_posts’ capability.
    Thus it is necessary to fully rewrite this part of plugin to divide work with Sermons posts and Settings page.

    Trishah
    Participant

    @trishahdee

    Ah… than that makes sense why I was having problems trying to get it to work. I appreciate you taking the time to explain this to me.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] Only allow MP3 uploads to Sermons’ is closed to new replies.