Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'profile fields'

Viewing 25 results - 1,226 through 1,250 (of 3,608 total)
  • Author
    Search Results
  • #184407
    nhalation
    Participant

    Well, with a bit more Googling I’ve gotten this solved for the most part. I know these pages get indexed so here’s what I did for anyone’s future reference. For this example’s sake I’ll just cover the “Member Since” field.

    – Created a copy of profile-loop.php in the appropriate child theme directory for update-safe modification.

    – In the child copy of profile-loop.php, right beneath <?php do_action( 'bp_after_profile_field_content' ); ?>, which is inside (and at the bottom) of the ‘if ( bp_profile_group_has_fields())’ if check, I put the following code to output this field for the base group only (assuming the base group has an ID of 1):

    <?php if ( bp_get_the_profile_group_id() == 1 ) : ?>
      <table class="profile-fields">
       <tr<?php bp_field_css_class(); ?>>
        <td class="label">Member Since</td>
        <td class="data"><?php bp_custom_profile_fields(); ?></td>
       </tr>
      </table>
     <?php endif; ?>

    And then finally, in my child theme’s functions.php file (this could probably also go in bp-custom.php) I found and pasted this code to define and format the join date:

    function bp_custom_profile_fields() {
        global $bp;
        $currentuser = get_userdata( $bp->displayed_user->id );
        $joined = date("F jS, Y", strtotime($currentuser ->user_registered));
        echo '' . $joined . '';
    }
    #184399
    GT Director
    Participant

    UPDATE: okay guys, I figured out that I needed to click onto the word “Edit” and fill out the new fields to see them displayed in my new profile – after clicking the word “View”. But there is no way to change the stupid avatar.

    What is the simple way to click onto a user profile link (when a user wants to view their own profile – not the profiles of other users), view just their own information and edit it?? We have to click a “Members” page, search for our personal profile and try to access it that way?

    Why is there no “Profile” page listed among the “Pages” portion of this plugin???? That would be an easy, self-explanatory page that we could preview to see how profiles appear to all users, decide which fields to display or rearrange fields. Change avatars, etc. Why is this program not that simple? What am I missing?

    #184345
    godavid33
    Participant

    @kaizerking you should probably start your own thread, as that is an entirely different problem ( actually, I would say same for you @dhyana , but your question was already answered haha)

    but if I had to posit a suggestion (in a new thread of course) it would be to use the plugin Theme My Login. It has saved me a good bit of headache as far as getting xprofile fields to show up on registration

    #184293
    kaizerking
    Participant

    Added two fields in profile fields they are not displayed in registration form

    #184210
    koendb
    Participant

    Got it πŸ™‚

    All you need is the value of the checkbox.
    <input id="nieuwsbrief" type="checkbox" value="newsletter"
    You can find/set this value in the users –> profile fields page

    Then just set the value of $newsletter to ‘newsletter’ when the box is checked or any other value if it’s not and use:
    $meta_update = xprofile_set_field_data( '<em>name or id of field</em>', $user_id, $newsletter);

    Glad to answer any questions

    #184178
    danbp
    Participant

    @yoshimitsu1234 @dromy,

    1) create your social fields on xprofile
    2) give them a name like Twitter or Facebook
    3) tell the user to enter their social username
    4) install font-awesome or similar to get nice social icons

    This function works as of BP 1.7 and was tested on BP 2.0.1. Add it to bp-custom.php or your (child) theme’s functions.php

    Icons are showed under @username | active since at the right of the user avatar on the profile header.

    Remove the text Test… if you want to use only font-awesome icons or replace it with an image or text of your choice

    function bpfr_socialize_profile () {	
    
    echo '<br>'; // don't remove !
    
    if ( $data = bp_get_profile_field_data( 'field=Twitter ' ) ) : 
    ?>
    
    <a href="http://twitter.com/<?php echo xprofile_get_field_data( 'Twitter', bp_displayed_user_id() );?>/" target="_blank" title="Twitter"><i class="icon-twitter">  </i>Test Twitter</a>&nbsp;
    
    <?php endif;
    
    if ( $data = bp_get_profile_field_data( 'field=Facebook ' ) ) : 
    ?>
    
    <a href="http://facebook.com/<?php echo xprofile_get_field_data( 'Facebook', bp_displayed_user_id() );?>/" target="_blank" title="Facebook"><i class="icon-facebook"></i>Test FB</a>		
    
    <?php		
    endif;
    }
    add_filter( 'bp_before_member_header_meta', 'bpfr_socialize_profile' );
    #184168
    dromy
    Participant

    I agree, can you add option to create a field with a custom link not relating to the search?
    like on the wp profile but on the bp edit profile fields selection.

    #184148
    escudero95
    Participant

    Hi danbp,

    I put the code you posted into functions.php but it didn’t seem to have any effect. I made the visibility of the date of birth field to ‘friends only’ first via the user selection, then via the profile fields settings area and ‘enforced default’. Is there a different way you mean for me to do that?

    Thanks

    #184102
    paton400
    Participant

    No, 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?

    #184071

    In reply to: Help with profiles

    danbp
    Participant

    It’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.

    #183996
    pstidsen
    Participant

    Now 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' );
    #183977
    Chris Perryman
    Participant

    Just 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 );
    #183942
    dromy
    Participant

    Thank 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)

    #183939
    danbp
    Participant

    On 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 πŸ˜‰

    #183913
    CommonEasy
    Participant

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

    CommonEasy
    Participant
    #183889
    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 !

    #183741
    CommonEasy
    Participant

    I 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 = "&euro; $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…

    #183740

    In reply to: Remove profile links

    CommonEasy
    Participant

    sorry 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 ?

    #183705
    compixonline
    Participant

    Hi –

    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.

    #183669
    whedlund
    Participant

    To 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 );

    #183636
    Iurie Malai
    Participant

    @simpleone,

    Can 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.

    CommonEasy
    Participant

    you 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/

    #183454
    SimpleOne
    Participant

    @commoneasy

    I 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' );
    #183453
    CommonEasy
    Participant

    Hi 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 πŸ™‚

Viewing 25 results - 1,226 through 1,250 (of 3,608 total)
Skip to toolbar