The GFA_Shortcodes class provides class methods that can be used to render links and information about files handled by the Groups File Access plugin.
GFA_Shortcodes::groups_file_url( $atts, $content = null )
Renders a file URL.
Attributes are passed through $atts:
file_id: id of the filevisibility: This option determines whether the file URL will be returned for the current user or not.can_accesswill only return the file URL if the current user is allowed to access the file;alwayswill return the file URL disregarding whether the user is allowed to access the file.
Parameters
array $attsattributesstring $content– not used
Returns:
string rendered URL
GFA_Shortcodes::groups_file_link( $atts, $content = null )
Renders a link to a file based on settings passed through $atts.
Required attributes are either file_id or group.
Basic attributes:
file_id: id of the filevisibility:can_accessoralwaysseeGFA_Shortcodes::groups_file_url()group: group name or ID – will list files for the given group sorted by namedescription: defaults tono,yesshows description for each entry (onlygroup)order:ASCorDESCsort order (only forgroup)list_prefix: defaults to<ul>list_suffix: defaults to</ul>item_prefix: defaults to<li>item_suffix: defaults to</li>
Note that the prefixes and suffixes are very limited due to filters applied.
Allowed link attributes that are applied to the rendered a tag: accesskey, alt, charset, coords, class, dir, hreflang, id, lang, name, rel, rev, shape, style, tabindex, target
Parameters:
array $attsattributesstring $contentnot used
Returns:
string rendered link
GFA_Shortcodes::groups_can_access_file( $atts, $content = null )
Returns $content if the current user can access the file.
Parameters:
array $attsattributes – must provide thefile_idstring $contentcontent to render
Returns:
string $content or empty string
GFA_Shortcodes::groups_can_not_access_file( $atts, $content = null )
Returns $content if the current user can not access the file.
Parameters:
array $attsattributes – must provide thefile_idstring $contentcontent to render
Returns:
string $content or empty string
GFA_Shortcodes::groups_file_info( $atts, $content = null )
Renders file information.
The visibility parameter determines whether the $content will be returned for the current user or not:
can_access will only return $content if the current user is allowed to access the file; alwayswill return $content disregarding whether the user is allowed to access the file
Attributes:
file_id: id of the filevisibility:can_access(default) oralwaysshow:name,description,count,max_count,remaining,file_id
Parameters:
array $attsattributes – must provide thefile_idstring $contentcontent to render
Returns:
string $content or empty string
GFA_Shortcodes::groups_visibility( $atts, $content = null )
Allows to switch the default visibility setting for shortcodes handled by GFA_Shortcodes.
Parameters:
array $attsattributes must specify thevisibilitywith allowed valuesalways,can_accessstring $contentnot used
