BuddyDev

Search

 mpp_register_type ( $args )

Register a new media/gallery type.

Description

This function is used to register new gallery or media type.

Parameters

$args

  • key (string) (Required) Unique identifier for this type. Example “photo”, “audio”,”video” etc.
  • label (string) (Required) A name for this status. Example:- “Photo”, “Audio”, “Video”
  • labels (array) (Required ) An associative array with two keys, “singular_name”, “plural_name” the values represent labels.
  • description (string) (Optional) A textual description of this status
  • extensions (array) (Required ) An array of file extensions allowed for the media of this type.

Returns

It does not return anything.

 Examples

The code shows how we register the Friends only privacy

In the above code, we have created a new media/gallery type called presentation and have allowed file types with extensions “ppt”, “pps”, “pptx”, “odp” to be uploadable to this type of gallery.

To make this media type available to a component, we need to tell the system that this type is supported for a component type. We can use the following code to make presentations available to sitewide and user component.

The above code lets the system know that this type is available for the sitewide and members component. MediaPress will let admin choose whether to allow users to use this type or not.

 

Note:-

It must be used on or after “mpp_setup_core” action.

See also:-

mpp_deregister_type

 Changelog

  • Since 1.0.0

Source

medisapress/core/api/mpp-api.php