Skip to:
Content
Pages
Categories
Search
Top
Bottom

Followup to Add xprofile field Vibility "Admin only" #5317


  • michaeltransmissions
    Participant

    @michaeltransmissions

    Hi – this is in reference to https://buddypress.trac.wordpress.org/ticket/5317. I have a valid case requiring this feature – details on the case below. Can anyone tell me the status on this -whether it is a current or future feature, or if there is an alternative plugin I can use? Based on this conversation, the idea for this feature seems doa.

    Case Details:
    My client maintains a website. The site has a moderate sized community. Each member’s profile contains a number of BP xprofile fields. The client wants to have several additional xprofile fields that are viewable only to the admin, and not the user. The purpose of these additional, admin-only fields, is to make it easier for the admin to essentially ‘tag’ users as having a certain status (warning flag for inappropriate behavior, new member, etc. etc.) or being a member of certain interest groups (i.e. members who have pets, members who like hiking) without letting the user know that the admin/moderator has tagged them or even that there is tagging. The reason for doing it with BP xprofile fields, is that it provides such a simple, handy, and clean method for creating additional field in the WP context that it makes it easy for the non-technical admin to go in and edit member data.

    Thanks in advance,
    Michael

Viewing 8 replies - 1 through 8 (of 8 total)

  • @mercime
    Participant

    @mercime

    @michaeltransmissions As you noted above, the ticket as been closed as wontfix on the UI but lead dev enabled plugin authors to create custom levels by adding a new filter. I’m sorry that there is no plugin that I know of created for your needs. You’d either have to create one or hire someone to do it for you or wait till someone makes it.


    michaeltransmissions
    Participant

    @michaeltransmissions

    Hi – thank you for the response. You are talking about the bp_xprofile_get_hidden_field_types_for_user filter? Looks like I would have to modify the code in bp-xprofile-functions.php by adding a new level…?

    Michael


    shanebp
    Moderator

    @shanebp

    How will the ‘tags’ be used?
    As the basis for filtering members?
    Or just as ‘notes’ about each member?

    If the former, see the BP_User_Query codex page.

    If the latter, you could use this premium plugin: BuddyNotes

    Or you could simply create template overloads of these 2 files:

    buddypress\bp-templates\bp-legacy\buddypress\members\single\profile\profile-loop.php
    buddypress\bp-templates\bp-legacy\buddypress\members\single\profile\edit.php

    And check the fields via their id or name and then decide, based on who the logged-in user is, whether the fields should be displayed.


    michaeltransmissions
    Participant

    @michaeltransmissions

    The tags will be used as a filter. For example, to generate a mailing list that is a sub slice of the entire list of site members.


    michaeltransmissions
    Participant

    @michaeltransmissions

    shanebp — I followed your suggestion and it worked like a charm. I also had to add some code to my functions.php file to be able to redirect calls to the WP Profile page to the BP Profile page because editing the the files you suggested didn’t affect restrict the fields on the WP Profile page (code for this below, if anyone wants).

    My only question is the following – would changes to the files in the bp-templates directory get overwritten if I update the BP plugin? If so, it would be nice to find an alternative way to do this, but otherwise I just need to know so I can incorporate a restore of the code changes from a backup to my upgrade workflow document for this site.

    Thanks,
    Michael

    add_action ('init' , 'prevent_profile_access');
     
    function 	prevent_profile_access(){
       		if (current_user_can('manage_options')) return '';  //if admin, exit
    		
    		//everyone else, redirect to the bp profile page, not the wp profile page!
       		if (strpos ($_SERVER ['REQUEST_URI'] , 'wp-admin/profile.php' )){
          		wp_redirect (bp_loggedin_user_domain());
     		 }
     
    }

    shanebp
    Moderator

    @shanebp

    would changes to the files in the bp-templates directory get overwritten if I update the BP plugin?

    Of course, which is why I suggested you create template overloads instead.


    michaeltransmissions
    Participant

    @michaeltransmissions

    got, thanks for the heads up. the link on overloads explained much. i’m still a newbie re: WordPress and BuddyPress and find that it’s not always easy to get crucial info out of the documentation unless you already know it exists (or are familiar enough with these systems to know what you might be looking for).

    Thanks again


    shanebp
    Moderator

    @shanebp

    it’s not always easy to get crucial info out of the documentation

    Very true. And BP docs aren’t at the level of WP docs.
    BP codex is being worked on, but it’s a cumbersome process.
    If you see an opportunity to improve / amend something, I think participants can still do so.
    Or start a topic here with suggestions.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Followup to Add xprofile field Vibility "Admin only" #5317’ is closed to new replies.
Skip to toolbar