Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function dojo_profile_checks($field_ids, $id = null)
- {
- global $wpdb;
- global $current_user;
- /**/
- $field_ids = (array)$field_ids;
- /**/
- if($id === NULL)
- $id = $current_user->ID;
- /**/
- $values = array();
- /**/
- $sel_fields = get_user_meta($id, $wpdb->prefix.'bp_profile_field_data', true);
- $all_fields = bp_profile_field_data();
- /**/
- foreach($field_ids as $f):
- $pos = $all_fields[$f]['config']['options'];
- $sel = $sel_fields[$f];
- $values[$f] = array();
- /**/
- $pos = explode("\n", $pos);
- foreach($pos as $key => $str)
- {
- $str = explode('|', $str);
- $pos[$str[0]] = $str[1];
- unset($pos[$key]);
- }
- /**/
- foreach($sel as $sf)
- {
- if($pos[$sf] !== NULL)
- $values[$f][$sf] = $pos[$sf];
- }
- endforeach;
- /**/
- return $values;
- }
- $fields = dojo_profile_checks('profile_experience', $thisauthor->ID);
- var_dump($fields['profile_experience']);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement