[buddypress-trac] [BuddyPress Trac] #5192: User roles with differents profile fields
buddypress-trac
noreply at wordpress.org
Tue Jul 7 08:59:59 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: |
----------------------------------+------------------
Comment (by imath):
The more i think of it, the more i think this feature is really really
interesting for 2.4 !
Again, @Offereins did a great work.
Maybe i'm overthinking it, but i think the logic used is improvable. What
the plugin's doing is it waits for the visibility to be set on *all*
fields before querying again *all* fields to check if some needs to be
removed because they don't match with the member's member type.
I think my brain would feel more comfortable (maybe it's working in a
strange way :) ) if we would reverse the order of the logic. First remove
the fields that don't match the member types and then for *these remaining
fields*, check for their visibility.
More globally the registration thing in my previous comment shows that we
should also be able to fetch the fields for a given member type *without*
needing any user id. Ideally there should be a new argument in
`bp_has_profile()` so it would be possible to use it in specific loops
such as the registration one. Maybe something like :
{{{
function bp_has_profile( $args = '' ) {
// Parse arguments
$r = bp_parse_args( $args, array(
'user_id' => bp_displayed_user_id(),
/* other arguments */
'member_type' => bp_get_current_member_type(),
), 'has_profile' );
if ( ! empty( $r['user_id'] ) ) {
$r['member_type'] = bp_get_member_type( $r['user_id'] );
}
}}}
In BP_XProfile_Group::get(), we could remove the fields that are not of
the requested member types, and then apply the visibility to the remaining
fields.
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/5192#comment:27>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list