Accessing and Displaying Group Profiles By ID

In today’s tutorial, I’m sharing with you how to access and display group profiles by id.

Not to be confused with the group_profiles API service — which allows you to pass in a given date and have all groups created or modified since that date returned to you, today’s tutorial will access group_profiles_from_id API service.

So instead of focusing on returning ALL group profiles, we’ll focus on accessing and displaying a specific group by its group id (as shown below).


That stated, let’s get started with today’s tutorial. 

One of the first actions to take is opening a text editor of your choice, and naming and saving the following php file: group-profile-id.php.

Setting of Variables and Include Files

As with previous tutorials, be sure to include the config.php file and the appropriate comments.

Next, it’s time to define the following required parameters for the group_profiles_from_id API service:

  • apiService – value equals group_profile_from_id
  • groupId – value is equal to the specific group id
  • imageLink – value is false by default, but set the value equal to true for this tutorial

Once required variables are defined, each variable must be bound to its respective label as defined by CCB’s API Documentation for group_profiles_from_id.

Set binded variables and labels within a filtered array via the urlData variable.

Once urlData variable is appropriately defined, the ccbDetails function can be instantiated by passing get as the first argument and the urlData as the second argument.

The ccbDetails function does the heavy lifting to authenticate, authorize, access, and retrieve data from the CCB system.

Once the response is successfully returned as defined by the rss variable, create a nodes variable and set it equal to the rss variable.

The rss variable uses a reference or pointer to parse the response data using the following expression in conjunction to PHP’s XPATH query method: //groups/group.

Now that the response data has been accessed and parse for the specific group id, it’s time to access each data point for display to the web browser.

To do so, create an empty response_object variable and then create a foreach statement to iterate the nodes variable.

Within the foreach statement, the following data points for the specific group id can be accessed and concatenated using HTML tags via the response_object variable:

Once the aforementioned data points have been defined with the foreach statement, don’t forget the close the foreach statement and echo the response_object as the last step before saving.

Guess What Time It Is?

Yes, it’s time to test your technical prowess. Below is the code in it’s entirety. Be sure to save the file before opening it via a web browser.

Barring any technical errors, the following or something similar should be displayed via the web browser:


In closing, this tutorial should help you unlock the door to displaying group info via your website or church app (hint, hint). 😉

I’m signing off now, but let me know if you have questions or encounter any technical challenges.

Please comment if this tutorial has helped you.