bpxpt_translate_xprofile_groups

The BuddyPress Extended Profile Translation bpxpt translate xprofile groups function.

Description

bpxpt_translate_xprofile_groups( $groups ); 

Parameters (1)

0. $groups
The groups.

Usage

  1. if ( !function_exists( 'bpxpt_translate_xprofile_groups' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress-extended-profile-translation/buddypress-extended-profile-translation.php'; 
  3.  
  4. // The groups. 
  5. $groups = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bpxpt_translate_xprofile_groups($groups); 
  9.  

Defined (1)

The function is defined in the following location(s).

/buddypress-extended-profile-translation.php  
  1. function bpxpt_translate_xprofile_groups( $groups ) { 
  2.  
  3. // leave them in default language in admin screen, no matter the currently active locale 
  4. if ( is_admin() ) { 
  5. return $groups; 
  6.  
  7. $option = get_option( 'bpxpt_xprofile_data' ); 
  8. if ( $option === false ) { 
  9. return $groups; 
  10.  
  11. $locale = get_locale(); 
  12.  
  13. foreach ( $groups as $group ) { 
  14. if ( isset( $option[$group->id][0][0]['name'] ) ) { 
  15. $group->name = $option[$group->id][0][0]['name']; 
  16. if ( isset( $option[$group->id][0][0]['dsc'] ) ) { 
  17. $group->description = $option[$group->id][0][0]['dsc']; 
  18. foreach ( $group->fields as $field ) { 
  19. if ( isset( $option[$group->id][$field->id][0] ) ) { 
  20. $field->name = $option[$group->id][$field->id][0]['name']; 
  21. if ( isset( $option[$group->id][$field->id][0]['dsc'] ) ) { 
  22. $field->description = $option[$group->id][$field->id][0]['dsc']; 
  23.  
  24. return $groups;