Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'profile fields'

Viewing 25 results - 851 through 875 (of 3,576 total)
  • Author
    Search Results
  • djsteveb
    Participant

    @redgard
    seems to be a similar question with a couple of intersting answers here: https://buddypress.org/support/topic/html-or-wysiwyg-in-text-profile-fields/

    #246535
    Antipole
    Participant

    So I am getting my extra user data fields with a line like:
    echo '<div style="position: absolute; left:150px;">' , bp_get_member_profile_data('field=Ovni model'),'</div>';
    But I would like them to be search links as it is in an individual profile. I have achieved this with

    echo '<div style="position: absolute; left:60px;"><a href=', $bp->pages->members, '?s=', bp_get_member_profile_data('field=Ovni model'),' rel="nofollow">' , bp_get_member_profile_data('field=Ovni model'),'</a></div>';
    

    However, I am now also using the plugin Custom Profile Filters for BuddyPress, which lets me set which profile fields should not be search links and also allows users to spilt their data up, so a profile field “[ocean] and [coast]” gets two separate search links, one for ‘ocean’ and another for ‘coast’. Neat. It seems to do this by adding a filter to bp_get_the_profile_field_value.

    However, my manual addition of search links as above ignores these settings, and any [] in the fields comes through and are visible.

    It occurs to me that, rather than fetching the fields with bp_get_member_profile_data(), I would do better to get the data however it is got for the individual profile display, as this method puts the search links in and obeys the options set in Custom Profile Filters for BuddyPress. I have spent much of today trying to find how to call bp_get_the_profile_field_value. If I use
    echo '<div style="position: absolute; left:150px;">' , bp_get_member_profile_value('field=Ovni model'),'</div>';
    I get an invalid link. I suspect it need a data type argument to get a search link. I have tried to find how it is called to display the user profile, but failed to find it. In the BP Codex I have only found how to remove the filter that puts the links in.

    If someone could enlighten me it would be most helpful. Thanks.

    #246500
    danbp
    Participant

    Hi @ma3ry,

    unable to visit the indicated page due to redirection… BP’s xProfile text box contains are autolinked by default for the 5 first words.
    This is handy when you use a field called city for example. The city name is autolinked and let each user click on it to find other who may entered the same name.

    Of course, an about me box with a long description, which several autolinked words has less interrest. Fortunately, you can deactivate xprofile autolinking.
    Two options for this: all or selected.

    Here 3 snippets. The first can be used if you want to completely remove autolink from all field values.
    The second is a new filter to let you choose the field(s) you want to deactivate. This need two snippet. The first to rewrite a filter and the second to remove / replace the existing BP filter.

    Add the snippet to bp-custom.php.

    // remove any autolink from profile
    function remove_xprofile_links() {
    remove_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_link_profile_data', 9, 2 );
    }
    add_action( 'bp_init', 'remove_xprofile_links' ); 
    
    // custom filter to selectively remove autolink
    function my_xprofile_filter_link_profile_data( $field_value, $field_type = 'textbox' ) {
    
        // Access the field you are going to display value.
        global $field;
    
        // In this array you write the ids (separated by comma) of the fields you want to hide the link.
        $excluded_field_ids = array(2);
    
        // If the id of this $field is in the array, we return the value only and not the link.
        if (in_array($field->id, $excluded_field_ids))
    	return $field_value;
    	
    	if ( 'datebox' == $field_type )
    	return $field_value;
    	
    	if ( !strpos( $field_value, ',' ) && ( count( explode( ' ', $field_value ) ) > 5 ) )
    	return $field_value;
    	
    	$values = explode( ',', $field_value );
    	
    	if ( !empty( $values ) ) {
    		foreach ( (array) $values as $value ) {
    			$value = trim( $value );
    			
    			// If the value is a URL, skip it and just make it clickable.
    			if ( preg_match( '@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@', $value ) ) {
    				$new_values[] = make_clickable( $value );
    				
    				// Is not clickable
    			} else {
    				
    				// More than 5 spaces
    				if ( count( explode( ' ', $value ) ) > 5 ) {
    					$new_values[] = $value;
    					
    					// Less than 5 spaces
    				} else {
    					$search_url   = add_query_arg( array( 's' => urlencode( $value ) ), bp_get_members_directory_permalink() );
    					$new_values[] = '<a href="' . $search_url . '" rel="nofollow">' . $value . '</a>';
    				}
    			}
    		}
    		
    		$values = implode( ', ', $new_values );
    	}
    	
    	return $values;
    }
    
    /**
     * We remove the buddypress filter and add our custom filter.
     */
    function remove_xprofile_links() {
        // Remove the old filter.
        remove_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_link_profile_data', 9, 2 );
        // Add your custom filter.
        add_filter( 'bp_get_the_profile_field_value', 'my_xprofile_filter_link_profile_data', 9, 2);
    }
    add_action('bp_setup_globals', 'remove_xprofile_links');
    #246456
    buckyb
    Participant

    I’ve decided to try and put the fields in a separate custom editing page, and I’m searching for how to add each extended editable input xprofile field individually, with their id number. I think that will help solve the styling issue. I’ve been searching for something similar like this so I can see how to accomplish this, if anyone can suggest something I would greatly appreciate it! 🙂

    #245772
    shanebp
    Moderator

    can anyone tell me how i could for instance output only label for email?

    In register.php…

    <?php while ( bp_profile_fields() ) : bp_the_profile_field(); ?>
    
         if( 'Email' == bp_get_the_profile_field_name() )
            echo 'Email: this is the email field';
    
    //etc

    You could use that approach for xprofile fields.
    But ’email’ is not an xprofile field.
    It is hardcoded in register.php ~Line 77

    #245636
    danbp
    Participant

    xprofile component use his own tables:
    _bp_xprofile_data
    _bp_xprofile_fields
    _bp_xprofile_groups
    _bp_xprofile_meta
    See here for detailed structure: https://codex.buddypress.org/developer/buddypress-database-diagram/

    Somehow related to your question, this topic who explains how to use bp_update_user_meta (update_user_meta belongs to WP)

    #245577

    In reply to: Profile URLs

    Andrew
    Participant

    You need to add the target=”_blank” attribute to the profile field value anchors.

    I think the best way to do this is by using str_replace. Add this to your functions.php or bp-custom.php

    function profile_target_blank( $field_value, $field_type, $field_id ){
    	
       $field_value = str_replace('rel="nofollow"', 'rel="nofollow" target="_blank"', $field_value);
    
    	return $field_value;
    }
    add_filter('bp_get_the_profile_field_value', 'profile_target_blank', 11, 3);

    I’ve tested this and it works. This should open a new browser window/tab for all profile fields that have a URL’s.

    #245460

    Perfect! Works great! Thanks so much for the reply! 🙂

    You mentioned there were other ways to display this?

    Can the user directly upload through profile fields & then automatically display in tabs like you showed without entering the url?

    #245458
    danbp
    Participant

    @canadianmusicnetwork,

    i never used BuddyForms, so i can’t help you with this. Ask on their support if a specific audio field exist or can be added, and how.

    That said, WP comes with all of this, but later. Meaning by this that a user will be able to upload an audio file once it is already registered.

    It is commonly accepted that nothing can be added to a site as long as a new user is not validated or pending.

    On a standart install, i would use a simple text field on a new field group named Audio. And, eg., if you allow 5 files, use 5 fields.

    BP strips HTML on prfoile fields, so it’ not possible by default to get the automatted embed like in a post. Why is unclear to me, as embed is implemented since BP 1.6 for activities, groups, but not profiles… Anyway, a little bp-custom snippet magic (here it is ! ) will let you do this.

    function set_audio_field( $field_value ) {
    	$bp_this_field_name = bp_get_the_profile_field_name();
    	// field name (case sensitive)
    	if( $bp_this_field_name == 'N° 1' || $bp_this_field_name == 'N° 2' ) {
    		$field_value = strip_tags( $field_value );
    		$field_value = '[audio mp3 ="'.$field_value.'"]';
    	}
    	return $field_value;
    }
    add_filter( 'bp_get_the_profile_field_value','set_audio_field');

    That’s it for site admin. Now for the user.

    The new user capability should be “author”, so he can upload files. This is default, but you can change that, if you search a bit on WP’s codex.

    First he have to upload his file. From Toolbar: Dashbord > Media > add new. Then he has to copy the file URL avaible on the media upload page, under “edit” and then in the right menu.

    User goes to his profile > edit > audio tab and paste the file URL into the audio field, save and voila ! Here the result:

    audio display on profile

    That’s only one possibility. the’re others, like custom post type…

    #245450

    Thanks so much for the professional reply. I really enjoy Buddypress & The Support Community. I suggest this service to everyone else in the Canadian Music Industry. Sorry about the capital lock! Didn’t proof read before hitting submit! Lesson Learned 🙂

    Anyways, I want to be able to create a Profile Field when Users/Artists sign up where they can upload (2) mp3 files so it will automatically display in their profile. This is the main page where there (2) Featured Songs will be displayed. The rest will be displayed in RTMEDIA or BuddyMedia.

    I have some experience with coding, but was wondering how would I add a profile field that says audio to my drop down list in profile fields & output the mp3 player on the user end?

    First Example (Second To Follow)

    Second:

    Thanks in advanced!

    #245168

    In reply to: Defoult user files

    mrjarbenne
    Participant

    Similar answer to this topic. https://buddypress.org/support/topic/user-fields/

    This plugin mentioned, with a bit of tweaking, can do exactly what you are talking about: https://wordpress.org/plugins/custom-profile-filters-for-buddypress/

    #245089

    In reply to: User Fields

    ckchaudhary
    Participant

    Default behaviour is to search through values of all profile fields for the search term.
    So if someone has entered ‘london’ in ‘city’ field and you click on it, the search result doesn’t only contain members who have entered ‘london’ in ‘city’ field. It’ll also return members who have entered ‘london’ in any of profile fields.
    That’s what makes you see the result set as inaccurate i guess.

    #244926

    In reply to: mySql querry help

    shaunik
    Participant

    @danbp: not sure why not working it comes with error

    MySQL said: Not unique table/alias: 'wp_bp_xprofile_data'
    

    Tried query in phpmyadmin, same error:

    
    SELECT wp_bp_xprofile_data.value,
           wp_users.user_email,
           wp_users.display_name
    FROM wp_users
      LEFT JOIN wp_bp_xprofile_data
         ON wp_bp_xprofile_data.user_id = wp_user.ID
      LEFT JOIN wp_bp_xprofile_data
         ON wp_bp_xprofile_fields.id = wp_bp_xprofile_data.field_id
     LIMIT 0, 30 
    MySQL said: Documentation
    #1066 - Not unique table/alias: 'wp_bp_xprofile_data'

    @shanebp: I wish wpdatatables allow php functions … it does’t

    #244913
    @mcuk
    Participant

    Hi @danbp thanks for reply.

    Tried the code you wrote in the link above and it works fine. But as with the one referenced in my first post it reduces the string length upon display rather than preventing the user typing in a large number of characters in the first place (and the data being stored in database).

    So moved onto looking at the code snippet by @henrywright for the sign up page. Would be suitable if i could convert it to work with profile fields. Got to this stage with a few q’s:

    function my_textarea_validation() {
        $custom_field_id = bp_get_member_profile_data( 'field=Mini Bio' );	
    	//is the use of $_POST['field_' . $custom_field_id] correct to access desired profile field?
    	if ( strlen( $_POST['field_' .$custom_field_id] ) > 5 ) { 
            global $bp;
            //which $bp->... error message to use?
    	$bp->signup->errors['field_'] = __( 'CUSTOM ERROR MESSAGE', 'buddypress' ); 
        }
    }
    //which hook to use? (to affect the textarea on Profile > Edit navigation tab)
    add_action( '???', 'my_textarea_validation' );
    #244765
    DanielEngelhardt
    Participant

    i did it that way and it worked for me. so i now have all my profile fields in one group and display only one of the fields on the registration-page

    danbp
    Participant

    You can add custom option fields for References and Places Worked:

    Profile → Edit

    Not sure that adding a memberlist as drop down is very clever. What if you get a community of hundreds of members ?

    To get database info, see here: (that’s a common WP task)
    https://codex.wordpress.org/Class_Reference/wpdb

    #244694
    shanebp
    Moderator

    Then create a template overload of this file:
    buddypress\bp-templates\bp-legacy\buddypress\members\register.php

    In that file, prevent the display of certain fields by checking them by using
    bp_get_the_profile_field_id() or bp_get_the_profile_field_input_name()
    in the loop: while ( bp_profile_fields() ) : bp_the_profile_field();

    #244692
    DanielEngelhardt
    Participant

    thanks for your input, @danbp.
    There is, of course, a reason why i want it as requested 🙂
    On my registration form, i only want to show one field to not bother new users with unnecessary fields. this one field is in my base group.
    All other fields are arranged in another group.

    From my point of view, it doesn’t make sense to show two tabs on the profile-edit page, but it does make sense to show as less fields as possible on the registration page. I think UX comes first today. Customers pay our rent, so we should avoid putting spokes in there wheel. I also think buddypress is doing a pretty bad job here regarding UX (Of course this behavior gives structure, but we pay with UX for it). Since we live in 2015 it shouldn’t be a matter of “hacking” to reduce the amount of inputs and clicks for such “trivial” actions (from a users perspective) like editing a profile.

    Is that reason enough? 🙂

    #244689
    danbp
    Participant

    To get all fields on the same tab, you simply add them to the Base tab. Users can then fill in anything from one tab and profile will show only one tab.

    This will spare you a lot of time to tweak the original form.

    First topic mention: So the user can edit and save all fields without clicking through serveral tabs.
    If, as site owner, you create profile field group it is probably because you want some structurized output.

    Now, before hacking, you have to ask yourself about what you want: structure or UX. And IMHO in this case, the user comes in second position.
    Another point of view, if it so “complicated” for user to fill in several tabs, consider your work first and justify why you have so many fields, that your user consider it is a mess to fill them… 😉

    #244549
    JECPFG
    Participant

    Hi djsteveb, I appreciate that but it’s been several days since I asked on the wpmudev’s support forums and they haven’t replied yet, so I’m anticipating the “you’ll need to ask BuddyPress” response. I figure if I ask in both forums, one side may have an answer.

    And since this is a function of the BuddyPress Profile Fields, I assumed I might have a better chance of getting a response here anyway. I know this isn’t overly complex for someone who knows the answer, I’m just hoping to find someone who does.

    #244526
    danbp
    Participant

    @douglaslovin83

    You’re lucky !
    Download the latest version of the plugin, as it seems that this is now in since 101 minutes:
    Added support for Buddypress custom profile fields

    https://plugins.trac.wordpress.org/browser/wp-auto-affiliate-links/

    #244209
    rezon8dev
    Participant

    OK yup that does it. A question and one more request. @danbp I really do appreciate this, you’re helping me learn some basic stuff and some more detail on BP in general!

    Question, why does bp_member_profile_data pull in the array data but not print the classes?

    Request, I need the fields returned from musical genre to all be on one line and they should be if all the values of the array are returned wrapped in the class rather than than each of the values being wrapped in the class, I just can’t figure out the syntax to make that happen…

    Thanks a million!

    #244205

    In reply to: Add a Text Area Field

    danbp
    Participant

    hi,
    Dashboard > Users > Profile Fields > Add new field

    Name []
    Description []
    Type > select Multi-line Text Area

    User Extended Profiles

    #244201
    danbp
    Participant

    Ok, i see… multiselectbox/checkbox values are returned in a array.

    if ( $data = bp_member_profile_data( 'field=Musical Genre' ) )....endif; thing cannot work, because we have to fetch the whole array of values, not only one.
    Give this a try:

    function custom_display_xprofile_fields() {
    
    if ( $data = bp_get_profile_field_data( 'field=Artist Name' ) ) : 
    	echo '<div class="artist"><h4 class="user-nicename">'. xprofile_get_field_data( 'Artist Name', bp_displayed_user_id() ) .'</h4></div>';
    endif;
    
    if ( $datas = bp_get_profile_field_data( array( 'field' => 'Musical Genre' ) ) ) :
        foreach ( $datas as $data ) { 
           echo '<div class="genre">'. $data .'</div>';
        }
    endif;
    
    if ( $data = bp_get_profile_field_data( 'field=Location' ) ) : 
    	echo '<div class="location">'. xprofile_get_field_data( 'Location', bp_displayed_user_id() ) .'</div>';
    endif;
    }
    add_action( 'bp_profile_header_meta' , 'custom_display_xprofile_fields' );
    #244198
    rezon8dev
    Participant

    Changing the function to this:

    /*
    * Add xprofile fields to member header
    */
    function custom_display_xprofile_fields() {
    
    if ( $data = bp_get_profile_field_data( 'field=Artist Name' ) ) : 
    	echo '<div class="mdetcenter"><div class="artist"><h4 class="user-nicename">'. xprofile_get_field_data( 'Artist Name', bp_displayed_user_id() ) .'</h4></div></div>';
    endif;
    
    if ( $data = bp_member_profile_data( 'field=Musical Genre' ) ) : 
    
    	echo '<div class="mdetcenter"><div class="genre">'. xprofile_get_field_data( 'Musical Genre', bp_displayed_user_id() ) .'</div></div>';
    
    endif;
    
    if ( $data = bp_get_profile_field_data( 'field=Location' ) ) : 
        echo '<br>';
    	echo '<div class="mdetcenter"><div class="location">'. xprofile_get_field_data( 'Location', bp_displayed_user_id() ) .'</div></div>';
    endif;

    Gives me this HTML output:

    	<div class="mdetcenter"><div class="artist"><h4 class="user-nicename">No Way Back</h4></div></div>
    Alternative, Blues, Country, Electronic
    <br><div class="mdetcenter"><div class="location">Detroit, MI. US</div></div>
Viewing 25 results - 851 through 875 (of 3,576 total)
Skip to toolbar