ID; //make sure the page is not trashed... $the_page->post_status = 'publish'; $the_page_id = wp_update_post( $the_page ); } delete_option( 'my_plugin_page_id' ); add_option( 'my_plugin_page_id', $the_page_id ); } function calculator_remove() { global $wpdb; $the_page_title = get_option( "my_plugin_page_title" ); $the_page_name = get_option( "my_plugin_page_name" ); // the id of our page... $the_page_id = get_option( 'my_plugin_page_id' ); if( $the_page_id ) { wp_delete_post( $the_page_id ); // this will trash, not delete } delete_option("my_plugin_page_title"); delete_option("my_plugin_page_name"); delete_option("my_plugin_page_id"); } function kalkulaator($content){ global $post; if($post->post_title=='Kalkulaator'){ global $current_user; get_currentuserinfo(); /* add food into storage */ if($_POST['add-kilo']){ $queryaddstorage = mysql_query('SELECT * FROM wp_food_storage WHERE owner_id="'.$current_user->ID.'" LIMIT 1'); $row = mysql_fetch_array($queryaddstorage); $totalstorage = $row['quantity']; if(mysql_num_rows($queryaddstorage)==0){ mysql_query('INSERT INTO wp_food_storage SET owner_id="'.$current_user->ID.'", quantity="1", date_added="'.time().'"'); } else { $totalstorage=$totalstorage+1; mysql_query('UPDATE wp_food_storage SET quantity='.$totalstorage.' WHERE owner_id="'.$current_user->ID.'"'); } } /* end of adding food into storage */ /* subtract food from storage */ if($_POST['subtract-kilo']){ $queryaddstorage = mysql_query('SELECT * FROM wp_food_storage WHERE owner_id="'.$current_user->ID.'" LIMIT 1'); $row = mysql_fetch_array($queryaddstorage); $totalstorage = $row['quantity']; $totalstorage=$totalstorage-1; mysql_query('UPDATE wp_food_storage SET quantity='.$totalstorage.' WHERE owner_id="'.$current_user->ID.'"'); } /* end of subtracting food from storage */ /* add custom food storage */ if($_POST['save-custom-storage']){ $queryaddstorage = mysql_query('SELECT * FROM wp_food_storage WHERE owner_id="'.$current_user->ID.'" LIMIT 1'); if(mysql_num_rows($queryaddstorage)==0){ mysql_query('INSERT INTO wp_food_storage SET owner_id="'.$current_user->ID.'", quantity="'.$_POST['custom-storage'].'", date_added="'.time().'"'); } else { mysql_query('UPDATE wp_food_storage SET quantity='.$_POST['custom-storage'].' WHERE owner_id="'.$current_user->ID.'"'); } } /* end of adding custom food storage */ ?>
nickname!=''){ ?>

Toiduvajadus teie koertel (kuus)

ID.''); while($row = mysql_fetch_array($query)){ $birthdate = $row['dog_age']; $agestamp = time()-$birthdate; $age = ceil($agestamp/60/60/24/365); if($age<2){ if($row['dog_pregnant']==1){ $puppy .= $row['dog_name'].', '.$row['breed'].' '.$age.'a (tiine) - ('.($age*10).' kg)
'; } else { $puppy .= $row['dog_name'].', '.$row['breed'].' '.$age.'a - ('.($age*10).' kg)
'; } } else { if($row['dog_pregnant']==1){ $adult .= $row['dog_name'].', '.$row['breed'].' '.$age.'a (tiine) - ('.($age*10).' kg)
'; } else { $adult .= $row['dog_name'].', '.$row['breed'].' '.$age.'a - ('.($age*10).' kg)
'; } } } ?>
'.$puppy; } ?>
'.$adult; } ?>
Arvestuslikult on toitu veel alles ID.' LIMIT 1'); $row = mysql_fetch_array($querystorage); if($row['quantity']>0){ echo ''; } else { $row['quantity']=0; } echo ' kilogrammi (seisuga '.date('d.m.Y'.$row['date_added']).')'; ?>

Logige sisse!'; } ?>
post_content; } } add_filter('the_content', 'kalkulaator'); ?>