Title: Extra data
Last modified: March 6, 2018

---

# Extra data

 *  [jeremysmcknight](https://wordpress.org/support/users/jeremysmcknight/)
 * (@jeremysmcknight)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/extra-data-2/)
 * I was curious if there was a way to add other non-main leaders (<leaders>, group
   members (<participants>) and Custom Fields created in CCB (<user_defined_fields
   >) that I saw on the XML file from [https://mychurchname.ccbchurch.com/api.php?srv=group_profiles](https://mychurchname.ccbchurch.com/api.php?srv=group_profiles)
 * Does anyone have knowledge or point me to the right direction?

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Jared Cobb](https://wordpress.org/support/users/jaredcobb/)
 * (@jaredcobb)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/extra-data-2/#post-10042671)
 * Hi Jeremy,
 * Yes, you’re able to customize the “post mapping”. The post mapping is simply 
   a config that tells WordPress “This XML node goes to that post field”. The plugin
   has a filter that you can hook into in your theme or your own plugin like so:
 *     ```
       /**
        * Customize the post mappings from the CCB API XML nodes
        * to the ccb_core_group post type fields.
        *
        * @param array $post_type_maps A collection of all mappings currently in use
        *
        * @return array
        */
       function ccb_core_customize_group_fields( $post_type_maps ) {
       	if ( ! empty( $post_type_maps['ccb_core_group']['fields'] ) ) {
       		$post_type_maps['ccb_core_group']['fields']['user_defined_fields'] = 'post_meta';
       		$post_type_maps['ccb_core_group']['fields']['leaders'] = 'post_meta';
       		$post_type_maps['ccb_core_group']['fields']['membership_type'] = 'post_meta';
       	}
       	return $post_type_maps;
       }
       add_filter( 'ccb_core_synchronizer_post_api_map', 'ccb_core_customize_group_fields', 20, 1 );
       ```
   
 * The main thing to note is that the **name** of the XML node (for example `user_defined_fields`
   needs to be defined as a property of the `fields` array which is a property of
   the `ccb_core_group` array.
 * You can even override / remove some of the default mappings. For example, you
   can map something _else_ to the post content like so (instead of the description):
 *     ```
       // Override the post content with the calendar feed
       $post_type_maps['ccb_core_group']['fields']['calendar_feed'] = 'post_content';
       ```
   
 * The _value_ of the item you add can be any property that exists on a `WP_Post`
   object (like ‘post_title, ‘post_content’, etc) **or** can be ‘post_meta’ (which
   saves it as a custom field).
 * That `$post_types_maps` variable has many more configuration options in it (that
   you can customize with this filter). More info here: [https://github.com/jaredcobb/ccb-core/wiki/Custom-Post-Types#get_post_api_map-maps-](https://github.com/jaredcobb/ccb-core/wiki/Custom-Post-Types#get_post_api_map-maps-)
   on what that array contains.
    -  This reply was modified 8 years, 2 months ago by [Jared Cobb](https://wordpress.org/support/users/jaredcobb/).
 *  Plugin Author [Jared Cobb](https://wordpress.org/support/users/jaredcobb/)
 * (@jaredcobb)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/extra-data-2/#post-10042678)
 * I forgot to mention, if you alter the mappings, the plugin won’t be aware that
   your data needs to be synchronized again.
 * For example, it’s going to think that your Groups are “up to date” and it won’t
   try to fetch new data.
 * In a situation like this, you’ll need to delete all your Groups from WordPress
   and then synchronize back from CCB after you’ve made your changes.
 *  Thread Starter [jeremysmcknight](https://wordpress.org/support/users/jeremysmcknight/)
 * (@jeremysmcknight)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/extra-data-2/#post-10042777)
 * Thanks for the quick reply Jared. So the user defined fields seems to be somewhat
   working Let me try to explain.
 *     ```
       <user_defined_fields>
       <user_defined_field>
       <name>udf_2</name>
       <label>Type of Group</label>
       <selection id="1">Trailguide</selection>
       <admin_only>false</admin_only>
       </user_defined_field>
       <user_defined_field>
       <name>udf_3</name>
       <label>Kids?</label>
       <selection id="2">Adults Only</selection>
       <admin_only>false</admin_only>
       </user_defined_field>
       </user_defined_fields>
       ```
   
 * This is the information in my CCB XML. After installing the POST META INSPECTOR
   plugin I see user defined fields as this.
    `'a:1:{s:18:"user_defined_field";a:
   4:{s:4:"name";s:5:"udf_3";s:5:"label";s:5:"Kids?";s:9:"selection";s:11:"Adults
   Only";s:10:"admin_only";b:0;}}'`
 * I deleted the groups out and resync’d them like you suggested. The leaders and
   participants just show up blank but I’m assuming it is because there are multiple
   options like the user defined fields. Again I may be asking too much and it isn’t
   necessary for me to complete my mission but I was trying to add some sort of 
   display of who was in the group on my custom post type I created.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Extra data’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/church-community-builder-core-api_a6a5a5.
   svg)
 * [Church Community Builder Core API](https://wordpress.org/plugins/church-community-builder-core-api/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/church-community-builder-core-api/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/church-community-builder-core-api/)
 * [Active Topics](https://wordpress.org/support/plugin/church-community-builder-core-api/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/church-community-builder-core-api/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/church-community-builder-core-api/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [jeremysmcknight](https://wordpress.org/support/users/jeremysmcknight/)
 * Last activity: [8 years, 2 months ago](https://wordpress.org/support/topic/extra-data-2/#post-10042777)
 * Status: not a support question