Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

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

  • mrapino
    Participant

    @mrapino

    Okay, this is my first piece: http://pastebin.com/pyz8XaaP

    This first link is some code findings that might continue the conversation toward an elegant solution.

    And then I came up with another possible solution here, which is actually partially working, but might be a bit clunky: http://pastebin.com/3JBCuZrx

    Basically, the first link is not working, but may give us more food for thought. The second link is working, but there are a few caveats. What I am doing in the second link is finding out what user role the logged in user is attached to. Then I create a conditional that states that if the user is under a certain role, it hides the profile group tabs from being seen, which essentially prevent them from adding content to them, and if there is no content for any of the fields in the group, it won’t show on the front end.

    CAVEAT: if you go directly to the profile group URL, you can still edit. I need to figure out how to actually prevent the URL from working, as opposed to/ or in addition to hiding it.

    Either way, I think there’s a bunch of good stuff to talk about here.

    Let me know what you think.

    NOTE: I am using some code found on this post:
    https://buddypress.org/support/topic/conditional-exclusion-of-a-xprofile-fields-group-from-editing/


    mrapino
    Participant

    @mrapino

    Am I not allowed to submit code snippets? I keep getting an “ERROR: Your reply cannot be created at this time.”


    mrapino
    Participant

    @mrapino

    I think I am onto something. I have a post I am trying to submit with some code snippets, but it isn’t going through. I’ll try a couple other things…


    mrapino
    Participant

    @mrapino

    Thanks for the links.

    Defining a role doesn’t necessarily require previous input from the people using your site … you simply define the roles of your users based on what you want those users to be. Custom user roles allow you to have more granular control over what your users can do and see when registered on your site. Regarding Buddypress … I think that having a way to pre-define user types/roles and assigning custom profiles to those various user types is something to be desired.

    I am using Gravity Forms to create a custom registration form that allows a registrant to pick the type of user they are and when the user type is chosen, I am conditionally displaying custom fields that are associated to the specific user type.

    The problem is that after the user registers, and the fields are filled out, if they go to their profile to edit the information, they see ALL FIELDS regardless of the user role they chose during registration. The reason is that although Gravity Forms allows you to map certain fields on the form to profile fields in Buddypress, you still have to edit Buddypress to HIDE the fields you don’t want those users to see.

    That is why I am posting this question … I am trying to get code together to alter the profile section of Buddypress to allow you to associate specific profile fields to a user role, so when the user of a specific role finally goes to their profile to make edits, they do see, and are not allowed to edit fields that are not associated to their specific role.

    IMHO this type of control is very useful, as it can help you create some fairly interesting communities.

    Thanks for your assistance. I hope I have clarified things further for you. If anyone can help, great … if not, I am still moving forward on this and when I come up with a solution, I will post it here. If anyone can help me get to that solution faster, I’d be very appreciative. If not, I hope I can help those of you who are looking for the same results.


    mrapino
    Participant

    @mrapino

    I appreciate your response! I will take a look at this plugin. I am always hesitant to use plugins that are so out of date, but perhaps there is some code within the plugin files that will be useful.

    Also, is there any resource that details the functions available within Buddypress. I have looked at the Codex, but I can’t seem to find a nice definitive resource. The WP Codex has all of the actions, filters, functions, etc… I was trying to find something similar within the Buddypress website, but can’t seem to find documentation that has everything detailed out. Is there a lot of documentation that hasn’t been written yet, or am I just looking in the wrong place?

    Please keep me posted if you have any other suggestions about what functions, or code snippets I might use to gather the correct information to alter the profile section based on user roles.

    Basically, I need to know where you might place the custom code (is it within the bp_custom file?) And if I use bp_custom, I am guessing I would have to hook my code into the correct location, so Buddypress knows to enact my code correctly (Is there an action hook that hooks into the Profile section specifically?) I also would need to know where to find the functions I need to edit the profile section (all xprofile functions, any functions that might help me attach user roles to profile fields, any functions that pull data relevant to the connection between profiles and users, etc…)

    Regarding the connection between user/user role and profile, would I be calling these functions separately … meaning, would I first use a conditional to see what user role the user is, and then within that conditional be using general xprofile functions to display only the fields I want to display for the user role that the conditional is specifying?

    I think if we all start to spitball ideas, this post can be a sounding board for the code that can build this functionality out. In my research over the past week, I have found so many incomplete conversations about how to make this functionality a reality. So, I know there are many people looking to do exactly what I am attempting. And the beauty is that we all have bits and pieces of this idea and how it might fit together. Perhaps we can all start posting our code snippets here to build this out together?

    If we can make it work, I bet this post can be the beginning of a core Buddypress code update that can integrate this into the actual Buddypress Core.

    What do you all think?

    I’ll be continuing my research and posting my findings here. Let’s make this happen!


    mrapino
    Participant

    @mrapino

    Bump

Viewing 6 replies - 1 through 6 (of 6 total)
Skip to toolbar