bp_parse_args( string|array $args, array $defaults = array(), string $filter_key = '' )
Merge user defined arguments into defaults array.
Description #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 #Parameters
- $args
-
(string|array) (Required) Value to merge with $defaults.
- $defaults
-
(array) (Optional) Array that serves as the defaults.
Default value: array()
- $filter_key
-
(string) (Optional) String to key the filters from.
Default value: ''
Return #Return
(array) Merged user defined values with defaults.
Source #Source
File: bp-core/bp-core-functions.php
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 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 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; }
Expand full source code Collapse full source code View on Trac
Related #Related
Uses #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 #Used By
Used By | Description |
---|---|
bp-core/admin/bp-core-admin-schema.php: bp_core_install_emails() |
Add default emails. |
bp-core/admin/bp-core-admin-types.php: bp_core_admin_insert_type() |
Insert a new type into the database. |
bp-core/admin/bp-core-admin-types.php: bp_core_admin_update_type() |
Update a type into the database. |
bp-core/admin/bp-core-admin-types.php: bp_core_admin_delete_type() |
Delete a type from the database. |
bp-core/bp-core-rest-api.php: bp_rest_register_field() |
Registers a new field on an existing BuddyPress object. |
bp-core/bp-core-functions.php: bp_add_optout() |
Add a new BP_Optout. |
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/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::__construct() |
Construct Upload parameters. |
bp-core/classes/class-bp-attachment.php: BP_Attachment::crop() |
Crop an image file. |
bp-core/classes/class-bp-optout.php: BP_Optout::get() |
Get opt-outs, based on provided filter parameters. |
bp-core/classes/class-bp-optout.php: BP_Optout::get_total_count() |
Get a count of total optouts matching a set of arguments. |
bp-core/classes/class-bp-invitation.php: BP_Invitation::get() |
Get invitations, based on provided filter parameters. |
bp-core/classes/class-bp-invitation.php: BP_Invitation::get_total_count() |
Get a count of total invitations matching a set of arguments. |
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-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/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/bp-core-attachments.php: bp_attachments_cover_image_ajax_upload() |
Ajax Upload and set a cover image |
bp-core/bp-core-attachments.php: bp_attachments_get_cover_image_settings() |
Get the cover image settings |
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_cover_image_upload_dir() |
Gets the upload dir array for cover images. |
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-core/bp-core-taxonomy.php: bp_get_terms() |
Get taxonomy BP Terms from the database. |
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_get_send_public_message_button() |
Return button for sending a public message (an @-mention). |
bp-activity/bp-activity-template.php: bp_has_activities() |
Initialize the activity loop. |
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_delete_by_item_id() |
Delete an activity item by activity id. |
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-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-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-activity.php: bp_blogs_delete_activity() |
Delete a blog-related activity stream item. |
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-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-signup.php: BP_Signup::update() |
Update the meta for a signup. |
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_has_members_invitations() |
Initialize the community invitations loop. |
bp-members/bp-members-template.php: bp_get_member_type_list() |
Return a comma-delimited list of member types. |
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-members/bp-members-functions.php: bp_members_invitations_invite_user() |
Invite a user to a BP community. |
bp-members/bp-members-functions.php: bp_members_invitations_delete_invites() |
Delete a membership invitation. |
bp-members/bp-members-functions.php: bp_register_member_type() |
Register a member type. |
bp-members/bp-members-functions.php: bp_core_get_users() |
Fetch an array of users based on the parameters passed. |
cli/src/email.php: Email::create() |
Create a new email post connected to an email type. |
bp-templates/bp-nouveau/includes/classes.php: BP_Nouveau_Object_Nav_Widget::widget() |
Displays the output, the button to post new support topics |
bp-templates/bp-nouveau/includes/classes.php: BP_Nouveau_Object_Nav_Widget::form() |
Output the new support topic widget options form |
bp-templates/bp-nouveau/includes/activity/widgets.php: BP_Latest_Activities::form() |
Display the form to set the widget settings. |
bp-templates/bp-nouveau/includes/classes.php: BP_Buttons_Group::__construct() |
Constructor |
bp-templates/bp-nouveau/includes/classes.php: BP_Buttons_Group::update() |
Update the group of buttons |
bp-templates/bp-nouveau/includes/activity/template-tags.php: bp_nouveau_get_activity_entry_buttons() |
Get the action buttons inside an Activity Loop, |
bp-templates/bp-nouveau/includes/notifications/functions.php: bp_nouveau_notifications_register_filter() |
Register new filters for the notifications screens. |
bp-templates/bp-nouveau/includes/functions.php: bp_nouveau_get_appearance_settings() |
Get the BP Nouveau Appearance settings. |
bp-templates/bp-nouveau/includes/functions.php: bp_nouveau_ajax_querystring() |
This function looks scarier than it actually is. 🙂 Each object loop (activity/members/groups/blogs/forums) contains default parameters to show specific information based on the page we are currently looking at. |
bp-templates/bp-nouveau/includes/functions.php: bp_nouveau_wrapper() |
Output HTML content into a wrapper. |
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/template-tags.php: bp_nouveau_has_nav() |
Init the Navigation Loop and check it has items. |
bp-templates/bp-nouveau/includes/groups/classes.php: BP_Nouveau_Group_Invite_Query::build_exclude_args() |
Exclude group members from the user query as it’s not needed to invite members to join the group. |
bp-templates/bp-nouveau/includes/groups/ajax.php: bp_nouveau_ajax_get_users_to_invite() | |
bp-templates/bp-nouveau/includes/groups/functions.php: bp_nouveau_get_group_potential_invites() | |
bp-templates/bp-nouveau/includes/groups/template-tags.php: bp_nouveau_the_group_meta() |
Outputs or returns the group meta(s). |
bp-templates/bp-nouveau/buddypress-functions.php: BP_Nouveau::customizer_set_uri() |
Set the BP Uri for the customizer in case of Ajax requests. |
bp-templates/bp-nouveau/buddypress-functions.php: BP_Nouveau::enqueue_styles() |
Enqueue the template pack css files |
bp-templates/bp-nouveau/buddypress-functions.php: BP_Nouveau::register_scripts() |
Register Template Pack JavaScript files |
bp-messages/classes/class-bp-messages-thread.php: BP_Messages_Thread::get_current_threads_for_user() |
Get current message threads for a user. |
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-messages/bp-messages-functions.php: messages_new_message() |
Create a new message. |
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_thread_has_messages() |
Initialize the messages template loop for a specific thread. |
bp-messages/bp-messages-template.php: bp_get_send_message_button() |
Generate the ‘Private 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-groups/classes/class-bp-groups-group.php: BP_Groups_Group::get() |
Query for groups. |
bp-groups/classes/class-bp-groups-widget.php: BP_Groups_Widget::form() |
Extends our form method. |
bp-groups/classes/class-bp-groups-membership-requests-template.php: BP_Groups_Membership_Requests_Template::__construct() |
Constructor method. |
bp-groups/classes/class-bp-groups-template.php: BP_Groups_Template::__construct() |
Constructor 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-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-group-members-template.php: BP_Groups_Group_Members_Template::__construct() |
Constructor. |
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_avatar() |
Return the avatar for the group currently being created |
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_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_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_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_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_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-groups/bp-groups-activity.php: groups_post_update() |
Post an Activity status update affiliated with a group. |
bp-groups/bp-groups-activity.php: groups_record_activity() |
Record an activity item related to the Groups component. |
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 some or 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: 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_get_group() |
Fetch a single group object. |
bp-groups/bp-groups-functions.php: groups_create_group() |
Create a group. |
bp-groups/bp-groups-functions.php: groups_edit_base_group_details() |
Edit the base details for a 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/bp-xprofile-functions.php: xprofile_insert_field_group() |
Insert a new profile field group. |
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-multiselectbox.php: BP_XProfile_Field_Type_Multiselectbox::edit_field_html() |
Output the edit field HTML for this field type. |
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-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-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-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-field-type-wordpress-biography.php: BP_XProfile_Field_Type_WordPress_Biography::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-checkbox-acceptance.php: BP_XProfile_Field_Type_Checkbox_Acceptance::edit_field_html() |
Output the edit field HTML for this field type. |
bp-xprofile/classes/class-bp-xprofile-field-type-checkbox-acceptance.php: BP_XProfile_Field_Type_Checkbox_Acceptance::admin_field_html() |
Field html for Admin-> User->Profile Fields screen. |
bp-xprofile/classes/class-bp-xprofile-field-type.php: BP_XProfile_Field_Type::get_edit_field_html_elements() |
Get a sanitized and escaped string of the edit field’s HTML elements and attributes. |
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-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/bp-xprofile-settings.php: bp_xprofile_get_settings_fields() |
Query all profile fields and their visibility data for display in settings. |
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 stream (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 stream and sitewide stream (if installed). |
bp-notifications/bp-notifications-template.php: bp_has_notifications() |
Initialize the notifications loop. |
bp-notifications/bp-notifications-functions.php: bp_notifications_add_notification() |
Add a notification for a specific user, from a specific component. |
bp-friends/classes/class-bp-friends-friendship.php: BP_Friends_Friendship::get_friendships() |
Get the friendships for a given user. |
bp-friends/bp-friends-template.php: bp_friends_get_profile_stats() |
Return the number of friends in user’s profile. |
Changelog #Changelog
Version | Description |
---|---|
2.0.0 | Introduced. |