fix: plugin working on clean installation #58
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The issue of creating Enrollment Requests during a clean installation of WordPress and plugin installation was attributed to caching problems and checks when creating the table that holds vital request information in the WordPress database. After further investigation, the following errors were resolved:
Misuse of $logs_table Variable: We identified an error where the variable
$logs_table
, obtained from thewp_cache_get()
function, was incorrectly being used as the table name. This approach is flawed because the function does not return the table name. Using$logs_table
for creating the table and conducting existence checks resulted in SQL errors.Incorrect Variable Usage: When the table was not found in the cache, SQL was employed to verify its existence in the database using 'SHOW TABLES LIKE.' Unfortunately, an error was made by using the variable
$logs_table
instead of the actual table name in the database.Table Creation Error: In the
CREATE TABLE
statement, we were using the variable$logs_table
, which did not contain the correct table name to be created. To rectify this, we introduced the variable$logs_table_name
, which combines the WordPress prefix and the table name.This commit addresses these issues and improves the overall code reliability.
Testing instructions
To perform testing, you should bring the code from this branch to your local environment, run the 'composer install' command to fetch the libraries, and carry out a clean WordPress installation. Once you have a clean WordPress setup, use a .zip file containing the code we have in your local environment and install the plugin. Finally, verify its proper functionality.
Checklist for Merge