[buddypress-trac] [BuddyPress Trac] #5192: User roles with differents profile fields

buddypress-trac noreply at wordpress.org
Mon Jul 13 16:24:41 UTC 2015

#5192: User roles with differents profile fields
 Reporter:  _DorsVenabili         |       Owner:
     Type:  enhancement           |      Status:  new
 Priority:  normal                |   Milestone:  2.4
Component:  Component - XProfile  |     Version:
 Severity:  normal                |  Resolution:
 Keywords:  has-patch             |
Changes (by boonebgorges):

 * keywords:  needs-patch => has-patch


 [5192.2.diff] is an update with the following changes:

 * Fixed textdomains.
 * Switched to 'member_type' instead of 'member-type' for meta_key.
 * To decrease confusion, use 'null' to signify members with no member
 types. Continue to use '_none' internally for fields that should be
 unavailable to all types.
 * In `bp_register_member_type()`, enforce an array of illegal names.
 * Added a "Member Type: Foo, Bar" label to the Profile Fields admin page.
 * imath's suggestion: In `BP_XProfile_Group::get()`, instead of doing a
 post-query filter of fields to remove those that are not applicable to the
 current user's member type(s), do a pre-query check to get a list of the
 user's member_types, and the fields available for those types. The heavy
 lifting is done by `BP_Xprofile_Field::get_fields_for_member_type()`,
 which returns a multidimensional array that looks like this: `[3] =>
 ['student', 'teacher'], [5] => ['student', 'null']` etc, where 3 and 5 are
 field IDs and the array values are the member types for each field.
 * Add 'member_type' parameter support to the `bp_has_profile()` function
 stack. The default value in `bp_has_profile()` is 'any', which is a
 special value that returns only those fields that are available to *all*
 types. 'member_type' is ignored if 'user_id' is non-zero. This setup means
 that restricted fields are unavailable during registration by default.

 The new queries in `get_fields_for_member_type()` are a bit ugly. I will
 add some caching support - maybe even caching in a transient, so that all
 sites will get it, not just those running a persistent cache - if we are
 all agreed that the current strategy is a good one.

 Thanks for playing along at home :)

Ticket URL: <https://buddypress.trac.wordpress.org/ticket/5192#comment:40>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac

More information about the buddypress-trac mailing list