Title: Adding the score trough api or code?
Last modified: February 26, 2025

---

# Adding the score trough api or code?

 *  [pixelhouse18](https://wordpress.org/support/users/pixelhouse18/)
 * (@pixelhouse18)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/adding-the-score-trough-api-or-code/)
 * i’m trying to hook a live score api to your plugin, and would like to update 
   the score automatically when a match is finished. And calculate the points?
 * is there a way we can do that trough code?
 * thanks in advance!
    -  This topic was modified 1 year, 3 months ago by [pixelhouse18](https://wordpress.org/support/users/pixelhouse18/).

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [AntoineH](https://wordpress.org/support/users/antoineh/)
 * (@antoineh)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/adding-the-score-trough-api-or-code/#post-18331303)
 * You should be able to call the following to start a calculation:
 *     ```wp-block-code
       Football_Pool_Admin::update_score_history( 'force' );
       ```
   
 *  Thread Starter [pixelhouse18](https://wordpress.org/support/users/pixelhouse18/)
 * (@pixelhouse18)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/adding-the-score-trough-api-or-code/#post-18331444)
 * [@antoineh](https://wordpress.org/support/users/antoineh/)
 * Thanks for the force refresh code, is there perhaps a same option for updating/
   adding scores from a certain match?
 * Thanks in advance man
    -  This reply was modified 1 year, 3 months ago by [pixelhouse18](https://wordpress.org/support/users/pixelhouse18/).
    -  This reply was modified 1 year, 3 months ago by [pixelhouse18](https://wordpress.org/support/users/pixelhouse18/).
 *  Plugin Author [AntoineH](https://wordpress.org/support/users/antoineh/)
 * (@antoineh)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/adding-the-score-trough-api-or-code/#post-18331742)
 * I gave it another thought, and maybe it is better to copy some of the code in
   the two CLI classes for calculating the score and for importing results. Code
   can be found in the /cli folder
 * Calculation CLI uses this construct
 *     ```wp-block-code
       $completed = 0;$error = false;$calc_args = array(	'force_calculation' => 'no',	'iteration' => 0,);while ( $completed !== 1 && $error === false ) {	$calc_args = Football_Pool_Admin_Score_Calculation::process( true, $calc_args );	extract( $calc_args, EXTR_OVERWRITE );}
       ```
   
 * The results import just uses some SQL queries to update relevant tables.
 * If you want to automate stuff, you can also consider writing your own CLI function,
   schedule it via a cron, and kick off my CLI functions once you’re done.
 *  Thread Starter [pixelhouse18](https://wordpress.org/support/users/pixelhouse18/)
 * (@pixelhouse18)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/adding-the-score-trough-api-or-code/#post-18333093)
 * Thanks Antoine you’re the best. I’ll check out your solution once i’m diving 
   back in!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Adding the score trough api or code?’ is closed to new replies.

 * ![](https://ps.w.org/football-pool/assets/icon-256x256.png?rev=983880)
 * [Football Pool](https://wordpress.org/plugins/football-pool/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/football-pool/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/football-pool/)
 * [Active Topics](https://wordpress.org/support/plugin/football-pool/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/football-pool/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/football-pool/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [pixelhouse18](https://wordpress.org/support/users/pixelhouse18/)
 * Last activity: [1 year, 3 months ago](https://wordpress.org/support/topic/adding-the-score-trough-api-or-code/#post-18333093)
 * Status: not a support question