I have the last question about my plugin. I add to wp-admin site with my plugin and i have a place where i can write URL and i can save it but what i must do if want save this URL and I would like to save to the code.

<?php
/**
Plugin Name: [WPJB] Terms and Conditions
Version: 1.0
Author: Greg Winiarski
Description: Adds required "i agree to terms and conditions" checkbox at the end of registration forms
*/
<?php
add_action('save_link','mod_wpjb_tos_field');
function terms_condition()
{
echo "terms condition";
}
?>
<?php
/* Runs when plugin is activated */
register_activation_hook(__FILE__,'terms_condition_install'); 

/* Runs on plugin deactivation*/
register_deactivation_hook( __FILE__, 'terms_condition_remove' );

function terms_condition_install() {
/* Creates new database field */
add_option("terms_condition_data", 'Default', '', 'yes');
}

function terms_condition_remove() {
/* Deletes the database field */
delete_option('terms_condition_data');
}

?>
<?php
if ( is_admin() ){

/* Call the html code */
add_action('admin_menu', 'terms_condition_admin_menu');

function terms_condition_admin_menu() {
add_options_page('Terms and condition', 'Terms and Condition', 'administrator',
'terms_and_condition', 'terms_condition_html_page');
}
}
?>
<?php
function terms_condition_html_page() {
?>
<div>
<h2>Adress you site with terms and condition</h2>

<form method="post" action="options.php">
<?php wp_nonce_field('update-options'); ?>

<table width="510">
<tr valign="top">
<th width="92" scope="row">Enter Text</th>
<td width="406">
<input name="terms_condition_data" type="text" id="terms_conditiod_data"
value="<?php echo get_option('terms_condition_data'); ?>" />
(Paste link)</td>
</tr>
</table>

<input type="hidden" name="action" value="update" />
<input type="hidden" name="page_options" value="terms_condition_data" />

<p>
<input type="submit" value="<?php _e('Save Changes') ?>" />
</p>

</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 = "#";
    }

    $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: last Modified and end, last question!


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: