Here is what I have working btw:
public function bp2wp_add_sync_options( $field ) {
global $wpdb;
$bp2wp_sync = false;
if ($field) {
$childs = $field->get_children();
if (isset($childs) && $childs && count($childs) > 0
&& is_object($childs[0]) && $childs[0]->type == 'bp2wp_sync') {
$bp2wp_sync = $childs[0]->name;
}
}
$wpfields = $wpdb->get_results( "SELECT DISTINCT meta_key FROM {$wpdb->usermeta} ORDER BY meta_key" );
?>
<div class="postbox">
<h2><?php _e( 'Sync to WordPress user field', 'bp2wp-full-sync' ); ?></h2>
<div class="inside">
<p class="description">
<?php _e( 'Please select the WordPress user meta you want to sync with this BuddyPress field.', 'bp2wp-full-sync' ); ?>
</p>
<p>
<label class="screen-reader-text" for="bp2wp_sync"><?php _e( 'Sync to WordPress user field', 'bp2wp-full-sync' ); ?></label>
<select name="bp2wp_sync" id="bp2wp_sync" style="width: 90%">
<option value="" <?php selected( $bp2wp_sync, '' ); ?>><?php _e( 'None', 'bp2wp-full-sync' ); ?></option>
<?php foreach( $wpfields as $wpfield ) { ?>
<option value="<?php echo $wpfield->meta_key; ?>"<?php selected( $bp2wp_sync, $wpfield->meta_key ); ?>><?php echo $wpfield->meta_key; ?></option>
<?php } ?>
</select>
</p>
</div>
</div>
<?php
}
-
This reply was modified 5 years, 4 months ago by Eric Nemchik.
-
This reply was modified 5 years, 4 months ago by Eric Nemchik.