Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'profile fields'

Viewing 25 results - 876 through 900 (of 3,576 total)
  • Author
    Search Results
  • #244190
    rezon8dev
    Participant

    OK this mostly worked and I do not know how to fix the portion that is not working. I’ve entered 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 artist"><h4 class="user-nicename">'. xprofile_get_field_data( 'Artist Name', bp_displayed_user_id() ) .'</div>';
    endif;
    
    if ( $data = bp_get_profile_field_data( 'field=Musical Genre' ) ) : 
    	echo '<div class="mdetcenter genre">'. xprofile_get_field_data( 'Musical Genre', bp_displayed_user_id() ) .'</div>';
    endif;
    
    if ( $data = bp_get_profile_field_data( 'field=Location' ) ) : 
    	echo '<div class="mdetcenter location">'. xprofile_get_field_data( 'Location', bp_displayed_user_id() ) .'</div>';
    endif;
    
    }
    add_action( 'bp_profile_header_meta' , 'custom_display_xprofile_fields' );
    add_filter( 'bp_before_member_header_meta', 'custom_display_xprofile_fields' );
    

    The Musical Genre field is a multi-select field type and the echo is printing “array” rather than the array of selected values in this field…


    @danbp
    can you help here?

    #244188
    danbp
    Participant

    How else would I override the buddypress file unless it was in my child theme with the same name?

    You should NOT override core files. The only files you alter from child theme are template files.

    To alter core functions, you use custom functions and add them via filter hooks, preferably added to bp-custom.php – so you won’t loose your work at next update.

    member-profile.php doesn’t exist in BuddyPress.

    Codex is your friend !

    Theme Compatibility & Template Files

    Displaying Extended Profile Fields on Member Profiles

    … and forum search too. 😉

    #244184
    danbp
    Participant

    Is your child theme working correctly with Kleo ?
    Is the altered member-header.php file in your child-theme ?
    Do you really use a file called member-profile.php, as stated in your first topic ? Bad !

    Remove all your custom snippets and revert back to original BP template fisrt, then try this in bp-custom.php:

    function custom_display_xprofile_fields() {
    
    echo 'Custom display fields';
    echo '<ul>';
    if ( $data = bp_get_profile_field_data( 'field=Artist Name' ) ) : 
    	echo '<li>'. xprofile_get_field_data( 'Artist Name', bp_displayed_user_id() ) .'</li>';
    endif;
    
    if ( $data = bp_get_profile_field_data( 'field=Musical Genre' ) ) : 
    	echo '<li>'. xprofile_get_field_data( 'Musical Genre', bp_displayed_user_id() ) .'</li>';
    endif;
    
    if ( $data = bp_get_profile_field_data( 'field=Location' ) ) : 
    	echo '<li>'. xprofile_get_field_data( 'Location', bp_displayed_user_id() ) .'</li>';
    endif;
    
    echo '</ul>';
    }
    add_action( 'bp_profile_header_meta' , 'custom_display_xprofile_fields' );
    add_filter( 'bp_before_member_header_meta', 'custom_display_xprofile_fields' );
    #244181
    rezon8dev
    Participant

    Has anyone seen the duplicating profile fields issue happen when displaying xprofile fields in the member header before?

    #244175
    rezon8dev
    Participant

    OK will do @shanebp.
    Can anyone give me a hand and let me know if this code looks proper? Even if I remove this from my child theme functions.php file and add the following to my member-header.php file:

    
    bp_member_profile_data( 'field=Artist Name' );
    bp_member_profile_data( 'field=Musical Genre' );
    bp_member_profile_data( 'field=Location' );

    I get similar results; the custom fields being displayed multiple times, oddly when I add the above to the member-header.php I get the Artist name field showing 4 times in a row rather than repeating sets of fields 1-4 and then fields 1-4 again duplicating when the code in a previous post above is in the functions file…

    #244172
    rezon8dev
    Participant

    @shanebp, I’ve tracked it down but still cant figure out what is wrong. This was all working until I upgraded to the latest bp… It is in my functions file for my theme, it is this function to place 3 xprofile fields in the member header area:

    /** 
     *  Add extended profile fields to the member profile header area  
    */
    
    add_action( 'bp_profile_header_meta' , 'display_user_xprofile_fields' );
    function display_user_xprofile_fields() {
    
     	$artistname = bp_get_member_profile_data('field=Artist Name');
        $musicalgenre = bp_get_member_profile_data('field=Musical Genre');
        $location = bp_get_member_profile_data('field=Location');
    
        if ($artistname || $musicalgenre || $location) {
    
            echo '<div class="mdetcenter artist"><h4 class="user-nicename">'. '' . $artistname . '</h4></div>';
            echo '<div class="mdetcenter genre">'. '' . $musicalgenre . '</div>';
            echo '<div class="mdetcenter location">'. '' . $location . '</div>';
        }
    }

    Can you see what is wrong? This is driving me crazy…

    #244168
    shanebp
    Moderator

    >they now see their profile fields displayed 2 times.

    Rhetorical questions:
    As 2 sets or double entries?
    Does the issue remain if you remove the 3rd shortcode?

    It should be easy to narrow it down by following the clues given when you explore those questions.

    #244152
    modemlooper
    Moderator

    the column on the right are added profile fields, you can remove the field from the admin

    more info on profile fields https://codex.buddypress.org/administrator-guide/extended-profiles/

    #244138
    nilje
    Participant

    No, there is no other plugin which could cause it
    I’ve made a screenshot
    http://www.danielaholl.de/Apublic/Unbenannt-1.jpg
    I think the left side is the WordPress registration and right the one for buddypress.. there are my custom profile fields too.

    #244123
    danbp
    Participant

    Take a look at DB tables related to xprofile:
    _bp_xprofile_data
    _bp_xprofile_fields
    _bp_xprofile_groups
    _bp_xprofile_meta

    If users entered data like https://twitter.com/comandovictor use a mysql command to wipe out https://twitter.com/ via phpMyAdmin.

    UPDATE table_name SET col_name = REPLACE(col_name, 'old_value', 'new_value');

    wp_ is default table prefix, change it if you use another prefix.
    UPDATE wp_bp_xprofile_data SET col_name = REPLACE(value, 'https://twitter.com/', '');

    That’s the fastest method. Don’t forget to backup the table BEFORE doing this.

    Changing the field type can be done from the xprofile admin.

    #244118

    In reply to: Profile Signature

    danbp
    Participant

    It is standard! At least if you use xprofile component to let your users enter their signature.

    1) Create a new field. Call it Signature and give it a textarea type.
    2) Once this field is edited by a user, during registration or later, the signature appears on his profile.

    3) if you want this field somewhere else, for ex on the profile header, you simply write a function to call this field and hook it into the template you want.

    Ie. Add this to child theme functions.php or bp-custom.php

    function my_signature() {	
    if ( bp_is_active( 'xprofile' ) )
       if ( $signature = xprofile_get_field_data( 'Signature', bp_get_member_user_id() ) ) : // field name; case sensitive				
          echo $signature;	
       endif;
    }
    add_filter( 'bp_before_member_header_meta', 'my_signature' );

    Or to use Henry’s advice
    add_filter( 'bp_after_profile_content', 'my_signature' );

    Reference

    User Extended Profiles

    Displaying Extended Profile Fields on Member Profiles

    #243899
    shanebp
    Moderator

    Did you put the profile fields in the ‘Base (Primary)’ group?
    By default, only those fields appear on Register.

    Did you try switching to a WP theme like 2015 to determine if the issue is in your theme?

    #243797
    bigkahunaburger
    Participant

    Found it. The internet is written in ink. 😛

    http://web-archive-me.com/page/1845294/2013-04-09/http://modemlooper.me/allow-youtube-embed-in-buddypress-profile-fields/

    While you are here… It seems to be working great. It’s a bit old. Do you think it will cause any security or other issues with the current version of BP?

    Thanks again.

    #243792
    Naisai
    Participant

    You know what! Hahaha I didnt know you could scroll the code-box. So, I saw the word ‘country when I posted it into the buddypress editor. Silly me…

    But unfortunately…it didnt work There are no delete buttons to the profile fields.

    #243776
    shanebp
    Moderator

    Don’t replace the code.

    Use this function, and change ‘Country’ to the name you gave the field.

    function naisai_make_field_delete() {
    	global $wpdb;
    	
    	$table = $wpdb->prefix . "bp_xprofile_fields"; 
    	$wpdb->query( "UPDATE $table SET can_delete = 1 WHERE name = 'Country'" );
    	
    }
    add_action( 'bp_ready', 'naisai_make_field_delete' );

    Then visit your site’s home page.
    Then go to that field in wp-admin and you should see a Delete link.
    If you have more than one field you want to Delete, then change the name in the function and repeat the process.
    When you are done – remove the function.

    Then, if you want, get the code from the gist and run again.

    danbp
    Participant
    #243772
    Naisai
    Participant

    Thank you so much!

    You need to find the row(s) in the bp_xprofile_fields table and for each row, change the can_delete field value to 1

    But what if I have already deleted the code? Should I then replace it and overwrite according to your corrections?

    #243755
    danbp
    Participant

    @ericks89,

    There is a way, if you use BBPress Signature. 😉 Modifying bbp_get_reply_content filter.

    Here an example fetching 3 xprofile fields called Signature, Industry and Type. Change it to your need. Code goes into bp-custom.php or child theme functions.php

    
    function my_bbp_reply_content_append_user_signature( $content = '', $reply_id = 0, $args = array() ) {
    	// Default arguments
    	$defaults = array(
    		'separator' => '<hr />',
    		'before'    => '<div class="bbp-reply-signature">',
    		'after'     => '</div>'
    	);
    	$r = wp_parse_args( $args, $defaults );
    	extract( $r );
    
    	// Verify topic id, get author id and potential signature
    	$reply_id  = bbp_get_reply_id       ( $reply_id );
    	$user_id   = bbp_get_reply_author_id( $reply_id );
    	
    	// Get fields data. Caution: name is case sensitive.
    	if(function_exists('bbpress') ) {
    		$signature = xprofile_get_field_data( 'Signature', $user_id );	
    		$wowi = '<br>'. xprofile_get_field_data( 'Service', $user_id );
    		$wowt = '<br>'. xprofile_get_field_data( 'Type', $user_id );
    	}
    	else {
    		$signature = bbp_get_user_signature ( $user_id  );
    	}
    
    	// If signature exists, adjust the content accordingly
    	if ( !empty( $signature ) )
    		$content = $content . $separator . $before . $signature . $wowi . $wowt . $after;
    
    	return apply_filters( 'my_bbp_reply_content_append_signature', $content, $reply_id, $separator );
    }
    
    if ( !is_admin() ) {
       // remove the original BBPress filter
       remove_filter( 'bbp_get_reply_content', 'bbp_reply_content_append_user_signature', 1, 2 );
       // add our custom filter
       add_filter( 'bbp_get_reply_content', 'my_bbp_reply_content_append_user_signature', 1, 2 );	
    }
    

    May this help. 😉

    #243720
    shanebp
    Moderator

    You should remove that code as soon the field is created.
    If you edit the field name, then a new field will be created – if you don’t remove the code.

    They dont have a delete button and now I cannot remove any of the fields.

    That is because 'can_delete' => false, should be 'can_delete' => true,.
    I have corrected the gist.

    To delete the fields you already have, you can use a database tool like phpmyadmin.
    You need to find the row(s) in the bp_xprofile_fields table and for each row, change the can_delete field value to 1. Then a ‘Delete’ will appear for that field in wp-admin.

    #243595
    shanebp
    Moderator

    How about all other fields.

    Your best bet is to not nibble at the problem.
    Write a script to migrate all the WP profile fields & user data into BP xprofile fields & user data.

    #243430
    manicexpression
    Participant

    In the Dashbord, under users, go to profile fields, go to Add New Field, and in a box on the right there should be a requirement box, just switch it from Not Required to Required.

    #243426
    djsteveb
    Participant

    @katiemeeks
    someone posted a similar question 4 days ago ( https://buddypress.org/support/topic/i-want-to-nobody-can-not-change-own-gender/ )

    someone else answered to take a look at http://buddydev.com/plugins/bp-non-editable-profile-fields/

    I have not used this yet – but it sounds perfect for this kind of thing.

    #243408
    danbp
    Participant

    On a single install: danshboard > users > profile fields( your-site.com/wp-admin/users.php?page=bp-profile-setup).

    Base(primary)tab, then use Edit button.

    #243322
    danbp
    Participant

    Here an example for profile field lenght with some comments.

    function bpfr_custom_textfield_length() {	
    	
    	//Check if user is logged in & if xprofile component is activated
    	if ( is_user_logged_in() && bp_is_active( 'xprofile' ) ) :	
    	$my_custom_textfield = bp_get_member_profile_data( 'field=Brief Biography&user_id='.bp_get_member_user_id() );	
    	
    	/* 
    	 * The length = number of characters, not words.
    	 * Set the number of caracters to show. 
    	 * The 3 dots are the appended text ending the excerpt.
    	 * Don't remove the quotes if you change this
    	 * BuddyPress 2.1 will add new class and id for custom fields. 
    	 * The span can be omited to style this part. See ticket #5741
    	 */
    	if ( strlen($my_custom_textfield) > 20) :  //adjust to your need
    	$my_custom_textfield = substr($my_custom_textfield, 20).'...'; //adjust to your need
    	endif;
    	// uncomment the following line to get a span around the displayed field content
    	// echo '<span class="short-custom">'. $my_custom_textfield; .'</span>';
    	// comment the following line if you use the span
    	echo $my_custom_textfield;	
    	
    	endif; // is_user_logged_in
    }
    add_action( 'bp_directory_members_item', 'bpfr_custom_textfield_length' );

    Ticket #5741

    #243298
    Kailan Wyatt
    Participant

    You can try this plugin by BuddyDev

    BuddyPress Non Editable Profile Fields

Viewing 25 results - 876 through 900 (of 3,576 total)
Skip to toolbar