Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 10 replies - 1 through 10 (of 10 total)

  • maccast
    Participant

    @maccast

    Good point @henrywright. In our case it may not matter too much since for us this is only so we see a name in the admin interface. On the front end we are only using the xprofile name. Still is there possibly another hook that I could tie into that runs on user profile update?


    maccast
    Participant

    @maccast

    I was dealing with this problem too. It might not be exactly what you’re looking for, but in my case I just decided to hook into the BP signup, extract the full name, split it at the first space and then update the WordPress ‘first_name’ and ‘last_name’ user metadata fields with the results.

    Here is the code you can add to your functions.php or custom plug-in:

    // define the bp_core_signup_user callback 
    function ac_bp_core_signup_user( $user_id ) { 
        // make action magic happen here...
        $fullname = bp_get_member_profile_data( array( 'field' => 'Name', 'user_id' => $user_id ) );
       //split the full name at the first space
       $name_parts = explode(" ", $fullname, 2);
    
       //set the firstname and lastname for WordPress based on the BP name
       //firstname
       if( isset($name_parts[0]) )
            update_user_meta( $user_id, 'first_name', $name_parts[0] );
    
       //lastname
       if( isset($name_parts[1]) )
           update_user_meta( $user_id, 'last_name', $name_parts[1] );
    
       //not needed for an action, but I always like to return something
       return $fullname;
    }
    
    // BuddyPress save first name last name to WP profile on signup 
    add_action( 'bp_core_signup_user', 'ac_bp_core_signup_user', 10, 1 );

    maccast
    Participant

    @maccast

    Just circling back to say this worked like a charm. I wrote a series of functions and added it to a custom plug-in to get it all to work. I’ll try at some point to separate this into a simple stand-alone plugin and try to share it in case someone else needs this feature.


    maccast
    Participant

    @maccast

    That could work. Thanks


    maccast
    Participant

    @maccast

    I guess one way would be to only show our “default” choices as an option is they have not uploaded or deleted their custom uploaded cover photo.


    maccast
    Participant

    @maccast

    Thanks @shanebp. Yes for sure we would want to avoid the scenario where we are “re-uploading” the default choosen image for each user. I guess I was sort of hoping there was a way in the uploader to just offer them to choose images from our custom library. Sort of like when you use the WordPress media uploader and can choose to pick from the library limiting it to “uploaded to this post”. Overloading the template and using our own custom image picker will work fine. By it being stored in another custom user meta data field it does add some complexity in figuring out how to decide which cover image to use. Meaning that if they upload an image and have also chosen one of our images I need to decide which image takes priority. I’m not sure how I’d do that since meta data fields don;t maintain an “updated” timestamp.


    maccast
    Participant

    @maccast

    This works and hides the button, but I’m curious. Can someone still send a private message to another user when they are “not” friends using URL manipulation or should the _wpnonce stop that?


    maccast
    Participant

    @maccast

    Just so this is complete. Here’s the code updated for BuddyPress 2.6 or later.

    
    function add_settings_subnav_tab() {
    
        //reorder messages tabs
        buddypress()->members->nav->edit_nav( array(
            'position' => 10,
        ), 'compose', 'messages' );
    
        buddypress()->members->nav->edit_nav( array(
            'position' => 11,
        ), 'inbox', 'messages' );
    
        buddypress()->members->nav->edit_nav( array(
            'position' => 12,
        ), 'sentbox', 'messages' );
    
         buddypress()->members->nav->edit_nav( array(
            'position' => 20,
        ), 'starred', 'messages' );
    
    }
     
    add_action( 'bp_setup_nav', 'add_settings_subnav_tab', 100 );
    

    maccast
    Participant

    @maccast

    Oh, sorry. I totally missed that. We’ll guess this still works for older versions. Thanks.


    maccast
    Participant

    @maccast

    Did a ticket get opened for this because I’m seeing a similar, possibly related bug. Basically I’m seeing bp_get_loggedin_user_nav() return the correct menu item, but the messages, notification, and friends counts that are displayed are for the “displayed” user.

Viewing 10 replies - 1 through 10 (of 10 total)
Skip to toolbar