Filter: profile navigation order

Hook
peepso_filter_navigation_profile_order

 

Plugin PeepSo Foundation
Since 3.0.0.0
Status Active
Args
array

Description

This filter is used to order the list of links built with peepso_navigation_profile. The argument is an array of strings – the unique keys representing the links.

The “Stream” and “About” tabs cannot be moved – they will always be displayed first. You are not required to specify all keys – omitted keys will fall back to their original sorting. It’s recommended to follow the array_merge() approach displayed below, to make sure other plugins can also use this filter successfully.

If you are using the WooCommerce Product Vendors plugin and wish to move the “Products” tab, you need to use filter priority higher than 10000.

Examples

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

Filter: custom cover size

Hook
peepso_filter_cover_sizes_to_delete

 

Plugin PeepSo Foundation
Since 1.11.4
Status Active
Args
array(int)

Description

To use a custom cover size in your theme or plugin, simply pass an integer to PeepSoUser::get_cover($value). Custom sized images are generated on-the-fly and stored in the user’s directory.

If you do use custom cover images by passing an integer to PeepSoUser::get_cover(), you should hook into this filter to make sure your custom sized cover is deleted when the user removes it.

Examples

Let’s say you use a custom sized cover of 666 somewhere in your plugin or theme:

Since PeepSo creates a file on-the-fly if needed, make sure the file is cleaned up when user removes his cover. To do that, you need to add your custom size to the array of integers.

Action: profile completeness changed

Hook
peepso_action_profile_completeness_change

 

Plugin PeepSo Foundation
Since 1.8.2
Status Active
Args
array

Description

Fires after user’s profile completeness percentage changes when saving a field.

Fires inside an AJAX call and all output is discarded. You can set transients, send notifications, write to database etc, but you cannot modify the AJAX output.

The argument is an array('before'⇒(int),'after'⇒(int) so you can (for example) make sure to fire your code only when the percentage goes up (or down).

This will NOT take into account admin adding/removing fields until user saves something in their profile. Profile completeness is recalculated ONLY when users modify their profiles.

Examples

Action: print after login form

Hook
peepso_after_login_form

 

Plugin PeepSo Foundation
Since 1.6.2
Status Active
Args
(none)

Description

Available in Welcome Screen and PeepSo Profile Widget for guest users.

Use it to print additional login/registration HTML – for example buttons for external login/registration handlers like Facebook.

Examples

Action: user profile field saved

Hook
peepso_action_profile_field_save

 

Plugin PeepSo Foundation
Since 1.7.3
Status Active
Args
PeepSoField

Description

Fires after PeepSoField::save() successfully writes data for a given user field. Also applies to all classes that extend PeepSoField.

Examples

Welcome to PeepSo Developer Documentation

Where To Start?

Check out our Hello World! plugin. This example plugin that highlights several most important hooks and actions necessary to successfully “plug into”  PeepSo. Please don’t download and install it if you are not a programmer, it’s a resource for experienced engineers!

Documentation

You can access the hooks (actions & filters) documentation from the panel on the left.  Unfortunately, documenting our hooks has never been extremely high on our priority list, given little time left after the between day-to-day development and end-user documentation and support. We do try to document anything that is asked often enough. More often than not, things can be figured out by reading our source code. Frankly, if you ask us a question, that’s what we will do – because nobody remembers every line of PeepSo code by heart.

Community Support

We have a special group for developers where you can ask questions. Most often repeated topics are prioritized for documentation.

Success stories

Despite being a relatively young project, PeepSo already attracted the attention of some third party developers. We maintain  a list of all known third party software and hope to see you there some day!

Thank you

Thanks for choosing (or considering) PeepSo for your next project.

Live long and prosper,
Matt Jaworski
Founder & CTO

Filter: name parts

Hook
peepso_get_name_parts
Plugin PeepSo Foundation
Since 1.8.2
Status Active
Args
array

Description

This filter is used to gather and order “parts” used to display the user’s name. The default “parts” are: the real name (first name & last name), or username, depending on availability of the data and the settings.

Practical uses of this filter can include: changing the order of the name parts, adding a middle name or a nickname, removing last names from display etc.

When working with this filter, always assume you will have access to one or more parts, never assume a specific number.

For example, admin or user might decide to only show username (by using the “display name style” settings). Sometimes the real name has not been provided. In these cases the username will be available.

Sometimes the real name is used, but last name is missing – then only the first name will be available.

Limitations

Do not use this filter to add rich HTML to name parts. This should be done with actions: peepso_action_render_user_name_before and peepso_action_render_user_name_after.

Examples