/** * Add posting main form * * @author Tareq Hasan * @package WP User Frontend * * @param $post_type */ function wpuf_pending_post($post_type) { global $userdata; $userdata = get_userdata($userdata->ID); $info = __("Post It!", 'wpuf'); $can_post = 'yes'; $info = apply_filters('wpuf_addpost_notice', $info); $can_post = apply_filters('wpuf_can_post', $can_post); if ($can_post == 'yes') { ?> <div id="wpuf-post-area"> <form id="wpuf_new_post_form" name="wpuf_new_post_form" action="" enctype="multipart/form-data" method="POST"> <?php wp_nonce_field('wpuf-add-post'); ?> <ul class="wpuf-post-form"> <?php do_action('wpuf_add_post_form_top', $post_type); //plugin hook ?> <?php wpuf_build_custom_field_form('top'); ?> <li> <label for="new-post-title"> <?php echo get_option('wpuf_title_label'); ?> <span class="required">*</span> </label> <input class="requiredField" type="text" name="wpuf_post_title" id="new-post-title" minlength="2"> <div class="clear"></div> <p class="description"><?php echo stripslashes(get_option('wpuf_title_help')); ?> </p> </li> <?php if (get_option('wpuf_allow_choose_cat') == 'yes') { ?> <li> <label for="new-post-cat"> <?php echo get_option('wpuf_cat_label'); ?> <span class="required">*</span> </label> <div style="float:left;"> <div id="catlvl0"> <?php $exclude = get_option('wpuf_exclude_cat'); ?> <?php wp_dropdown_categories('show_option_none=' . __('-- Select --', 'wpuf') . '&hierarchical=1&hide_empty=0&orderby=name&name=category[]&id=cat&show_count=0&title_li=&use_desc_for_title=1&class=cat requiredField&depth=1&exclude=' . $exclude); ?> </div> </div> <div id="categories-footer" style="float:left;"></div> <div class="clear"></div> <p class="description"><?php echo stripslashes(get_option('wpuf_cat_help')); ?> </p> </li> <?php } ?> <?php do_action('wpuf_add_post_form_description', $post_type); ?> <?php wpuf_build_custom_field_form('description'); ?> <li> <label for="new-post-desc"> <?php echo get_option('wpuf_desc_label'); ?> <span class="required">*</span> </label> <div style="float:left;"> <?php if (get_option('wpuf_editor_type') == 'rich') { ?> <?php wp_editor('', 'new-post-desc', array('textarea_name' => 'wpuf_post_content', 'teeny' => true, 'textarea_rows' => 8)); ?> <?php } else { ?> <textarea name="wpuf_post_content" id="new-post-desc" cols="60" rows="8"></textarea> <?php } ?> </div> <div class="clear"></div> <p class="description"><?php echo stripslashes(get_option('wpuf_desc_help')); ?> </p> </li> <?php do_action('wpuf_add_post_form_after_description', $post_type); ?> <?php wpuf_build_custom_field_form('tag'); ?> <?php if (get_option('wpuf_allow_tags') == 'yes') { ?> <li> <label for="new-post-tags"> <?php echo get_option('wpuf_tag_label'); ?> </label> <input type="text" name="wpuf_post_tags" id="new-post-tags" class="new-post-tags"> <p class="description"><?php echo stripslashes(get_option('wpuf_tag_help')); ?> </p> <div class="clear"></div> </li> <?php } ?> <?php do_action('wpuf_add_post_form_tags', $post_type); ?> <?php wpuf_attachment_fields(); ?> <?php wpuf_build_custom_field_form('bottom'); ?> <li> <label> </label> <input class="wpuf_submit" type="submit" name="wpuf_new_post_submit" value="Proposer un projet"> <input type="hidden" name="wpuf_post_type" value="<?php echo $post_type; ?> " /> <input type="hidden" name="wpuf_post_new_submit" value="yes" /> </li> <?php do_action('wpuf_add_post_form_bottom', $post_type); ?> </ul> </form> </div> <?php } else { echo '<div class="info">' . $info . '</div>'; } }
function edit_form($curpost) { $post_tags = wp_get_post_tags($curpost->ID); $tagsarray = array(); foreach ($post_tags as $tag) { $tagsarray[] = $tag->name; } $tagslist = implode(', ', $tagsarray); $categories = get_the_category($curpost->ID); $featured_image = wpuf_get_option('enable_featured_image'); ?> <div id="wpuf-post-area"> <form name="wpuf_edit_post_form" id="wpuf_edit_post_form" action="" enctype="multipart/form-data" method="POST"> <?php wp_nonce_field('wpuf-edit-post'); ?> <ul class="wpuf-post-form"> <?php do_action('wpuf_add_post_form_top', $curpost->post_type, $curpost); //plugin hook ?> <?php wpuf_build_custom_field_form('top', true, $curpost->ID); ?> <?php if ($featured_image == 'yes') { ?> <?php if (current_theme_supports('post-thumbnails')) { ?> <li> <label for="post-thumbnail"><?php echo wpuf_get_option('ft_image_label'); ?> </label> <div id="wpuf-ft-upload-container"> <div id="wpuf-ft-upload-filelist"> <?php $style = ''; if (has_post_thumbnail($curpost->ID)) { $style = ' style="display:none"'; $post_thumbnail_id = get_post_thumbnail_id($curpost->ID); echo wpuf_feat_img_html($post_thumbnail_id); } ?> </div> <a id="wpuf-ft-upload-pickfiles" class="button" href="#"><?php echo wpuf_get_option('ft_image_btn_label'); ?> </a> </div> <div class="clear"></div> </li> <?php } else { ?> <div class="info"><?php _e('Your theme doesn\'t support featured image', 'wpuf'); ?> </div> <?php } ?> <?php } ?> <li> <label for="new-post-title"> <?php echo wpuf_get_option('title_label'); ?> <span class="required">*</span> </label> <input type="text" name="wpuf_post_title" id="new-post-title" minlength="2" value="<?php echo esc_html($curpost->post_title); ?> "> <div class="clear"></div> <p class="description"><?php echo stripslashes(wpuf_get_option('title_help')); ?> </p> </li> <?php if (wpuf_get_option('allow_cats') == 'on') { ?> <li> <label for="new-post-cat"> <?php echo wpuf_get_option('cat_label'); ?> <span class="required">*</span> </label> <?php $exclude = wpuf_get_option('exclude_cats'); $cat_type = wpuf_get_option('cat_type'); $cats = get_the_category($curpost->ID); $selected = 0; if ($cats) { $selected = $cats[0]->term_id; } //var_dump( $cats ); //var_dump( $selected ); ?> <div class="category-wrap" style="float:left;"> <div id="lvl0"> <?php if ($cat_type == 'normal') { wp_dropdown_categories('show_option_none=' . __('-- Select --', 'wpuf') . '&hierarchical=1&hide_empty=0&orderby=name&name=category[]&id=cat&show_count=0&title_li=&use_desc_for_title=1&class=cat requiredField&exclude=' . $exclude . '&selected=' . $selected); } else { if ($cat_type == 'ajax') { wp_dropdown_categories('show_option_none=' . __('-- Select --', 'wpuf') . '&hierarchical=1&hide_empty=0&orderby=name&name=category[]&id=cat-ajax&show_count=0&title_li=&use_desc_for_title=1&class=cat requiredField&depth=1&exclude=' . $exclude . '&selected=' . $selected); } else { wpuf_category_checklist($curpost->ID); } } ?> </div> </div> <div class="loading"></div> <div class="clear"></div> <p class="description"><?php echo stripslashes(wpuf_get_option('cat_help')); ?> </p> </li> <?php } ?> <?php do_action('wpuf_add_post_form_description', $curpost->post_type, $curpost); ?> <?php wpuf_build_custom_field_form('description', true, $curpost->ID); ?> <li> <label for="new-post-desc"> <?php echo wpuf_get_option('desc_label'); ?> <span class="required">*</span> </label> <?php $editor = wpuf_get_option('editor_type'); if ($editor == 'full') { ?> <div style="float:left;"> <?php wp_editor($curpost->post_content, 'new-post-desc', array('textarea_name' => 'wpuf_post_content', 'editor_class' => 'requiredField', 'teeny' => false, 'textarea_rows' => 8)); ?> </div> <?php } else { if ($editor == 'rich') { ?> <div style="float:left;"> <?php wp_editor($curpost->post_content, 'new-post-desc', array('textarea_name' => 'wpuf_post_content', 'editor_class' => 'requiredField', 'teeny' => true, 'textarea_rows' => 8)); ?> </div> <?php } else { ?> <textarea name="wpuf_post_content" class="requiredField" id="new-post-desc" cols="60" rows="8"><?php echo esc_textarea($curpost->post_content); ?> </textarea> <?php } } ?> <div class="clear"></div> <p class="description"><?php echo stripslashes(wpuf_get_option('desc_help')); ?> </p> </li> <?php do_action('wpuf_add_post_form_after_description', $curpost->post_type, $curpost); ?> <?php wpuf_build_custom_field_form('tag', true, $curpost->ID); ?> <?php if (wpuf_get_option('allow_tags') == 'on') { ?> <li> <label for="new-post-tags"> <?php echo wpuf_get_option('tag_label'); ?> </label> <input type="text" name="wpuf_post_tags" id="new-post-tags" value="<?php echo $tagslist; ?> "> <p class="description"><?php echo stripslashes(wpuf_get_option('tag_help')); ?> </p> <div class="clear"></div> </li> <?php } ?> <?php do_action('wpuf_add_post_form_tags', $curpost->post_type, $curpost); ?> <?php wpuf_build_custom_field_form('bottom', true, $curpost->ID); ?> <li> <label> </label> <input class="wpuf_submit" type="submit" name="wpuf_edit_post_submit" value="<?php echo esc_attr(wpuf_get_option('update_label')); ?> "> <input type="hidden" name="wpuf_edit_post_submit" value="yes" /> <input type="hidden" name="post_id" value="<?php echo $curpost->ID; ?> "> </li> </ul> </form> </div> <?php }
function wpuf_edit_show_form($post) { $post_tags = wp_get_post_tags($post->ID); $tagsarray = array(); foreach ($post_tags as $tag) { $tagsarray[] = $tag->name; } $tagslist = implode(', ', $tagsarray); $categories = get_the_category($post->ID); ?> <form name="wpuf_edit_post_form" id="wpuf_edit_post_form" action="" enctype="multipart/form-data" method="POST"> <?php wp_nonce_field('wpuf-edit-post'); ?> <ul class="wpuf-post-form"> <?php do_action('wpuf_add_post_form_top', $post->post_type, $post); //plugin hook ?> <?php wpuf_build_custom_field_form('top', true, $post->ID); ?> <li> <label for="new-post-title"> <?php echo get_option('wpuf_title_label'); ?> <span class="required">*</span> </label> <input type="text" name="wpuf_post_title" id="new-post-title" minlength="2" value="<?php echo esc_html($post->post_title); ?> "> <div class="clear"></div> </li> <?php if (get_option('wpuf_allow_choose_cat') == 'yes') { ?> <li> <label for="new-post-cat"> <?php echo get_option('wpuf_cat_label'); ?> <span class="required">*</span> </label> <?php $exclude = get_option('wpuf_exclude_cat'); $cats = get_the_category($post->ID); $selected = 0; if ($cats) { $selected = $cats[0]->term_id; } ?> <?php wp_dropdown_categories('show_option_none=' . __('-- Select --', 'wpuf') . '&hierarchical=1&hide_empty=0&orderby=id&show_count=0&title_li=&use_desc_for_title=1&class=cat requiredField&exclude=' . $exclude . '&selected=' . $selected); ?> <div class="clear"></div> <p class="description"><?php echo stripslashes(get_option('wpuf_cat_help')); ?> </p> </li> <?php } ?> <?php do_action('wpuf_add_post_form_description', $post->post_type, $post); ?> <?php wpuf_build_custom_field_form('description', true, $post->ID); ?> <li> <label for="new-post-desc"> <?php echo get_option('wpuf_desc_label'); ?> <span class="required">*</span> </label> <div style="float:left;"> <?php if (get_option('wpuf_editor_type') == 'rich') { ?> <?php wp_editor($post->post_content, 'new-post-desc', array('textarea_name' => 'wpuf_post_content', 'teeny' => true, 'textarea_rows' => 8)); ?> <?php } else { ?> <textarea name="wpuf_post_content" id="new-post-desc" cols="60" rows="8"><?php echo esc_textarea($post->post_content); ?> </textarea> <?php } ?> </div> <div class="clear"></div> </li> <?php do_action('wpuf_add_post_form_after_description', $post->post_type, $post); ?> <?php wpuf_build_custom_field_form('tag', true, $post->ID); ?> <?php if (get_option('wpuf_allow_tags') == 'yes') { ?> <li> <label for="new-post-tags"> <?php echo get_option('wpuf_tag_label'); ?> </label> <input type="text" name="wpuf_post_tags" id="new-post-tags" value="<?php echo $tagslist; ?> "> <div class="clear"></div> </li> <?php } ?> <?php wpuf_attachment_fields(true, $post->ID); ?> <?php do_action('wpuf_add_post_form_tags', $post->post_type, $post); ?> <?php wpuf_build_custom_field_form('bottom', true, $post->ID); ?> <li> <label> </label> <input class="wpuf_submit" type="submit" name="wpuf_edit_post_submit" value="<?php echo esc_attr(get_option('wpuf_post_update_label', 'Update Post!')); ?> "> <input type="hidden" name="wpuf_edit_post_submit" value="yes" /> <input type="hidden" name="post_id" value="<?php echo $post->ID; ?> "> </li> </ul> </form> <?php if (get_option('wpuf_allow_attachments') == 'yes') { ?> <div class="wpuf-edit-attachment"> <?php wpuf_edit_attachment($post->ID); ?> </div> <?php } }
/** * Add posting main form * * @author Tareq Hasan * @package WP User Frontend * * @param $post_type */ function wpuf_add_message($post_type) { global $userdata, $wpdb; $userdata = get_userdata($userdata->ID); $info = __("Post It!", 'wpuf'); $can_post = 'yes'; $info = apply_filters('wpuf_addpost_notice', $info); $can_post = apply_filters('wpuf_can_post', $can_post); if ($can_post == 'yes') { $sql = "SELECT ID, display_name FROM {$wpdb->users} ORDER BY user_registered ASC"; $users = $wpdb->get_results($sql); ?> <div id="wpuf-post-area"> <form id="wpuf_new_post_form" name="wpuf_new_post_form" action="" enctype="multipart/form-data" method="POST"> <input type="hidden" value="<?php echo $userdata->ID; ?> " /> <?php wp_nonce_field('wpuf-add-projet'); ?> <select> <?php foreach ($users as $u) { ?> <option> ehbhjhkj</option> <?php } ?> </select> <ul class="wpuf-post-form"> <?php do_action('wpuf_add_post_form_top', $post_type); //plugin hook ?> <?php wpuf_build_custom_field_form('top'); ?> <li> <label for="new-post-title"> <?php echo get_option('wpuf_title_label'); ?> <span class="required">*</span> </label> <input class="requiredField" type="text" name="wpuf_post_title" id="new-post-title" minlength="2"> <div class="clear"></div> <p class="description"> <?php echo stripslashes(get_option('wpuf_title_help')); ?> </p> </li> <?php do_action('wpuf_add_post_form_description', $post_type); ?> <?php wpuf_build_custom_field_form('description'); ?> <li> <label for="new-post-desc"> <?php echo get_option('wpuf_desc_label'); ?> <span class="required">*</span> </label> <div style="float:left;"> <?php if (get_option('wpuf_editor_type') == 'rich') { ?> <?php wp_editor('', 'new-post-desc', array('textarea_name' => 'wpuf_post_content', 'teeny' => true, 'textarea_rows' => 8)); ?> <?php } else { ?> <textarea name="wpuf_post_content" id="new-post-desc" cols="60" rows="8"></textarea> <?php } ?> </div> <div class="clear"></div> <p class="description"> <?php echo stripslashes(get_option('wpuf_desc_help')); ?> </p> </li> <?php wpuf_build_custom_field_form('bottom'); ?> <li> <label> </label> <input class="wpuf_submit" type="submit" name="wpuf_new_post_submit" value="<?php echo stripslashes(get_option('wpuf_post_submit_label')); ?> "> <input type="hidden" name="wpuf_post_type" value="<?php echo $post_type; ?> " /> <input type="hidden" name="wpuf_post_new_submit" value="yes" /> </li> <?php do_action('wpuf_add_post_form_bottom', $post_type); ?> </ul> </form> </div> <?php } else { echo '<div class="info">' . $info . '</div>'; } }
/** * Add posting main form * * @param $post_type */ function post_form($post_type) { global $userdata; $userdata = get_user_by('id', $userdata->ID); if (isset($_POST['wpuf_post_new_submit'])) { $nonce = $_REQUEST['_wpnonce']; if (!wp_verify_nonce($nonce, 'wpuf-add-post')) { wp_die(__('Cheating?')); } $this->submit_post(); } $info = __("Post It!", 'wpuf'); $can_post = 'yes'; $info = apply_filters('wpuf_addpost_notice', $info); $can_post = apply_filters('wpuf_can_post', $can_post); $featured_image = wpuf_get_option('enable_featured_image', 'wpuf_frontend_posting', 'no'); $title = isset($_POST['wpuf_post_title']) ? esc_attr($_POST['wpuf_post_title']) : ''; $description = isset($_POST['wpuf_post_content']) ? $_POST['wpuf_post_content'] : ''; if ($can_post == 'yes') { ?> <div id="wpuf-post-area"> <form id="wpuf_new_post_form" name="wpuf_new_post_form" action="" enctype="multipart/form-data" method="POST"> <?php wp_nonce_field('wpuf-add-post'); ?> <ul class="wpuf-post-form"> <?php do_action('wpuf_add_post_form_top', $post_type); //plugin hook ?> <?php wpuf_build_custom_field_form('top'); ?> <?php if ($featured_image == 'yes') { ?> <?php if (current_theme_supports('post-thumbnails')) { ?> <li> <label for="post-thumbnail"><?php echo wpuf_get_option('ft_image_label', 'wpuf_frontend_posting', 'Featured Image'); ?> </label> <div id="wpuf-ft-upload-container"> <div id="wpuf-ft-upload-filelist"></div> <a id="wpuf-ft-upload-pickfiles" class="button" href="#"><?php echo wpuf_get_option('ft_image_btn_label', 'wpuf_frontend_posting', 'Upload Image'); ?> </a> </div> <div class="clear"></div> </li> <?php } else { ?> <div class="info"><?php _e('Your theme doesn\'t support featured image', 'wpuf'); ?> </div> <?php } ?> <?php } ?> <li> <label for="new-post-title"> <?php echo wpuf_get_option('title_label', 'wpuf_labels', 'Post Title'); ?> <span class="required">*</span> </label> <input class="requiredField" type="text" value="<?php echo $title; ?> " name="wpuf_post_title" id="new-post-title" minlength="2"> <div class="clear"></div> <p class="description"><?php echo stripslashes(wpuf_get_option('title_help', 'wpuf_labels')); ?> </p> </li> <?php if (wpuf_get_option('allow_cats', 'wpuf_frontend_posting', 'on') == 'on') { ?> <li> <label for="new-post-cat"> <?php echo wpuf_get_option('cat_label', 'wpuf_labels', 'Category'); ?> <span class="required">*</span> </label> <div class="category-wrap" style="float:left;"> <div id="lvl0"> <?php $exclude = wpuf_get_option('exclude_cats', 'wpuf_frontend_posting'); $cat_type = wpuf_get_option('cat_type', 'wpuf_frontend_posting', 'normal'); if ($cat_type == 'normal') { wp_dropdown_categories('show_option_none=' . __('-- Select --', 'wpuf') . '&hierarchical=1&hide_empty=0&orderby=name&name=category[]&id=cat&show_count=0&title_li=&use_desc_for_title=1&class=cat requiredField&exclude=' . $exclude); } else { if ($cat_type == 'ajax') { wp_dropdown_categories('show_option_none=' . __('-- Select --', 'wpuf') . '&hierarchical=1&hide_empty=0&orderby=name&name=category[]&id=cat-ajax&show_count=0&title_li=&use_desc_for_title=1&class=cat requiredField&depth=1&exclude=' . $exclude); } else { wpuf_category_checklist(0, false, 'category', $exclude); } } ?> </div> </div> <div class="loading"></div> <div class="clear"></div> <p class="description"><?php echo stripslashes(wpuf_get_option('cat_help', 'wpuf_labels')); ?> </p> </li> <?php } ?> <?php do_action('wpuf_add_post_form_description', $post_type); ?> <?php wpuf_build_custom_field_form('description'); ?> <li> <label for="new-post-desc"> <?php echo wpuf_get_option('desc_label', 'wpuf_labels', 'Post Content'); ?> <span class="required">*</span> </label> <?php $editor = wpuf_get_option('editor_type', 'wpuf_frontend_posting'); if ($editor == 'full') { ?> <div style="float:left;"> <?php wp_editor($description, 'new-post-desc', array('textarea_name' => 'wpuf_post_content', 'editor_class' => 'requiredField', 'teeny' => false, 'textarea_rows' => 8)); ?> </div> <?php } else { if ($editor == 'rich') { ?> <div style="float:left;"> <?php wp_editor($description, 'new-post-desc', array('textarea_name' => 'wpuf_post_content', 'editor_class' => 'requiredField', 'teeny' => true, 'textarea_rows' => 8)); ?> </div> <?php } else { ?> <textarea name="wpuf_post_content" class="requiredField" id="new-post-desc" cols="60" rows="8"><?php echo esc_textarea($description); ?> </textarea> <?php } } ?> <div class="clear"></div> <p class="description"><?php echo stripslashes(wpuf_get_option('desc_help', 'wpuf_labels')); ?> </p> </li> <?php do_action('wpuf_add_post_form_after_description', $post_type); $this->publish_date_form(); $this->expiry_date_form(); wpuf_build_custom_field_form('tag'); if (wpuf_get_option('allow_tags', 'wpuf_frontend_posting', 'on') == 'on') { ?> <li> <label for="new-post-tags"> <?php echo wpuf_get_option('tag_label', 'wpuf_labels', 'Tags'); ?> </label> <input type="text" name="wpuf_post_tags" id="new-post-tags" class="new-post-tags"> <p class="description"><?php echo stripslashes(wpuf_get_option('tag_help', 'wpuf_labels')); ?> </p> <div class="clear"></div> </li> <?php } do_action('wpuf_add_post_form_tags', $post_type); wpuf_build_custom_field_form('bottom'); ?> <li> <label> </label> <input class="wpuf_submit" type="submit" name="wpuf_new_post_submit" value="<?php echo esc_attr(wpuf_get_option('submit_label', 'wpuf_labels', 'Submit')); ?> "> <input type="hidden" name="wpuf_post_type" value="<?php echo $post_type; ?> " /> <input type="hidden" name="wpuf_post_new_submit" value="yes" /> </li> <?php do_action('wpuf_add_post_form_bottom', $post_type); ?> </ul> </form> </div> <?php } else { echo '<div class="info">' . $info . '</div>'; } }