Advertisement
manchumahara

Custom post submission from front end

Nov 14th, 2011
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 32.87 KB | None | 0 0
  1. <?php
  2. /**
  3. * The template for displaying all pages.
  4. * Template Name: Post a Race
  5. * This is the template that displays all pages by default.
  6. * Please note that this is the WordPress construct of pages
  7. * and that other 'pages' on your WordPress site will use a
  8. * different template.
  9. *
  10. * @package WordPress
  11. * @subpackage Twenty_Ten
  12. * @since Twenty Ten 1.0
  13. */
  14. ?>
  15. <?php
  16. global $userdata,$user_ID, $user_identity, $user_level, $spages,$userexpired;
  17. global $spages, $wpdb;
  18. $regipage_link = get_permalink($spages->regipage);
  19. $jobpostpage_link = get_permalink($spages->jobpostpage);
  20. if (!is_user_logged_in()){ // no access for guest
  21.  
  22. $redirect_link = cb_getquerylink($regipage_link).'redirect_to='.$jobpostpage_link;
  23. wp_redirect($redirect_link); exit;
  24. }
  25. global $recaptcha_publickey,$recaptcha_privatekey;
  26. /*
  27. if($userexpired){
  28. wp_redirect(get_permalink($spages->subscription)); exit;
  29. }
  30. */
  31. /*
  32. else if($userdata->rdrole != 'parents' && $user_level <10){ //no access for driver , others or having user level less than 10
  33. wp_redirect(get_bloginfo('url')); exit;
  34. }
  35. */
  36.  
  37.  
  38.  
  39. //include_once TEMPLATEPATH."/libs/jobpostform.php";
  40. include_once TEMPLATEPATH."/libs/checklist.php";
  41. include_once TEMPLATEPATH."/libs/radiolist.php";
  42. include_once TEMPLATEPATH."/libs/dropdownlist.php";
  43. //myprint_r($userdata);
  44. //var_dump($userdata->rdrole);
  45. //var_dump($user_identity);
  46. //var_dump($user_level);
  47. //http://pastebin.com/rw4c6jZQ
  48. $page_title = get_the_title();
  49. if ( isset($_GET['raceid']) || isset ($_POST['raceid']) ) $page_title = 'Edit Race';
  50. ?>
  51. <?php
  52. $i = 1;
  53. $title = '';
  54. $description = '';
  55. $racetag = array();
  56. $racetype = array();
  57. $racedistance = array();
  58. $racelocation = array();
  59. $awards = array();
  60.  
  61. //$eventname = '';
  62. $distancekm = '';
  63. $distancemile = '';
  64. $terraintype = '';
  65. $startdate = '';
  66. $starttime = '';
  67. $venue = '';
  68. $organizername = '';
  69. $racewebsite = '';
  70. $bestimemen = '';
  71. $bestimewoman = '';
  72. $towncity = '';
  73. $county = '';
  74. $region = '';
  75. $zipcode = '';
  76. $findstartline = '';
  77. $nearestparking = '';
  78. $entryfee = '';
  79. $enteronday = 0;
  80. $onlineentrylink = '';
  81. $postalentry = '';
  82. $checquepayableto = '';
  83. $entryclosedate = '';
  84. $entrylimit = '';
  85. $contact = '';
  86. $toilets = 0;
  87. $changingfacility = 0;
  88. $waterstation = 0;
  89.  
  90.  
  91. # the response from reCAPTCHA
  92. $recaptcha_resp = null;
  93. # the error code from reCAPTCHA, if any
  94. $recaptcha_error = null;
  95.  
  96. //$raceid = '';
  97. if ( isset($_GET['raceid']) ){
  98. $raceid = (int) $_GET['raceid'];
  99. $jobpost = null;
  100. if ( $raceid ) {
  101. $jobpost = get_post($raceid);
  102. //main fields
  103. $title = $jobpost->post_title;
  104. $description = $jobpost->post_content;
  105. //taxonomies
  106. $racetag = get_the_terms( $raceid, 'racetag');
  107. $racetype = get_the_terms( $raceid, 'racetype');
  108. $racedistance = get_the_terms( $raceid, 'racedistance');
  109. $racelocation = get_the_terms( $raceid, 'racelocation');
  110. $awards = get_the_terms( $raceid, 'awards');
  111.  
  112. //custom fields
  113. //$eventname = get_post_meta( $raceid, 'eventname', true);
  114. $distancekm = get_post_meta( $raceid, 'distancekm', true);
  115. $distancemile = get_post_meta( $raceid, 'distancemile', true);
  116. $terraintype = get_post_meta( $raceid, 'terraintype', true);
  117. $startdate = get_post_meta( $raceid, 'startdate', true); //yyyy-mm-dd
  118. $startdate = convert_datetoukdate($startdate); //dd-mm-yyyy
  119. $starttime = get_post_meta( $raceid, 'starttime', true);
  120. $venue = get_post_meta( $raceid, 'venue', true);
  121. $organizername = get_post_meta( $raceid, 'organizername', true);
  122. $racewebsite = get_post_meta( $raceid, 'racewebsite', true);
  123. $bestimemen = get_post_meta( $raceid, 'bestimemen', true);
  124. $bestimewoman = get_post_meta( $raceid, 'bestimewoman', true);
  125. $towncity = get_post_meta( $raceid, 'towncity', true);
  126. $county = get_post_meta( $raceid, 'county', true);
  127. $region = get_post_meta( $raceid, 'region', true);
  128. $zipcode = get_post_meta( $raceid, 'zipcode', true);
  129. $findstartline = get_post_meta( $raceid, 'findstartline', true);
  130. $nearestparking = get_post_meta( $raceid, 'nearestparking', true);
  131. $entryfee = get_post_meta( $raceid, 'entryfee', true);
  132. $enteronday = intval(get_post_meta( $raceid, 'enteronday', true));
  133. $onlineentrylink = get_post_meta( $raceid, 'onlineentrylink', true);
  134. $postalentry = get_post_meta( $raceid, 'postalentry', true);
  135. $checquepayableto = get_post_meta( $raceid, 'checquepayableto', true);
  136. $entryclosedate = get_post_meta( $raceid, 'entryclosedate', true); //yyyy-mm-dd
  137. $entryclosedate = convert_datetoukdate($entryclosedate); //dd-mm-yyyy
  138. $entrylimit = get_post_meta( $raceid, 'entrylimit', true);
  139. $contact = get_post_meta( $raceid, 'contact', true);
  140. $toilets = intval(get_post_meta( $raceid, 'toilets', true));
  141. $changingfacility = intval(get_post_meta( $raceid, 'changingfacility', true));
  142. $waterstation = intval(get_post_meta( $raceid, 'waterstation', true));
  143.  
  144. }
  145. }
  146. elseif ( isset($_POST['raceid']) )
  147. $raceid = (int) $_POST['raceid'];
  148. else
  149. $raceid = 0;
  150.  
  151.  
  152. $submit_title = 'Create Race';
  153.  
  154. $errormessage = '';
  155.  
  156. if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['mode'] )) {
  157. $nonce = $_REQUEST['_wpnonce'];
  158. $mode = $_POST['mode'];
  159. if($mode == 'newpost'){
  160. if (! wp_verify_nonce($nonce, 'newjobpostby'.$user_ID) ) die('Security check');
  161. }
  162. else if($mode == 'postupdate' ){
  163. if (! wp_verify_nonce($nonce, 'newjobpostid'.$raceid.'_'.$user_ID) ) die('Security check');
  164. }
  165. else{
  166. die('Security check');
  167. }
  168. //basic fields
  169. $title = (isset ($_POST['title']))? sanitize_text_field($_POST['title']): '';
  170. $description = (isset ($_POST['description']))? esc_textarea($_POST['description']):'';
  171.  
  172. //taxonomies
  173. $racetag = (isset ($_POST['racetag']))? $_POST['racetag']:'';
  174.  
  175. $racetype = (isset ($_POST['racetype']))? $_POST['racetype']:'';
  176.  
  177. $racedistance = (isset ($_POST['racedistance']))? $_POST['racedistance']:'';
  178. $racelocation = (isset ($_POST['racelocation']))? $_POST['racelocation']:'';
  179. $awards = (isset ($_POST['awards']))? $_POST['awards']:'';
  180. //custom fields
  181. //$eventname = (isset ($_POST['eventname']))? sanitize_text_field($_POST['eventname']):'';
  182. $distancekm = (isset ($_POST['distancekm']))? sanitize_text_field($_POST['distancekm']): '';
  183. $distancemile = (isset ($_POST['distancemile']))? sanitize_text_field($_POST['distancemile']): '';
  184. $terraintype = (isset ($_POST['terraintype']))? sanitize_text_field($_POST['terraintype']): '';
  185. $startdate = (isset ($_POST['startdate']))? sanitize_text_field($_POST['startdate']): '';
  186. $starttime = (isset ($_POST['starttime']))? sanitize_text_field($_POST['starttime']): '';
  187. $venue = (isset ($_POST['venue']))? sanitize_text_field($_POST['venue']): '';
  188. $organizername = (isset ($_POST['organizername']))? sanitize_text_field($_POST['organizername']): '';
  189. $racewebsite = (isset ($_POST['racewebsite']))? sanitize_text_field($_POST['racewebsite']): '';
  190. $bestimemen = (isset ($_POST['bestimemen']))? sanitize_text_field($_POST['bestimemen']): '';
  191. $bestimewoman = (isset ($_POST['bestimewoma']))? sanitize_text_field($_POST['bestimewoma']): '';
  192. $towncity = (isset ($_POST['towncity']))? sanitize_text_field($_POST['towncity']): '';
  193. $county = (isset ($_POST['county']))? sanitize_text_field($_POST['county']): '';
  194. $region = (isset ($_POST['region']))? sanitize_text_field($_POST['region']): '';
  195. $zipcode = (isset ($_POST['zipcode']))? sanitize_text_field($_POST['zipcode']): '';
  196. $findstartline = (isset ($_POST['findstartline']))? sanitize_text_field($_POST['findstartline']): '';
  197. $nearestparking = (isset ($_POST['nearestparking']))? sanitize_text_field($_POST['nearestparking']): '';
  198. $entryfee = (isset ($_POST['entryfee']))? sanitize_text_field($_POST['entryfee']): '';
  199. $enteronday = (isset ($_POST['enteronday']))? sanitize_text_field($_POST['enteronday']): '';
  200. $onlineentrylink = (isset ($_POST['onlineentrylink']))? sanitize_text_field($_POST['onlineentrylink']): '';
  201. $postalentry = (isset ($_POST['postalentry']))? sanitize_text_field($_POST['postalentry']): '';
  202. $checquepayableto = (isset ($_POST['checquepayableto']))? sanitize_text_field($_POST['checquepayableto']): '';
  203. $entryclosedate = (isset ($_POST['entryclosedate']))? sanitize_text_field($_POST['entryclosedate']): '';
  204. $entrylimit = (isset ($_POST['entrylimit']))? sanitize_text_field($_POST['entrylimit']): '';
  205. $contact = (isset ($_POST['contact']))? sanitize_text_field($_POST['contact']): '';
  206. $toilets = (isset ($_POST['toilets']))? sanitize_text_field($_POST['toilets']): 0;
  207. $changingfacility = (isset ($_POST['changingfacility']))? sanitize_text_field($_POST['changingfacility']): 0;
  208. $waterstation = (isset ($_POST['waterstatio']))? sanitize_text_field($_POST['waterstatio']): 0;
  209.  
  210.  
  211.  
  212. $raceid = (isset ($_POST['raceid']))? sanitize_text_field($_POST['raceid']):'';
  213.  
  214.  
  215. $wp_error = new WP_ERROR();
  216. if ( $title == ''){ $wp_error->add( 'empty_title', __( '<strong>ERROR</strong>: Please enter title.' ));}
  217. if(strlen($title) < 10 ){$wp_error->add( 'short_title', __( '<strong>ERROR</strong>: Title is too short. Please put the title more than 10 characters.' ));}
  218. if ( $description == '' ) { $wp_error->add( 'empty_description', __( '<strong>ERROR</strong>: Please enter description.' ));}
  219. if(strlen($description) < 30 ){$wp_error->add( 'short_description', __( '<strong>ERROR</strong>: Description is too short. Please put the description more than 30 characters.' ));}
  220.  
  221. if(!is_array($racetype) || empty ($racetype)){
  222. $wp_error->add( 'empty_racetype', __( '<strong>ERROR</strong>: Please select Race Type.' ));
  223. }
  224. if(!is_array($racedistance) || empty ($racedistance)){
  225. $wp_error->add( 'empty_racedistance', __( '<strong>ERROR</strong>: Please select Race Distance.' ));
  226. }
  227. if(!is_array($racelocation) || empty ($racelocation)){
  228. $wp_error->add( 'empty_racelocation', __( '<strong>ERROR</strong>: Please select Race Location.' ));
  229. }
  230. $startdatet = $startdate;
  231. $entryclosedatet = $entryclosedate;
  232.  
  233. if(empty ($startdate)){
  234. $wp_error->add( 'empty_startdate', __( '<strong>ERROR</strong>: Start Date empty.' ));
  235. }
  236. else if(!cv_isvalid_date($startdatet)){
  237. $wp_error->add( 'empty_startdate', __( '<strong>ERROR</strong>: Invalid Start Date.' ));
  238. }
  239. if(empty ($starttime)){
  240. $wp_error->add( 'empty_starttime', __( '<strong>ERROR</strong>: Start Time empty.' ));
  241. }
  242.  
  243. if(empty ($venue)){
  244. $wp_error->add( 'empty_venue', __( '<strong>ERROR</strong>: Empty venue.' ));
  245. }
  246. if(empty ($organizername)){
  247. $wp_error->add( 'empty_organizername', __( '<strong>ERROR</strong>: Organizer name empty.' ));
  248. }
  249. if(empty ($county)){
  250. $wp_error->add( 'empty_county', __( '<strong>ERROR</strong>: County empty.' ));
  251. }
  252. if(empty ($towncity)){
  253. $wp_error->add( 'empty_towncity', __( '<strong>ERROR</strong>: Town/City empty.' ));
  254. }
  255. if(empty ($region)){
  256. $wp_error->add( 'empty_region', __( '<strong>ERROR</strong>: Region empty.' ));
  257. }
  258. if(empty ($zipcode)){
  259. $wp_error->add( 'empty_zipcode', __( '<strong>ERROR</strong>: Zipcode empty.' ));
  260. }
  261. if(empty ($entryclosedate)){
  262. $wp_error->add( 'empty_entryclosedate', __( '<strong>ERROR</strong>: Entry Close Date empty.' ));
  263. }
  264. else if(!cv_isvalid_date($entryclosedatet)){
  265. $wp_error->add( 'empty_entryclosedate', __( '<strong>ERROR</strong>: Invalid Entry Close Date.' ));
  266. }
  267.  
  268.  
  269. # was there a reCAPTCHA response?
  270. //var_dump($_POST["recaptcha_response_field"]);
  271. $recaptcha_response_field = (isset ($_POST['recaptcha_response_field']))? $_POST['recaptcha_response_field']:'';
  272. if (!empty ($recaptcha_response_field)) {
  273. $recaptcha_resp = recaptcha_check_answer ($recaptcha_privatekey,
  274. $_SERVER["REMOTE_ADDR"],
  275. $_POST["recaptcha_challenge_field"],
  276. $_POST["recaptcha_response_field"]);
  277.  
  278. if ($recaptcha_resp->is_valid) {
  279. //echo "You got it!";
  280. } else {
  281. # set the error code so that we can display it
  282. $recaptcha_error = $recaptcha_resp->error;
  283. $wp_error->add( 'empty_recaptcha', __( '<strong>ERROR</strong>:'.$recaptcha_error ));
  284. }
  285. }
  286. else{
  287. $recaptcha_error = 'Captcha is empty';
  288. $wp_error->add( 'empty_recaptcha', __( '<strong>ERROR</strong>: Please fill the captcha challenge carefully'));
  289. }
  290.  
  291. //$jobid = '';
  292. if ( !isset( $wp_error ) || ( isset( $wp_error ) && is_object( $wp_error ) && false == $wp_error->get_error_codes() ) ){
  293. //let's form the post data
  294. $new_post = array(
  295. 'post_title' => $title,
  296. 'post_content' => $description,
  297. 'tax_input' => array (
  298. 'racetype' => $racetype,
  299. 'racedistance' => $racedistance,
  300. 'racelocation' => $racelocation
  301. ),
  302. 'post_status' => 'pending', // Choose: publish, preview, future, draft, etc.
  303. 'post_type' => 'race', //'post',page' or use a custom post type if you want to
  304. );
  305. if($mode == 'newpost'){
  306. $raceid = wp_insert_post($new_post);
  307. $success = 'created';
  308. }
  309. else if($mode == 'postupdate' ){
  310. $new_post['ID'] = $raceid;
  311. $raceid = wp_update_post( $new_post );
  312. $success = 'edited';
  313. }
  314. else{
  315. die('Security check');
  316. }
  317.  
  318.  
  319. //var_dump($jobid);
  320. if($raceid == 0){
  321. $wp_error->add( 'error_jobcreate', __( '<strong>ERROR</strong>: Error creating/updating post. Please contact with site admin' ));
  322. }
  323. else{
  324. //post added or edited successfully.
  325. if($mode == 'newpost'){
  326. //add_post_meta($raceid, "eventname", $eventname);
  327. add_post_meta($raceid, "distancekm", $distancekm);
  328. add_post_meta($raceid, "distancemile", $distancemile);
  329. add_post_meta($raceid, "terraintype", $terraintype);
  330. add_post_meta($raceid, "startdate", convert_ukdatetodate($startdate));
  331. add_post_meta($raceid, "starttime", $starttime);
  332. add_post_meta($raceid, "venue", $venue);
  333. add_post_meta($raceid, "organizername", $organizername);
  334. add_post_meta($raceid, "racewebsite", $racewebsite);
  335. add_post_meta($raceid, "bestimemen", $bestimemen);
  336. add_post_meta($raceid, "bestimewoman", $bestimewoman);
  337. add_post_meta($raceid, "towncity", $towncity);
  338. add_post_meta($raceid, "county", $county);
  339. add_post_meta($raceid, "region", $region);
  340. add_post_meta($raceid, "zipcode", $zipcode);
  341. add_post_meta($raceid, "findstartline", $findstartline);
  342. add_post_meta($raceid, "nearestparking", $nearestparking);
  343. add_post_meta($raceid, "entryfee", $entryfee);
  344. add_post_meta($raceid, "onlineentrylink", $onlineentrylink);
  345. add_post_meta($raceid, "enteronday", $enteronday);
  346. add_post_meta($raceid, "postalentry", $postalentry);
  347. add_post_meta($raceid, "checquepayableto", $checquepayableto);
  348. add_post_meta($raceid, "entryclosedate", convert_ukdatetodate($entryclosedate));
  349. add_post_meta($raceid, "contact", $contact);
  350. add_post_meta($raceid, "changingfacility", $changingfacility);
  351. add_post_meta($raceid, "waterstation", $waterstation);
  352. }
  353. else{
  354. //update_post_meta($raceid, "eventname", $eventname);
  355. update_post_meta($raceid, "distancekm", $distancekm);
  356. update_post_meta($raceid, "distancemile", $distancemile);
  357. update_post_meta($raceid, "startdate", convert_ukdatetodate($startdate));
  358. update_post_meta($raceid, "starttime", $starttime);
  359. update_post_meta($raceid, "venue", $venue);
  360. update_post_meta($raceid, "organizername", $organizername);
  361. update_post_meta($raceid, "racewebsite", $racewebsite);
  362. update_post_meta($raceid, "bestimemen", $bestimemen);
  363. update_post_meta($raceid, "bestimewoman", $bestimewoman);
  364. update_post_meta($raceid, "towncity", $towncity);
  365. update_post_meta($raceid, "county", $county);
  366. update_post_meta($raceid, "region", $region);
  367. update_post_meta($raceid, "zipcode", $zipcode);
  368. update_post_meta($raceid, "findstartline", $findstartline);
  369. update_post_meta($raceid, "nearestparking", $nearestparking);
  370. update_post_meta($raceid, "entryfee", $entryfee);
  371. update_post_meta($raceid, "onlineentrylink", $onlineentrylink);
  372. update_post_meta($raceid, "enteronday", $enteronday);
  373. update_post_meta($raceid, "postalentry", $postalentry);
  374. update_post_meta($raceid, "checquepayableto", $checquepayableto);
  375. update_post_meta($raceid, "entryclosedate", convert_ukdatetodate($entryclosedate));
  376. update_post_meta($raceid, "contact", $contact);
  377. update_post_meta($raceid, "changingfacility", $changingfacility);
  378. update_post_meta($raceid, "waterstation", $waterstation);
  379. }
  380.  
  381. }
  382. }
  383. if(is_wp_error( $wp_error ) ) {
  384. //var_dump($wp_error);
  385. foreach ( $wp_error->get_error_codes() as $code ) {
  386.  
  387. foreach ( $wp_error->get_error_messages($code) as $error ) {
  388. $errormessage .= ' ' . $error . "<br />\n";
  389. }
  390. }
  391. $errormessage = '<div id="login_error">'.$errormessage.'</div>';
  392. }
  393. if(false == $wp_error->get_error_codes()){
  394. if(strpos($jobpostpage_link, '?') !== false) {
  395. $jobpostpage_link_redirect = $jobpostpage_link_redirect.'&raceid='.$raceid.'&status='.$success;
  396. }
  397. else{
  398. $jobpostpage_link_redirect = $jobpostpage_link_redirect.'?raceid='.$raceid.'&status='.$success;
  399. }
  400. wp_redirect($jobpostpage_link_redirect); exit();
  401.  
  402. //$errormessage = '<div id="login_error">Job '.$success.' successfully! | Continue edit or <a href="'.get_permalink($jobid).'">Click to view the job</a></div>';
  403. }
  404. //echo $errormessage;
  405.  
  406. }
  407.  
  408. ?>
  409. <?php get_header(); ?>
  410. <div id="container">
  411. <div id="content" role="main">
  412. <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
  413. <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  414. <h1 class="entry-title"><?php echo $page_title; ?></h1>
  415. <div class="entry-content">
  416. <?php
  417. //the_content();
  418. //cb_show_jobpost_form();
  419. if($errormessage != '') echo $errormessage;
  420. if(isset ($_GET['status'])){
  421. echo '<div id="login_error">'.$_GET['status'].' successfully! | Continue edit or <a href="'.get_permalink($raceid).'">Click to view</a></div>';
  422. }
  423. ?>
  424. <form name="registerform" id="registerform" method="post" action="<?php echo $jobpostpage_link; ?>" class="job-form" enctype="multipart/form-data">
  425. <p><label for="title">Race Title: *</label><input class="input" type="text" id="title" value="<?php echo $title; ?>" name="title" /></p>
  426. <p>
  427. <label for="description">Description: *</label>
  428. <textarea class="input" id="post_content" name="description" cols="50" rows="10"><?php echo $description; ?></textarea>
  429. </p>
  430. <div class="childrenage_selectbox">
  431. <label>Race Type: *</label>
  432. <div class="formselectbox">
  433. <select class="nonbulletlist" name="racetype[]">
  434. <?php
  435. // wp_terms_radiolist($raceid, array( 'taxonomy' => 'racetype') );
  436. wp_terms_dropdownlist($raceid, array( 'taxonomy' => 'racetype') );
  437. ?>
  438. </select>
  439. </div>
  440. <div class="clear"></div>
  441. </div>
  442. <div class="childrenage_selectbox">
  443. <label>Race Distance: *</label>
  444. <div class="formselectbox">
  445. <select class="nonbulletlist" name="racedistance[]">
  446. <?php
  447. wp_terms_dropdownlist($raceid, array( 'taxonomy' => 'racedistance') );
  448. ?>
  449. </select>
  450. </div>
  451. <div class="clear"></div>
  452. </div>
  453. <div class="childrenage_selectbox">
  454. <label>Race Location: *</label>
  455. <div class="formselectbox">
  456. <select class="nonbulletlist" name="racelocation[]">
  457. <?php
  458. wp_terms_dropdownlist($raceid, array( 'taxonomy' => 'racelocation') );
  459. ?>
  460. </select>
  461. </div>
  462. <div class="clear"></div>
  463. </div>
  464. <!--p><label for="eventname">Event Name:</label><input class="input" type="text" id="eventname" value="<?php echo $eventname; ?>" name="eventname" /></p-->
  465. <p><label for="distancekm">Distance(KMs):</label><input class="input" type="text" id="distancekm" value="<?php echo $distancekm; ?>" name="distancekm" /></p>
  466. <p><label for="distancemile">Distance(Miles):</label><input class="input" type="text" id="distancemile" value="<?php echo $distancemile; ?>" name="distancemile" /></p>
  467. <p><label for="terraintype">Terrain Type:</label><input class="input" type="text" id="terraintype" value="<?php echo $terraintype; ?>" name="terraintype" /></p>
  468. <p><label for="startdate">Start Date: *</label><input class="input" type="text" id="startdate" value="<?php echo $startdate; ?>" name="startdate" /> <span class="smallformlabel">Format: dd-mm-yyyy</span></p>
  469. <p><label for="starttime">Start Time: *</label><input class="input" type="text" id="starttime" value="<?php echo $starttime; ?>" name="starttime" /> <span class="smallformlabel">Format: hh:mm</span></p>
  470. <p><label for="venue">Venue: *</label><input class="input" type="text" id="venue" value="<?php echo $venue; ?>" name="venue" /></p>
  471. <p><label for="organizername">Organizer Name: *</label><input class="input" type="text" id="organizername" value="<?php echo $organizername; ?>" name="organizername" /></p>
  472. <p><label for="racewebsite">Race Website:</label><input class="input" type="text" id="racewebsite" value="<?php echo $racewebsite; ?>" name="racewebsite" /></p>
  473. <p><label for="bestimemen">Best Time(Men):</label><input class="input" type="text" id="bestimemen" value="<?php echo $bestimemen; ?>" name="bestimemen" /></p>
  474. <p><label for="bestimewoman">Best Time(Woman):</label><input class="input" type="text" id="bestimewoman" value="<?php echo $bestimewoman; ?>" name="bestimewoman" /></p>
  475. <p><label for="towncity">Town/City: *</label><input class="input" type="text" id="towncity" value="<?php echo $towncity; ?>" name="towncity" /></p>
  476. <p><label for="county">County: *</label><input class="input" type="text" id="county" value="<?php echo $county; ?>" name="county" /></p>
  477. <p><label for="region">Region: *</label><input class="input" type="text" id="region" value="<?php echo $region; ?>" name="region" /></p>
  478. <p><label for="zipcode">ZIP Code: *</label><input class="input" type="text" id="zipcode" value="<?php echo $zipcode; ?>" name="zipcode" /></p>
  479. <p><label for="findstartline">How to Find Start Line:</label><input class="input" type="text" id="findstartline" value="<?php echo $findstartline; ?>" name="findstartline" /></p>
  480. <p><label for="nearestparking">Nearest Parking:</label><input class="input" type="text" id="nearestparking" value="<?php echo $nearestparking; ?>" name="nearestparking" /></p>
  481. <p><label for="entryfee">Entry Fee(NOK):</label><input class="input" type="text" id="entryfee" value="<?php echo $entryfee; ?>" name="entryfee" /></p>
  482. <div class="childrenage_selectbox">
  483. <label for="enteronday">Enter On the Day?</label>
  484. <div class="formselectbox">
  485. <input type="radio" name="enteronday" id="enteronday0" value="0" <?php checked( 0, intval($enteronday)); ?> /> No
  486. <input type="radio" name="enteronday" id="enteronday1" value="1" <?php checked( 1, intval($enteronday)); ?> /> Yes
  487. </div>
  488. <div class="clear"></div>
  489. </div>
  490. <p><label for="onlineentrylink">Online Entry Link:</label><input class="input" type="text" id="onlineentrylink" value="<?php echo $onlineentrylink; ?>" name="onlineentrylink" /></p>
  491. <div class="childrenage_selectbox">
  492. <label for="postalentry">Postal Entry:</label>
  493. <div class="formselectbox">
  494. <input type="radio" name="postalentry" id="postalentry0" value="0" <?php checked( 0, intval($postalentry)); ?> /> No
  495. <input type="radio" name="postalentry" id="postalentry1" value="1" <?php checked( 1, intval($postalentry)); ?> /> Yes
  496. </div>
  497. <div class="clear"></div>
  498. </div>
  499. <!--p><label for="postalentry">Postal Entry:</label><input class="input" type="text" id="postalentry" value="<?php echo $postalentry; ?>" name="postalentry" /></p-->
  500. <p><label for="checquepayableto">Cheques Payable To:</label><input class="input" type="text" id="checquepayableto" value="<?php echo $checquepayableto; ?>" name="checquepayableto" /></p>
  501. <p><label for="entryclosedate">Entry Close Date:</label><input class="input" type="text" id="entryclosedate" value="<?php echo $entryclosedate; ?>" name="entryclosedate" /> <span class="smallformlabel">Format: dd-mm-yyyy</span></p>
  502. <p><label for="entrylimit">Entry Limit:</label><input class="input" type="text" id="entrylimit" value="<?php echo $entrylimit; ?>" name="entrylimit" /></p>
  503. <p><label for="contact">Contact / Race Secretary:</label><input class="input" type="text" id="contact" value="<?php echo $contact; ?>" name="contact" /></p>
  504. <div class="childrenage_selectbox">
  505. <label for="toilets">Toilet?</label>
  506. <div class="formselectbox">
  507. <input type="radio" name="toilets" id="toilets0" value="0" <?php checked( 0, intval($toilets)); ?> /> No
  508. <input type="radio" name="toilets" id="toilets1" value="1" <?php checked( 1, intval($toilets)); ?> /> Yes
  509. </div>
  510. <div class="clear"></div>
  511. </div>
  512. <div class="childrenage_selectbox">
  513. <label for="changingfacility">Changing Facilities?</label>
  514. <div class="formselectbox">
  515. <input type="radio" name="changingfacility" id="changingfacility0" value="0" <?php checked( 0, intval($changingfacility)); ?> /> No
  516. <input type="radio" name="changingfacility" id="changingfacility1" value="1" <?php checked( 1, intval($changingfacility)); ?> /> Yes
  517. </div>
  518. <div class="clear"></div>
  519. </div>
  520. <div class="childrenage_selectbox">
  521. <label for="waterstation">Water Stations?</label>
  522. <div class="formselectbox">
  523. <input type="radio" name="waterstation" id="waterstation0" value="0" <?php checked( 0, intval($waterstation)); ?> /> No
  524. <input type="radio" name="waterstation" id="waterstation1" value="1" <?php checked( 1, intval($waterstation)); ?> /> Yes
  525. </div>
  526. <div class="clear"></div>
  527. </div>
  528. <div class="childrenage_selectbox">
  529. <label>Awards / Prizes: </label>
  530. <div class="formselectbox">
  531. <ul class="nonbulletlist">
  532. <?php
  533. wp_terms_checklist($raceid, array( 'taxonomy' => 'awards') );
  534. ?>
  535. </ul>
  536. </div>
  537. <div class="clear"></div>
  538. </div>
  539. <p><label for="recaptcha">Hope you are Human:</label>
  540. <?php echo recaptcha_get_html($recaptcha_publickey, $recaptcha_error); ?>
  541. </p>
  542. <?php
  543. if($raceid != 0):
  544. $submit_title = 'Edit Race';
  545. ?>
  546. <?php wp_nonce_field( 'newjobpostid'.$raceid.'_'.$user_ID); ?>
  547. <input type="hidden" name="mode" value="postupdate" />
  548. <input type="hidden" name="raceid" value="<?php echo esc_attr($raceid); ?>" />
  549. <?php else: ?>
  550. <?php wp_nonce_field( 'newjobpostby'.$user_ID ); ?>
  551. <input type="hidden" name="mode" value="newpost" />
  552. <?php endif; ?>
  553. <input type="hidden" name="user_id" id="user_id" value="<?php echo esc_attr($user_ID); ?>" />
  554. <p class="submit jobsubmit"><input type="submit" name="wp-submit" id="wp-submit" class="button-primary" value="<?php echo $submit_title; ?>" tabindex="100" /></p>
  555. </form>
  556. <script type="text/javascript">
  557.  
  558. jQuery(window).load(function() {
  559. jQuery("#startdate").datepick({dateFormat: 'dd-mm-yyyy'});
  560. jQuery("#entryclosedate").datepick({dateFormat: 'dd-mm-yyyy'});
  561. });
  562. /*
  563. $ = jQuery;
  564. $("h3.widget-ftitle").click(function(){
  565. handle = this;
  566. $(this).next("div.widget-content").toggle("slow", function(){
  567. //alert("hello");
  568.  
  569. if($(handle).hasClass("widget-ftitle2")){
  570. $(handle).removeClass('widget-ftitle2');
  571. }else{
  572. $(handle).addClass('widget-ftitle2');
  573. }
  574.  
  575. });
  576. });
  577. */
  578. </script>
  579.  
  580.  
  581. <div class="clear"></div>
  582. </div><!-- .entry-content -->
  583. </div><!-- #post-## -->
  584. <?php endwhile; // end of the loop. ?>
  585. </div><!-- #content -->
  586. </div><!-- #container -->
  587. <?php get_sidebar(); ?>
  588. <?php get_footer(); ?>
  589.  
  590.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement