Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
07/21/2015 02:00:38 PM (9 years ago)
Author:
boonebgorges
Message:

Allow xProfile fields to be restricted to users belonging to one or more member types.

A new metabox on the profile field edit panel allows the administrator to
select the member types to which the field is applicable. Admins can also
choose to have a field apply to users who do not belong to any member type.
Information about a field's member type associations is displayed on the
Users > Profile Fields page, alongside each field name.

During registration, the only fields that are displayed are those that are
unrestricted - that is, those available to all users, regardless of member type
(or lack thereof).

This changeset introduces a number of new methods on BP_XProfile_Field that
developers should use to manipulate member type information:
get_member_types(), set_member_types(), and the static
get_fields_for_member_type(). In addition to member types that have been
explicitly registered, 'null' is a pseudo-type representing users who do not
belong to a member type.

This changeset introduces a blacklist of illegal member type names. By default,
the blacklist includes 'any', 'null', and '_none'. Use the
'bp_member_type_illegal_names' filter to add names to the blacklist.

Props Offereins, boonebgorges, tanner m, imath.
See #5192.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-xprofile/bp-xprofile-cache.php

    r9819 r10022  
    235235add_action( 'xprofile_fields_saved_field',   'xprofile_clear_profile_field_object_cache' );
    236236add_action( 'xprofile_fields_deleted_field', 'xprofile_clear_profile_field_object_cache' );
     237
     238/**
     239 * Clears member_type cache when a field's member types are updated.
     240 *
     241 * @since BuddyPress (2.4.0)
     242 */
     243function bp_xprofile_clear_member_type_cache() {
     244    wp_cache_delete( 'field_member_types', 'bp_xprofile' );
     245}
     246add_action( 'bp_xprofile_field_set_member_type', 'bp_xprofile_clear_member_type_cache' );
    237247
    238248/**
Note: See TracChangeset for help on using the changeset viewer.