JReviews logo Docs
Menu
Version

community

Allows changing or hiding user display name and avatar.

Filter
Users
Since 3.8.0

You need to have a working knowledge of Hooks before you get started.

The community filter combines the following related filters into one:

  • community_avatar
  • community_screenname
  • community_profile_preview_attributes

When using the common community filter name, each filter will also pass a $params['referer'] value to be able to identify which filter is being run.

Parameters

Name Type Description
$output parameter (mixed) Varies based on filter `referer`
$params parameter (array) Includes `entry` key represent a listing, review, discussion, etc.

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('community', function($output, $params)
{
    // Uncomment line below to view available data passed into hook
    // fwd_dd($output, $params);

    return $output;
});
Development & Support
Customizations are not included with support. We provide this information to make it easier for developers to extend the functionality. From time to time we may have some availability for custom work. Get in touch to see if there's an opportunity to work together.

Examples

Hide display name and avatar for specific users

function hide_user($output, $params)
{
	// List of user IDs for which to hide name and avatar
  	$hideUserIds = [10,20,30];

	if ( in_array($params['entry']['User']['user_id'], $hideUserIds)) 
	{
		return '';
	}

    return $output;
}

Clickfwd\Hook\Filter::add('community', 'hide_user', 20);

// The above filter combines the three filters below in one

// Clickfwd\Hook\Filter::add('community_avatar', 'hide_user', 20);

// Clickfwd\Hook\Filter::add('community_screenname', 'hide_user', 20);

// Clickfwd\Hook\Filter::add('community_profile_preview_attributes', 'hide_user', 20);

Source Files

  • /views/helpers/community.php