I have this little php code for wordpress. It doesn't work. I want to make one add_action under another add_action. But the add_action that is under, is not working!
function no_reminder() {
echo "no_reminder function is active";
add_action('admin_menu','no_reminder');
remove_action( 'admin_notices', 'update_nag', 3 );
}
add_action('admin_menu', 'custom');
function custom() {
add_menu_page('settings', 'settings', '8', 'custom', 'customfunc');
}
function customfunc(){
$wpp_rg = get_option('wpp_rg');
if ($_POST['wpp_submit']):
update_option('wpp_rg',$_POST['wpp_rg']);
endif;
$farzad = get_option('wpp_rg');
/******************** IF1 ***********************/
if ($farzad==1) {
do_action('no_reminder');
no_reminder();
echo "If active";
}
if ($farzad==2) {
echo "IF Not Active";
}
/******************** IF1 ***********************/
?>
<div class="wrap">
<form action="" method="post">
<table width="50%" border="0" cellspacing="5" cellpadding="5">
<tr>
<th scope="row">test mode :</th>
<td><p>
<label>
<input name="wpp_rg" type="radio" value="1" id="RadioGroup1_0" <?php echo ($farzad==1 ? 'checked="checked"' : '') ?> />
active</label>
<br />
<label>
<input name="wpp_rg" type="radio" value="2" id="RadioGroup1_1" <?php echo ($farzad==2 ? 'checked="checked"' : '') ?>/>
not active</label>
<br />
</p></td>
</tr>
<tr>
<th></th>
<td><input type="submit" name="wpp_submit" value="save" class="button" /></td>
</tr>
</table>
</form>
</div>
<?php
}
?>
What should i do ?