Advertisement
dalbeck

Buddypress attempt to display checkbox data 1

Dec 28th, 2012
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.15 KB | None | 0 0
  1.                 <?php
  2.                     function dojo_profile_checks($field_ids, $id = null)
  3.                         {
  4.                             global $wpdb;
  5.                             global $current_user;
  6.                             /**/
  7.                             $field_ids = (array)$field_ids;
  8.                             /**/
  9.                             if($id === NULL)
  10.                                 $id = $current_user->ID;
  11.                             /**/
  12.                             $values = array();
  13.                             /**/
  14.                             $sel_fields = get_user_meta($id, $wpdb->prefix.'bp_profile_field_data', true);
  15.                             $all_fields = bp_profile_field_data();
  16.                             /**/
  17.                             foreach($field_ids as $f):
  18.                                 $pos = $all_fields[$f]['config']['options'];
  19.                                 $sel = $sel_fields[$f];
  20.                                 $values[$f] = array();
  21.                                 /**/
  22.                                 $pos = explode("\n", $pos);
  23.                                 foreach($pos as $key => $str)
  24.                                     {
  25.                                         $str = explode('|', $str);
  26.                                         $pos[$str[0]] = $str[1];
  27.                                         unset($pos[$key]);
  28.                                     }
  29.                                 /**/
  30.                                 foreach($sel as $sf)
  31.                                     {
  32.                                         if($pos[$sf] !== NULL)
  33.                                             $values[$f][$sf] = $pos[$sf];
  34.                                     }
  35.                             endforeach;
  36.                             /**/
  37.                             return $values;
  38.                         }
  39.                             $fields = dojo_profile_checks('profile_experience', $thisauthor->ID);
  40.                             var_dump($fields['profile_experience']);
  41.                 ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement