Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+5 votes
413 views
in Q2A Core by
edited by

Over the last 3 years I got more and more experience in how to use advanced themes and plugins of question2answer. Thus many of my "solutions" through core hacks from 2012/2013 could be done with an advanced theme now.

However, there are still some hacks left that need to be done. This is the core hack list of June 2015, necessary for q2a v1.7.1:

 

All following files you find in the folder /qa-include/

1. ajax/answer.php (line 41)
    // q2apro hack: allow answers on closed questions, otherwise their content is lost
    // if ((@$question['basetype']=='Q') && (!isset($question['closedbyid'])) && !qa_user_post_permit_error('permit_post_a', $question, QA_LIMIT_ANSWERS)) {
    if ((@$question['basetype']=='Q') && !qa_user_post_permit_error('permit_post_a', $question, QA_LIMIT_ANSWERS)) {

2. app/mailing.php (line 130)
    // q2apro hack for html
    // 'body' => trim(qa_opt('mailing_body'))."\n\n\n".qa_lang('users/unsubscribe').' '.$unsubscribeurl,
    // 'html' => false,
    'body' => nl2br( trim(qa_opt('mailing_body'))."\n\n\n" ).' <span style="font-size:12px;color:#888">'.qa_lang('users/unsubscribe').' <a style="color:#888" href="'.$unsubscribeurl.'">Unsubscribe</a></span>',
    'html' => true,

3. db/selects.php (line 356)
    switch ($by) {
        case 'selchildid':
            // q2apro hack: do not show closed question in unanswered list - no selected answer
            // $bysql='selchildid IS NULL';
            $bysql='selchildid IS NULL AND closedbyid IS NULL';
            break;

        case 'amaxvote':
            // q2apro hack: do not show closed question in unanswered list - no upvoted answer
            // $bysql='amaxvote=0';
            $bysql='amaxvote=0 AND closedbyid IS NULL AND acount=0'; // eetv: only question without answer
            break;

        default:
            // q2apro hack: do not show closed question in unanswered list
            // $bysql='acount=0';
            $bysql='acount=0 AND closedbyid IS NULL';
            break;
    }

4. db/selects.php (line 701)
    // q2apro hack: added WHERE (^posts.closedbyid IS NULL)
    $selectspec['source'].=" JOIN (SELECT postid, SUM(score)+LOG(postid)/1000000 AS score FROM ((SELECT ^titlewords.postid, LOG(#/titlecount) AS score FROM ^titlewords JOIN ^words ON ^titlewords.wordid=^words.wordid JOIN ^titlewords AS source ON ^titlewords.wordid=source.wordid WHERE source.postid=# AND titlecount<#) UNION ALL (SELECT ^posttags.postid, 2*LOG(#/tagcount) AS score FROM ^posttags JOIN ^words ON ^posttags.wordid=^words.wordid JOIN ^posttags AS source ON ^posttags.wordid=source.wordid WHERE source.postid=# AND tagcount<#) UNION ALL (SELECT ^posts.postid, LOG(#/^categories.qcount) FROM ^posts JOIN ^categories ON ^posts.categoryid=^categories.categoryid AND ^posts.type='Q' WHERE ^categories.categoryid=(SELECT categoryid FROM ^posts WHERE postid=#) AND ^categories.qcount<#)) x WHERE postid!=# GROUP BY postid ORDER BY score DESC LIMIT #) y ON ^posts.postid=y.postid WHERE (^posts.closedbyid IS NULL)";

5. pages/account (line 55)
    // q2apro hack: disallow change of username
    // $changehandle=qa_opt('allow_change_usernames') || ((!$userpoints['qposts']) && (!$userpoints['aposts']) && (!$userpoints['cposts']));
    $changehandle=qa_opt('allow_change_usernames');

6. pages/activity.php (add after line 47)
    // q2apro hack: do not show notices like edit or reshown etc.
    $questions4 = array();

7. pages/question-view.php (add after line 122)
    // q2apro hack: do not show answer button if spam-limit exceeded (git-suggest)
    if(!qa_limits_remaining($userid, QA_LIMIT_ANSWERS)) {
        $rules['answerbutton']=false;
    }
    // see github https://github.com/q2a/question2answer/pull/255

8. plugins/qa-search-basic.php (from line 48)
    // q2apro hack: switch off q2a search to save db space, search taken over by google cse
    /*
    $contentwordidcounts=array();
    foreach ($contentcount as $word => $count)
        if (isset($wordtoid[$word]))
            $contentwordidcounts[$wordtoid[$word]]=$count;

    qa_db_contentwords_add_post_wordidcounts($postid, $type, $questionid, $contentwordidcounts);
    */

9. plugins/qa-search-basic.php (line 72)
    // q2apro hack: switch off to save db space, search taken over by google cse
    // qa_db_word_contentcount_update(array_keys($contentwordidcounts));

10. plugins/qa-widget-activity-count.php
    // see github https://github.com/q2a/question2answer/pull/257
   
11. 4 more core files
hacks from https://github.com/q2a/question2answer/pull/259

 

I really hope that gidgreen, Scott, pupi1985 .... can find solutions (I would be happy about admin options) to solve the hacks above. I have already pushed three solutions to the github repo.

Kai

 

Edit:

12. pages/user-answers.php
We really need to link the answers directly from the user's answers list. See my post here.

Q2A version: 1.7.1
by
Solved by override, thanks to Scott:

- pages/question-view.php (add after line 177) - code block for user permissions - see https://github.com/q2a/question2answer/issues/256

Please log in or register to answer this question.

...