• Resolved pvtsolver

    (@pvtsolver)


    Hello,

    Is there a way to display a hit counter that instantly counts how many times the “Calculate” button was clicked since created?

    Please advise.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @pvtsolver

    You can create a server-side equation to increase a number in the database and call this equation from a calculated field in the form. The code of the server-side equation can be as simple as:

    
    $GLOBALS['SERVER_SIDE_EQUATIONS']['increase_counter'] = function(){
    $counter = get_option('calculate_button_clicked', 0)+1;
    update_option('calculate_button_clicked', $counter);
    return $counter;
    };
    

    More information about the server-side equations by reading the following posts in the plugin’s blog:

    https://cff.dwbooster.com/blog/2018/10/01/server-side-equations

    https://cff.dwbooster.com/blog/2019/08/04/partial

    For reading the counter in the form, you can use a DS field with a query similar to:

    
    SELECT option_value as value FROM {wpdb.options} WHERE option_name="calculate_button_clicked"
    

    More information about the use of data source fields by reading the following post in the plugin’s blog:

    https://cff.dwbooster.com/blog/2019/02/14/ds/

    Best regards.

    Thread Starter pvtsolver

    (@pvtsolver)

    Can this be done with the basic (free) version of CFF?

    Plugin Author codepeople

    (@codepeople)

    Hello @pvtsolver

    No, I’m sorry. If you want to register the times a button is pressed by any user, you should store this information on the server-side. So, you need features that are not distributed with the free version of the plugin.

    Best regards.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to create a hit counter?’ is closed to new replies.