</li> <li class=""><i class="fa fa-star-o"></i> </li> </ul> <input name="comment_rate" class="comment_rate" type="hidden"> </div>'; $comment_form['comment_field'] .= '<div class="form-group"> <label>' . st_get_language('review_title') . '</label> <input class="form-control" type="text" name="comment_title"> </div>'; $comment_form['comment_field'] .= '<div class="form-group"> <label>' . st_get_language('review_text') . '</label> <textarea name="comment" id="comment" class="form-control" rows="6"></textarea> </div> '; /* st update review without not login */ $comment_form_arg = apply_filters(get_post_type($item_id) . '_wp_review_form_args', $comment_form, $item_id); if (STReview::check_reviewable($item_id)) { echo '<div class="box bg-gray">'; comment_form($comment_form_arg); echo "</div>"; } if (STReview::check_reviewed($item_id)) { echo '<div class="box bg-gray">'; echo st_get_language('you_have_been_post_a_review') . ' ' . $title; echo '</div>'; } ?> </form> <?php }
function st_write_review() { if (STInput::request('write_review')) { if (!STInput::request('item_id')) { $user_url = st()->get_option('page_my_account_dashboard'); if ($user_url) { wp_safe_redirect(get_permalink($user_url)); } else { wp_safe_redirect(home_url()); } die; //wp_safe_redirect(); } else { if (!get_post_status(STInput::request('item_id'))) { $user_url = st()->get_option('page_my_account_dashboard'); if ($user_url) { wp_safe_redirect(get_permalink($user_url)); } else { wp_safe_redirect(home_url()); } die; } } } if (STInput::post() and STInput::post('comment_post_ID') and STInput::post('_wp_unfiltered_html_comment')) { if (wp_verify_nonce(STInput::post('st_user_write_review'), 'st_user_settings')) { global $current_user; $comment_data['comment_post_ID'] = STInput::post('comment_post_ID'); $comment_data['comment_author'] = $current_user->data->user_nicename; $comment_data['comment_author_email'] = $current_user->data->user_email; $comment_data['comment_content'] = STInput::post('comment'); $comment_data['comment_type'] = 'st_reviews'; $comment_data['user_id'] = $current_user->ID; if (STInput::post('item_id')) { $comment_data['comment_post_ID'] = STInput::post('item_id'); } if (STReview::check_reviewable(STInput::post('comment_post_ID'))) { $comment_id = wp_new_comment($comment_data); if ($comment_id) { update_comment_meta($comment_id, 'comment_title', STInput::post('comment_title')); if (STInput::post('comment_rate')) { update_comment_meta($comment_id, 'comment_rate', STInput::post('comment_rate')); } } wp_safe_redirect(get_permalink(STInput::post('comment_post_ID'))); die; } } } }