groups_file_access_can_access
This filter is used to modify whether a file should be accessible for a particular user or not. The filter is invoked before the file is served.
The filter takes three parameters and must return a boolean which determines whether the user is allowed to access the particular file or not.
Parameters:
boolean $can_access
true
if the user is already allowed to access the file, otherwisefalse
int $user_id
the ID of the user to whom the file would be servedint $file_id
the ID of the file to be served
Returns:
boolean
true
if the user should be allowed to access the file, otherwise false
Example:
function custom_groups_file_access_can_access( $can_access, $user_id, $file_id ) { if ( $can_access ) { // additional verification ... } return $can_access; } add_filter( 'groups_file_access_can_access', 'custom_groups_file_access_can_access', 10, 3 );
We recommend to put this in a plugin of its own although a customized filter can also be added to your theme’s functions.php.
groups_file_access_server_response_title
Allows to modify the page title.
This is one of several filters that allow to customize server responses when 403 or 404 responses are sent in reply to requests for invalid or inaccessible files. See the Groups File Access Custom Response plugin for an example implementation. This filter cannot be used within a theme’s functions.php
, it must be used within a plugin.
Parameters:
string $title
the page titleint $code
the error codeint $file_id
the ID of the file
Returns:
string
the page title
groups_file_access_server_response_heading
Allows to modify the heading displayed.
This is one of several filters that allow to customize server responses when 403 or 404 responses are sent in reply to requests for invalid or inaccessible files. See the Groups File Access Custom Response plugin for an example implementation. This filter cannot be used within a theme’s functions.php
, it must be used within a plugin.
Parameters:
string $heading
the headingint $code
the error codeint $file_id
the ID of the file
Returns:
string
the heading
groups_file_access_server_response_message
Allows to modify the message displayed.
This is one of several filters that allow to customize server responses when 403 or 404 responses are sent in reply to requests for invalid or inaccessible files. See the Groups File Access Custom Response plugin for an example implementation. This filter cannot be used within a theme’s functions.php
, it must be used within a plugin.
Parameters:
string $message
the messageint $code
the error codeint $file_id
the ID of the file
Returns:
string
the message
groups_file_access_server_response_document
Allows to modify the document, uses %s
placeholders for title, heading and message.
This is one of several filters that allow to customize server responses when 403 or 404 responses are sent in reply to requests for invalid or inaccessible files. See the Groups File Access Custom Response plugin for an example implementation. This filter cannot be used within a theme’s functions.php
, it must be used within a plugin.
Parameters:
string $document
the documentint $code
the error codeint $file_id
the ID of the file
Returns:
string
the document
groups_file_access_uploads_dir
Allows to modify the uploads directory used by the plugin.
For a multisite, this provides the individual uploads directory for each network site.
Parameters:
string $gfa_uploads_dir
the full path of the uploads directory
Returns:
string
the full path of the uploads directory
groups_file_access_groups_file_served_datetime
Allows to modify the date and time displayed in the admin notification email.
Parameters:
- string $datetime
- int $now timestamp
- int $file_id file ID
- int $user_id user ID
Returns:
- string formatted date and time
groups_file_access_groups_file_served_tokens
Allow to modify the tokens used for the admin notification email.
Parameters:
- array $tokens
- int $file_id file ID
- int $user_id user ID
Returns:
- array
groups_file_access_group_file_info_shortcode
Allows to modify the output produced by the [groups_file_info]
shortcode.
Parameters:
- string $output the output produced by the shortcode
- array $atts the shortcode attributes
- object $file the file for which the shortcode is applied
- object $metas the meta data for the file
Returns:
- string the output