Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants