Developers

API

Commentics has a built-in API module for updating and deleting users. In your admin area, go to 'Extensions -> Modules' to set it up. Then, to call the API, send a POST request using cURL. Examples are below.

Update User

                        <?php
                        $url = 'https://your-domain.com/comments/frontend/index.php?route=module/api';
                         
                        $data = [
                            'api_key'   => 'ENTER-YOUR-API-KEY-HERE',
                            'action'    => 'update_user',
                            'old_email' => '[email protected]',
                            'new_email' => '[email protected]',
                            'new_name'  => 'New Name Here'
                        ];
                         
                        $ch = curl_init($url);
                         
                        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
                        curl_setopt($ch, CURLOPT_POST, true);
                        curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
                        curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
                         
                        $response = curl_exec($ch);
                         
                        if (curl_errno($ch)) {
                            echo 'cURL error: ' . curl_error($ch);
                        } else {
                            echo 'Response: ' . $response;
                        }
                         
                    

Delete User

                        <?php
                        $url = 'https://your-domain.com/comments/frontend/index.php?route=module/api';
                         
                        $data = [
                            'api_key' => 'ENTER-YOUR-API-KEY-HERE',
                            'action'  => 'delete_user',
                            'email'   => '[email protected]',
                        ];
                         
                        $ch = curl_init($url);
                         
                        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
                        curl_setopt($ch, CURLOPT_POST, true);
                        curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
                        curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
                         
                        $response = curl_exec($ch);
                         
                        if (curl_errno($ch)) {
                            echo 'cURL error: ' . curl_error($ch);
                        } else {
                            echo 'Response: ' . $response;
                        }
                         
                    

Logging

If you enable logging, the log file will be located here:

/comments/system/logs/api.log