Search Results for 'profile fields'
-
AuthorSearch Results
-
June 16, 2014 at 3:01 am #184102
In reply to: Front End Profile Editing
paton400
ParticipantNo, I need to grant the user role permission to ‘edit users’. But by granting that, I’m granting them access too much access.
I want only want them to be able to change the information in other users profile fields. I don’t want them to be able to read private messages.
Is this a question for Buddypress, WordPress or my user role permissions plugin?
June 15, 2014 at 8:44 am #184071In reply to: Help with profiles
danbp
ParticipantIt’s a field builder plugin, not a filter, so no it wouldn’t help you. BuddyPress already do this (building fields and fields section) for xprofile component, so such a plugin is not to use with BP.
Conditionnal fields is an old and remaining “must have” thing, but the state of the art is far away i guess.
https://buddypress.org/support/topic/buddypress-conditional-profile-fields-available-now/i would take a try over Gravity Form at your place.
June 13, 2014 at 1:13 pm #183996In reply to: [Resolved] Display xProfile field groups
pstidsen
ParticipantNow the function is runned, but no fields are shown. My code is:
//Prints xProfile function PrintKontaktinformationer() { // we need the user_id first (mandatory outside a loop) $user_id = bp_displayed_user_id(); // now we fetch the field data (separate field id's by comma) $my_field = xprofile_get_field_data('10, 9, 1, 11, 12, 13, 14, 15', $user_id); // we built the output echo '<div class="authorinfo">TEST'. $my_field . '</div>'; } // the new hook add_action( 'show_PrintKontaktinformationer', 'PrintKontaktinformationer' );June 12, 2014 at 7:54 pm #183977In reply to: [Resolved] Notify by Email when xProfile Updated
Chris Perryman
ParticipantJust wanted to follow up…we did come up with a solution for this in case any one else is looking for it.
Full details are now on my blog at Revelation Concept.
function rc_buddypress_profile_update( $user_id ) { $admin_email = "YOUR-EMAIL@DOMAIN.COM"; $message = sprintf( __( 'Member: %1$s', 'buddypress' ), bp_core_get_user_displayname( $user_id ) ) . "\r\n\r\n"; $message .= sprintf( __( 'Color: %s' ), bp_get_profile_field_data('field=Color') ). "\r\n\r\n"; wp_mail( $admin_email, sprintf( __( '[YOUR SITE] Member Profile Update' ), get_option('blogname') ), $message ); } add_action( 'xprofile_updated_profile', 'rc_buddypress_profile_update', 10, 5 );June 12, 2014 at 8:25 am #183942In reply to: Hot can I display the profile fields groups in tabs?
dromy
ParticipantThank you for the quick response.
when adding groups and more fields the groups and fields are displayed on the member page as a table.
I would like to create a tabs display to the member information (my created fields and group) when each group of (ex.wp-widget base) div\table is displayed on a different tab.hope I am clear.
on the admin or edit cases I do not want to touch for now. This relate only for the view buddypress member profile as a member or as anonymous.(and sorry, I meant how on topic and not hot)
June 12, 2014 at 8:18 am #183939In reply to: Hot can I display the profile fields groups in tabs?
danbp
ParticipantOn xprofile component, the default field group is called Name and contains only one field who will contain the username. This group is already tabed on a profile page and is the only group field who appears on the register page.
Now, on the xprofile admin you can add as many fields and group fields you want, and you can set each field to different visibility.
These new field can be grouped and each group you create will automatically be tabed on a profile page.https://codex.buddypress.org/buddypress-components-and-features/extended-profiles/
If you mean showing groups on the profile, this also made automatically by BP. On each profile, you have (if exist) the groups the member belongs to.
If all this is not what you mean, be more explicit π
June 11, 2014 at 12:33 pm #183913In reply to: [Resolved] How to hide more than one profile field?
CommonEasy
ParticipantHi there, i have an additional question… can this be used to hide profile groups from the edit profile group tab ? I tried;
// commoneasy hide fields function commoneasy_hide_some_profile_fields( $retval ) { if( bp_is_profile_edit() ) { $retval['exclude_fields'] = '15'; //multiple field ID's should be separated by comma } return $retval; } add_filter( 'bp_after_has_profile_parse_args', 'commoneasy_hide_some_profile_fields' ); // commoneasy hide groups function commoneasy_hide_some_profile_groups( $retval ) { if( bp_is_profile_edit() ) { $retval['exclude_groups'] = '4'; //multiple field ID's should be separated by comma } return $retval; } add_filter( 'bp_after_has_profile_parse_args', 'commoneasy_hide_some_profile_groups' );unfortunatly it didn’t work, i hope somebody can help!
June 11, 2014 at 12:14 pm #183912CommonEasy
ParticipantJune 10, 2014 at 7:25 pm #183889In reply to: [Resolved] /settings/profile is empty?
godavid33
Participant@henrywright worked like a charm. Now I just need to style it a bit. Thanks!
And thanks to @johnjamesjacoby for the great plugin. The problem was (is) probably that all my profile fields are xprofile fields.
Thanks for the example @mercime !
June 6, 2014 at 9:25 am #183741In reply to: show profile fields as currency and %
CommonEasy
ParticipantI got this working with:
add_filter( 'bxcft_show_field_value', 'my_show_field', 15, 4); function my_show_field($value_to_return, $type, $id, $value) { if ($value_to_return == '') return $value_to_return; if ($type == 'number') { $value = str_replace("<p>", "", $value); $value = str_replace("</p>", "", $value); $field = new BP_XProfile_Field($id); if ($field->id == '18' ) { $f_value=number_format($value,2); $new_value = "€ $f_value,-"; } else { $new_value = $value; } return '<p>'.$new_value.'</p>'; } return $value_to_return; }Does anybody have an idea how i can use this for multiple fields? strangely something like ‘2,18,19’ isn’t working…
June 6, 2014 at 9:08 am #183740In reply to: Remove profile links
CommonEasy
Participantsorry to bump this old topic. I use both BP 2.0.1 and BP custom fields type and i got the the links removed with:
function remove_xprofile_links() { remove_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_link_profile_data', 9, 2 ); } add_action('bp_setup_globals', 'remove_xprofile_links');I was wondering if you could use this to only hide the links from certain profile fields, like only for profile field 2, 6 & 7 ?
June 5, 2014 at 10:06 pm #183705In reply to: Pulling from existing custom fields
compixonline
ParticipantHi –
I really appreciate your reply… it’s a little above my head but working on it. How would you then populate the buddypress Xprofile fields (which would be the same, say user_meta is occupation I would have a BP Xprofile field “occupation” and I’d want to copy it across.
I’d also want to hide the ability to change that field in the BP members profile, forcing them to use the Membermouse field in order to change their occupation both in the Membermouse Table and their BP profile…
Hope you can help! Many thanks.
June 5, 2014 at 1:15 pm #183669In reply to: [Resolved] Notify by Email when xProfile Updated
whedlund
ParticipantTo simplify my question, I’ve pasted the code in that Chris wrote. I just don’t know how to call the buddypress xprofile fields?
/* ===========================================
Send Emails when User Profile Changes
=============================================*/// IF EMAIL CHANGES
function sr_user_profile_update_email( $user_id, $old_user_data ) {$user = get_userdata( $user_id );
if($old_user_data->user_email != $user->user_email) {
$admin_email = "email@yourdomain.com";
$message = sprintf( __( 'This user has updated their profile on the SchoolRise USA Staff Member site.' ) ) . "\r\n\r\n";
$message .= sprintf( __( 'Display Name: %s' ), $user->display_name ). "\r\n\r\n";
$message .= sprintf( __( 'Old Email: %s' ), $old_user_data->user_email ). "\r\n\r\n";
$message .= sprintf( __( 'New Email: %s' ), $user->user_email ). "\r\n\r\n";
wp_mail( $admin_email, sprintf( __( '[Staff Member Site] User Profile Update' ), get_option('blogname') ), $message );
}
}// Save old user data and meta for later comparison for non-standard fields (phone, address etc.)
function sr_old_user_data_transient(){$user_id = get_current_user_id();
$user_data = get_userdata( $user_id );
$user_meta = get_user_meta( $user_id );foreach( $user_meta as $key=>$val ){
$user_data->data->$key = current($val);
}// 1 hour should be sufficient
set_transient( 'sr_old_user_data_' . $user_id, $user_data->data, 60 * 60 );
}
add_action('show_user_profile', 'sr_old_user_data_transient');// Cleanup when done
function sr_old_user_data_cleanup( $user_id, $old_user_data ){
delete_transient( 'sr_old_user_data_' . $user_id );
}
add_action( 'profile_update', 'sr_old_user_data_cleanup', 1000, 2 );
June 4, 2014 at 8:57 am #183636In reply to: How add filter to bp_the_profile_group_field_ids?
Iurie Malai
ParticipantCan you show how you solved your problem? danbp‘s code did not work for me. As you, I also wanted to hide some xprofile fields and tabs that I donβt want users to be able to edit.
May 30, 2014 at 10:42 am #183482CommonEasy
Participantyou should try to hide the fields from the edit profile page but not from the profile page. try editing the wwwroot/wp-content/plugins/buddypress/bp-themes/bp-default/members/single/profile/edit.php. more information here https://buddypress.org/support/topic/ow-to-hide-more-than-one-profile-field/
May 29, 2014 at 5:20 pm #183454In reply to: [Resolved] How to hide more than one profile field?
SimpleOne
ParticipantI found another solution that was suggested by someone in a different thread I had opened. Instead of modifying the edit.php file, I simply put the following code inside my functions.php file in my child theme. (Or you could put it in bp-custom.php.)
Please be warned that this solution didn’t work when I tried it on my site running BP 1.9.1. (Even though my desired fields were successfully hidden by this solution, I still received a “required fields” error message after clicking the Save button.)
So, in order for this to work, you need to be running BP 2.0 +.
The below profile field ids 1, 32, and 48 correspond to the three fields I needed to hide from editing.
function simple_one_hide_some_profile_fields( $retval ) { if( bp_is_profile_edit() ) { $retval['exclude_fields'] = '32,48,1'; //field ID's separated by comma } return $retval; } add_filter( 'bp_after_has_profile_parse_args', 'simple_one_hide_some_profile_fields' );Try inserting the following into your functions.php or bp-custom.php and see if it works. I modified my above code specifically to hide your profile field id 15.
function commoneasy_hide_some_profile_fields( $retval ) { if( bp_is_profile_edit() ) { $retval['exclude_fields'] = '15'; //multiple field ID's should be separated by comma } return $retval; } add_filter( 'bp_after_has_profile_parse_args', 'commoneasy_hide_some_profile_fields' );May 29, 2014 at 4:37 pm #183453In reply to: [Resolved] How to hide more than one profile field?
CommonEasy
ParticipantHi SimpleOne, I’m working on the same problem here! I tried to hide some fields from the edit profile page . i tried <
div class="clear"></div> <?php while ( bp_profile_fields() ) : bp_the_profile_field(); if ( bp_get_the_profile_field_id() != '15' ) :?> <div<?php bp_field_css_class( 'editfield' ); ?>>to hide profilefield 15 from the editing page, unfortunatly it doesnt work, can you maybe send me a duplicate of your edit.php file? you would help me big time π
May 27, 2014 at 6:35 pm #183381Iurie Malai
Participant@danbp, I know how to check for errors, but this didn’t helped me too much :). I solved with the blank page, but no more. Your solution works for hiding some xProfile tabs from viewing, but not from editing them. Am I wrong? Sorry!
This is my tested function (as I said, it hiding only from viewing, not from editing):
function flegmatiq_profiles( $retval ) { if ( is_user_logged_in() && !bp_is_profile_edit() ) { $myfield = xprofile_get_field_data( 'User Type' ); if( $myfield == "Faculty" ) { $retval['exclude_groups'] = '2'; //$retval['exclude_fields'] = '6,18,39'; } } return $retval; } add_filter( 'bp_after_has_profile_parse_args', 'flegmatiq_profiles' );The next code works as I need, but I think it is not so elegant, and it not allow to use the group ID, only his order number, as ordered by admin:
function hide_profile_group_tabs_from_editing( $group_names ){ if ( is_user_logged_in() && bp_is_profile_edit() && xprofile_get_field_data( "User Type") != "Faculty" ) { for ($x=0; $x<=sizeof($group_names); $x++) { if ( $x != 3 ) echo $group_names[$x]; //3 is the order number (from 0) of the tab that I need to hide in the profile edit page. This is not the group ID. } } else { return $group_names; } } add_filter('xprofile_filter_profile_group_tabs', 'hide_profile_group_tabs_from_editing');May 24, 2014 at 4:16 am #183301In reply to: Need initial advice on custom design capabilities
theatereleven
ParticipantI’m finally back on this – have installed the new BuddyPress.
Have a problem: there are no WYSIWYG editors as option profile fields. I’m trying to find a solution to this – have you seen any?
I also need to be able to use if and then statements so profile fields that are not filled out don’t show in the template.
Just purchased the book on theming BP, but if you have any pointers on the above two items, that would rock. Thanks!
May 23, 2014 at 5:08 am #183264In reply to: Buddypress Profiles feature request
theatereleven
ParticipantHey, did anyone get this working? I too need a WYSIWYG editor for the text areas in the BuddyPress profiles. Can’t live without that.
Henry – I see your notes above, but a little hazy on where to put that in my edit.php file. Would you be able to spell it out more?
Basically, my edit.php file now shows this:
<?php while ( bp_profile_fields() ) : bp_the_profile_field(); ?> <div<?php bp_field_css_class( 'editfield' ); ?>> <?php $field_type = bp_xprofile_create_field_type( bp_get_the_profile_field_type() ); $field_type->edit_field_html(); do_action( 'bp_custom_profile_edit_fields_pre_visibility' ); ?> <?php if ( bp_current_user_can( 'bp_xprofile_change_field_visibility' ) ) : ?> <p class="field-visibility-settings-toggle" id="field-visibility-settings-toggle-<?php bp_the_profile_field_id() ?>"> <?php printf( __( 'This field can be seen by: <span class="current-visibility-level">%s</span>', 'buddypress' ), bp_get_the_profile_field_visibility_level_label() ) ?> <a href="#" class="visibility-toggle-link"><?php _e( 'Change', 'buddypress' ); ?></a> </p> <div class="field-visibility-settings" id="field-visibility-settings-<?php bp_the_profile_field_id() ?>"> <fieldset> <legend><?php _e( 'Who can see this field?', 'buddypress' ) ?></legend> <?php bp_profile_visibility_radio_buttons() ?> </fieldset> <a class="field-visibility-settings-close" href="#"><?php _e( 'Close', 'buddypress' ) ?></a> </div> <?php else : ?> <div class="field-visibility-settings-notoggle" id="field-visibility-settings-toggle-<?php bp_the_profile_field_id() ?>"> <?php printf( __( 'This field can be seen by: <span class="current-visibility-level">%s</span>', 'buddypress' ), bp_get_the_profile_field_visibility_level_label() ) ?> </div> <?php endif ?> <?php do_action( 'bp_custom_profile_edit_fields' ); ?> <p class="description"><?php bp_the_profile_field_description(); ?></p> </div> <?php endwhile; ?>May 22, 2014 at 8:15 pm #183247Iurie Malai
Participant@danbp, thank you! I tested your solution (the last function), but no success. Is enough to put this in the bp-custom.php file?
I tried the next simple function to hide the extended fields group number 2 from editing for all members, but it not working.
function flegmatiq_profiles( $retval ) { if( bp_is_profile_edit() ) { $retval['exclude_groups'] = '2'; } return $retval; } add_filter( 'bp_after_has_profile_parse_args', 'flegmatiq_profiles' );May 21, 2014 at 5:45 pm #183208In reply to: Set checbox value with xprofile_set_field_data
danbp
ParticipantMaybe read here, the post and all the comments:
Fetching and Showing only Specific fields from BuddyPress XProfile data
May 21, 2014 at 11:57 am #183188danbp
ParticipantSince BP 2.0, you can use bp_parse_args to customise template loops and on a much easier way as never before.
The example function below will hide profile groups with ID 1 and profile fields IDs 6, 18 & 39 on the public profile screen of each member and stay visible on the edit screen. Tested & approved 2.0.1
If you get some php warning while using this function, be aware that there is a bug in 2.0.1 bp-xprofile-classes.php (fixed. See ticket). Simply apply the lattest patch to get rid of this error.
function flegmatiq_profiles( $retval ) { // conditionnals to set accordingly to your purpose if( !is_user_logged_in() && !bp_is_profile_edit() ) { $retval['exclude_groups'] = '2'; $retval['exclude_fields'] = '6,18,39'; } return $retval; } add_filter( 'bp_after_has_profile_parse_args', 'flegmatiq_profiles' );In your particular case, you have to play with the conditionnals
The example below is to give you an idea how to handle this. Not tested !
function flegmatiq_profiles( $retval ) { $myfield = xprofile_get_field_data( 'Faculty', $user_id ); if( empty( $myfield ) ) return; // or echo if( $myfield == "Faculty" ) if( bp_is_profile_edit() ) { $retval['exclude_groups'] = '1,56'; $retval['exclude_fields'] = '6,18,39'; . } if $myfield == "field_name_2"; // do something other... return $myfield; add_filter( 'bp_after_has_profile_parse_args', 'flegmatiq_profiles' );May 19, 2014 at 4:39 pm #183117In reply to: How add filter to bp_the_profile_group_field_ids?
danbp
Participant@simpleone,
you found the reason why it doesn’t work on one site and not on the other !
1.9.1 and 2.0.1 are sligthly different BP version !
And the function you mention whas only introduced in BP 2.0, so this can’t anyway work on previous versions.Actually there is a small bug in BP 2.0+ when using this function to modify profile groups. I opened a ticket about this and @imath provided a patch that works and let the function handle correctly on profile groups. I personnally use this function to conditionnally show/hide fields from the base group without problems. My profile form contains over 20 fields in differents groups, even Base, and are all required and viewable by members only.
I advise you to cancel whatever you have done about this so far, to apply the patch, to add the function to bp-custom.php and to test again.
May 18, 2014 at 10:00 pm #183097In reply to: Filter Members List Based On Profile Field
latinosamorir
ParticipantHi @kizzywizzy.
Thank you for bringing this up.
I’m interested in created an additional Member Directory (keep default, and have a new page with a custom member directory).
In this new Custom Member Directory, I would like to do something similar to what you’re doing (filter members based on loggedin member profile fields). Basically create a list of Member Suggestions.
Any idea on how to use the code you’re provided to make the above happen?
Thank you!
-
AuthorSearch Results