BuddyDev

Search

[Resolved] Prevent subscribers from uploading images?

  • Participant
    Level: Initiated
    Posts: 8
    A. Rhein on #511

    Hi,

    is there a way to prevent subscribers from uploading?

    I would like only contributors and “up” being able to upload media.

    Thank you, kind regards,

    Achim

  • Keymaster
    (BuddyDev Team)
    Posts: 24636
    Brajesh Singh on #512

    Hi Achim,
    That is very easy to do. I just need to ask you another question tough. Do you want your subscribers to create galleries? I guess an obvious answer should be no.

  • Participant
    Level: Initiated
    Posts: 8
    A. Rhein on #515

    Hello, thank you for answering.

    No, subscribers should not be able to create galleries, obviously.

  • Participant
    Level: Initiated
    Posts: 1
    abudantlyblessed on #516

    Sorry to have to post here but I am unable to respond on my original string #514. Can you email me directly? About the stealth mode.

  • Keymaster
    (BuddyDev Team)
    Posts: 24636
    Brajesh Singh on #531

    Hi A,
    Apologies for the delayed reply.
    Please put this in your bp-custom.php

    
    add_filter( 'mpp_user_can_create_gallery', 'mpp_custom_prevent_gallery_creation', 11, 3 );
    
    function mpp_custom_prevent_gallery_creation( $can_do, $component, $component_id ) {
    	
    	return buddydev_is_above_subscriber();
    }
    
    add_filter( 'mpp_user_can_upload', 'mpp_custom_prevent_gallery_upload', 11, 4 );
    
    function mpp_custom_prevent_gallery_upload( $can_do, $component, $component_id, $gallery ) {
    	
    	return buddydev_is_above_subscriber();
    }
    

    That will do it but the Ui will be still visible.

  • Participant
    Level: Initiated
    Posts: 8
    A. Rhein on #573

    Hello, thank you for your answer.

    However, with your code in my bp-custom.php, NOBODY can´t even SEE any galleries any more!

    What am I doing wrong?

    Thank you, kind regards,

    A. Rhein

  • Keymaster
    (BuddyDev Team)
    Posts: 24636
    Brajesh Singh on #576

    Hi A . Rhein,
    I am sorry, That was a mistake in my part.

    I forgot to put the function we are calling.
    Please add this snippet too to your bp-custom.php

    
    function buddydev_is_above_subscriber() {
    	
    	if (  current_user_can( 'delete_posts' ) ) {
    		return true;
    	}
    	
    	return false;
    }
    
    

    Now, that will work for sure.

  • Participant
    Level: Initiated
    Posts: 8
    A. Rhein on #599

    YEAH – that´s it!

    This works very much as I hoped it would!
    And I can´t even see any unwished UI.

    Thank you SO much!

    Kind regards, Achim

The topic ‘ [Resolved] Prevent subscribers from uploading images?’ is closed to new replies.

This topic is: resolved