Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+5 votes
3.0k views
in Q2A Core by
I've looked everywhere (I think) but I nor my users can find a delete button... Is this a known issue?

1 Answer

+6 votes
by
selected by
 
Best answer

It is great that people use the v1.7 alpha code. The delete button has been added on July 23rd, so I guess you've downloaded the 1.7 version before that day. Most likely, if you download the latest code you should see the button: https://github.com/q2a/question2answer/archive/dev.zip

Also bear in mind that an index was created and then removed: https://github.com/q2a/question2answer/commit/cde60dbb2f90ee048a0855353c50ba30ee36e781 which means you should drop the previously created index:

DROP INDEX fromhidden on qa_messages
 
And then recreate it:
 
ALTER TABLE qa_messages ADD KEY fromhidden (fromhidden), ADD KEY tohidden (tohidden)
 
Note this would only apply to you if you've downloaded the code betwen May 16th and July 23rd. If you don't remember when you've download then run those SQL statements only if you have this exact line in your qa-db-install.php:
 
qa_db_upgrade_query('ALTER TABLE ^messages ADD KEY fromhidden (fromhidden, tohidden)');
 
EDIT:
 
Extending my answer on how to fix this the easy way:
 
For those who are caught in this same situation these are some steps to get this fixed.
 
1. Open qa-page-admin-categories.php
 
2. Locate line:
require_once QA_INCLUDE_DIR.'qa-db-admin.php';
 
3. After it copy and paste the following code (gist here)
 
$query = "SHOW INDEX FROM ^messages WHERE key_name = 'tohidden'";
$result = qa_db_read_one_value(qa_db_query_sub($query), true);
$shouldRun = !isset($result) && qa_opt('db_version') == 57;
if ($shouldRun) {
    echo "Running the update...<br>";
    qa_db_query_sub('DROP INDEX fromhidden on ^messages');
    qa_db_query_sub('ALTER TABLE ^messages ADD KEY fromhidden (fromhidden), ADD KEY tohidden (tohidden)');
    echo "Update done!!<br>";
} else {
    echo "You should not run the update. Remove the text from the file.<br>";
}
 
4. Navigate to the admin/categories section: http://yoursite.com/admin/categories
 
5. You should see some text above stating whether the update has run or whether it is not necessary for it to be run
 
6. If it has run, then refresh the page to make sure it will not run again (the text will state it is not necessary to run it)
 
7. Remove all the lines you've added and forget about this :)

 

by
It is weird that you couldn't delete the messages after that; I was in the same situation as you and it perfectly worked for me. Actually, the DB update has nothing to do with being able to delete posts or not... maybe you haven't updated all files when replacing the files with most up-to-date version. Hard to tell.

Well, I don't really know the WHY of things, I just know the WHAT by looking at the code. You are right: in order to fully delete a message from the database you have to delete it from both inboxes (the from and the to). Actually, the first one in deleting it just hides it from their own inbox, rather than deleting it, so that the one who still hasn't deleted it yet is still able to see it. Once that other user deletes the message it gets actually deleted from the database.

Now, I think it makes sense. I mean, I understand you'd like it to be simpler, something like: the first user in deleting the message actually deletes it from the DB. The issue with this approach is that the first user in deleting the message is "controlling" the other users' inbox by deleting a message there. It is like sending an email to a user, then regretting, deleting the message from your sent items, and then expecting it to be deleted from the recipient's inbox. If this was a democracy, I would vote for this to be the way it is right now :)

By the way, it has nothing to do with the hosting service, this is by design. Anyway, I don't know if core developers will make changes to this in the future. If you have a better approach you could post it to the v1.7 requests... but with 100 answers I hardly believe it will be herd :(
by
Paragraph one of yours aside. 2 and 3 make sense the way you've explained it and so. I/we have got as good as can be expected re; the PMing facility. And in the end, it was thanks to the version link you provided and so I'm grateful to you for that.

Re; your closing paragraph. I didn't really think the hosting service was a likely cause for concern but on the basis of 'But what do I know' I supplied the info.

As to adding to v1.7 requests? I think it prudent to pass on that one... But I appreciate you mentioning it.

Thanks again for your help.
by
hello, i use 1.6.3 and i just download the qa-dev files. How do i update my database and files to this 1.7? So it can work smoothly with problem.

Please some help.
by
This post is not exactly related to how to upgrade from 1.6.3 to 1.7alpha1 but rather about an issue that very few users could have encountered when upgrading. If you are upgrading now, you won't fall in this situation. Btw, upgrade process is the same as always http://www.question2answer.org/install.php . If you have further questions then ask them in a different thread. Thanks
...