Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
873 views
in Q2A Core by
Is there a way to prevent private messaging until a user reaches a certain points level?

1 Answer

+2 votes
by
selected by
 
Best answer

Core hack example. Add codes at L55 [Case of V1.6.2] 

File: qa-include/qa-page-message.php

Code:

$necessarypoint = 200;  // Exmaple of 200 points
if(qa_get_logged_in_points() < $necessarypoint) {
  $qa_content=qa_content_prepare();
  $qa_content['error'] = 'You must get '.$necessarypoint.' points to post messages.';
  return $qa_content;
}
by
Thanks really appreciate your time. I have this at line: 55 using notepad++

    if (!defined('QA_VERSION')) { // don't allow this page to be requested directly from browser

        header('Location: ../');
                <----- line 55
        exit;

    }

Is this where it should go as I tried it and nothing happened?
by
Do you not get wrong file to change?
Is the version of your Q2A 1.6.2?

    if (!isset($loginuserid)) {
        $qa_content=qa_content_prepare();
        $qa_content['error']=qa_insert_login_links(qa_lang_html('misc/message_must_login'), qa_request());
        return $qa_content;
    }

////////// Insert here! //////////

//    Find the user profile and questions and answers for this handle
   
    list($toaccount, $torecent, $fromrecent)=qa_db_select_with_pending(
        qa_db_user_account_selectspec($handle, false),
        qa_db_recent_messages_selectspec($loginuserid, true, $handle, false),
        qa_db_recent_messages_selectspec($handle, false, $loginuserid, true)
    );
by
I'm using 1.6.2

I have added the code below and set it to 1000 points, I have a test account with 400 points just tested and I was able to post a PM.
by
if (!isset($loginuserid)) {

        $qa_content=qa_content_prepare();

        $qa_content['error']=qa_insert_login_links(qa_lang_html('misc/message_must_login'), qa_request());

        return $qa_content;

    }
   
    $necessarypoint = 1000;  // Exmaple of 200 points
   
    if(qa_get_logged_in_points() < $necessarypoint) {
      $qa_content=qa_content_prepare();
      $qa_content['error'] = 'You must get '.$necessarypoint.' points to post messages.';
      return $qa_content;
    }

//    Find the user profile and questions and answers for this handle

   

    list($toaccount, $torecent, $fromrecent)=qa_db_select_with_pending(

        qa_db_user_account_selectspec($handle, false),

        qa_db_recent_messages_selectspec($loginuserid, true, $handle, false),

        qa_db_recent_messages_selectspec($handle, false, $loginuserid, true)

    );
by
never mind, got it working now, not sure what the problem was :) Thanks a ton sama55 for your time
...