Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'profile fields'

Viewing 25 results - 2,176 through 2,200 (of 5,755 total)
  • Author
    Search Results
  • #183301
    theatereleven
    Participant

    I’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!

    #183283
    kemmieg
    Participant

    I have a multi-select box for one of my profile fields and I need to add to that particular field a text box when the user selects other. Is there a way to do this. I know it’s possible with JQuery because I’ve done it but I haven’t tried to do it with a plugin and I’m not sure where I would put the code to make this happen. Any suggestions?

    theatereleven
    Participant

    I’m trying to show an image on a profile based on whether a check box is checked in the extended profile.

    For example, on a normal WordPress site I do this with custom fields like this:

     <?php if (get_field('badge_certified')): ?>
      <div class="badge"><img src="<?php echo get_bloginfo('url'); ?>/media/badge-certified.png" class="tooltips" title="Certified Member"></div>
     <?php endif; ?>

    The above code only shows the badge if the ‘badge_certified’ custom field is filled out.

    So if I have a BP extended profile checkbox named ‘Certified Member’ and I want an image to display if that field is checked, how could I do this?

    Thanks to anyone willing to help out!

    #183264
    theatereleven
    Participant

    Hey, 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; ?>
    theatereleven
    Participant

    Hey BuddyPressers.

    I’m brand spanking new to BP. I’m used to building themes from scratch in WordPress, and for designing a site, I’m a custom post type/custom field addict.

    With that said, I have a current site that just launched with user profile pages that are really custom post types, with a bunch of custom fields assigned to them. I’m now moving this site to BuddyPress, and after looking at instructions on theme development, my approach is to take my existing styling, and instead of calling in custom fields, I’m using:

    <?php bp_member_profile_data( 'field=Name' ); ?>

    to fully construct the profile pages. For each custom field I currently have, I’m adding an extended profile field in BuddyPress.

    Does that make sense? Because this seems really easy to implement which is really nice!!!

    Any comments appreciated….I don’t want to do it wrong.

    (And yes, I’ve moved the buddypress and css folders to my theme’s root, and am styling the profile page using buddypress.php in the root of my theme)

    Iurie 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' );
    #183241
    latinosamorir
    Participant

    Hi.

    So I’m using Gravity Forms User Add On and Autochimp. What was happening was that Gravity Forms updated buddypress profile fields using the function: xprofile_set_field_data() but Autochimp was not updating the subscribers list with this information.

    Autochimp updates your subscriber list with buddypress profile fields when the buddypress profile fields are updated, it uses this action: xprofile_updated_profile

    However, this action: “xprofile_updated_profile” is only available here: bp-xprofile-admin.php line 659 in function user_admin_load() and here: bp-xprofile-screens.php in line 134 in function xprofile_screen_edit_profile(). It is not available in the function xprofile_set_field_data() that Gravity Forms and many other plugins use.

    The action should also exist in the function xprofile_set_field_data() in the file bp-xprofile-functions.php .

    However, my php level is 5 out of 10 and the format of filters/hooks and object programming is still not 100% clear to me.

    If I add the action below “return $field->save();” I assume it won’t happen since the function ends at return, yes?

    But I also can’t add it before because the data has not saved and there might be some errors. I saw there were 3 save() functions in bp-xprofile-clases.php and couldn’t figure out which one was being called.

    All 3 functions do have this action: “xprofile_data_after_save” but it’s an array and I have no idea how to manage that.

    This is how Mailchimp calls the action:

    add_action('xprofile_updated_profile', array( $this, 'OnBuddyPressUserUpdate' ), 101 );

    inside this function

    public function SyncBuddyPress()
    	{
    		// Used to sync users with MailChimp
    		add_action('xprofile_updated_profile', array( $this, 'OnBuddyPressUserUpdate' ), 101 ); 
    		add_action('bp_core_signup_user', array( $this, 'OnBuddyPressUserUpdate' ), 101 ); 
    	}

    And the function the action calls is this:

    public function OnBuddyPressUserUpdate( $user_id = 0 )
    	{
    		if ( 0 == $user_id )
    		{
    			// Get the current user
    			$user = wp_get_current_user();
    		}
    		else
    		{
    			$user = get_userdata( $user_id );
    		}
    		// Pass their ID to the function that does the work.
    		AC_OnUpdateUser( $user->ID, $user, TRUE );
    	}
    

    I have multiple questions:

    – why does the action get called with an array? what’s $this?
    – how can I make Autochimp update when this function is called: xprofile_set_field_data()

    Thank you in advance!

    #183208
    danbp
    Participant

    Maybe read here, the post and all the comments:

    Fetching and Showing only Specific fields from BuddyPress XProfile data

    danbp
    Participant

    Since 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' );
    Iurie Malai
    Participant

    Hi!

    I have created in the Base (Primary) extended profile group a drop-down menu/field ‘User Type’ with three options (Faculty, Student, Visitor). Also, I have created an extended profile fields group ‘Academic Profile’ (id number 2).

    What I want to do is to hide the ‘Academic Profile’ fields group from editing (not displaying on the user edit profile page) if the drop-down field ‘User Type’ from the Base group is empty or not ‘Faculty’.

    I have the next code in the bp-custom.php, but it not works. What am I doing wrong?

    /* xProfile display for faculties */
    function exclude_xProfile_group_if_user_is_not_a_faculty( $args = array() ) {
    
       //Check if the user is not a faculty
       if ( xprofile_get_field_data( 'User Type', $user_ID ) != 'Faculty' ) :
          //Comma-separated list of xProfile fields group IDs to exclude
          $args['exclude_groups'] = "2";
       endif; 
    
       return $args;
    }
    
    add_filter( 'has_profile', 'exclude_xProfile_group_if_user_is_not_a_faculty');
    

    WordPress 3.9.1
    Buddypress 2.0.1
    http://upsic.org/

    carloscardenas.me
    Participant

    Hi everyone, first of all forgive my bad English.

    I have one problem with this site, http://www.companyculture.com.php53-8.dfw1-2.websitetestlink.com/ especifically in the registration code.
    At this line

    if ( bp_is_active( 'xprofile' ) ) : if ( bp_has_profile( 'profile_group_id=1' ) ) : while ( bp_profile_groups() ) : bp_the_profile_group();

    The if ( bp_has_profile( ‘profile_group_id=1’ ) ) returns false, even when there is a profile group with the group_id=1.

    I don’t know why is this happening, the site uses a 2 step registration form, the first one for basic info and the second one that supposedly run through the profile fields and build the form.

    It was working before and my client says he didn’t do anything to cause the issue.

    If you want I can add the full file code and the jQuery function.

    Thanks for your help!

    #183117
    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.

    #183097
    latinosamorir
    Participant

    Hi @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!

    #183096
    SimpleOne
    Participant

    @shanebp,

    OK, so this is interesting. When I tried inserting the code from @danbp in the functions.php file for another test site that I have, it worked! All 3 fields were successfully hidden during Profile Edit, and I no longer received the error message that all required fields must be filled in. Yippee!!!

    Still not sure why I cannot get this to work on my first site, though. FYI, I’m running BP 1.9.1 on that one, and on the other test site (where I got this to work), I’m running BP 2.0.1. I even tried removing all code from my functions.php file on my first site and just leaving the above code, but that didn’t make any difference. So I’m still scratching my head trying to understand why this would work on one of my sites, but not the other.

    NOTE: I did discover that this solution ONLY works if you do not have a required field set up in your base profile group. Otherwise, you will still receive the error message about needing to fill in required fields when you click the Save Changes button. I found a way to get around this by moving all required fields (like Display Username) out of the base profile group and putting those required fields in a different profile group.

    #183085
    shanebp
    Moderator

    danbp’s function works fine here.
    Although in BP 2.0+, bp_is_profile_edit() should be bp_is_user_profile_edit() to avoid the deprecation notice.

    Are you sure you’re inserting the correct ids?

    Try this and see if it hides the Name field:

    $retval['exclude_fields'] = '1';

    #183084
    SimpleOne
    Participant

    @danbp,

    Thanks. I tried inserting your suggested code into my functions.php, but it did not hide the desire fields. Also, I looked at the references in the links you provided for me to read through. Thanks for those too. However, I’m still stuck on how to resolve my problem.

    Just to be clear… I think what I specifically need to figure out is how to add a filter to bp_the_profile_group_field_ids(), which apparently creates a list of the expected field names (for the specific group tab that I’m currently on) when I click “Save Changes” button on Profile Edit page. Until I can find a way to filter out my 3 desired “required” fields during the Save Changes button press, I will continue to receive the error message: “Please make sure you fill in all required fields in this profile field group before saving“.

    Is there some other type of coding I can try to insert inside functions.php to resolve this?

    #183075
    danbp
    Participant

    Hi @SimpleOne,

    read from line 154 in bp-xprofile-classes.php file. It contains many information for what you want to do.
    See also on Codex here and here

    You can also revert your changes back and use this kind of function (goes into theme’s functions.php or bp-custom.php):

    function simple_one_hide_some_profile_fields( $retval ) {	
    	
    	if(  bp_is_profile_edit() ) {		
    		$retval['exclude_fields'] = '48';	//field ID's separated by comma
    		
    	}	
    	
    	return $retval;
    	
    }
    add_filter( 'bp_after_has_profile_parse_args', 'simple_one_hide_some_profile_fields' );

    May this help ? 😉

    SimpleOne
    Participant

    I’m a total novice with PHP and need some help with creating some code to go inside my functions.php file. The code I need is a clone of the call to bp_the_profile_group_field_ids() that will filter out 3 xprofile field names that I don’t want users to be able to edit.

    Background: I’ve successfully modified the edit.php file to not display those 3 “required” fields (because I don’t want users to be able to edit them). However, the problem I discovered is that after modifying the edit.php file to hide those 3 fields (which I make “required” during registration), when a user clicks “Save Changes” on their Edit Profile page, it results in the message: “Please make sure you fill in all required fields in this profile field group before saving” (even though all required fields have data in them).

    Through my online research, I found that the following line of code in the edit.php file is the problem…

    <input type="hidden" name="field_ids" id="field_ids" value="<?php bp_the_profile_group_field_ids() ?>" />

    Apparently, the call to bp_the_profile_group_field_ids() which creates a list of the expected field names does not have a filter. So I would need to clone that function in my functions.php file and manually filter out my 3 desired fields from the string that gets generated.

    Anyone able to help with this… PLEASE?

    #183059

    In reply to: 2.1 top features

    stripedsquirrel
    Participant

    1) Change group slug (old plugin does not work).
    2) All possible types of X-profile fields (homepage URL, twitter URL, working multi-select boxes etc)
    3) x-profile fields that can be set by admin and not edited by user.
    4) Shortcodes or other options to display userquery based on x-profile fields. For example: display all users that have checked option ‘B’, all users that have run 2 marathons, all users from Europe etc.
    5) easy way to change all base-level slugs (groups -> teams, members-> runners etc).

    #183038
    SimpleOne
    Participant

    Correction to my last post. I meant to say…

    I was able to successfully hide certain profile fields from being displaying (by modifying profile-loop.php). And I was able to hide the same fields from being displayed when a user goes to edit their profile (by modifying edit.php).

    NOTE: Both files are located in: /bp-templates/bp-legacy/buddypress/members/single/

    I still need help figuring out how to avoid the above-mentioned “required fields” error message upon clicking the Save Changes button.

    #183032
    SimpleOne
    Participant

    Oops… I just found a problem.

    The good news is that I was able to successfully hide certain profile fields from being displaying (by modifying profile.php). That part works great. Also, I was able to hide the same fields from being displayed when a user goes to edit their profile.

    However, the problem I just discovered is that if any of those fields that I’ve hidden (using the above code changes) are “required” fields, then when a user goes to the Edit Profile page, the following error message appears upon clicking the Save Changes button: “Please make sure you fill in all required fields in this profile field group before saving.”

    Even though I’m certain those hidden fields have values in them, that error message appears and there’s no way to save changes.

    Any solution to this?

    #183027
    shanebp
    Moderator

    Try:

    while ( bp_profile_fields() ) : bp_the_profile_field(); 
    if ( bp_get_the_profile_field_id() != 'ID # YOU WANT TO SKIP' && bp_get_the_profile_field_id() != 'ID # 2nd field YOU WANT TO SKIP' ) :
    evertsaar
    Participant

    Hi guys!
    I have extended my WordPress sign up form with additional BP profile fields. All text fields save to the database just fine apart from multi fields (I’m using checkboxes and dropdowns). The default values are not set, nor is the information saved to the database. Any ideas what may cause that? I’m running latest versions of WP and BP and have tested on a clean site with BP as only plugin.

    Thanks

    #182934
    julianprice
    Participant

    @antimuffin are you referring to extending profile fields. If so here’s the link for that which supports drop down select. however unsure if it supports conditional/dependent fields. You may have to look into a plugin.

    i.e
    Drop Down Select:
    – option 1 NAME
    – option 2 NAME
    – option 3 Other
    if other [TEXT BOX]

    Anyways here’s the link to codex https://codex.buddypress.org/buddypress-components-and-features/extended-profiles/

    #182889
    mika89
    Participant

    It doesn’t seem to work :(.
    Maybe I’m not doing it in the good way…

    I also tried the function

    /**
     * Search the friends of a user by a search string.
     *
     * @param string $filter The search string, matched against xprofile fields (if
     *        available), or usermeta 'nickname' field.
     * @param int $user_id ID of the user whose friends are being searched.
     * @param int $limit Optional. Max number of friends to return.
     * @param int $page Optional. The page of results to return. Default: null (no
     *        pagination - return all results).
     * @return array|bool On success, an array: {
     *     @type array $friends IDs of friends returned by the query.
     *     @type int $count Total number of friends (disregarding
     *           pagination) who match the search.
     * }. Returns false on failure.
     */
    function friends_search_friends( $search_terms, $user_id, $pag_num = 10, $pag_page = 1 ) {
    	return BP_Friends_Friendship::search_friends( $search_terms, $user_id, $pag_num, $pag_page );
    }

    I called it this way : friends_search_friends('', $user_id, 0, 0);
    But doesn’t work

Viewing 25 results - 2,176 through 2,200 (of 5,755 total)
Skip to toolbar