Skip to:
Content
Pages
Categories
Search
Top
Bottom

Updating buddypress details


  • kiekers
    Participant

    @kiekers

    Hi everyone, I hope that you can help me.

    I need a way of updating all buddypress xProfile fields with the current values that they have (no info have changed), I know this sounds insane, but I have added custom taxonomy terms as a field, which were saved at the time, but now have changed values (as in <option value=”55″…” was changed to <option value=”text_goes_here…”). Is there a way to re-save all fields programmatically instead of going to each individual profile manually in the backend and resaving? As mentioned, no changes was made to the info, just changes to the code/structure.

Viewing 1 replies (of 1 total)

  • kiekers
    Participant

    @kiekers

    Something along the line of this will work. Just posting the solution here in case someone is also looking for this. I am unsure about what the parameter for page size is, so you might just want to look that up.

    function update_db_users()
    {
    	 if ( bp_has_members('page_size=1000') ) :
        while ( bp_members() ) : bp_the_member(); 
        
       
     
        $some_field = xprofile_get_field_data( 'some field', bp_get_member_user_id() );
        if ( $some_field != '66' )
            {
    	     xprofile_set_field_data( 'Registration Type', bp_get_member_user_id(), 'new value', $is_required = false )   
            }
        
           
             endwhile;
        endif;
    }
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar