当前位置: 首页>>代码示例>>PHP>>正文


PHP BP_XProfile_Field::bp_xprofile_field方法代码示例

本文整理汇总了PHP中BP_XProfile_Field::bp_xprofile_field方法的典型用法代码示例。如果您正苦于以下问题:PHP BP_XProfile_Field::bp_xprofile_field方法的具体用法?PHP BP_XProfile_Field::bp_xprofile_field怎么用?PHP BP_XProfile_Field::bp_xprofile_field使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BP_XProfile_Field的用法示例。


在下文中一共展示了BP_XProfile_Field::bp_xprofile_field方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: prepare_buddypress_data

 public static function prepare_buddypress_data($user_id, $config, $entry)
 {
     // required for user to display in the directory
     if (function_exists('bp_update_user_last_activity')) {
         bp_update_user_last_activity($user_id);
     } else {
         bp_update_user_meta($user_id, 'last_activity', true);
     }
     $buddypress_meta = rgars($config, 'meta/buddypress_meta');
     if (empty($buddypress_meta)) {
         return;
     }
     self::log_debug(__METHOD__ . '(): starting.');
     $form = RGFormsModel::get_form_meta($entry['form_id']);
     $buddypress_row = array();
     $i = 0;
     foreach ($buddypress_meta as $meta_item) {
         if (empty($meta_item['meta_name']) || empty($meta_item['meta_value'])) {
             continue;
         }
         $buddypress_row[$i]['field_id'] = $meta_item['meta_name'];
         $buddypress_row[$i]['user_id'] = $user_id;
         // get GF and BP fields
         $gform_field = RGFormsModel::get_field($form, $meta_item['meta_value']);
         if (version_compare(BP_VERSION, '1.6', '<')) {
             $bp_field = new BP_XProfile_Field();
             $bp_field->bp_xprofile_field($meta_item['meta_name']);
         } else {
             require_once WP_PLUGIN_DIR . '/buddypress/bp-xprofile/bp-xprofile-classes.php';
             $bp_field = new BP_XProfile_Field($meta_item['meta_name']);
         }
         // if bp field is a checkbox AND gf field is a checkbox, get array of input values
         $input_type = RGFormsModel::get_input_type($gform_field);
         if (in_array($bp_field->type, array('checkbox', 'multiselectbox')) && in_array($input_type, array('checkbox', 'multiselect'))) {
             $meta_value = RGFormsModel::get_lead_field_value($entry, $gform_field);
             if (!is_array($meta_value)) {
                 $meta_value = explode(',', $meta_value);
             }
             $meta_value = self::maybe_get_category_name($gform_field, $meta_value);
             $meta_value = array_filter($meta_value, 'GFUser::not_empty');
         } else {
             if ($bp_field->type == 'datebox' && $gform_field['type'] == 'date') {
                 if (version_compare(BP_VERSION, '2.1.1', '<')) {
                     $meta_value = strtotime(self::get_prepared_value($gform_field, $meta_item['meta_value'], $entry));
                 } else {
                     $meta_value = self::get_prepared_value($gform_field, $meta_item['meta_value'], $entry) . ' 00:00:00';
                 }
             } else {
                 $meta_value = self::get_prepared_value($gform_field, $meta_item['meta_value'], $entry);
             }
         }
         self::log_debug(__METHOD__ . "(): Meta item: {$meta_item['meta_name']}. Value: {$meta_value}");
         $buddypress_row[$i]['value'] = $meta_value;
         $buddypress_row[$i]['last_update'] = date('Y-m-d H:i:s');
         $buddypress_row[$i]['field'] = $bp_field;
         $i++;
     }
     GFUserData::insert_buddypress_data($buddypress_row);
     self::log_debug(__METHOD__ . '(): finished.');
 }
开发者ID:Inteleck,项目名称:hwc,代码行数:60,代码来源:userregistration.php

示例2: prepare_buddypress_data

 public static function prepare_buddypress_data($user_id, $config, $entry)
 {
     // required for user to display in the directory
     bp_update_user_meta($user_id, 'last_activity', true);
     $buddypress_meta = rgars($config, 'meta/buddypress_meta');
     if (empty($buddypress_meta)) {
         return;
     }
     $form = RGFormsModel::get_form_meta($entry['form_id']);
     $buddypress_row = array();
     $i = 0;
     foreach ($buddypress_meta as $meta_item) {
         $buddypress_row[$i]['field_id'] = $meta_item['meta_name'];
         $buddypress_row[$i]['user_id'] = $user_id;
         // get GF and BP fields
         $gform_field = RGFormsModel::get_field($form, $meta_item['meta_value']);
         $bp_field = new BP_XProfile_Field();
         $bp_field->bp_xprofile_field($meta_item['meta_name']);
         // if bp field is a checkbox AND gf field is a checkbox, get array of input values
         if ($bp_field->type == 'checkbox' && $gform_field['type'] == 'checkbox') {
             $meta_value = RGFormsModel::get_lead_field_value($entry, $gform_field);
             $meta_value = array_filter($meta_value, 'GFUser::not_empty');
         } else {
             if ($bp_field->type == 'multiselectbox' && $gform_field['type'] == 'checkbox') {
                 $meta_value = RGFormsModel::get_lead_field_value($entry, $gform_field);
                 $meta_value = array_filter($meta_value, 'GFUser::not_empty');
             } else {
                 if ($bp_field->type == 'datebox' && $gform_field['type'] == 'date') {
                     $meta_value = strtotime(self::get_prepared_value($gform_field, $meta_item['meta_value'], $entry));
                 } else {
                     $meta_value = self::get_prepared_value($gform_field, $meta_item['meta_value'], $entry);
                 }
             }
         }
         $buddypress_row[$i]['value'] = xprofile_sanitize_data_value_before_save($meta_value, $meta_item['meta_name']);
         $buddypress_row[$i]['last_update'] = date('Y-m-d H:i:s');
         $i++;
     }
     GFUserData::insert_buddypress_data($buddypress_row);
 }
开发者ID:hscale,项目名称:webento,代码行数:40,代码来源:userregistration.php


注:本文中的BP_XProfile_Field::bp_xprofile_field方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。