Search Results for 'profile fields'
-
AuthorSearch Results
-
August 23, 2014 at 9:07 pm #188338
r-a-y
KeymasterYou shouldn’t be loading your field_xprofile_twitter() function on ‘bp_init’. Doing this creates your field on every page load.
Why don’t you just create your field once in the WP admin dashboard under “Users > Profile Fields”?
August 23, 2014 at 12:30 pm #188324Bajdh
ParticipantHi,
Again thanks for your quick reply.
Yes, I used the snippet ‘as is’, and then tried to use the field name instead of the ID.
Field name obviously didn’t work, although you could use it too, according to this page:
https://codex.buddypress.org/getting-started/guides/displaying-extended-profile-fields-on-member-profiles/But I found the profile field ID, and now it works!
Thank you so much :D.
(Yes, KLEO has premium support. But they are very, very slow. I opened a few tickets 1-2 weeks ago, still no replies. Found the answer in the meantime though 😛 ).
August 23, 2014 at 12:16 pm #188323danbp
ParticipantI use the KLEO theme (BuddyPress is integrated), could it be because of that?
Normally, no.But as you use a premium theme, don’t except much help here. You also payed for support. If the snippet doesn’t work for you ( i tested it successfully with Twentythirteen before publishing), you have to get in contact with the theme author or read his doc about customization (if exist).
To get the field ID, see it from where the field is created, in xprofile admin. If you hover the delete button, you can see it at the bottom left corner of your browser.
You can also go into the DB and check for it in the bp_xprofile_fields table.
NOTE:
When you get a snippet, the first thing to do is to use it “as is” to test it – this means also “understanding how it works”, not to apply what you think is better. 🙄And only when the test is ok, you can modify it or try to do so. 😉
August 23, 2014 at 11:48 am #188321Bajdh
ParticipantHey,
Thank you for your quick reply! 🙂
I added the code to my theme’s functions.php, and replaced ’54’ with the name of the field (I can’t find the ID number anywhere), but that specific field still shows up in profiles/edit fields.
I use the KLEO theme (BuddyPress is integrated), could it be because of that?
Or is there a different way to find the field’s ID number? 🙂I really appreciate your help, I didn’t expect such a fast and detailed reply! 😀
August 23, 2014 at 8:49 am #188312danbp
ParticipantHi @ww2boy,
Yes ! 😉 Give this a try. Add it to child theme’s functions.php or bp-custom.php
function bpfr_hide_profile_edit( $retval ) { // remove field from edit tab if( bp_is_profile_edit() ) { $retval['exclude_fields'] = '54'; // ID's separated by comma } // allow field on registration page if ( bp_is_register_page() ) { $retval['include_fields'] = '54'; // ID's separated by comma } // hide the filed on profile view tab if ( $data = bp_get_profile_field_data( 'field=54' ) ) : $retval['exclude_fields'] = '54'; // ID's separated by comma endif; return $retval; } add_filter( 'bp_after_has_profile_parse_args', 'bpfr_hide_profile_edit' );Codex reference:
https://codex.buddypress.org/plugindev/using-bp_parse_args-to-filter-buddypress-template-loops/August 22, 2014 at 2:31 pm #188267In reply to: using placeholder attribute instead of label
mmadden
ParticipantYes, I’ve already edited the input fields within the basic-details-section div. I want to edit the input field in the profile-details-section div to match, but there is no input field in the register.php for that section. Instead there’s this:
<div class="register-section" id="profile-details-section"> <h4><?php _e( 'Profile Details', 'buddypress' ); ?></h4> <?php /* Use the profile field loop to render input fields for the 'base' profile field group */ ?> <?php if ( bp_is_active( 'xprofile' ) ) : if ( bp_has_profile( array( 'profile_group_id' => 1, 'fetch_field_data' => false ) ) ) : while ( bp_profile_groups() ) : bp_the_profile_group(); ?>Is there any way to get at the input tag that gets output to the profile-details-section?
August 22, 2014 at 7:30 am #188236In reply to: Xprofile fields – Per Member Visibility
danbp
Participantyou will find some usefull posts about this on the codex.
Add custom filters to loops and enjoy them within your plugin
https://codex.buddypress.org/plugindev/playing-with-the-users-id-in-different-contexts/
https://codex.buddypress.org/plugindev/using-bp_parse_args-to-filter-buddypress-template-loops/Searching on the forum can also help.
https://buddypress.org/support/search/xprofile+conditionnal+fields/August 21, 2014 at 9:09 pm #187770In reply to: using placeholder attribute instead of label
danbp
ParticipantHi @mmadden,
not sure i understand what you want to achieve. Are you creating a register page from scratch ?
Anyway….
Open the original BP register file (/buddypress/bp-templates/bp-legacy/buddypress/members/register.php). It contains many placeholders and conditionnalsSo, for the mandatory NAME xprofile group (the only one you use), you have line 65
if ( bp_is_active( 'xprofile' ) ) : if ( bp_has_profile( array( 'profile_group_id' => 1, 'fetch_field_data' => false ) ) ) : while ( bp_profile_groups() ) : bp_the_profile_group(); --- blah---Line 75 sit this placeholder
do_action( 'bp_custom_profile_edit_fields_pre_visibility' );where you can hook your additionnal information.Line 98 there’s another one:
do_action( 'bp_custom_profile_edit_fields' );just above this function:<p class="description"><?php bp_the_profile_field_description(); ?></p>In register.php, the section you speak about goes from line 50 to 112
From/***** Extra Profile Details ******/to</div><!-- #profile-details-section -->Of course, you can also add your own placeholder to your register template.
Sorry if i’m wrong.
August 21, 2014 at 3:02 pm #187708aces
ParticipantUsing firefox on http://animalsfunnypictures.com/members/sanaa/ I can see
entry-content img {which has awidth: 510pxif i disable it in firefox it becomes the ‘normal’ size.This is coming from Marla theme’s style.css on line 1464 – see for yourself…
August 19, 2014 at 8:01 am #187192Saurabh Jain
ParticipantThanks @1a-spielwiese,
Is there any way to search users using xprofile fields.
E.g. In my xprofile field i have named “Skills” i want to search all user having the Skill = I.T.
I made Skills as checkbox.August 19, 2014 at 4:31 am #187185Saurabh Jain
ParticipantThanks @1a-spielwiese and @danbp,
I created new fields and didn’t updated profile that was the reason of not showing.Is there any way i can access the data in the fields. I created field named Skill i want to access the data in that field and use in other pages/post.
August 18, 2014 at 9:35 pm #187166mrapino
ParticipantOkay, 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/August 18, 2014 at 4:58 pm #187141mrapino
ParticipantThanks 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.
August 18, 2014 at 4:14 pm #187138mrapino
ParticipantI 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!
August 18, 2014 at 10:40 am #1871181a-spielwiese
ParticipantDo you have inserted text (information) into the fields and profiles at issue?
If you have old profiles and create later new fields, this fields are of course empty. So you have to update the profile information at first.
August 18, 2014 at 2:29 am #187103In reply to: Add profile field to 'Order By' drop down menu
danbp
Participantdid you noticed that profile field datas are clickable ?
This default behaviour is intended to be use as a filter.Member A filled the Contractor field
If any visitor goes to member’s A profile and click on the Contractor field value, BP will show a list of all other members who also filled in this field.So what you want to get already exist !
August 16, 2014 at 11:46 pm #187041danbp
ParticipantWould it matter that I have my group_order (i.e., the order in which my field groups are displayed) arranged in a specific order?
No !
Anyway, i was wrong myself. Apologize. My snippet hides groups from viewing, not from editing. But you can get another trick on this post. And this one works realy. 😉August 16, 2014 at 10:29 pm #187039In reply to: [Resolved] No button for finishing registration
1a-spielwiese
Participant“remove all xprofile fields to get only the default name field.”
When I posted the comment:
https://buddypress.org/support/topic/no-button-for-finishing-registration/#post-187032
non xprofile field was created.
“Also download a fresh copy of wordpress and upload the twenty twelve theme folder to your site. Maybe your’s is corrupted somewhere.”
That’s really unlikely, because both copies worked without problems, before I installed the BuddyPress-Plugin. And I tried never to make any major change of twenty twelve theme or WordPress itself.
August 16, 2014 at 9:58 pm #187037In reply to: [Resolved] No button for finishing registration
danbp
ParticipantDo you use a wordpress copy provided by your host ?
Do you use a child-theme ?
Do you use any shortcode on the register page ?Disallow blog creation for the moment and remove all xprofile fields to get only the default name field.
Also download a fresh copy of wordpress and upload the twenty twelve theme folder to your site. Maybe your’s is corrupted somewhere.August 16, 2014 at 3:43 pm #187012In reply to: Modifying The Member List
danbp
ParticipantYes, by creating a custom function.
Add custom filters to loops and enjoy them within your plugin
https://codex.buddypress.org/plugindev/using-bp_parse_args-to-filter-buddypress-template-loops/How to
https://wordpress.org/support/topic/display-profile-fields-in-the-members-directory-all-members
(2nd topic gives a technique you can use)August 16, 2014 at 10:08 am #186999In reply to: [Resolved] No button for finishing registration
1a-spielwiese
ParticipantAmendment:
I guess, connected with the above described problem is another problem.
In the meantime I have activated “Extended Profiles” and I created three profile field groups.
But only the fields of the first group are displayed – the fields of the field groups 2 und 3 not.
August 13, 2014 at 9:30 am #186516danbp
ParticipantHi @simpleone,
you can actually only hide xprofile fields. Hiding field groups is not possible, due to a bug.
But it is corrected for 2.1 and you’ll find a patch on the trac.You can already apply the patch to 2.0.2 bp-xprofile-classes.php and the above snippet will work. Add it to bp-custom.php or theme’s functions.php
To hide an xprofile group, use bp_parse_args like this:
function bpfr_make_profile_tab_members_only( $retval ) { // hide to non members if( !is_user_logged_in() ) { // exlude groups, separated by comma $retval['exclude_groups'] = '4,5'; // exclude fields, separated by comma $retval['exclude_fields'] = '1,39'; } return $retval; } add_filter( 'bp_after_has_profile_parse_args', 'bpfr_make_profile_tab_members_only' );August 13, 2014 at 12:19 am #186506shanebp
ModeratorTry this:
<?php /*** * If you want to show specific profile fields here you can, * but it'll add an extra query for each member in the loop * (only one regardless of the number of fields you show): * bp_member_profile_data( 'field=the field name' ); */ $data = bp_get_member_profile_data( 'field=Current Location' ); if( $data != false ) echo $data; ?>August 12, 2014 at 11:29 pm #186492shanebp
ModeratorAre you putting this code in the members-loop.php template?
Are you putting it in the designated area?
Look for this text: ‘If you want to show specific profile fields here you can,…’August 12, 2014 at 10:34 pm #186489alscott99
ParticipantThanks for your response, @shanebp.
That code still has the fields repeating, but perhaps I entered it wrong? Since you didn’t include the php tags I’m not sure where they go; I did it this way:
<?php $data = bp_member_profile_data( 'field=Current Location' ); ?> <?php if( $data != false ) ?> <?php echo $data; ?> -
AuthorSearch Results