ID; $post_content=filterinput($_REQUEST['post_content']); $post_title=filterinput($_REQUEST['post_title']); $post_category_item= $_REQUEST['post_category']; $twitter_link=$_REQUEST['twitter_link']; $post_tags=filterinput($_REQUEST['tags_input']); $inpost_category=array("$post_category_item"); $_SESSION['post_content']=$post_content; $_SESSION['post_title']=$post_title; $_SESSION['post_category_item']=$post_category_item; $_SESSION['twitter_link']=$twitter_link; $_SESSION['twitter_tags']=$post_tags; if ( empty($inpost_category) || 0 == count($inpost_category) || !is_array($inpost_category) ) { $post_category = array(get_option('default_category')); } else { $post_category = $inpost_category; } $post_tag=explode(",",$post_tags); $tags_input=array(); for ($i=0;isset($post_tag[$i]);++$i) { $tags_input[]=$post_tag[$i]; } $verror=false; if ( empty($post_title) ) { $verror=true; echo "You did not enter your twitter name. "; } if ( empty($post_content) ) { $verror=true; echo "You did not enter your twitter description. "; } if ( empty($twitter_link) ) { $verror=true; echo "You did not enter your twitter URL. "; } if(!strstr($twitter_link,'http://')) { $verror=true; echo "The twitter URL link you have entered is badly formatted. The URL needs to start with http://"; } if (!empty($post_tags) ) { if(!strstr($post_tags,',') && (strlen($post_tags) > 50)) { $verror=true; echo "Your tags appear to be badly formatted. Please make sure your tags are separated by commas and that none of your individual tags is too long."; } } if(!$verror) { if (is_user_logged_in()){ clearthesessionvars(); $post_id = wp_insert_post( array( 'post_author' => $user_id, 'post_title' => $post_title, 'post_content' => $post_content, 'tags_input' => $tags_input, 'post_category' => $post_category, 'post_status' => 'pending', 'post_type' => 'post' )); add_post_meta($post_id, url, $twitter_link, $unique = false); $theresultmessage = "Submission successful. Thank you!"; } else { $hidemytwitterform=1; ?>

You must be logged in before you can add your twitter info



Not a Member? Sign Up

";} ?>

"; } ?> get_results("select a.term_id as cat_ID, a.name as cat_name from ".$table_prefix."terms a, ".$table_prefix."term_taxonomy b WHERE a.term_id = b.term_id AND b.taxonomy = 'category'"); foreach($twittercatnid as $thewpcategories) { $optionitem .= ""; } return $optionitem; } function clearthesessionvars() { if(isset($_SESSION['post_content']) ) { unset($_SESSION['post_content']); } if(isset($_SESSION['post_title']) ) { unset($_SESSION['post_title']); } if(isset($_SESSION['post_category_item']) ) { unset($_SESSION['post_category_item']); } if(isset($_SESSION['twitter_link']) ) { unset($_SESSION['twitter_link']); } if(isset($_SESSION['twitter_tags']) ) { unset($_SESSION['twitter_tags']); } } function filterinput($input) { $input = strip_tags($input); $input = trim($input); return $input; } ?>