i am finished my project but i want to add last amendments. I want to add buffer “ob_start” in my form html but i don’t know how to use it because when i make it i lost all what i have on site :D. My second problem is so then i wrote no URL address i want have communicate about user mistake example “This is not address URL, try again. Try help me because i so close end this project.

My code:

<?php
/**
Plugin Name:  Terms and Conditions
Version: 1.0
Description: Adds required "i agree to terms and conditions" checkbox at the end of registration forms
*/



// Call Terms_and_conditions_menu is function which load plugin menu
add_action( 'admin_menu', 'terms_and_conditions_submenu', 20 );

// Add to WordPress admin menu
if( !function_exists("terms_and_conditions_submenu") ) {
    function terms_and_conditions_submenu(){



add_submenu_page( 'wpjb-config','WordPress Extra Post Info', __('Terms And Conditions'),'manage_options', 'terms-post-info','terms_post_info_page');


        // update_terms_condition_info update database
        add_action( 'admin_init', 'update_terms_condition_info' );
    }
}

// This function register on database
if( !function_exists("update_terms_condition_info") ) {
    function update_terms_condition_info() {
        register_setting( 'terms-conditions-info-settings', 'terms_post_info' );
    }
}

// Page our plugin
if( !function_exists("terms_post_info_page") ) {



    function terms_post_info_page() {

    esc_html( '<h1>Terms And Condition</h1>','<td><input type="text" name="terms_post_info" value="<?php echo get_option(terms_post_info); ?>"/></td>', ' <th scope="row">Terms and condition link:</th>')
        ?>

           <div class="wrap">
            <h1>Terms And Condition</h1>

              <form method="post" action="options.php">
                <?php _e(settings_fields( 'terms-conditions-info-settings' )); ?>
                <?php _e(do_settings_sections ('terms-conditions-info-settings' )); ?>
                    <table class="form-table">
                        <tr valign="top">
                            <th scope="row">Terms and condition link:</th>
                            <td><input type="url" name="terms_post_info" value="<?php echo get_option('terms_post_info'); ?>"/></td>
                        </tr>
                    </table>
                <?php submit_button(); ?>
              </form>
          </div>
        <?php
    }
}

add_filter("wpjb_form_init_company", "mod_wpjb_tos_field");
add_filter("wpjr_form_init_register", "mod_wpjb_tos_field");


function mod_wpjb_tos_field($form) {

    if(is_admin() || $form instanceof Daq_Form_ObjectAbstract && !$form->isNew()) {
        return $form;
    }

    // change terms-and-conditions to your ToS page slug,
    // or create a Page with slug terms-and-conditions
    $page = get_page_by_path("terms-and-conditions");

    if($page) {
        $url = get_permalink($page->ID);
    } else {
        $url = get_option('terms_post_info');
    }

    $form->addGroup("tos", "Terms and Conditions");

    $e = $form->create("uterms", "checkbox");
    $e->setLabel(__("Terms And Conditions", "wpjobboard"));
    $e->addOption(1, 1, "I have read and agree to the <a href="$url">Terms and Conditions</a>.");
    $e->setRequired(true);
    $e->addFilter(new Daq_Filter_Int());
    $form->addElement($e, "tos");

    return $form;
}

?>

Read more here: Transiet and bufor problem


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: