Custom Fields
Re-Envisioned
Support MB Settings Page Setting a settings page option programatically.

  • Creator
    Topic
  • #33191

    Hi
    Using Oxygen Builder 3.9.

    I have the following code which perfectly changes a text field on my settings page when it is run in a code block on a page.

    <?php

    $option_name = 'marketplace';
    $field_id = 'market_place';
    $myvalue = 'closed';
    rwmb_set_meta( $option_name, $field_id, $myvalue, [ 'object_type' =&gt; 'setting' ] );
    

    ?>

    In reality I need this to run at a set time every day, and thus far I have been unable to do that using dplugins script organiser and a timed script execution.

    I thought I'd try another approach and have it fire when a countdown timer ends (as the logic I wish to execute on the site involves them both this seems sensible. With that in mind I know the following javascript will pickup the countdowm timer ending.

    jQuery(document).ready(function($) {

    if ($ ('html'). attr ('ng-app') == 'CTFrontendBuilder') return; 
    
    
    const myCountdownTimerSelector = '#-countdown-timer-15-26'; /* ID of countdown timer element */
    
    const countdownTimer = $(myCountdownTimerSelector).find('.oxy-countdown-timer_inner');
    
    
    // do something when countdown finishes
    countdownTimer.on('finish.countdown', function() {
    
        // code inside here runs when the countdown hits zero.
                //What is best way to change metabox customfield value here?
    
    });
    
    
    // set a new date/time programatically
    //countdownTimer.countdown('2022-03-12 11:31:30');
    
    
    // control the timer ('pause, resume, start, stop')
    //countdownTimer.countdown('pause');
    

    });

    My knowledge of mixing php and javascript is scant at best and I seem not to be able to effect the change I need to to the custom field.

    Can you tell me if it's even possible to do it this way?

    Many thanks

    Dom

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.