userprofiles_account_sections
Allows adding and removing sections from the UserProfiles account page.
You need to have a working knowledge of Hooks before you get started.
Parameters
| Name | Type | Description |
|---|---|---|
$sections |
parameter |
(array) sections array with title, summary and body keys for each section. |
$params |
parameter |
(array) associative array with current profile user and public profile listing data |
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('userprofiles_account_sections', function($sections, $params)
{
// Uncomment line below to view available data passed into hook
// fwd_dd($sections, $params);
return $sections;
});
Examples
Add Section with Membership Information for 3rd Party Solution
If you have a membership solution from another provider on your site, you can add information about the user's membership status or link to the membership management page.
Clickfwd\Hook\Filter::add('userprofiles_account_sections', function($sections, $params = [])
{
// The user ID for the current profile
$userId = array_get($params,'user.User.id');
$sections['membership'] = [
'title'=>'Your Membership Status',
'summary'=>'Below you can find the details of your current membership plan',
'body'=>'<p>Here you can add a link to the membership page or if you have the code to lookup membership info you can insert the rendered template with that information here</p>'
];
return $sections;
}, 10);
Source Files
/userprofiles/controllers/components/userprofiles_profile.php