Filter: profile navigation

Hook
peepso_navigation_profile

 

Plugin PeepSo Foundation
Since 1.8.5
Status Active
Args
array

Description #

This filter is used to build a list ofย  links used in:

  • profile tabs
  • profile widget links
  • mobile profile sub-menu

All tabs are supposed to be the same in every context. It is not possible to sort the tabs – they are appended in the order of the filters firing – you can adjust that by using filter priority.

Each tab is identified by an unique key. By hooking into the filter and modifying the array after everything was processed, it’s also possible to delete or rename tabs to your liking.

Examples #

Adding custom tabs #

The peepso_navigation_profile filter only works in pair with a dedicated peepso_profile_segment_* action. Please refer to the PeepSo Hello World plugin – it contains example code showing exactly how to add tabs and the subsequent action hook required for rendering.

Deleting and renaming #

Deleting a tab should not be treated as a security measureย  – the URL related to the tab will still work, so if you are trying to implement access control, it should be done in the rendering action mentioned above.

Profile ownership #

You can check ownership (for example to remove a tab if the viewer is not the owner)ย  by checking if get_current_user_id() is the same as $links['_user_id'].

Sorting #

Tabs can be sorted with a final filter peepso_filter_navigation_profile_order.

Screenshot #

Elements marked in red are managed by peepso_navigation, yellow marks peepso_navigation_profile. Mobile view on the left, desktop view on the right

peepso_navigation filter
peepso_navigation & peepso_navigation_profile
What are your feelings
Updated on September 22, 2023