I’m back, and what a fast two weeks this has been. I thought I would have had a few cycles over the last two weeks to produce a tutorial, yet that certainly wasn’t the case.
Nevertheless, I traveled to Las Vegas for a conference while playing catch up with a number of projects.
Now that I’m caught up on other projects, I can now catch up with CCB Tutorials.
Today’s tutorial stems from an email I received and focuses on setting a person’s Church Community Builder (CCB) login credentials.
You may be wondering why anyone would ever need to use the CCB API to set the login credentials for a individual’s profile.
One thought that comes to mind are 3rd Party Web or Mobile App using CCB Login Credentials. In most cases, a user is required to register and login to an app to gain access.
A well-thought out and planned user experience should also provide for a forgot password option allowing users to reset their credentials.
One way would be to email your church technical staff or person, but that’s a “snail mail” approach when a user could easily enter their new password from their device to gain access to the app.
To offer a self-service option for setting credentials, whether by user or simply integrating CCB with 3rd party applications that set credentials, you’ll likely find today’s tutorial just what the doctor ordered.
To set credentials for a person’s CCB profile using CCB’s API, use the following CCB API service: set_individual_credentials.
To successfully execute a set_individual_credentials API service call, you’ll need to define the following variables:
- id
- username
- password
Refer to CCB API Documentation should you have additional questions about required/optional parameters, and overall API attributes pertaining to the set_individual_credentials API service.
Another detail to pay close attention to is that the set_individual_credentials API service uses POST and NOT GET. This is mission-critical to successfully making a set_individual_credentials API service call.
Outside of this one glaring difference and consideration, the tutorial in and of itself operates much like a tutorial making GET API request.
The final item to note is whether or not the person’s credentials have been successfully set.
The attribute to pay close attention to is the success element ($node->success), returning true if credentials are successfully set and false if not set.
And there you have it! You, my friend, can now use the CCB API to set a person’s login credentials. Save the code, and modify and integrate to your own liking.
Let me know if you have questions or encounter any technical difficulties I could assist with. Thanks and see you back here next week. 😉
<?PHP // contains resusable globals and functions include("includes/config.php"); $apiService = 'set_individual_credentials'; // CCB api service $id = '3224' $username = 'jdoe'; $password = 'c0nt@1n5'; $urlData = array_filter( array( 'srv' => "$apiService", 'id' => "$id", 'username' => "$username", 'password' => "$password" ) ); $rss = ccbDetails('post',$urlData); // transform to XML $nodes = $rss->xpath('//individuals/indivdual'); // xpath for individuals/individual $response_object = ''; foreach ($nodes as $node) { // now print the position name and description // (See CCB API documentation for more $apiService fields) $response_object .= '<p>'.$node->name.' ('.$node->login.'): '.$node->success.'</p>'; } echo $response_object; ?>