Contents
bp_parse_args( string|array $args, array $defaults = array(), string $filter_key = '' )
Merge user defined arguments into defaults array.
Description
This function is used throughout BuddyPress to allow for either a string or array to be merged into another array. It is identical to wp_parse_args() except it allows for arguments to be passively or aggressively filtered using the optional $filter_key parameter. If no $filter_key is passed, no filters are applied.
Parameters
- $args
-
(Required) Value to merge with $defaults.
- $defaults
-
(Optional) Array that serves as the defaults.
Default value: array()
- $filter_key
-
(Optional) String to key the filters from.
Default value: ''
Return
(array) Merged user defined values with defaults.
Source
File: bp-core/bp-core-functions.php
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | function bp_parse_args( $args , $defaults = array (), $filter_key = '' ) { // Setup a temporary array from $args. if ( is_object ( $args ) ) { $r = get_object_vars( $args ); } elseif ( is_array ( $args ) ) { $r =& $args ; } else { wp_parse_str( $args , $r ); } // Passively filter the args before the parse. if ( ! empty ( $filter_key ) ) { /** * Filters the arguments key before parsing if filter key provided. * * This is a dynamic filter dependent on the specified key. * * @since BuddyPress 2.0.0 * * @param array $r Array of arguments to use. */ $r = apply_filters( 'bp_before_' . $filter_key . '_parse_args' , $r ); } // Parse. if ( is_array ( $defaults ) && ! empty ( $defaults ) ) { $r = array_merge ( $defaults , $r ); } // Aggressively filter the args after the parse. if ( ! empty ( $filter_key ) ) { /** * Filters the arguments key after parsing if filter key provided. * * This is a dynamic filter dependent on the specified key. * * @since BuddyPress 2.0.0 * * @param array $r Array of parsed arguments. */ $r = apply_filters( 'bp_after_' . $filter_key . '_parse_args' , $r ); } // Return the parsed results. return $r ; } |
Changelog
Version | Description |
---|---|
BuddyPress 2.0.0 | Introduced. |
Related
Uses
Uses | Description |
---|---|
bp-core/bp-core-functions.php: bp_before_{$filter_key}_parse_args |
Filters the arguments key before parsing if filter key provided. |
bp-core/bp-core-functions.php: bp_after_{$filter_key}_parse_args |
Filters the arguments key after parsing if filter key provided. |
Used By | Description |
---|---|
bp-messages/classes/class-bp-messages-thread.php: BP_Messages_Thread::get() |
Query for recipients. |
bp-messages/classes/class-bp-messages-thread.php: BP_Messages_Thread::get_threads_for_user() |
Get message threads. |
bp-messages/classes/class-bp-messages-message.php: BP_Messages_Message::get() |
Query for messages |
bp-messages/classes/class-bp-messages-notice.php: BP_Messages_Notice::get() |
Query for Notices. |
bp-document/bp-document-template.php: bp_has_folders() |
Initialize the folder loop. |
bp-document/bp-document-template.php: bp_has_document() |
Initialize the document loop. |
bp-document/bp-document-functions.php: bp_folder_get() |
Retrieve an folder or folders. |
bp-document/bp-document-functions.php: bp_folder_get_specific() |
Fetch specific folders. |
bp-document/bp-document-functions.php: bp_folder_add() |
Add folder item. |
bp-document/bp-document-functions.php: bp_folder_delete() |
Delete folder item. |
bp-document/bp-document-functions.php: bp_document_get() |
Retrieve an document or documents. |
bp-document/bp-document-functions.php: bp_document_get_specific() |
Fetch specific document items. |
bp-document/bp-document-functions.php: bp_document_add() |
Add an document item. |
bp-document/bp-document-functions.php: bp_document_delete() |
Delete document. |
bp-templates/bp-nouveau/includes/groups/ajax.php: bp_groups_messages_new_message() |
Create New Group Message. |
bp-messages/classes/class-bp-rest-group-messages-endpoint.php: BP_REST_Group_Messages_Endpoint::bp_rest_groups_messages_new_message() |
Create New Group Message. |
bp-members/classes/class-bp-rest-members-endpoint.php: BP_REST_Members_Endpoint::bp_rest_get_member_last_active() |
Return the current member’s last active time. |
bp-core/bp-core-rest-api.php: bp_rest_register_field() |
Registers a new field on an existing BuddyBoss object. |
bp-core/classes/class-bp-invitation-manager.php: BP_Invitation_Manager::accept_invitation() |
Accept invitation, based on provided filter parameters. |
bp-core/classes/class-bp-invitation-manager.php: BP_Invitation_Manager::accept_request() |
Accept invitation, based on provided filter parameters. |
bp-core/classes/class-bp-invitation-manager.php: BP_Invitation_Manager::add_invitation() |
Add an invitation to a specific user, from a specific user, related to a specific class. |
bp-core/classes/class-bp-invitation-manager.php: BP_Invitation_Manager::add_request() |
Add a request to an item for a specific user, related to a specific class. |
bp-core/classes/class-bp-invitation.php: BP_Invitation::get() |
Get invitations, based on provided filter parameters. |
bp-core/admin/bp-core-admin-schema.php: bp_core_install_group_message_email() |
Add default invites emails. |
bp-media/bp-media-template.php: bp_has_albums() |
Initialize the album loop. |
bp-media/bp-media-template.php: bp_has_media() |
Initialize the media loop. |
bp-media/bp-media-functions.php: bp_album_get_specific() |
Fetch specific albums. |
bp-media/bp-media-functions.php: bp_album_add() |
Add album item. |
bp-media/bp-media-functions.php: bp_album_delete() |
Delete album item. |
bp-media/bp-media-functions.php: bp_album_get() |
Retrieve an album or albums. |
bp-media/bp-media-functions.php: bp_media_get_specific() |
Fetch specific media items. |
bp-media/bp-media-functions.php: bp_media_add() |
Add an media item. |
bp-media/bp-media-functions.php: bp_media_delete() |
Delete media. |
bp-media/bp-media-functions.php: bp_media_get() |
Retrieve an media or medias. |
bp-notifications/bp-notifications-functions.php: bp_notifications_add_notification() |
Add a notification for a specific user, from a specific component. |
bp-notifications/bp-notifications-template.php: bp_has_notifications() |
Initialize the notifications loop. |
bp-blogs/bp-blogs-activity.php: bp_blogs_delete_activity() |
Delete a blog-related activity feed item. |
bp-blogs/bp-blogs-template.php: bp_blogs_get_profile_stats() |
Return the number of blogs in user’s profile. |
bp-blogs/bp-blogs-template.php: bp_get_blog_last_active() |
Return the last active date of the current blog in the loop. |
bp-blogs/bp-blogs-template.php: bp_get_blog_avatar() |
Get a blog’s avatar. |
bp-blogs/bp-blogs-template.php: bp_has_blogs() |
Initialize the blogs loop. |
bp-blogs/bp-blogs-functions.php: bp_blogs_get_blogs() |
Retrieve a set of blogs. |
bp-blogs/bp-blogs-functions.php: bp_blogs_record_existing_blogs() |
Populate the BP blogs table with existing blogs. |
bp-xprofile/bp-xprofile-activity.php: xprofile_record_activity() |
Records activity for the logged in user within the profile component so that it will show in the users activity feed (if installed). |
bp-xprofile/bp-xprofile-activity.php: xprofile_delete_activity() |
Deletes activity for a user within the profile component so that it will be removed from the users activity feed and sitewide stream (if installed). |
bp-xprofile/bp-xprofile-functions.php: xprofile_insert_field_group() |
Insert a new profile field group. |
bp-xprofile/bp-xprofile-template.php: bp_profile_get_visibility_radio_buttons() |
Return the field visibility radio buttons. |
bp-xprofile/bp-xprofile-template.php: bp_profile_get_settings_visibility_select() |
Return the XProfile field visibility select list for settings. |
bp-xprofile/bp-xprofile-template.php: bp_get_the_profile_field_options() |
Retrieves field options HTML for field types of ‘selectbox’, ‘multiselectbox’, ‘radio’, ‘checkbox’, and ‘datebox’. |
bp-xprofile/bp-xprofile-template.php: bp_has_profile() |
Query for XProfile groups and fields. |
bp-xprofile/classes/class-bp-xprofile-field-type.php: BP_XProfile_Field_Type::get_edit_field_html_elements() |
Get a sanitised and escaped string of the edit field’s HTML elements and attributes. |
bp-xprofile/classes/class-bp-xprofile-field-type-url.php: BP_XProfile_Field_Type_URL::edit_field_html() |
Output the edit field HTML for this field type. |
bp-xprofile/classes/class-bp-xprofile-field-type-url.php: BP_XProfile_Field_Type_URL::admin_field_html() |
Output HTML for this field type on the wp-admin Profile Fields screen. |
bp-xprofile/classes/class-bp-xprofile-field-type-telephone.php: BP_XProfile_Field_Type_Telephone::edit_field_html() |
Output the edit field HTML for this field type. |
bp-xprofile/classes/class-bp-xprofile-field-type-telephone.php: BP_XProfile_Field_Type_Telephone::admin_field_html() |
Output HTML for this field type on the wp-admin Profile Fields screen. |
bp-xprofile/classes/class-bp-xprofile-user-admin.php: BP_XProfile_User_Admin::user_admin_profile_metaboxes() |
Render the xprofile metabox for Community Profile screen. |
bp-xprofile/classes/class-bp-xprofile-field-type-number.php: BP_XProfile_Field_Type_Number::edit_field_html() |
Output the edit field HTML for this field type. |
bp-xprofile/classes/class-bp-xprofile-field-type-number.php: BP_XProfile_Field_Type_Number::admin_field_html() |
Output HTML for this field type on the wp-admin Profile Fields screen. |
bp-xprofile/classes/class-bp-xprofile-field-type-textarea.php: BP_XProfile_Field_Type_Textarea::admin_field_html() |
Output HTML for this field type on the wp-admin Profile Fields screen. |
bp-xprofile/classes/class-bp-xprofile-field-type-textbox.php: BP_XProfile_Field_Type_Textbox::edit_field_html() |
Output the edit field HTML for this field type. |
bp-xprofile/classes/class-bp-xprofile-field-type-textbox.php: BP_XProfile_Field_Type_Textbox::admin_field_html() |
Output HTML for this field type on the wp-admin Profile Fields screen. |
bp-xprofile/classes/class-bp-xprofile-field-type-datebox.php: BP_XProfile_Field_Type_Datebox::edit_field_html() |
Output the edit field HTML for this field type. |
bp-xprofile/classes/class-bp-xprofile-field-type-datebox.php: BP_XProfile_Field_Type_Datebox::admin_field_html() |
Output HTML for this field type on the wp-admin Profile Fields screen. |
bp-xprofile/classes/class-bp-xprofile-field-type-multiselectbox.php: BP_XProfile_Field_Type_Multiselectbox::admin_field_html() |
Output HTML for this field type on the wp-admin Profile Fields screen. |
bp-xprofile/classes/class-bp-xprofile-field-type-multiselectbox.php: BP_XProfile_Field_Type_Multiselectbox::edit_field_html() |
Output the edit field HTML for this field type. |
bp-messages/bp-messages-star.php: bp_get_the_message_star_action_link() |
Return the link or raw URL for starring or unstarring a message. |
bp-xprofile/bp-xprofile-settings.php: bp_xprofile_get_settings_fields() |
Query all profile fields and their visibility data for display in settings. |
bp-messages/bp-messages-template.php: bp_get_the_thread_message_sender_avatar_thumb() |
Get the avatar for the current message sender. |
bp-messages/bp-messages-template.php: bp_get_thread() |
Initialize the messages template loop for a specific thread and sets thread. |
bp-messages/bp-messages-template.php: bp_get_send_message_button() |
Generate the ‘Message’ button for member profile headers. |
bp-messages/bp-messages-template.php: bp_get_message_thread_avatar() |
Return the avatar for the last sender in the current message thread. |
bp-messages/bp-messages-template.php: bp_has_message_threads() |
Retrieve private message threads for display in inbox/sentbox/notices. |
bp-messages/bp-messages-functions.php: messages_new_message() |
Create a new message. |
bp-groups/classes/class-bp-groups-template.php: BP_Groups_Template::__construct() |
Constructor method. |
bp-groups/classes/class-bp-group-member-query.php: BP_Group_Member_Query::get_include_ids() |
Get a list of user_ids to include in the IN clause of the main query. |
bp-groups/classes/class-bp-groups-widget.php: BP_Groups_Widget::form() |
Extends our form method. |
bp-groups/classes/class-bp-groups-invite-template.php: BP_Groups_Invite_Template::__construct() |
BP_Groups_Invite_Template constructor. |
bp-groups/classes/class-bp-groups-membership-requests-template.php: BP_Groups_Membership_Requests_Template::__construct() |
Constructor method. |
bp-groups/classes/class-bp-groups-group.php: BP_Groups_Group::get() |
Query for groups. |
bp-groups/classes/class-bp-groups-group-members-template.php: BP_Groups_Group_Members_Template::__construct() |
Constructor. |
bp-groups/bp-groups-functions.php: bp_get_active_group_types() |
Get all active group types. |
bp-groups/bp-groups-functions.php: bp_groups_register_group_type() |
Register a group type. |
bp-groups/bp-groups-functions.php: groups_send_membership_request() |
Create a group membership request. |
bp-groups/bp-groups-functions.php: groups_send_invites() |
Send all pending invites by a single user to a specific group. |
bp-groups/bp-groups-functions.php: groups_invite_user() |
Invite a user to a group. |
bp-groups/bp-groups-functions.php: groups_post_update() |
Post an Activity status update affiliated with a group. |
bp-groups/bp-groups-functions.php: bp_get_user_groups() |
Get a list of groups of which the specified user is a member. |
bp-groups/bp-groups-functions.php: groups_get_group_members() |
Fetch the members of a group. |
bp-groups/bp-groups-functions.php: groups_get_groups() |
Get a collection of groups, based on the parameters passed. |
bp-groups/bp-groups-functions.php: groups_edit_base_group_details() |
Edit the base details for a group. |
bp-groups/bp-groups-functions.php: groups_get_group() |
Fetch a single group object. |
bp-groups/bp-groups-functions.php: groups_create_group() |
Create a group. |
bp-groups/bp-groups-activity.php: groups_record_activity() |
Record an activity item related to the Groups component. |
bp-groups/bp-groups-template.php: bp_groups_get_profile_stats() |
Return the number of groups in user’s profile. |
bp-groups/bp-groups-template.php: bp_group_has_invites() |
Whether or not there are invites. |
bp-groups/bp-groups-template.php: bp_group_has_membership_requests() |
Initialize a group membership request template loop. |
bp-groups/bp-groups-template.php: bp_get_new_group_invite_friend_list() |
Return a list of friends who can be invited to a group |
bp-groups/bp-groups-template.php: bp_get_new_group_avatar() |
Return the avatar for the group currently being created |
bp-groups/bp-groups-template.php: bp_get_group_member_joined_since() |
Return the joined date for the current member in the group member loop. |
bp-groups/bp-groups-template.php: bp_get_group_member_avatar() |
Return the group member avatar while in the groups members loop. |
bp-groups/bp-groups-template.php: bp_get_group_member_avatar_thumb() |
Return the group member avatar while in the groups members loop. |
bp-groups/bp-groups-template.php: bp_get_group_member_avatar_mini() |
Output the group member avatar while in the groups members loop. |
bp-groups/bp-groups-template.php: bp_group_has_members() |
Initialize a group member query loop. |
bp-groups/bp-groups-template.php: bp_get_group_member_promote_mod_link() |
Generate a URL for promoting a user to moderator. |
bp-groups/bp-groups-template.php: bp_get_group_member_promote_admin_link() |
Generate a URL for promoting a user to admin. |
bp-groups/bp-groups-template.php: bp_get_possible_parent_groups() |
Get an array of possible parent group ids for a specific group and user. |
bp-groups/bp-groups-template.php: bp_get_group_creator_avatar() |
Return the avatar of the creator of the current group in the loop. |
bp-groups/bp-groups-template.php: bp_get_group_date_created() |
Return the created date of the current group in the loop. |
bp-groups/bp-groups-template.php: bp_get_group_last_active() |
Return the ‘last active’ string for the current group in the loop. |
bp-groups/bp-groups-template.php: bp_get_group_avatar() |
Get a group’s avatar. |
bp-groups/bp-groups-template.php: bp_get_group_type_list() |
Return a comma-delimited list of group types. |
bp-groups/bp-groups-template.php: bp_has_groups() |
Start the Groups Template Loop. |
bp-members/bp-members-functions.php: bp_get_active_member_types() |
Get all profile types. |
bp-members/bp-members-functions.php: bp_register_member_type() |
Register a profile type. |
bp-members/bp-members-functions.php: bp_core_get_users() |
Fetch an array of users based on the parameters passed. |
bp-members/classes/class-bp-signup.php: BP_Signup::update() |
Update the meta for a signup. |
bp-members/classes/class-bp-signup.php: BP_Signup::get() |
Fetch signups based on parameters. |
bp-members/classes/class-bp-signup.php: BP_Signup::add() |
Add a signup. |
bp-members/classes/class-bp-core-whos-online-widget.php: BP_Core_Whos_Online_Widget::parse_settings() |
Merge the widget settings into defaults array. |
bp-members/classes/class-bp-core-recently-active-widget.php: BP_Core_Recently_Active_Widget::parse_settings() |
Merge the widget settings into defaults array. |
bp-members/classes/class-bp-core-members-widget.php: BP_Core_Members_Widget::parse_settings() |
Merge the widget settings into defaults array. |
bp-members/bp-members-template.php: bp_get_member_last_active() |
Return the current member’s last active time. |
bp-members/bp-members-template.php: bp_has_members() |
Initialize the members loop. |
bp-friends/bp-friends-template.php: bp_friends_get_profile_stats() |
Return the number of friends in user’s profile. |
bp-friends/classes/class-bp-friends-friendship.php: BP_Friends_Friendship::get_friendships() |
Get the friendships for a given user. |
bp-templates/bp-nouveau/includes/groups/functions.php: bp_nouveau_get_group_potential_invites() |
Get potential group invites. |
bp-templates/bp-nouveau/includes/template-tags.php: bp_nouveau_get_customizer_link() |
Get a link to reach a specific section into the customizer |
bp-templates/bp-nouveau/includes/functions.php: bp_nouveau_get_appearance_settings() |
Get the BP Nouveau Appearance settings. |
bp-core/admin/bp-core-admin-schema.php: bp_core_install_emails() |
Add default emails. |
bp-core/admin/bp-core-admin-schema.php: bp_core_install_bbp_emails() |
Add default bbp emails. |
bp-core/admin/bp-core-admin-schema.php: bp_core_install_invites_email() |
Add default invites emails. |
bp-core/deprecated/buddyboss/1.0.php: bp_get_send_public_message_button() |
Return button for sending a public message (an @-mention). |
bp-core/bp-core-template.php: bp_get_email_subject() |
Retrieve a client friendly version of the root blog name. |
bp-core/bp-core-template.php: bp_create_excerpt() |
Truncate text. |
bp-core/classes/class-bp-attachment.php: BP_Attachment::edit_image() |
Edit an image file to resize it or rotate it |
bp-core/classes/class-bp-attachment.php: BP_Attachment::crop() |
Crop an image file. |
bp-core/classes/class-bp-attachment.php: BP_Attachment::__construct() |
Construct Upload parameters. |
bp-core/classes/class-bp-core-network-posts-widget.php: BP_Core_Network_Posts_Widget::parse_settings() |
Merge the widget settings into defaults array. |
bp-core/bp-core-functions.php: bp_email_get_appearance_settings() |
Return email appearance settings. |
bp-core/bp-core-functions.php: bp_send_email() |
Send email, similar to WordPress’ wp_mail(). |
bp-core/bp-core-functions.php: bp_core_get_suggestions() |
BuddyPress Suggestions API for types of at-mentions. |
bp-core/bp-core-attachments.php: bp_attachments_cover_image_ajax_upload() |
Ajax Upload and set a cover photo |
bp-core/bp-core-attachments.php: bp_attachments_enqueue_scripts() |
Enqueues the script needed for the Uploader UI. |
bp-core/bp-core-attachments.php: bp_attachments_get_cover_image_settings() |
Get the cover photo settings |
bp-core/bp-core-attachments.php: bp_attachments_cover_image_upload_dir() |
Gets the upload dir array for cover photos. |
bp-core/bp-core-attachments.php: bp_attachments_create_item_type() |
Use the absolute path to an image to set an attachment type for a given item. |
bp-core/bp-core-attachments.php: bp_attachments_get_attachment() |
Get the url or the path for a type of attachment. |
bp-activity/bp-activity-functions.php: bp_activity_delete_by_item_id() |
Delete an activity item by activity id. |
bp-activity/bp-activity-functions.php: bp_activity_get_activity_id() |
Fetch the activity_id for an existing activity entry in the DB. |
bp-activity/bp-activity-functions.php: bp_activity_delete() |
Delete activity item(s). |
bp-activity/bp-activity-functions.php: bp_activity_get() |
Retrieve an activity or activities. |
bp-activity/bp-activity-functions.php: bp_activity_get_specific() |
Fetch specific activity items. |
bp-activity/bp-activity-functions.php: bp_activity_add() |
Add an activity item. |
bp-activity/bp-activity-functions.php: bp_activity_get_post_type_tracking_args() |
Get tracking arguments for a specific post type. |
bp-activity/bp-activity-filters.php: bp_activity_link_preview() |
Embed link preview in activity content |
bp-activity/bp-activity-filters.php: bp_activity_heartbeat_last_recorded() |
Use WordPress Heartbeat API to check for latest activity update. |
bp-activity/bp-activity-template.php: bp_activity_types_list() |
Echo a list of all registered activity types for use in dropdowns or checkbox lists. |
bp-activity/bp-activity-template.php: bp_activity_comments_user_avatars() |
Echo a list of linked avatars of users who have commented on the current activity item. |
bp-activity/bp-activity-template.php: bp_has_activities() |
Initialize the activity loop. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.