Domains Research and Blog
Fall 2020 and Winter Break 2021 Work
Fall 2020 and Winter Break 2021 Work

Fall 2020 and Winter Break 2021 Work

During the fall of the 2020 school year and into winter break of 2021 I had the opportunity to work with Taylor Jadin on the Knight Domains archival process of old accounts. This process was broken up into a few parts:

  • Comparing registered Knight Domains accounts with alumni holding accounts
  • Writing PHP scripts/programs to put the alumni accounts into an email group in WHMCS
  • Sending out a mass email in WHMCS 

To find alumni who had Knight Domains accounts we ended up referencing a list of recent graduates from the registrar’s office and a database report of Knight Domains users using Google Sheets. This was challenging at first because I had never used Google Sheets formulas before.  Ultimately through the formula below we were able to find the matches and produce a list.

Google Sheets Formula

After we had a list of names and emails the next step was to write a PHP program that would take the emails and put them into an email group in WHMCS. This was also challenging since neither Taylor nor I had lots of experience with PHP.  Our goal was to use the terminal on the Knight Domains control panel to:

  • run a script that would connect to WHMCS
  • Reference each line on the  “emails.txt” file holding the alumni emails
  • Find the corresponding client ID number for each email address
    • Call the API and update a client’s/alumni’s assigned email group

Thankfully, WHMCS had some documentation to get us started. We were able to modify the given example code below to access both Knight Domains and WHMCS information.

whmcs_callAPI
WHMCS sample code that accesses the API using CURL

After the API was called, the data was then decoded and dumped. This allowed us to then to update the “post values” of a client. In this case, we were specifically updating the group id of a client. The WHMCS email group we wanted to put alumni in was “Winter 2020 group” which had a corresponding group id of 2. 

Updating group id numbers

Running the PHP program in terminal put all of our alumni accounts in WHCMS into the Winter 2020 Archive group. From there, the last thing to do was create an email template in WHMCS and send it out. Below is the template and WHMCS and an example email of what alumni recieved.

Archive template
Recipient Email

Leave a Reply

Your email address will not be published. Required fields are marked *

css.php