BuddyDev

Search

[Resolved] multi bp_xprofile_data table and use any of them based on condition

  • Participant
    Level: Initiated
    Posts: 14
    Abhist on #43583

    i am aware that bp_xprofile_data table name define by code written below

     class BP_XProfile_Component extends BP_Component {
    public function setup_globals( $args = array() ) 
    
    		$global_tables = array(
    			'table_name_data'   => $bp->table_prefix . 'bp_xprofile_data',
    			'table_name_groups' => $bp->table_prefix . 'bp_xprofile_groups',
    			'table_name_fields' => $bp->table_prefix . 'bp_xprofile_fields',
    			'table_name_meta'   => $bp->table_prefix . 'bp_xprofile_meta',
    		);

    i want to make multi langunage bp_xprofile_data table line bp_xprofile_data_hi or bp_xprofile_data_ur
    and at a time any one of table will responsible to privde xprofile field value base on user setted coddition like language or location …

  • Participant
    Level: Initiated
    Posts: 14
    Abhist on #43584

    i want to make multi langunage bp_xprofile_data table “like” bp_xprofile_data_hi or bp_xprofile_data_ur

  • Keymaster
    (BuddyDev Team)
    Posts: 24231
    Brajesh Singh on #43598

    Hi Abhist,
    Welcome to BuddyDev support forums.

    This is not a good way to achieve it as it might cause complications where the tables might have been used directly(instead of using the table name on BP object).

    Still, if you know how to find the language code, you can adapt the following code to modify tables

    
    add_filter( 'bp_xprofile_global_tables', function( $tables ) {
    
    	//$tables['table_name_data']  =  'my table name';
    	//$tables['table_name_groups']  =  'my table name';
    	//$tables['table_name_fields']  =  'my table name';
    	//$tables['table_name_meta']  =  'my table name';
    
    	// feel free to modify it here.
    	return $tables;
    });
    
    

    Please put this code in your wp-content/plugins/bp-custom.php and add the login to change your table name based on language conditions.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 14
    Abhist on #43659

    Thank You So much

  • Keymaster
    (BuddyDev Team)
    Posts: 24231
    Brajesh Singh on #43671

    You are welcome.

The topic ‘ [Resolved] multi bp_xprofile_data table and use any of them based on condition’ is closed to new replies.

This topic is: resolved