Primary

Filters

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, otherwise false
  • int $user_id the ID of the user to whom the file would be served
  • int $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 title
  • int $code the error code
  • int $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 heading
  • int $code the error code
  • int $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 message
  • int $code the error code
  • int $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 document
  • int $code the error code
  • int $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