/** * Saves the term selected on the edit user/profile page in the admin. This function is triggered when the page * is updated. We just grab the posted data and use wp_set_object_terms() to save it. * * @param int $user_id The ID of the user to save the terms for. */ public function wepn_save_user_city_group_category($user_id) { if (!WEPN_Helper::check_user_role('vendor', $user_id)) { return; } global $wpdb; $company_name = esc_attr($_POST['company_name']); $company_id = get_user_meta($user_id, 'company', true); if ($company_id && is_numeric($company_id)) { wp_update_post(array('ID' => $company_id, 'post_title' => $company_name, 'post_author' => $user_id, 'post_type' => 'vendor', 'post_status' => 'publish')); } else { $company_id = $wpdb->get_var("SELECT ID FROM wp_posts WHERE post_title = '" . $company_name . "'"); if (!empty($company_name) && !$company_id) { $company_id = wp_insert_post(array('post_title' => $company_name, 'post_author' => $user_id, 'post_type' => 'vendor', 'post_status' => 'publish')); update_user_meta($user_id, 'company', $company_id); } } // Update Post Meta update_post_meta($company_id, 'vendor', $user_id); //Only administrator can change this section if (current_user_can('manage_options')) { $city = $_POST['city']; $group = $_POST['group']; $category = $_POST['category']; $group_slug = sanitize_title($group); $category_slug = sanitize_title($category); $other_categories = (array) (!empty($_POST['categories']) ? $_POST['categories'] : array()); // Remove existing post and term relatinships $old_tax = get_post_meta($company_id, 'city', true); wp_delete_object_term_relationships($company_id, $old_tax); if (!in_array($category, $other_categories)) { $other_categories = array_merge($other_categories, array($category)); } if (count($other_categories) > 0) { $terms = array(); foreach ($other_categories as $term_title) { if (empty($term_title)) { continue; } $term_slug = sanitize_title($term_title); if (!($term = term_exists($term_title, $city))) { $term = wp_insert_term($term_title, $city, array('slug' => $term_slug)); } if (!is_wp_error($term)) { $terms[] = $term['term_id']; } } wp_set_post_terms($company_id, $terms, $city, false); } // Update custom permalink update_post_meta($company_id, 'custom_permalink', $city . '/' . $group_slug . '/' . $category_slug . '/' . sanitize_title($company_name)); update_post_meta($company_id, 'region', $group_slug); update_post_meta($company_id, 'city', $city); update_post_meta($company_id, 'category', $category_slug); // Update user meta update_user_meta($user_id, 'city', $city); update_user_meta($user_id, 'group', $group_slug); update_user_meta($user_id, 'category', $category_slug); } }
/** * Template Name: Form Page * * @package WordPress * @subpackage Twenty_Fourteen * @since Twenty Fourteen 1.0 */ get_header(); ?> <div class="l-content-bg" style="background: url('<?php WEPN_Helper::background_image(get_field('page_background', get_the_ID())); ?> ') no-repeat"> <div class="container"> <div class="row"> <div class="col-md-9"> <div class="l-content-container"> <div class="page-header"> <div class="row">
public function wepn_venue_search_form() { ?> <form id="venueSearchForm" action="<?php echo home_url('/'); ?> " method="post" class="form"> <div class="row row-sm"> <div class="col-md-2"> <div class="form-group"> <?php $selected_post_code = isset($_REQUEST['post_code']) ? $_REQUEST['post_code'] : ''; $post_codes = get_field('post_codes', 'option'); $post_codes_array = explode("\r\n", $post_codes); if (count($post_codes_array) != 0) { echo '<select name="post_code" class="form-control">'; echo '<option value=""' . selected('', $selected_post_code) . '>-- Post Code --</option>'; foreach ($post_codes_array as $post_code) { $post_code = wp_strip_all_tags($post_code); echo '<option value="' . $post_code . '" ' . selected($post_code, $selected_post_code, false) . '>' . $post_code . '</option>'; } echo '<select>'; } ?> </div> </div> <div class="col-md-3"> <div class="form-group"> <?php WEPN_Helper::dropwdown_cities(); ?> </div> </div> <div class="col-md-2"> <div class="form-group"> <?php $selected_capacity = isset($_REQUEST['capacity']) ? $_REQUEST['capacity'] : ''; $capacities = get_field('capacity', 'option'); $capacities_array = explode("\r\n", $capacities); if (count($capacities_array) != 0) { echo '<select name="capacity" class="form-control">'; echo '<option value=""' . selected('', $selected_capacity) . '>-- Capacity --</option>'; foreach ($capacities_array as $capacity) { $capacity = wp_strip_all_tags($capacity); echo '<option value="' . $capacity . '" ' . selected($capacity, $selected_capacity, false) . '>' . $capacity . '</option>'; } echo '<select>'; } ?> </div> </div> <div class="col-md-3"> <div class="form-group"> <?php wp_dropdown_categories(array('taxonomy' => 'venue-category', 'name' => 'category', 'selected' => isset($_REQUEST['category']) ? $_REQUEST['category'] : '-1', 'hide_empty' => 0, 'class' => 'form-control', 'show_option_none' => '-- Select Category --', 'option_none_value' => '-1')); ?> </div> </div> <div class="col-md-2"> <input type="hidden" name="s" value=""> <input type="hidden" name="post_type" value="venue"> <button class="btn btn-secondary btn-block" ><?php _e('Search', 'atu'); ?> </button> </div> </div> </form> <?php }
$vendor_info = $user_id; $description = wp_trim_words(get_user_meta($user_id, 'description', true), $num_words = 16, $more = '...'); $image_id = get_user_meta($user_id, 'profile_image', true); $company_name = get_user_meta($user_id, 'company_name', true); ?> <li class="post-item"> <div class="post-img well-img"> <a href="<?php the_permalink(); ?> "> <img src="<?php echo WEPN_Helper::supplier_avatar($image_id, 'vendor-small-thumb'); ?> " /> </a> </div> <div class="post-core"> <a href="<?php the_permalink(); ?> " class="link"> <div class="post-title t-normal"><?php the_title();
<?php } ?> <?php if (of_get_option('video_diff', '')) { ?> <div class="widget"> <a href="#main_vid" role="button" data-toggle="modal" class="btn btn-primary btn-block mb-20"><span class="fa fa-play-circle icon-l-sm"></span> Why we are Different</a> </div> <?php } ?> <div class="widget widget-aside widget-list"> <div class="widget-header">Supplier Types</div> <?php WEPN_Helper::list_vendor_category(); ?> </div> <div class="widget widget-aside well-widget"> <div class="form form-labeled"> <div class="well-header">Subscribe to our Newsletter</div> <?php echo do_shortcode('[mc4wp_form]'); ?> </div> </div> </aside> </div> </div> </div> </div>
function your_custom_menu_item($items, $args) { if ($args->theme_location == 'primary') { if (count(WEPN_Helper::get_regions())) { $submenu = '<ul class="sub-menu"><li class="menu-item menu-item-type-custom menu-item-object-custom"><a href="' . get_permalink(492) . '">Become a Member</a></li>'; foreach (WEPN_Helper::get_regions() as $key => $val) { $submenu .= '<li class="menu-item menu-item-type-custom menu-item-object-custom">'; $submenu .= '<a href="' . home_url('/?s=®ion=' . $key . '&post_type=vendor') . '">' . $val . '</a></li>'; } $submenu .= '</ul>'; $items = str_replace('WEPN Groups</a>', 'WEPN Groups</a>' . $submenu, $items); } if (count(WEPN_Helper::city_lists())) { $submenu = '<ul class="sub-menu"><li class="menu-item menu-item-type-custom menu-item-object-custom"><a href="' . home_url('/suppliers/') . '">All Cities</a></li>'; foreach (WEPN_Helper::city_lists() as $key => $val) { $submenu .= '<li class="menu-item menu-item-type-custom menu-item-object-custom">'; $submenu .= '<a href="' . home_url('/?s=&city=' . $key . '&post_type=vendor') . '">' . $val . '</a></li>'; } $submenu .= '</ul>'; $items = str_replace('Event Suppliers</a>', 'Event Suppliers</a>' . $submenu, $items); $submenu = '<ul class="sub-menu"><li class="menu-item menu-item-type-custom menu-item-object-custom"><a href="' . home_url('/venue/') . '">All Cities</a></li>'; foreach (WEPN_Helper::city_lists() as $key => $val) { $submenu .= '<li class="menu-item menu-item-type-custom menu-item-object-custom">'; $submenu .= '<a href="' . home_url('/?s=&city=' . $key . '&post_type=venue') . '">' . $val . '</a></li>'; } $submenu .= '</ul>'; $items = str_replace('Venue Partners</a>', 'Venue Partners</a>' . $submenu, $items); } } return $items; }
/** * Get the single review via ajax * * @param array $reviewOptions * @param array $ratingFormArray * @param int $lastcommentid * @param bool $ajax * * @return array|string */ public static function build_user_rating_review_single($reviewOptions = array(), $ratingFormArray = array(), $lastcommentid, $ajax = false) { global $wpdb; $firstLabel = ''; $post_id = !empty($reviewOptions['post_id']) ? $reviewOptions['post_id'] : get_the_ID(); if (!empty($reviewOptions['form_id'])) { $ratingFormId = $reviewOptions['form_id']; } else { $defaultFormId = get_option('cbratingsystem_defaultratingForm'); $ratingFormId = apply_filters('rating_form_array', $defaultFormId); } if (is_string($reviewOptions['theme']) and !empty($reviewOptions['theme'])) { $theme_key = $reviewOptions['theme']; } else { $theme_key = 'basic'; } $reviews = CBRatingSystemData::get_user_ratings_with_ratingForm_lastID($lastcommentid, true); $output = $mainContent = ''; if (!empty($reviews[0])) { if (!empty($reviews) and is_array($reviews)) { $jsArray = array(); $shownReviews = 0; foreach ($reviews as $reviewKey => $review) { $mainContent .= '<div id="cbrating-' . $ratingFormId . '-review-' . $review->id . '" data-review-id="' . $review->id . '" data-post-id="' . $post_id . '" data-form-id="' . $ratingFormId . '" class="cbratingsinglerevbox reviews_wrapper_' . $theme_key . '_theme review_wrapper review_wrapper_post-' . $post_id . '_form-' . $ratingFormId . ' review_wrapper_post-' . $post_id . '_form-' . $ratingFormId . '_review-' . $review->id . '">'; $mainContent .= ' <div class="cbratingboxinner ' . $reviewOptions['comment_status'] . ' reviews_rating_' . $theme_key . '_theme review_rating review_rating_review-' . $review->id . '">'; if (!empty($review->rating) and is_array($review->rating)) { // User Details part. if ($review->user_id != 0) { $user_url = get_author_posts_url($review->user_id); //$name = get_the_author_meta( 'display_name', $review->user_id ); $name = get_user_meta($review->user_id, 'company_name', true); if (!empty($user_url) && $ratingFormArray['show_user_link_in_review'] == '1') { $name = '<a target="_blank" href="' . $user_url . '">' . $name . '</a>'; } $name = apply_filters('cbrating_edit_review_user_link', $name, $review->user_id); //finally check the settings if ($ratingFormArray['show_user_avatar_in_review'] == '1') { // $gravatar = get_avatar( $review->user_id, 36 ); $gravatar = '<img src="' . WEPN_Helper::supplier_avatar($review->user_id, 'vendor-small-thumb') . '" />'; } else { $gravatar = ''; } $gravatar = apply_filters('cbrating_edit_review_user_avatar', $gravatar, $review->user_id); $user_html = ' <p class="cbrating_user_name">' . (!empty($user_url) ? '<span class="user_gravatar">' . $gravatar . $name . '</span>' : '<span class="user_gravatar">' . $gravatar . $name . '</span>') . '</p>'; if (isset($ratingFormArray['buddypress_active']) && $ratingFormArray['buddypress_active'] == '1') { if (function_exists('bp_is_active')) { $rating_review_filtered_authorlink = apply_filters('cbratingsystem_buddypress_authorlink', array('show_image' => $ratingFormArray['show_user_avatar_in_review'], 'show_link' => $ratingFormArray['show_user_link_in_review'], 'review_user_id' => $review->user_id, 'user_html' => $user_html)); $user_html = $rating_review_filtered_authorlink['user_html']; } } } else { $user_url = ''; $name = !empty($review->user_name) ? $review->user_name : 'Anonymous'; if ($ratingFormArray['show_user_avatar_in_review'] == '1') { $gravatar = get_avatar(0, 36, 'gravatar_default'); } else { $gravatar = ''; } $user_html = ' <p class="cbrating_user_name">' . (!empty($user_url) ? '<span class="user_gravatar">' . $gravatar . $name . '</span>' : '<span class="user_gravatar">' . $gravatar . $name . '</span>') . '</p>'; } $user_html = apply_filters('cbrating_edit_review_user_info', $user_html, $review->user_id, $ratingFormArray, $reviewOptions, $review); $mainContent .= ' <div class="reviews_user_details_' . $theme_key . '_theme review_user_details"> ' . $user_html . ' <span class="user_rate_time"><a title="' . date('l, F d, Y \\a\\t j:ia', $review->created) . '" href="' . get_permalink($post_id) . '#cbrating-' . $ratingFormId . '-review-' . $review->id . '">' . CBRatingSystemFunctions::codeboxr_time_elapsed_string($review->created) . '</a></span> </div> <div class="clear" style="clear:both;"></div> '; // Criteria Display part. $mainContent .= '<div data-form-id="' . $ratingFormId . '" class="all_criteria_warpper_' . $theme_key . '_theme all-criteria-wrapper all-criteria-wrapper-form-' . $ratingFormId . '">'; foreach ($review->rating as $criteriId => $value) { if (is_numeric($criteriId)) { $value = $value / 100 * $review->rating[$criteriId . '_starCount']; $jsArray['review'][$review->id]['ratingForm'] = $ratingFormId; $jsArray['review'][$review->id]['criteria']['review_' . $review->id . '_criteria_' . $criteriId . '_value'] = $value; $jsArray['review'][$review->id]['criteria']['review_' . $review->id . '_criteria_' . $criteriId . '_count'] = $review->rating[$criteriId . '_starCount']; $jsArray['review'][$review->id]['criteria']['review_' . $review->id . '_criteria_' . $criteriId . '_redOnlyHint'] = $review->rating[$criteriId . '_stars'][$value - 1]; $jsArray['review'][$review->id]['criteria']['review_' . $review->id . '_criteria_' . $criteriId . '_hints'] = $review->rating[$criteriId . '_stars']; $imgtitle = ''; $hello = ''; $i = 0; $ratvalue = round($value); for (; $i < $ratvalue; $i++) { $hello .= '<img src="' . plugins_url('/images/star-on.png', __FILE__) . '" alt="' . $i . '" title="' . $imgtitle . '">'; } $whiteimg = $review->rating[$criteriId . '_starCount'] - $ratvalue; for ($j = 0; $j < $whiteimg; $j++) { $hello .= '<img src="' . plugins_url('/images/star-off.png', __FILE__) . '" alt="' . $j . '" title="' . $imgtitle . '">'; } $mainContent .= '<div data-form-id="' . $ratingFormId . '" data-criteria-id="' . $criteriId . '" class="criteria_warpper_' . $theme_key . '_theme criteria-wrapper criteria-id-wrapper-' . $criteriId . ' criteria-id-wrapper-' . $criteriId . '-form-' . $ratingFormId . ' "> <div class="criteria_label_warpper_' . $theme_key . '_theme criteria-label-wrapper"> <span class="criteria-label criteria-label-id-' . $criteriId . '" ><strong>' . __($review->custom_criteria[$criteriId]['label'], 'cbratingsystem') . '</strong></span> </div> <div id="criteria-star-wrapper-' . $review->id . '" data-form-id="' . $ratingFormId . '" data-criteria-id="' . $criteriId . '" class="criteria-star-wrapper criteria-star-wrapper-id-' . $firstLabel . ' criteria-star-wrapper-id-' . $criteriId . '-form-' . $ratingFormId . '"></div> <div class="readonly_criteria_average_label_' . $theme_key . '_theme readonly-criteria-average-label criteria-average-label-form-' . $ratingFormId . '-label-' . $criteriId . '"> <span class="starTitle">' . sanitize_text_field($review->rating[$criteriId . '_stars'][$value - 1]) . '</span> </div> </div>'; } } $mainContent .= '</div><div class="clear" style="clear:both;"></div>'; // Question Display part. $mainContent .= ' <div data-form-id="' . $ratingFormId . '" class="question_wrapper_' . $theme_key . '_theme question-wrapper question-wrapper-form-' . $ratingFormId . '">'; if (!empty($review->question) && is_array($review->question)) { foreach ($review->question as $questionId => $value) { $single_question = $review->custom_question[$questionId]; $type = $single_question['field']['type']; if (is_array($value)) { //$single_question = $review->custom_question[$questionId]; //$type = $single_question['field']['type']; $seperated = isset($fieldArr['seperated']) ? intval($fieldArr['seperated']) : 0; $fieldArr = $single_question['field'][$type]; $valuesText = array(); foreach ($value as $key => $val) { $valuesText[$review->id][$questionId][] = '<strong>' . __(stripcslashes($fieldArr[$key]['text']), 'cbratingsystem') . '</strong>'; } if (!empty($valuesText)) { $mainContent .= ' <div data-form-id="' . $ratingFormId . '" data-q-id="' . $questionId . '" class="question_id_wrapper_' . $theme_key . '_theme question-id-wrapper-' . $questionId . ' question-id-wrapper-' . $questionId . '-form-' . $ratingFormId . ' "> <div class="question_label_wrapper_' . $theme_key . '_theme question-label-wrapper"> <span class="question-label question-label-id-' . $questionId . '" >' . (isset($review->custom_question[$questionId]) ? __(stripslashes($review->custom_question[$questionId]['title']), 'cbratingsystem') : '') . '</span> <span class="question-label-hiphen">' . (isset($review->custom_question[$questionId]) ? ' - ' : '') . '</span> <span class="answer"><strong>' . implode(', ', $valuesText[$review->id][$questionId]) . '</strong></span> </div> </div> '; } } else { /*$type = $review->custom_question['enabled'][$questionId]['field']['type']; $fieldArr = $review->custom_question['enabled'][$questionId]['field'][$type]; $seperated = $fieldArr['seperated'];*/ //$single_question = $review->custom_question[$questionId]; $seperated = isset($single_question['field']['type']['seperated']) ? intval($single_question['field']['type']['seperated']) : 0; //$type = $single_question['field']['type']; if ($seperated == 0) { if ($type == 'text') { $mainContent .= ' <div data-form-id="' . $ratingFormId . '" data-q-id="' . $questionId . '" class="question_id_wrapper_' . $theme_key . '_theme question-id-wrapper-' . $questionId . ' question-id-wrapper-' . $questionId . '-form-' . $ratingFormId . ' "> <div class="question_label_wrapper_' . $theme_key . '_theme question-label-wrapper"> <span class="question-label question-label-id-' . $questionId . '" >' . (isset($review->custom_question[$questionId]) ? __(stripslashes($review->custom_question[$questionId]['title']), 'cbratingsystem') : '') . '</span> <span class="question-label-hiphen">' . (isset($review->custom_question[$questionId]) ? ' - ' : '') . '</span> <span class="answer"><strong>' . $value . '</strong></span> </div> </div>'; } else { $fieldArr = $single_question['field'][$type]; $mainContent .= ' <div data-form-id="' . $ratingFormId . '" data-q-id="' . $questionId . '" class="question_id_wrapper_' . $theme_key . '_theme question-id-wrapper-' . $questionId . ' question-id-wrapper-' . $questionId . '-form-' . $ratingFormId . ' "> <div class="question_label_wrapper_' . $theme_key . '_theme question-label-wrapper"> <span class="question-label question-label-id-' . $questionId . '" >' . (isset($review->custom_question[$questionId]) ? __(stripslashes($review->custom_question[$questionId]['title']), 'cbratingsystem') : '') . '</span> <span class="question-label-hiphen">' . (isset($review->custom_question[$questionId]) ? ' - ' : '') . '</span> <span class="answer"><strong>' . ($value == 1 ? __('Yes', 'cbratingsystem') : __('No', 'cbratingsystem')) . '</strong></span> </div> </div>'; } } } //end of else } //end of foreach } $mainContent .= ' </div> <div class="clear" style="clear:both;"></div>'; // Comment Display part if (!empty($review->comment) and is_string($review->comment)) { $comment = CBRatingSystemFunctions::text_summary_mapper($review->comment); /* if ( is_array( $comment ) && ! empty( $comment['summury'] ) && isset( $comment['rest'] ) ) { $comment_output = ' <p class="comment"> ' . stripslashes( $comment['summury'] ) . ( ! empty( $comment['rest'] ) ? ' <span style="display:none;" class="read_more_paragraph disable_field">' . $comment['rest'] . '</span>' : '' ) . '</p> <a href="#" class="js_read_link read_more"> ...More</a>'; } else { $comment_output = '<p class="comment">' . stripslashes($comment['summury']) . '</p>'; } */ $comment_output = '<p class="comment">' . stripslashes($review->comment) . '</p>'; if ($reviewOptions['comment_status'] != 'approved') { if ($reviewOptions['comment_status'] == 'unverified') { $review_status = 'Your comment is' . $reviewOptions['comment_status'] . '[please check your mail to verify]'; } else { $review_status = $reviewOptions['comment_status']; } $mainContent .= '<div class="review_user_rating_comment_' . $theme_key . '_theme review_user_rating_comment"> <strong>Comment : </strong> ' . $comment_output . ' (' . $review_status . ')' . ' </div> <div class="clear" style="clear:both;"></div> '; } else { $mainContent .= '<div class="review_user_rating_comment_' . $theme_key . '_theme review_user_rating_comment"> <strong>Comment : </strong> ' . $comment_output . ' </div> <div class="clear" style="clear:both;"></div> '; } } } // end if ( ! empty( $review->rating ) and is_array( $review->rating ) ) $mainContent .= '</div>'; $mainContent .= '</div><div class="clear" style="clear:both;"></div>'; $shownReviews++; } // end foreach $output .= $mainContent; } // end if ( ! empty( $reviews ) and is_array( $reviews ) ) $jsSettings = self::front_end_review_js_settings($reviews, $jsArray, $post_id, $ajax); $output .= '<script type="text/javascript">' . $jsSettings . '</script>'; if ($ajax === true) { return array('html' => $mainContent . '<script type="text/javascript">' . $jsSettings . '</script>'); } $output = array($output, $review); return $output; } // end empty( $reviews[0] }
" class="btn btn-primary btn-block mb-20">Become a Member</a> </div> <?php } ?> <div class="widget widget-aside"> <div class="ven-avatar" style="border: 2px solid <?php echo hex2rgba(get_field('color')); ?> "> <img src="<?php echo WEPN_Helper::venue_avatar(get_post_thumbnail_id(), 'img-avatar'); ?> " /> <div class="ven-name" style="background-color: <?php echo hex2rgba(get_field('color'), 0.5); ?> "><?php the_title(); ?> </div> </div> </div>
private function get_fields() { $fields = array(array('type' => 'form', 'action' => '#', 'method' => 'post', 'attributes' => array('class' => 'form form-labeled'), 'id' => 'registrationForm'), array('title' => __('User Type', 'atu'), 'type' => 'select', 'id' => 'role', 'attributes' => array('class' => 'form-control'), 'required' => true, 'value' => '', 'default' => '0', 'options' => array('vendor' => 'Vendor', 'venue' => 'Venue')), array('title' => __('Username', 'atu'), 'type' => 'text', 'id' => 'username', 'placeholder' => '', 'attributes' => array('class' => 'form-control'), 'required' => true, 'value' => $this->get_post_value('username'), 'default' => ''), array('title' => __('Password', 'atu'), 'type' => 'password', 'id' => 'password', 'attributes' => array('class' => 'form-control'), 'placeholder' => '', 'required' => true, 'value' => $this->get_post_value('password'), 'default' => ''), array('title' => __('Confirm Password'), 'type' => 'password', 'id' => 'password_confirmation', 'attributes' => array('class' => 'form-control'), 'placeholder' => '', 'required' => true, 'value' => $this->get_post_value('password_confirmation'), 'default' => ''), array('title' => __('Email', 'atu'), 'type' => 'email', 'id' => 'email', 'attributes' => array('class' => 'form-control'), 'placeholder' => '', 'required' => true, 'value' => $this->get_post_value('email'), 'default' => ''), array('title' => __('Phone', 'atu'), 'type' => 'text', 'id' => 'phone', 'attributes' => array('class' => 'form-control'), 'placeholder' => '', 'value' => $this->get_post_value('phone'), 'default' => ''), array('title' => __('Mobile', 'atu'), 'type' => 'text', 'id' => 'mobile', 'attributes' => array('class' => 'form-control'), 'placeholder' => '', 'value' => $this->get_post_value('mobile'), 'default' => ''), array('title' => __('Website', 'atu'), 'type' => 'url', 'id' => 'website', 'attributes' => array('class' => 'form-control'), 'placeholder' => '', 'value' => $this->get_post_value('website'), 'default' => ''), array('title' => __('Company Name', 'atu'), 'type' => 'text', 'id' => 'company_name', 'attributes' => array('class' => 'form-control'), 'placeholder' => '', 'required' => true, 'value' => $this->get_post_value('company_name'), 'default' => ''), array('title' => __('Description', 'atu'), 'type' => 'textarea', 'id' => 'description', 'attributes' => array('class' => 'form-control', 'rows' => 3, 'cols' => 50), 'placeholder' => '', 'required' => true, 'value' => $this->get_post_value('description'), 'default' => ''), array('title' => __('First Name', 'atu'), 'type' => 'text', 'id' => 'first_name', 'attributes' => array('class' => 'form-control'), 'placeholder' => '', 'required' => true, 'value' => $this->get_post_value('first_name'), 'default' => ''), array('title' => __('Last Name', 'atu'), 'type' => 'text', 'id' => 'last_name', 'attributes' => array('class' => 'form-control'), 'placeholder' => '', 'required' => true, 'value' => $this->get_post_value('last_name'), 'default' => ''), array('title' => __('City', 'atu'), 'type' => 'select', 'id' => 'city', 'attributes' => array('class' => 'form-control'), 'required' => true, 'value' => '', 'default' => '0', 'options' => WEPN_Helper::city_lists()), array('title' => __('Region', 'atu'), 'type' => 'select', 'id' => 'group', 'attributes' => array('class' => 'form-control'), 'required' => true, 'value' => '', 'default' => '0', 'options' => WEPN_Helper::region_lists()), array('title' => __('Category', 'atu'), 'type' => 'select', 'id' => 'category', 'attributes' => array('class' => 'form-control'), 'required' => true, 'value' => '', 'default' => '0', 'options' => WEPN_Helper::category_list()), array('title' => __('Other Categories', 'atu'), 'type' => 'select', 'id' => 'categories[]', 'attributes' => array('class' => 'form-control', 'multiple' => true), 'required' => true, 'value' => '', 'default' => '0', 'options' => WEPN_Helper::category_list()), array('title' => __('Register', 'atu'), 'type' => 'button', 'id' => 'register', 'attributes' => array('class' => 'btn btn-primary btn-block btn-lg'), 'button_type' => 'submit', 'value' => 'register'), array('type' => 'nonce_field', 'id' => 'wepn_registration_nonce_field', 'action' => 'wepn_registration'), array('type' => 'hidden', 'id' => 'registration_code', 'value' => self::get_current_code(), 'default' => ''), array('type' => 'form-end', 'id' => 'registrationForm')); return $fields; }
/** * Returns Reviews Html Output * * @param array $reviewOptions * @param array $ratingFormArray * @param boolean $ajax * * @return string */ public static function build_user_rating_review($reviewOptions = array(), $ratingFormArray = array(), $ajax = false) { global $wpdb; $postID = isset($reviewOptions['post_id']) ? $reviewOptions['post_id'] : get_the_ID(); $postID = (int) $postID; $post = get_post($postID); if (in_array($post->post_type, $ratingFormArray['post_types'])) { if (!empty($reviewOptions['form_id'])) { $form_id = $reviewOptions['form_id']; } else { $defaultFormId = get_option('cbratingsystem_defaultratingForm'); $form_id = apply_filters('rating_form_array', $defaultFormId); } $form_id = (int) $form_id; if (!isset($reviewOptions['limit']['perpage'])) { // As we only need to get this ratingFormArray from DB to get the offset value. $ratingFormArray = CBRatingSystemData::get_ratingForm($form_id); } if (is_string($reviewOptions['theme']) and !empty($reviewOptions['theme'])) { $theme_key = $reviewOptions['theme']; } else { $theme_key = get_option('cbratingsystem_theme_key'); } $page = isset($reviewOptions['limit']['page']) ? $reviewOptions['limit']['page'] : 1; if ($page <= 0) { $page = 1; } $perpage = isset($reviewOptions['limit']['perpage']) ? $reviewOptions['limit']['perpage'] : $ratingFormArray['review_limit']; //$start = isset( $reviewOptions['limit']['start'] ) ? $reviewOptions['limit']['start']: (($page -1)*$perpage) ; //let's confirm the limit array once again $reviewOptions['limit']['page'] = $page; $reviewOptions['limit']['perpage'] = $perpage; //$reviewOptions['limit']['start'] = $start; $totalLimit = $wpdb->get_var("SELECT per_post_rating_count AS count FROM " . $wpdb->prefix . "cbratingsystem_ratings_summary WHERE form_id='{$form_id}' AND post_id='{$postID}'"); $reviews = array(); if ($totalLimit > $perpage) { $showLoadMoreButton = true; $reviews = CBRatingSystemData::get_user_ratings_with_ratingForm(array($form_id), array($postID), array(), '', 'time', 'DESC', $reviewOptions['limit'], true); } else { $showLoadMoreButton = false; $reviews = CBRatingSystemData::get_user_ratings_with_ratingForm(array($form_id), array($postID), array(), '', 'time', 'DESC', array(), true); } $output = $mainContent = ''; $jsArray = array(); $shownReviews = 0; $review_output = ''; if (!empty($reviews[0])) { //$output .= '<h3 id="cbratingfrom_reviews_title-'.$form_id.'" class="cbratingfrom_reviews_title">' .sprintf( __( "Reviews (%d)", 'cbratingsystem' ), $totalLimit) . '</h3>'; $review_heading = '<h3 id="cbratingfrom_reviews_title-' . $form_id . '" class="cbratingfrom_reviews_title">' . sprintf(__("Reviews (%d)", 'cbratingsystem'), $totalLimit) . '</h3>'; $review_output .= '<div id="reviews_container_' . $postID . '" data-post-id="' . $postID . '" data-form-id="' . $form_id . '" class="reviews_container reviews_container_' . $theme_key . '_theme reviews_container_post-' . $postID . '_form-' . $form_id . ' ">'; $review_output .= '<div data-post-id="' . $postID . '" data-form-id="' . $form_id . '" class="reviews_container_div_' . $theme_key . '_theme reviews_container_div reviews_container_div_post-' . $postID . '_form-' . $form_id . ' ">'; //$shownReviews = 0; if (!empty($reviews) && is_array($reviews)) { //$shownReviews = 0; //var_dump('manchu man'); //review loop foreach ($reviews as $reviewKey => $review) { /*echo '<pre>'; print_r($review); echo '</pre>';*/ $comment_status = self::check_cpmment_status($review->comment_status, $review->user_session, $review->user_ip); $show_reviews_user = self::check_permission($ratingFormArray['comment_view_allowed_users'], $review->user_session, $review->user_ip); if ($show_reviews_user && $comment_status) { //$output .= '<a name="cbrating-'.$form_id.'-review-'.$review->id.'" id="cbrating-'.$form_id.'-review-'.$review->id.'"></a>'; $mainContent .= '<div itemprop="review" itemscope itemtype="http://schema.org/Review" id="cbrating-' . $form_id . '-review-' . $review->id . '" data-review-id="' . $review->id . '" data-post-id="' . $postID . '" data-form-id="' . $form_id . '" class="reviews_wrapper_' . $theme_key . '_theme review_wrapper review_wrapper_post-' . $postID . '_form-' . $form_id . ' review_wrapper_post-' . $postID . '_form-' . $form_id . '_review-' . $review->id . '">'; $mainContent .= ' <div class="reviews_rating_' . $theme_key . '_theme review_rating review_rating_review-' . $review->id . '">'; if (!empty($review->rating) and is_array($review->rating)) { // User Details part. if ($review->user_id != 0) { $user_url = get_author_posts_url($review->user_id); //$name = get_the_author_meta( 'display_name', $review->user_id ); $name = get_user_meta($review->user_id, 'company_name', true); if (!empty($user_url) && $ratingFormArray['show_user_link_in_review'] == '1') { $name = '<a target="_blank" href="' . $user_url . '">' . $name . '</a>'; } //finally check the settings if ($ratingFormArray['show_user_avatar_in_review'] == '1') { // $gravatar = get_avatar( $review->user_id, 36 ); $gravatar = '<img src="' . WEPN_Helper::supplier_avatar($review->user_id, 'vendor-small-thumb') . '" />'; //wp_get_attachment_image( get_user_meta( $review->user_id, 'profile_image', true ), 'vendor-small-thumb' ); } else { $gravatar = ''; } $name = apply_filters('cbrating_edit_review_user_link', $name, $review->user_id); $gravatar = apply_filters('cbrating_edit_review_user_avatar', $gravatar, $review->user_id); $user_html = !empty($user_url) ? '<span itemprop="author" itemscope itemtype="http://schema.org/Person" class="user_gravatar">' . $gravatar . '<span itemprop="name">' . $name . '</span>' . '</span>' : '<span itemprop="author" itemscope itemtype="http://schema.org/Person" class="user_gravatar">' . $gravatar . '<span itemprop="name">' . $name . '</span>' . '</span>'; if (isset($ratingFormArray['buddypress_active']) && intval($ratingFormArray['buddypress_active'])) { if (function_exists('bp_is_active')) { $rating_review_filtered_authorlink = apply_filters('cbratingsystem_buddypress_authorlink', array('show_image' => $ratingFormArray['show_user_avatar_in_review'], 'show_link' => $ratingFormArray['show_user_link_in_review'], 'review_user_id' => $review->user_id, 'user_html' => $user_html)); $user_html = $rating_review_filtered_authorlink['user_html']; } } } else { $user_url = ''; $name = !empty($review->user_name) ? $review->user_name : __('Anonymous', 'cbratingsystem'); if ($ratingFormArray['show_user_avatar_in_review'] == '1') { // $gravatar = get_avatar( 0, 36, 'gravatar_default' ); //$gravatar = wp_get_attachment_image( get_user_meta( $review->user_id, 'profile_image', true ), 'vendor-small-thumb' ); $gravatar = '<img src="' . WEPN_Helper::supplier_avatar($review->user_id, 'vendor-small-thumb') . '" />'; } else { $gravatar = ''; } $user_html = !empty($user_url) ? '<span class="user_gravatar">' . $gravatar . $name . '</span>' : '<span class="user_gravatar">' . $gravatar . $name . '</span>'; } $modified_review = (array) $review; $user_html = apply_filters('cbrating_edit_review_user_info', $user_html, $review->user_id, $ratingFormArray, $modified_review, $review); $mainContent .= ' <div class="reviews_user_details_' . $theme_key . '_theme review_user_details"> <p class="cbrating_user_name">' . $user_html . '<span class="user_rate_value" itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating" title="' . sprintf(__('Rated %s out of 5', 'cbratingsystem'), $review->average / 100 * 5) . '"> ( <span itemprop="ratingValue">' . $review->average / 100 * 5 . '</span> ' . __('out of', 'cbratingsystem') . ' <span itemprop="bestRating">5</span> ) </span>' . '</p>' . '<span class="user_rate_time"><a title="' . date('l, F d, Y \\a\\t j:ia', $review->created) . '" href="' . get_permalink($postID) . '#cbrating-' . $form_id . '-review-' . $review->id . '">' . CBRatingSystemFunctions::codeboxr_time_elapsed_string($review->created) . '</a></span> </div> <div class="clear" style="clear:both;"></div> '; /*$mainContent .='<div itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating" class="star-rating" title="'. sprintf( __( 'Rated %s out of 5', 'cbratingsystem' ), ( ( $review->average / 100 ) * 5 ) ) .'"> <span ><strong itemprop="ratingValue">'.( ( $review->average / 100 ) * 5 ).'</strong> '. __( 'out of 5', 'cbratingsystem' ) .'</span> </div>';*/ $mainContent .= ' <div data-form-id="' . $form_id . '" class="all-criteria-wrapper all_criteria_warpper_' . $theme_key . '_theme all-criteria-wrapper-form-' . $form_id . ' all-criteria-wrapper-form-' . $form_id . $theme_key . '_theme">'; foreach ($review->rating as $criteriId => $value) { if (is_numeric($criteriId)) { $firstLabel = ''; $value = $value / 100 * $review->rating[$criteriId . '_starCount']; $jsArray['review'][$review->id]['ratingForm'] = $form_id; $jsArray['review'][$review->id]['criteria']['review_' . $review->id . '_criteria_' . $criteriId . '_value'] = $value; $jsArray['review'][$review->id]['criteria']['review_' . $review->id . '_criteria_' . $criteriId . '_count'] = $review->rating[$criteriId . '_starCount']; $jsArray['review'][$review->id]['criteria']['review_' . $review->id . '_criteria_' . $criteriId . '_redOnlyHint'] = $review->rating[$criteriId . '_stars'][$value - 1]; $jsArray['review'][$review->id]['criteria']['review_' . $review->id . '_criteria_' . $criteriId . '_hints'] = $review->rating[$criteriId . '_stars']; $mainContent .= '<div data-form-id="' . $form_id . '" data-criteria-id="' . $criteriId . '" class="criteria_warpper_' . $theme_key . '_theme criteria-wrapper criteria-id-wrapper-' . $criteriId . ' criteria-id-wrapper-' . $criteriId . '-form-' . $form_id . ' "> <div class="criteria_label_warpper_' . $theme_key . '_theme criteria-label-wrapper"> <span class="criteria-label criteria-label-id-' . $criteriId . '" ><strong>' . __($review->custom_criteria[$criteriId]['label'], 'cbratingsystem') . '</strong></span> </div> <div data-form-id="' . $form_id . '" data-criteria-id="' . $criteriId . '" class="criteria-star-wrapper criteria-star-wrapper-id-' . $firstLabel . ' criteria-star-wrapper-id-' . $criteriId . '-form-' . $form_id . '" id="criteria-star-wrapper-' . $review->id . '"></div> <div class="readonly_criteria_average_label_' . $theme_key . '_theme readonly-criteria-average-label criteria-average-label-form-' . $form_id . '-label-' . $criteriId . '"> <span class="starTitle">' . sanitize_text_field($review->rating[$criteriId . '_stars'][$value - 1]) . '</span> </div> </div> '; } } $mainContent .= '</div> <div class="clear" style="clear:both;"></div>'; //////////////////////////////////////////////// // Question Display part. $mainContent .= '<div data-form-id="' . $form_id . '" class="question_wrapper_' . $theme_key . '_theme question-wrapper question-wrapper-form-' . $form_id . '">'; if (!empty($review->question) && is_array($review->question)) { foreach ($review->question as $questionId => $question) { $single_question = $review->custom_question[$questionId]; $type = $single_question['field']['type']; if (is_array($question)) { $fieldArr = $single_question['field'][$type]; $seperated = isset($fieldArr['seperated']) ? intval($fieldArr['seperated']) : 0; $valuesText = array(); foreach ($question as $key => $val) { $valuesText[$review->id][$questionId][] = '<strong>' . __(stripcslashes($fieldArr[$key]['text']), 'cbratingsystem') . '</strong>'; } if (!empty($valuesText)) { $mainContent .= ' <div data-form-id="' . $form_id . '" data-q-id="' . $questionId . '" class="question_id_wrapper_' . $theme_key . '_theme question-id-wrapper-' . $questionId . ' question-id-wrapper-' . $questionId . '-form-' . $form_id . ' "> <div class="question_label_wrapper_' . $theme_key . '_theme question-label-wrapper"> <span class="question-label question-label-id-' . $questionId . '" >' . (isset($review->custom_question[$questionId]) ? __(stripslashes($review->custom_question[$questionId]['title']), 'cbratingsystem') : '') . '</span> <span class="question-label-hiphen">' . (isset($review->custom_question[$questionId]) ? ' - ' : '') . '</span> <span class="answer"><strong>' . implode(', ', $valuesText[$review->id][$questionId]) . '</strong></span> </div> </div>'; } } else { $seperated = isset($single_question['field'][$type]['seperated']) ? intval($single_question['field'][$type]['seperated']) : 0; //either checkbox single select or text area if ($seperated == 0) { if ($type == 'text') { $mainContent .= ' <div data-form-id="' . $form_id . '" data-q-id="' . $questionId . '" class="question_id_wrapper_' . $theme_key . '_theme question-id-wrapper-' . $questionId . ' question-id-wrapper-' . $questionId . '-form-' . $form_id . ' "> <div class="question_label_wrapper_' . $theme_key . '_theme question-label-wrapper"> <span class="question-label question-label-id-' . $questionId . '" >' . (isset($review->custom_question[$questionId]) ? __(stripslashes($review->custom_question[$questionId]['title']), 'cbratingsystem') : '') . '</span> <span class="question-label-hiphen">' . (isset($review->custom_question[$questionId]) ? ' - ' : '') . '</span> <span class="answer"><strong>' . $question . '</strong></span> </div> </div>'; } else { //$fieldArr = $single_question['field'][$type]; $mainContent .= ' <div data-form-id="' . $form_id . '" data-q-id="' . $questionId . '" class="question_id_wrapper_' . $theme_key . '_theme question-id-wrapper-' . $questionId . ' question-id-wrapper-' . $questionId . '-form-' . $form_id . ' "> <div class="question_label_wrapper_' . $theme_key . '_theme question-label-wrapper"> <span class="question-label question-label-id-' . $questionId . '" >' . (isset($review->custom_question[$questionId]) ? __(stripslashes($review->custom_question[$questionId]['title']), 'cbratingsystem') : '') . '</span> <span class="question-label-hiphen">' . (isset($review->custom_question[$questionId]) ? ' - ' : '') . '</span> <span class="answer"><strong>' . ($question == 1 ? __("Yes", 'cbratingsystem') : __("No", 'cbratingsystem')) . '</strong></span> </div> </div>'; } } } } //end each single question loop } $mainContent .= ' </div> <div class="clear" style="clear:both;"></div>'; /////////////////////////////////////////// // Comment Display part if (!empty($review->comment) && is_string($review->comment)) { //$comment = CBRatingSystemFunctions :: text_summary_mapper( $review->comment ); $comment = $review->comment; //$comment_output = '<p class="comment">' . htmlspecialchars($comment). '</p>'; $comment_output = '<p itemprop="reviewBody" class="comment">' . stripslashes($comment) . '</p>'; $mainContent .= '<div class="review_user_rating_comment_' . $theme_key . '_theme review_user_rating_comment"> <strong>Comment : </strong> ' . $comment_output; if ($review->comment_status != 'approved') { $mainContent .= '<br> <strong>Comment Status : </strong> ' . ucfirst($review->comment_status) . ' </div> <div class="clear" style="clear:both;"></div> '; } else { $mainContent .= ' </div> <div class="clear" style="clear:both;"></div> '; } } ////////////////////////////////////////////////// } $mainContent .= '</div>'; $mainContent .= '</div> <div class="clear" style="clear:both;"></div>'; $shownReviews++; } // end of if approved } //end for each review $review_output .= $mainContent; } $review_output .= '</div>'; $review_output .= '</div>'; if ($shownReviews > 0) { $output .= $review_heading; } $output .= $review_output; //add the //var_dump($form_id); if ($showLoadMoreButton === true) { //$output .= "<div class=\"load_more_button_".$theme_key."_theme load_more_button load_more_button_form-" . $form_id . "_post-$postID\" data-form-id=\"$form_id\" data-post-id=\"$postID\" data-offset=\"$offset\" data-start=\"$start\" data-end=\"$currentOffset\" clickable=\"true\">"; $output .= '<p class="cbratingload_more_button load_more_button load_more_button_' . $theme_key . '_theme load_more_button_form-' . $form_id . '_post-' . $postID . '" >'; //$output .= '<a href="#" data-form-id="'.$form_id.'" data-post-id="'.$postID.'" data-page="'.$page.'" data-perpage="'.$perpage.'" data-start="'.$start.'" clickable="true">'.__( 'Load More', 'cbratingsystem' ); $output .= '<a href="#" data-form-id="' . $form_id . '" data-post-id="' . $postID . '" data-page="' . $page . '" data-perpage="' . $perpage . '" clickable="true">' . __('Load More', 'cbratingsystem'); $output .= '<span style="display:none;" class="cbrating_waiting_icon cbrating_waiting_icon_form-' . $form_id . '_post-' . $postID . '"><img alt="' . __("Loading", 'cbratingsystem') . '" src="' . CB_RATINGSYSTEM_PLUGIN_DIR_URL . 'images/ajax-loader.gif" /></span>'; $output .= '<input type="hidden" id="cb_ratingForm_front_review_nonce_field" value="' . wp_create_nonce('cb_ratingForm_front_review_nonce_field') . '" />'; $output .= '</a>'; $output .= "</p>"; $output .= '<div class="ratingFormReviewStatus ratingFormReviewStatus_' . $theme_key . '_theme ratingFormReviewStatus-review-form-' . $form_id . '"></div>'; } //$output .= '</div>';//this is the error } $jsSettings = self::front_end_review_js_settings($reviews, $jsArray, $postID, $ajax); $output .= '<script type="text/javascript">' . $jsSettings . '</script>'; $totalpages = ceil($totalLimit / $perpage); //var_dump($totalpages); if ($ajax === true) { return array('html' => $mainContent . '<script type="text/javascript">' . $jsSettings . '</script>', 'page' => $page, 'perpage' => $perpage, 'isFinished' => $page >= $totalpages ? '1' : '0'); } return $output; } else { return ''; } }
</div> <?php // End the loop. } // If no content, include the "No posts found" template. } else { get_template_part('content', 'none'); } ?> </div> </div> <?php global $wp_query; WEPN_Helper::wepn_pagination($wp_query->max_num_pages); ?> </div> </div> </div> <div class="col-md-3"> <aside class="l-sidebar"> <?php if (!is_user_logged_in()) { ?> <div class="widget"> <a href="<?php echo wp_login_url(); ?> " class="btn btn-primary btn-block">Member Login</a>
</div> <?php } ?> <div class="widget widget-aside"> <div class="ven-avatar" style="border: 2px solid <?php echo hex2rgba($user_info->color); ?> "> <img src="<?php echo WEPN_Helper::supplier_avatar($user_info->profile_image, 'img-avatar'); ?> " /> <div class="ven-name"style="background-color:<?php echo hex2rgba($user_info->color, 0.5); ?> "><?php echo $user_info->first_name; ?> </div> </div> </div>
<ul class="post-inline-sm"> <?php while ($wp_venue_query->have_posts()) { $wp_venue_query->the_post(); $cat = get_term_by('id', get_field('main_category', get_the_ID()), 'venue-category'); $cat_name = !empty($cat) && !is_wp_error($cat) ? $cat->name : get_the_title(); ?> <li class="post-item"> <div class="post-img"> <a href="<?php the_permalink(); ?> "> <img src="<?php echo WEPN_Helper::venue_avatar(get_post_thumbnail_id(), 'venue-xs-small-thumb'); ?> " /> </a> </div> <div class="post-core"> <div class="post-title"><a href="<?php the_permalink(); ?> " class="link"><?php echo content(get_the_title(), 4); ?> </a></div> <p><?php echo $cat_name; ?>