Skip to content
This repository was archived by the owner on May 19, 2025. It is now read-only.

Error when set collaborator #37

Open
shrey2199 opened this issue Jul 10, 2021 · 1 comment
Open

Error when set collaborator #37

shrey2199 opened this issue Jul 10, 2021 · 1 comment

Comments

@shrey2199
Copy link

image
I get this error when a user is set in collaborator but in admin and editor it works fine

@joshp23
Copy link
Owner

joshp23 commented Dec 28, 2021

This seems to have a problem with

$where['sql'] = $where['sql'] . " AND (`user` = :user OR `user` IS NULL) ";

Your log is saying that the column user does not exist, and that column is referred to in the above code.

That column is added to the table on plugin activation

yourls_add_action('activated_plugin', 'amp_activated');
function amp_activated() {
global $ydb;
$table = YOURLS_DB_TABLE_URL;
$sql = "DESCRIBE `".$table."`";
$results = $ydb->fetchObjects($sql);
$activated = false;
foreach($results as $r) {
if($r->Field == 'user') {
$activated = true;
}
}
if(!$activated) {
if ($version) {
$sql = "ALTER TABLE `".$table."` ADD `user` VARCHAR(255) NULL";
$insert = $ydb->fetchAffected($sql);
} else {
$ydb->query("ALTER TABLE `".$table."` ADD `user` VARCHAR(255) NULL");
}
}
}

Check to see if the user column exists in your table and if not, try disabling and re-enabling the plugin. IF it still doesn't exist, add it manually if you must, but error logs are helpful as well.

If the user column is there when you check, I'm really not sure what the problem is, as I cannot reproduce the problem.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants