It’s a new week, new year and time for a new CCB Tutorial. I hope and pray that each of you have had a blessed Christmas and Holiday spent with family and friends.
But as time off comes to an end, it’s time to settle back into the groove of family and work in the year.
In this week’s edition, I’ll ease you back into tutorials sharing and learning how to retrieve custom field labels defined in Church Community Builder system (CCB).
To retrieve custom field labels using CCB’s Public Web API tool, we’ll use the custom_field_labels API service.
Today’s tutorial is straight forward and simple in nature. I did this to help you ease back into the New Year. You can thank me later. 🙂
Nevertheless, the code below produces a list of custom field labels as defined in CCB.
// contains resusable globals and functions
$apiService = 'custom_field_labels'; // CCB api service
$urlData = array_filter( array(
'srv' => "$apiService"
$rss = ccbDetails('get',$urlData); // transform to XML
$nodes = $rss->xpath('//custom_fields/custom_field'); // xpath for custom_fields/custom_field
$response_object = '<h2>Custom Label Fields</h2>';
foreach ($nodes as $node)
$response_object .= 'Name: '.$node->name.' | Label: '.$node->name.'<br>'; // now print the item name and it (See CCB API documentation for more $apiService fields)
Your custom field labels are likely to be different from the ones illustrated in this tutorial.
To learn more about the custom_field_labels API service, please refer to CCB Documentation.
All in all, when you execute the code above via a web browser, the following should be displayed (but using your CCB account’s specific custom field labels):
The code displays the name and label for each respective custom field label. In this tutorial, our church has not set custom field labels; therefore, executing this code returns the default name and label for each respective custom field label in our respective CCB account.
And that’s all it takes to use CCB’s API to retrieve custom field labels. Just that easy!
Please don’t hesitate to leave questions or comments should anything not make sense or you encounter technical issues.
I hope you finished 2017 strong, and have turned the corner in 2018 ready to raise the bar higher and achieve greater accomplishments than the last season.
Happy New Year and God’s Blessing Be Upon You and Yours!