How to enable a user to edit/delete and upload other user's media?


#1

I am working on a website where I have student guardian relationships. So when a guardian is visiting his student profile, he should be able to edit, delete all the fields that a user itself can do. I am using buddypress and have used rtmedia plugin. Now For example, student uploads media, images. By default, other user can’t delete or edit the media. But in my case, guardian should be capable of editing and deleting students media. Can you tell me where I can modify user roles or can you send me code to do this? I am thinking that if I assign the admin role to guardian when he is viewing students profile then my problem can be solved. But I don’t know how to assign a user amdin role. Thanks

Attachment Link(s):

http://rtcamp.com/wp-content/uploads/rtMedia/topics/65610/2014/05/Support.png


#2

Giving user an admin rights means he/she can make changes to the live site. You should avoid that actually.

There is a filter available in rtMedia rtmedia_media_delete_priv, using which you can check whether current user is guardian or not and according to that return true/false to allow delete media.


#3

Thanks for your help Ritesh. Now Guardian can edit and delete the students media but can’t upload media at students profile. Is there any filter to upload media also? Thanks


#4

Hi Tanoli,
It is not available in rtMedia right now to post media to other user’s profile. You need to write custom work for that. You can contact us -> https://rtcamp.com/contact/ for any rtMedia related custom work.


#5

Hi Ritesh, I need your assistance again. After uploading any media, I want to send a message to the students guardian that the student has uploaded a media. I don’t know at which point I should integrate this functionality. Is there any hook for this purpose? Thanks in advance.


#6

Hi Tanoli,
Yes there is a hook available for that -> rtmedia_after_add_media.
Please check this link -> https://github.com/rtCamp/rtMedia/blob/master/app/main/controllers/media/RTMediaMedia.php#L174, you will get the idea about parameters for this hook.


#7