can_upload_listing_media
Filter user permission to upload media to listings by specifying the allowed media types.
You need to have a working knowledge of Hooks before you get started.
To disable upload permissions, return an empty array. Individual media type permissions can also be controlled using the hooks available for each media type.
Parameters
Name | Type | Description |
---|---|---|
$allowedMediaTypes |
parameter |
(array) ['attachment', 'audio', 'photo', 'video'] |
$params |
parameter |
(array) associative array with contextual data |
Boilerplate Code
Use the boilerplate code to start using the filter, and add your own logic to modify the first argument and return it.
Clickfwd\Hook\Filter::add('can_upload_listing_media', function($allowedMediaTypes, $params)
{
// Uncomment line below to view available data passed into hook
// fwd_dd($allowedMediaTypes, $params);
return $allowedMediaTypes;
});
Source Files
/services/authorization/listing_permissions.php