user_level; if ($user_info->user_level > 0) { $data['DebugUserLevelHigherThan0'] = "Higher Than 0"; if ($user_info->user_level > 1) { $post_status = 'publish'; } $data['debugPostStatus'] = $post_status; if ($postURI != null && $ajaxText != null) { $data['debugNotNull'] = "Not Null"; $title = (count($ajaxText) > 40) ? substr($ajaxText,0,40) . "..." : $ajaxText; $post = array(); $post['post_title'] = trim($title); $post['post_content'] = make_clickable(trim($ajaxText)); $post['tags_input'] = $ajaxTags; $post['post_status'] = $post_status; $post['post_author'] = $user_ID; $data['debugPostTitle'] = $title; $data['debugPostTags'] = $ajaxTags; $newpostid = wp_insert_post( $post ); $data['DebugPostId'] = $newpostid; } if ($newpostid > 0) { $data['DebugPostIdNotNull'] = "Not Null"; if ($user_info->user_level > 1) { $data['DebugUserLevelHigherThan1'] = "Higher Than 1"; $data['newpostid'] = $newpostid; $data['message'] = @file_get_contents($postURI . '?ajaxPostId=' . $newpostid . '&ajaxSection=ajax&ajaxAction=get'); } else { $data['DebugUserLevelHigherThan1'] = "Lower Than Or Equal To 1"; $data['newpostid'] = 0; $data['message'] = 'Thank you for your submission. Your post is now waiting for administrator approval.'; } } else { $data['DebugPostIdNotNull'] = "Null"; $data['newpostid'] = 0; $data['message'] = 'A problem occourred while saving your post, please try again.'; } } else { $data['DebugUserLevelHigherThan0'] = "Lower Than Or Equal To 0"; $data['newpostid'] = 0; $data['message'] = 'You cannot add new posts.'; } echo json_encode($data); ?>