Skip to:
Content

BuddyPress.org

Opened 11 years ago

Closed 11 years ago

#5317 closed enhancement (wontfix)

Add xprofile field Vibility "Admin only"

Reported by: megainfo's profile megainfo Owned by:
Milestone: Priority: normal
Severity: normal Version: 1.9.1
Component: Extended Profile Keywords: has-patch
Cc:

Description

The meta value of default Vibility "Only me" is "adminsonly".

i suggest to change it to "onlyme"

and add new vibility levels "Admin only" with meta value "adminonly".

Attachments (2)

bp-xprofile-functions.php.patch (1.3 KB) - added by megainfo 11 years ago.
bp-xprofile-functions.php patch
bp-xprofile-loader.php.patch (812 bytes) - added by megainfo 11 years ago.
bp-xprofile-loader.php patch

Download all attachments as: .zip

Change History (13)

@megainfo
11 years ago

bp-xprofile-functions.php patch

@megainfo
11 years ago

bp-xprofile-loader.php patch

#1 @boonebgorges
11 years ago

  • Keywords 2nd-opinion reporter-feedback added

I'm not sure about this. Two questions:

  1. What's the advantage of having a field that is hidden from administrators? Can you give a use case for this?
  2. Currently, administrators of a BuddyPress site have complete access to all parts of the site. Your suggestion would mean that there are some things that an admin can't see. Is this a path we want to do down? What does this do to an admin's ability to moderate?

#2 @megainfo
11 years ago

My suggestion is to add new vibility levels called ""Admin only".

Fields with "Admin only" vibility level are Viwed & Edited by administrators only.
ie: Fields are hidden from all members except admins.

"Admin only" fields can be used in 2 cases :

  • Certain profiles fields viewable & editable by admin only :

In many cases, admin want create fields and make them visible & editable only for him. I think this new visibility level will give more flexibility to admins if he would manage confidential informations about members.

  • Can be useful in third party code or plugins :

It's can be useful for code costumizator or plugins authors if they want create some extra fonctionality like manage levels or roles for members.
I guess a lot of developers will found great utility to add this vibility level.

I suggested to add filter for hiddens levels in the patch :

// filter the visibility levels
return apply_filters( 'bp_xprofile_get_hidden_field_types_for_user', $hidden_levels, $displayed_user_id, $current_user_id );

i think this make bp-xprofile vibililty functionality extensible (ie. developers can add new vibility levels to $bp->profile->visibility_levels by using "bp_xprofile_get_visibility_levels" filter and they can extend the tests of visibility levels that should be hidden by calling the new filter "bp_xprofile_get_hidden_field_types_for_user".

#3 @boonebgorges
11 years ago

Thanks for the thoughts, megainfo. I agree that an "admins only" setting is useful. But we already *have* an adminsonly setting. We just happen to call it "Only Me" in the interface. What you are proposing is the introduction of a new "onlyme" setting, which is *not* visible to admins. What's the advantage of that?

#4 @megainfo
11 years ago

the current "only me" vibility level (with id "adminsonly" ) is viewable and editable by both admins and loggedin member.

the new vibility level i suggest is to add a level for admin only (only admin can view and edit the field ).

This is why i suggest to rename only the id of "adminsonly" level to "onlyme" for the level "Only me" and keep it's the same ( ie: only me mean only admin and loggedin member can view and edit the field) and add a new vibility level "Admins Only" with id "adminsonly" viewable and editable only by admins.


Last edited 11 years ago by megainfo (previous) (diff)

#5 @boonebgorges
11 years ago

Ah, I see now. Sorry, I misunderstood.

I guess I can see the use for this kind of field, but I don't think that we can implement it quite like you've suggested. A profile field hidden from the logged-in member would have to be hidden from the *edit* interface as well. And it's possible that we'd want to consider a different interface for configuring the field from the admin's point of view: the idea of a "default visibility" doesn't make much sense when the end user won't be able to see the field at all.

This is a feature that I think would work well as a plugin for a first implementation, so that the user interface can be thought through. If you come up with something that integrates nicely with BuddyPress, and proves useful to many people, we could consider it for BP core.

#6 @megainfo
11 years ago

It ca'nt be done by plugins or code with the current version because there is no filter in bp_xprofile_get_hidden_field_types_for_user() to filter the $hidden_levels array values.

this is why i suggeseted to added a this filter

return apply_filters( 'bp_xprofile_get_hidden_field_types_for_user', $hidden_levels, $displayed_user_id, $current_user_id );

Version 3, edited 11 years ago by megainfo (previous) (next) (diff)

#7 @boonebgorges
11 years ago

Well, technically, it could be done by filtering bp_xprofile_get_hidden_fields_for_user, and reproducing some of the logic in bp_xprofile_get_hidden_field_types_for_user() in your own plugin. But this is pretty cumbersome, of course, and I don't see any harm in adding the filter.

#8 @boonebgorges
11 years ago

In 7730:

Introduce filter 'bp_xprofile_get_hidden_field_types_for_user'

This will make it easier for plugin authors to create custom visibility levels.

See #5317

Props megainfo

#9 @DJPaul
11 years ago

What's the use case for an admin-only profile field? It sounds as though you want to be able to set notes for a user, or perhaps use the fields as a kind of user meta data, perhaps to use in template queries.

#10 @DJPaul
11 years ago

Can this ticket be closed up in lieu of someone building the proposed feature as a plugin to prove the idea?

#11 @boonebgorges
11 years ago

  • Keywords 2nd-opinion reporter-feedback removed
  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

What's the use case for an admin-only profile field? It sounds as though you want to be able to set notes for a user, or perhaps use the fields as a kind of user meta data, perhaps to use in template queries.

That's what I'm imagining too. And I'm wondering whether this is actually the "proper" use for xprofile. Not that there's anything wrong with using it this way - but I'm not certain that we need to officially encourage this non-standard use with our core options.

Can this ticket be closed up in lieu of someone building the proposed feature as a plugin to prove the idea?

+1.

Note: See TracTickets for help on using tickets.