Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
948 views
in Plugins by

I am trying to create one plugin to override some points calculation based on user role. I have tested with qa_db_points_calculations() function located in qa-db-points.php in someway and works fine but I want to create a plugin and want to know which would be the best way and how?

Shoudl I use plugin module or layer would works?

If module than how to implement? need some startup guidence. Other thing that function require qa-app-options.php so if I override in my plugin do I need to include that file as wel?

Q2A version: 1.5.3

2 Answers

+2 votes
by
 
Best answer

Okay found the solution. In case if anyone want to use it.

Create a plugin to ovreride the function using qa_register_plugin_overrides(). Make sure need to call two things into the plugin function file.

require_once QA_INCLUDE_DIR.'qa-app-options.php';

$options=qa_get_options(qa_db_points_option_names());

Otherwise it will reset all your points to zero and no event will update the points. I am not sure yet after implementing this plugin count will jump to some other value or it will starts from the same value.

Please let me know if you found some bug or better solution. We can try to solve it. But for me now it works as a plugin and may be I will finished with some additional optins and upload on Github so other can use.

 

IMPORTANT EDIT:

One important thing. By activate or deactivate this plugin will not recalculate the points but it starts from the point where its enabled or disabled.

0 votes
by
Do you charge anything for sellers?
by
You can start without any cost..  it's free now..
...