| 1 |
# Uninstaller Feedback Form |
| 2 |
|
| 3 |
A reusable WordPress package that collects plugin deactivation feedback via a React-based form, stores it via REST API, and optionally logs feedback to a Google Sheet. |
| 4 |
|
| 5 |
--- |
| 6 |
|
| 7 |
## 📦 Features |
| 8 |
|
| 9 |
- React-based feedback form shown on plugin deactivation |
| 10 |
- Sends feedback via REST API |
| 11 |
- Automatically deactivates the plugin after feedback submission |
| 12 |
- Optionally logs feedback to Google Sheets |
| 13 |
- Easy to integrate into any WordPress plugin |
| 14 |
|
| 15 |
--- |
| 16 |
|
| 17 |
## 🛠 Installation |
| 18 |
|
| 19 |
1. **Require this package via Composer** |
| 20 |
|
| 21 |
Add the following configuration to your `composer.json`: |
| 22 |
|
| 23 |
```json |
| 24 |
{ |
| 25 |
"require": { |
| 26 |
"themewinter/uninstaller_form": "dev-main" |
| 27 |
}, |
| 28 |
"repositories": [ |
| 29 |
{ |
| 30 |
"type": "vcs", |
| 31 |
"url": "https://github.com/themewinter/uninstaller_form" |
| 32 |
} |
| 33 |
] |
| 34 |
} |
| 35 |
``` |
| 36 |
If you do not have, composer installed in your plugin, please install using |
| 37 |
|
| 38 |
```bash |
| 39 |
composer init |
| 40 |
``` |
| 41 |
|
| 42 |
2. **Update Dependencies** |
| 43 |
|
| 44 |
```bash |
| 45 |
composer update |
| 46 |
composer dump-autoload |
| 47 |
``` |
| 48 |
|
| 49 |
3. **On composer udate process if you are asked to give token, followings are the steps you can generate token** |
| 50 |
- Go to GitHub: https://github.com |
| 51 |
- Login to your account. |
| 52 |
- Navigate to Settings: |
| 53 |
- Click your profile picture (top right) → Settings |
| 54 |
- Access Developer Settings: |
| 55 |
- Scroll down in the left sidebar → Click Developer settings |
| 56 |
- Personal access tokens → Tokens (classic): |
| 57 |
- Click Personal access tokens, then choose Tokens (classic) |
| 58 |
- Click "Generate new token" → "Generate new token (classic)" |
| 59 |
- Set token details: |
| 60 |
- Note: Give your token a name (e.g., "Git CLI access") |
| 61 |
- Expiration: Choose an expiry time (e.g., 30 days or "No expiration") |
| 62 |
- Scopes: Select the permissions you need, for example: |
| 63 |
- repo (full control of private repositories) |
| 64 |
- workflow (for GitHub Actions) |
| 65 |
- read:org (if needed for organization access) |
| 66 |
- user (for profile info) |
| 67 |
- Click Generate Token |
| 68 |
- Copy the token immediately — it won't be shown again! |
| 69 |
|
| 70 |
## Configuration |
| 71 |
|
| 72 |
1. **In your plugin's main file, add this initialization code. Make sure this code will be executed after all of your scripts enqued successfully** |
| 73 |
|
| 74 |
```php |
| 75 |
if (file_exists(plugin_dir_path( __FILE__ ) . '/vendor/autoload.php')) { |
| 76 |
require_once plugin_dir_path( __FILE__ ) . '/vendor/autoload.php'; |
| 77 |
} |
| 78 |
|
| 79 |
if ( class_exists( 'UninstallerForm\UninstallerForm' ) ) { |
| 80 |
$uninstaller_form = new UninstallerForm\UninstallerForm(); |
| 81 |
$uninstaller_form->init( |
| 82 |
'Poptics', |
| 83 |
'poptics', |
| 84 |
__FILE__, |
| 85 |
'poptics', |
| 86 |
'poptics-script' |
| 87 |
); |
| 88 |
} |
| 89 |
``` |
| 90 |
|
| 91 |
## Feedback API Integration From NPM Package |
| 92 |
|
| 93 |
**Install the Feedback API NPM Package**: base_url/plugin_slug/v1/feedback |
| 94 |
|
| 95 |
**Example**: http://localhost/project/wp-json/wp-cafe/v1/feedback |
| 96 |
|
| 97 |
**Here**: |
| 98 |
|
| 99 |
base_url = http://localhost/project/wp-json |
| 100 |
|
| 101 |
plugin_slug = wp-cafe |
| 102 |
|
| 103 |
**API DOCUMENTATION**: https://documenter.getpostman.com/view/3522317/2sB2cbaeCQ |
| 104 |
|
| 105 |
## Google Sheets Integration Setup for contributors |
| 106 |
|
| 107 |
Follow the steps below to integrate your application with Google Sheets using a service account: |
| 108 |
|
| 109 |
### 1. Go to the [](https://console.cloud.google.com/Google Cloud Console](https://console.cloud.google.com/](https://console.cloud.google.com/) |
| 110 |
|
| 111 |
### 2. Create a New Project |
| 112 |
- Click on the project dropdown at the top. |
| 113 |
- Select **"New Project"**, then give it a name and create it. |
| 114 |
|
| 115 |
### 3. Enable the Google Sheets API |
| 116 |
- Go to **APIs & Services → Library**. |
| 117 |
- Search for **Google Sheets API**. |
| 118 |
- Click on it, then click **Enable**. |
| 119 |
|
| 120 |
### 4. Create a Service Account |
| 121 |
- Go to **IAM & Admin → Service Accounts**. |
| 122 |
- Click **Create Service Account**. |
| 123 |
- Provide a name and description, then click **Create and Continue**. |
| 124 |
- Assign a role (e.g., **Editor** or **Viewer** based on your needs). |
| 125 |
- Click **Done**. |
| 126 |
|
| 127 |
### 5. Create a New Key for the Service Account |
| 128 |
- Open the service account you just created. |
| 129 |
- Go to the **"Keys"** tab. |
| 130 |
- Click **"Add Key" → "Create New Key"**. |
| 131 |
- Select **JSON** as the key type. |
| 132 |
- Click **Create** – a `.json` file will be downloaded. |
| 133 |
|
| 134 |
### 6. Store the JSON Key Securely |
| 135 |
- Save the contents of the downloaded `.json` key file in: |
| 136 |
|
| 137 |
### 7. Create a New Google Sheet |
| 138 |
- Go to [](https://sheets.google.com/Google Sheets](https://sheets.google.com/](https://sheets.google.com/). |
| 139 |
- Create a new spreadsheet for your project. |
| 140 |
|
| 141 |
### 8. Share the Sheet with the Service Account |
| 142 |
- Open the spreadsheet and click **Share**. |
| 143 |
- Share it with the **service account email** (found in the JSON key file under `client_email`). |
| 144 |
- Grant **Editor** access. |
| 145 |
|
| 146 |
### 9. Add the Spreadsheet ID to Your Config |
| 147 |
- Copy the **Spreadsheet ID** from the URL: |
| 148 |
- Add it to: **config/google-sheet.php** |
| 149 |
|