Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
236 views
in Plugins by

Please refer this question http://www.question2answer.org/qa/20321/best-way-to-override-qa_db_points_calculations-function

Based on this question I am creating a plugin for allowing additional setup for Admin point system. Calculation for Admin role itself works fine. Example: If I want to multiply by 2 it just works fine but when I re calculating the points its double the Basic users piont for the tilme till they do some action which adds the point. Once they do than all points go back to the original calculation. 4 hours I tried to understand but nothing happening.

In fact I tried to add additional input form for Admin Points that also not working. I am trying to do by something below code

 

if( qa_get_logged_in_level() > QA_USER_LEVEL_MODERATOR ) 
{        
return array(
 
'aposts' => array(
'multiple' => $options['points_multiple']*$options['points_post_a']*2, // here I am multiplying by 2
'formula' => "COUNT(*) AS aposts FROM ^posts AS userid_src WHERE userid~ AND type='A'",
),
 
//.......... continue .........
 
);
 
} else { // rest of the user role it shuld calculate with default point system
return array(
'qposts' => array(
'multiple' => $options['points_multiple']*$options['points_post_q'],
'formula' => "COUNT(*) AS qposts FROM ^posts AS userid_src WHERE userid~ AND type='Q'",
),
 
'aposts' => array(
'multiple' => $options['points_multiple']*$options['points_post_a'],
'formula' => "COUNT(*) AS aposts FROM ^posts AS userid_src WHERE userid~ AND type='A'",
),
//.......... continue .........
);
}

Please log in or register to answer this question.

...