function PricerrTheme_user_reviews_scr() { $id_icon = 'icon-options-general-rev'; $ttl_of_stuff = 'PricerrTheme - ' . __('User Reviews', 'PricerrTheme'); global $wpdb; //------------------------------------------------------ echo '<div class="wrap">'; echo '<div class="icon32" id="' . $id_icon . '"><br/></div>'; echo '<h2 class="my_title_class_sitemile">' . $ttl_of_stuff . '</h2>'; ?> <div id="usual2" class="usual"> <ul> <li><a href="#tabs1"><?php _e('All User Reviews', 'PricerrTheme'); ?> </a></li> <li><a href="#tabs2"><?php _e('Search User', 'PricerrTheme'); ?> </a></li> <!-- <li><a href="#tabs3"><?php _e('Search Job', 'PricerrTheme'); ?> </a></li> --> </ul> <div id="tabs1"> <?php $s = "select * from " . $wpdb->prefix . "job_ratings where awarded>0 order by id desc"; $r = $wpdb->get_results($s); if (count($r) > 0) { ?> <table class="widefat post fixed" cellspacing="0"> <thead> <tr> <th><?php _e('User', 'PricerrTheme'); ?> </th> <th><?php _e('Job', 'PricerrTheme'); ?> </th> <th><?php _e('Price', 'PricerrTheme'); ?> </th> <th><?php _e('Rating Type', 'PricerrTheme'); ?> </th> <th><?php _e('Description', 'PricerrTheme'); ?> </th> <th><?php _e('Awarded On', 'PricerrTheme'); ?> </th> <th><?php _e('Options', 'PricerrTheme'); ?> </th> </tr> </thead> <tbody> <?php foreach ($r as $row) { $s_ql = "select * from " . $wpdb->prefix . "job_orders where id='" . $row->orderid . "'"; $r_ql = $wpdb->get_results($s_ql); $post = get_post($r_ql[0]->pid); $userdata = get_userdata($post->post_author); $pid = $r_ql[0]->pid; echo '<tr>'; echo '<th>' . $userdata->user_login . '</th>'; echo '<th>' . pricerrtheme_get_show_price(get_post_meta($r_ql[0]->pid, 'price', true)) . '</th>'; echo '<th><a href="' . get_permalink($pid) . '">' . PricerrTheme_wrap_the_title($post->post_title, $pid) . '</a></th>'; echo '<th>' . PricerrTheme_show_stars_our_of_number($row->grade) . '</th>'; echo '<th>' . $row->reason . '</th>'; echo '<th>' . date('d-M-Y H:i:s', $row->datemade) . '</th>'; echo '<th>#</th>'; echo '</tr>'; } ?> </tbody> </table> <?php } else { ?> <div class="padd101"> <?php _e('There are no user feedback.', 'PricerrTheme'); ?> </div> <?php } ?> </div> <div id="tabs2"> <form method="get" action="<?php bloginfo('siteurl'); ?> /wp-admin/admin.php"> <input type="hidden" value="usrrev" name="page" /> <input type="hidden" value="tabs2" name="active_tab" /> <table width="100%" class="sitemile-table"> <tr> <td><?php _e('Search User', 'PricerrTheme'); ?> </td> <td><input type="text" value="<?php echo $_GET['search_user']; ?> " name="search_user" size="20" /> <input type="submit" name="PricerrTheme_save2" value="<?php _e('Search', 'PricerrTheme'); ?> "/></td> </tr> </table> </form> <?php $user = trim($_GET['search_user']); $user = get_userdatabylogin($user); $uid = $user->ID; $s = "select ratings.orderid, ratings.datemade, ratings.reason, ratings.grade \r\n\t\t from " . $wpdb->prefix . "job_ratings ratings, " . $wpdb->prefix . "job_orders orders, " . $wpdb->prefix . "posts posts where orders.pid=posts.ID AND posts.post_author='{$uid}' AND\r\n\t\t\t orders.id=ratings.orderid AND ratings.awarded>0 order by ratings.id desc"; $r = $wpdb->get_results($s); if (count($r) > 0) { ?> <table class="widefat post fixed" cellspacing="0"> <thead> <tr> <th><?php _e('User', 'PricerrTheme'); ?> </th> <th><?php _e('Job', 'PricerrTheme'); ?> </th> <th><?php _e('Price', 'PricerrTheme'); ?> </th> <th><?php _e('Rating Type', 'PricerrTheme'); ?> </th> <th><?php _e('Description', 'PricerrTheme'); ?> </th> <th><?php _e('Awarded On', 'PricerrTheme'); ?> </th> <th><?php _e('Options', 'PricerrTheme'); ?> </th> </tr> </thead> <tbody> <?php foreach ($r as $row) { $s_ql = "select * from " . $wpdb->prefix . "job_orders where id='" . $row->orderid . "'"; $r_ql = $wpdb->get_results($s_ql); $post = get_post($r_ql[0]->pid); $userdata = get_userdata($post->post_author); $pid = $r_ql[0]->pid; echo '<tr>'; echo '<th>' . $userdata->user_login . '</th>'; echo '<th>' . pricerrtheme_get_show_price(get_post_meta($r_ql[0]->pid, 'price', true)) . '</th>'; echo '<th><a href="' . get_permalink($pid) . '">' . PricerrTheme_wrap_the_title($post->post_title, $pid) . '</a></th>'; echo '<th>' . PricerrTheme_show_stars_our_of_number($row->grade) . '</th>'; echo '<th>' . $row->reason . '</th>'; echo '<th>' . date('d-M-Y H:i:s', $row->datemade) . '</th>'; echo '<th>#</th>'; echo '</tr>'; } ?> </tbody> </table> <?php } else { ?> <div class="padd101"> <?php _e('There are no user feedback.', 'PricerrTheme'); ?> </div> <?php } ?> </div> <div id="tabs3"> </div> <?php echo '</div>'; }
function PricerrTheme_my_account_reviews_area_function() { global $current_user; get_currentuserinfo(); $uid = $current_user->ID; //------------------------------------- global $wpdb, $wp_rewrite, $wp_query; $third_page = $wp_query->query_vars['third_page']; $third_page = $_GET['pg']; if (empty($_GET['pg'])) { $third_page = 'home'; } ?> <div id="content"> <div class="my_box3"> <div class="padd10"> <!-- page content here --> <div class="box_title3"><?php _e("My Ratings", 'PricerrTheme'); ?> </div> <?php $using_perm = PricerrTheme_using_permalinks(); if ($using_perm) { $rev_pg_lnk = get_permalink(get_option('PricerrTheme_my_account_reviews_page_id')) . "/?"; } else { $rev_pg_lnk = get_bloginfo('siteurl') . "/?page_id=" . get_option('PricerrTheme_my_account_reviews_page_id') . "&"; } ?> <div id="padd10"> <a class="green_btn"<?php echo $third_page == "home" ? 'class="actiove"' : ""; ?> href="<?php echo $rev_pg_lnk; ?> "><?php _e("Ratings to Award", "PricerrTheme"); ?> </a> <a class="green_btn"<?php echo $third_page == "waiting" ? 'class="actiove"' : ""; ?> href="<?php echo $rev_pg_lnk; ?> pg=waiting"><?php _e("Pending Ratings", "PricerrTheme"); ?> </a> <a class="green_btn"<?php echo $third_page == "my_rev" ? 'class="actiove"' : ""; ?> href="<?php echo $rev_pg_lnk; ?> pg=my_rev"><?php _e("My Ratings", "PricerrTheme"); ?> </a> </div> <div class="clear10"></div> <?php if ($third_page == "home") { ?> <div class="box_content"> <script> jQuery(document).ready(function() { jQuery('.dd-submit-rating').click(function() { var id = jQuery(this).attr('rel'); var uprating = jQuery("#rating_me-" + id + " :selected").val(); var reason = jQuery("#reason-" + id).val(); if(reason.length < 10) { alert("<?php _e('Please input a longer description for your rating', 'PricerrTheme'); ?> "); return false; } jQuery.ajax({ type: "POST", url: "<?php echo get_bloginfo('siteurl'); ?> /", data: "rate_me=1&ids="+id+"&uprating="+uprating+"&reason="+reason, success: function(msg){ jQuery("#post-" + id).hide('slow'); } }); return false; }); //------------------------- }); </script> <?php global $wpdb; $query = "select distinct *, ratings.id ratid from " . $wpdb->prefix . "job_ratings ratings, " . $wpdb->prefix . "job_orders orders where \r\n\t\t\t\t\t ratings.awarded='0' AND orders.id=ratings.orderid AND orders.uid='{$uid}'"; $r = $wpdb->get_results($query); if (count($r) > 0) { foreach ($r as $row) { $post = $row->pid; $post = get_post($post); $user = get_userdata($row->touser); ?> <div class="post" id="post-<?php echo $row->ratid; ?> "> <div class="padd10_only"> <div class="image_holder3"> <a href="<?php the_permalink(); ?> "><img width="65" height="50" src="<?php echo PricerrTheme_get_first_post_image($row->pid, 65, 50); ?> " /></a> </div> <div class="title_holder3" > <h2><a href="<?php echo get_permalink($row->pid); ?> "><?php echo PricerrTheme_wrap_the_title($post->post_title, $row->pid); ?> </a></h2> <div class="c111">Rate:</div> <div class="c111"><textarea id="reason-<?php echo $row->ratid; ?> " rows="2" cols="35"></textarea></div> <div class="c111"> <select name="rating_me" id="rating_me-<?php echo $row->ratid; ?> "> <option value="5">5</option> <option value="4">4</option> <option value="3">3</option> <option value="2">2</option> <option value="1">1</option> </select> </div> <div class="c111 ck999"> <a href="#" rel="<?php echo $row->ratid; ?> " class="dd-submit-rating"><?php _e('Submit Rating Now', 'PricerrTheme'); ?> </a> </div> </div> </div> </div> <?php } } else { _e("There are no reviews to be awarded.", "PricerrTheme"); } ?> </div> <?php } elseif ($third_page == "waiting") { ?> <div class="box_content"> <?php global $wpdb; $query = "select distinct * from " . $wpdb->prefix . "job_ratings ratings, " . $wpdb->prefix . "job_orders orders, \r\n\t\t\t\t\t" . $wpdb->prefix . "posts posts where posts.ID=orders.pid AND \r\n\t\t\t\t\t ratings.awarded='0' AND orders.id=ratings.orderid AND posts.post_author='{$uid}'"; $r = $wpdb->get_results($query); if (count($r) > 0) { foreach ($r as $row) { $post = $row->pid; $post = get_post($post); $user = get_userdata($row->uid); ?> <div class="post" id="post-<?php echo $row->ratid; ?> "> <div class="padd10_only"> <div class="image_holder3"> <a href="<?php the_permalink(); ?> "><img width="65" height="50" src="<?php echo PricerrTheme_get_first_post_image($row->pid, 65, 50); ?> " /></a> </div> <div class="title_holder3" > <h2><a href="<?php echo get_permalink($row->pid); ?> "><?php echo PricerrTheme_wrap_the_title($post->post_title, $row->pid); ?> </a></h2> <?php echo sprintf(__('Waiting from: %s', 'PricerrTheme'), $user->user_login); ?> </div> </div> </div> <?php } } else { _e("You have no pending reviews.", "PricerrTheme"); } ?> </div> <?php } elseif ($third_page == "my_rev") { ?> <div class="box_content"> <?php global $wpdb; $query = "select distinct *, ratings.id ratid from " . $wpdb->prefix . "job_ratings ratings, " . $wpdb->prefix . "job_orders orders, \r\n\t\t\t\t\t" . $wpdb->prefix . "posts posts where posts.ID=orders.pid AND \r\n\t\t\t\t\t ratings.awarded='1' AND orders.id=ratings.orderid AND posts.post_author='{$uid}'"; $r = $wpdb->get_results($query); if (count($r) > 0) { foreach ($r as $row) { $post = $row->pid; $post = get_post($post); $user = get_userdata($row->touser); ?> <div class="post" id="post-<?php echo $row->ratid; ?> "> <div class="padd10_only"> <div class="image_holder3"> <a href="<?php the_permalink(); ?> "><img width="65" height="50" src="<?php echo PricerrTheme_get_first_post_image($row->pid, 65, 50); ?> " /></a> </div> <div class="title_holder3" > <h2><a href="<?php echo get_permalink($row->pid); ?> "><?php echo PricerrTheme_wrap_the_title($post->post_title, $row->pid); ?> </a></h2> <div class="c111"><b><?php _e("Rated", "PricerrTheme"); ?> : </b></div> <div class="c111"><?php echo PricerrTheme_show_stars_our_of_number($row->grade); ?> </div> <div class="clear10" style="float:left"></div> <div class="c111"><b><?php _e("Description", "PricerrTheme"); ?> : </b></div> <div class="c111"><?php echo stripslashes($row->reason); ?> </div> </div> </div> </div> <?php } } else { _e("You have no reviews.", "PricerrTheme"); } ?> </div> <?php } ?> <!-- page content here --> </div></div></div> <?php PricerrTheme_get_users_links(); }