i try many time’s but i dont know how i can end my plugin.
I have small plugin who add information about “Terms and condition” but when i want to add URL must add it in code, so i try upgrade it. I add page on wp admin and when you click on it you have place when you write your new URL and save.
But this is not work…maybe someone can see on my code and edit some and this will be work…

<?php
add_action('change_link','Terms and Conditions');
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", 'page_url', '', '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="page_url" 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="get_page_by_path" type="page_url" id="get_page_by_path"
value="<?php echo get_option('get_page_by_path'); ?>" />
(Paste link)</td>
</tr>
</table>

<input type="hidden" name="action" value="update" />
<input type="hidden" name="page_url" value="$get_page_by_path" />

<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 = "page_url=get_page_by_path";
    }

    $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: Problem with plugin about Terms and condition


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: