function PricerrTheme_my_account_priv_mess_area_function() { global $current_user; get_currentuserinfo(); $uid = $current_user->ID; $myuid = $current_user->ID; //------------------------------------- global $wpdb, $wp_rewrite, $wp_query; $third_page = $_GET['priv_act']; if (empty($third_page)) { $third_page = 'home'; } $using_perm = PricerrTheme_using_permalinks(); if ($using_perm) { $privurl_m = get_permalink(get_option('PricerrTheme_my_account_priv_mess_page_id')) . "/?"; } else { $privurl_m = get_bloginfo('siteurl') . "/?page_id=" . get_option('PricerrTheme_my_account_priv_mess_page_id') . "&"; } ?> <div id="content"> <div class="my_box3"> <div class="padd10"> <div class="box_title3"><?php _e("Private Messages", 'PricerrTheme'); ?> </div> <div class="padd10"> <a href="<?php echo $privurl_m; ?> " class="green_btn"><?php _e("Messaging Home", "PricerrTheme"); ?> </a> <a href="<?php echo $privurl_m; ?> priv_act=send" class="green_btn"><?php _e("Send New Message", "PricerrTheme"); ?> </a> <a href="<?php echo $privurl_m; ?> priv_act=inbox" class="green_btn"><?php _e("Inbox", "PricerrTheme"); global $current_user; get_currentuserinfo(); $rd = PricerrTheme_get_unread_number_messages($current_user->ID); if ($rd > 0) { echo ' (' . $rd . ')'; } ?> </a> <a href="<?php echo $privurl_m; ?> priv_act=sent-items" class="green_btn"><?php _e("Sent Items", "PricerrTheme"); ?> </a> </div> </div> </div> <div class="clear10"></div> <?php if ($third_page == 'home') { ?> <!-- page content here --> <div class="my_box3"> <div class="padd10"> <div class="box_title"><?php _e("Latest Received Messages", "PricerrTheme"); ?> </div> <div class="box_content"> <?php global $wpdb; $s = "select * from " . $wpdb->prefix . "job_pm where user='******' AND show_to_destination='1' order by id desc limit 4"; $r = $wpdb->get_results($s); if (count($r) > 0) { echo '<table width="100%">'; echo '<tr>'; echo '<td>' . __('From User', 'PricerrTheme') . '</td>'; echo '<td>' . __('Subject', 'PricerrTheme') . '</td>'; echo '<td>' . __('Date', 'PricerrTheme') . '</td>'; echo '<td>' . __('Options', 'PricerrTheme') . '</td>'; echo '</tr>'; foreach ($r as $row) { if ($row->rd == 0) { $cls = 'bold_stuff'; } else { $cls = ''; } $user = get_userdata($row->initiator); echo '<tr>'; echo '<td class="' . $cls . '"><a href="' . PricerrTheme_get_user_profile_link($user->user_login) . '">' . $user->user_login . '</a></td>'; echo '<td class="' . $cls . '">' . $row->subject . '</td>'; echo '<td class="' . $cls . '">' . date_i18n('d-M-Y H:i:s', $row->datemade) . '</td>'; echo '<td><a href="' . $privurl_m . 'priv_act=read-message&id=' . $row->id . '">' . __('Read', 'PricerrTheme') . '</a> | <a href="' . $privurl_m . 'priv_act=delete-message&id=' . $row->id . '&return=home">' . __('Delete', 'PricerrTheme') . '</a></td>'; echo '</tr>'; } echo '</table>'; } else { _e('No messages here.', 'PricerrTheme'); } ?> </div> </div></div> <!--#######--> <div class="clear10"></div> <div class="my_box3"> <div class="padd10"> <div class="box_title"><?php _e("Latest Sent Items", "PricerrTheme"); ?> </div> <div class="box_content"> <?php global $wpdb; $s = "select * from " . $wpdb->prefix . "job_pm where initiator='{$myuid}' AND show_to_source='1' order by id desc limit 4"; $r = $wpdb->get_results($s); if (count($r) > 0) { echo '<table width="100%">'; echo '<tr>'; echo '<td>' . __('To User', 'PricerrTheme') . '</td>'; echo '<td>' . __('Subject', 'PricerrTheme') . '</td>'; echo '<td>' . __('Date', 'PricerrTheme') . '</td>'; echo '<td>' . __('Options', 'PricerrTheme') . '</td>'; echo '</tr>'; foreach ($r as $row) { //if($row->rd == 0) $cls = 'bold_stuff'; //else $cls = ''; $user = get_userdata($row->user); echo '<tr>'; echo '<td class="' . $cls . '"><a href="' . PricerrTheme_get_user_profile_link($user->user_login) . '">' . $user->user_login . '</a></td>'; echo '<td class="' . $cls . '">' . $row->subject . '</td>'; echo '<td class="' . $cls . '">' . date_i18n('d-M-Y H:i:s', $row->datemade) . '</td>'; echo '<td><a href="' . $privurl_m . 'priv_act=read-message&id=' . $row->id . '">' . __('Read', 'PricerrTheme') . '</a> | <a href="' . $privurl_m . 'priv_act=delete-message&id=' . $row->id . '&return=home">' . __('Delete', 'PricerrTheme') . '</a></td>'; echo '</tr>'; } echo '</table>'; } else { _e('No messages here.', 'PricerrTheme'); } ?> </div> </div> </div> <!-- page content here --> <?php } elseif ($third_page == 'inbox') { ?> <!-- page content here --> <div class="my_box3"> <div class="padd10"> <div class="box_title"><?php _e("Inbox", "PricerrTheme"); ?> </div> <div class="box_content"> <?php global $wpdb; $nrpostsPage = 12; $page = $_GET['pj']; if (empty($page)) { $page = 1; } $querystr2 = "select id from " . $wpdb->prefix . "job_pm where user='******' AND show_to_destination='1'"; $pageposts2 = $wpdb->get_results($querystr2, OBJECT); $total_count = count($pageposts2) == 0 ? 1 : count($pageposts2); $my_page = $page; $pages_curent = $page; //----------------------------------------------------------------------- $totalPages = $total_count > 0 ? ceil($total_count / $nrpostsPage) : 0; $pagess = $totalPages; $s = "select * from " . $wpdb->prefix . "job_pm where user='******' AND show_to_destination='1' order by id desc LIMIT " . $nrpostsPage * ($page - 1) . "," . $nrpostsPage; $r = $wpdb->get_results($s); if (count($r) > 0) { echo '<table width="100%">'; echo '<tr>'; echo '<td>' . __('From User', 'PricerrTheme') . '</td>'; echo '<td>' . __('Subject', 'PricerrTheme') . '</td>'; echo '<td>' . __('Date', 'PricerrTheme') . '</td>'; echo '<td>' . __('Options', 'PricerrTheme') . '</td>'; echo '</tr>'; foreach ($r as $row) { if ($row->rd == 0) { $cls = 'bold_stuff'; } else { $cls = ''; } $user = get_userdata($row->initiator); echo '<tr>'; echo '<td class="' . $cls . '"><a href="' . PricerrTheme_get_user_profile_link($user->user_login) . '">' . $user->user_login . '</a></td>'; echo '<td class="' . $cls . '">' . $row->subject . '</td>'; echo '<td class="' . $cls . '">' . date_i18n('d-M-Y H:i:s', $row->datemade) . '</td>'; echo '<td><a href="' . $privurl_m . 'priv_act=read-message&id=' . $row->id . '">' . __('Read', 'PricerrTheme') . '</a> | <a href="' . $privurl_m . 'priv_act=delete-message&id=' . $row->id . '&return=inbox">' . __('Delete', 'PricerrTheme') . '</td>'; echo '</tr>'; } echo '</table>'; ?> <div class="nav"> <?php $batch = 10; //ceil($page / $nrpostsPage ); $end = $batch * $nrpostsPage; if ($end > $pagess) { $end = $pagess; } $start = $end - $nrpostsPage + 1; if ($start < 1) { $start = 1; } $links = ''; $raport = ceil($my_page / $batch) - 1; if ($raport < 0) { $raport = 0; } $start = $raport * $batch + 1; $end = $start + $batch - 1; $end_me = $end + 1; $start_me = $start - 1; if ($end > $totalPages) { $end = $totalPages; } if ($end_me > $totalPages) { $end_me = $totalPages; } if ($start_me <= 0) { $start_me = 1; } $previous_pg = $page - 1; if ($previous_pg <= 0) { $previous_pg = 1; } $next_pg = $pages_curent + 1; if ($next_pg > $totalPages) { $next_pg = 1; } //PricerrTheme_get_browse_jobs_link($job_tax, $job_category, 'new', $page) if ($my_page > 1) { echo '<a href="' . PricerrTheme_get_browse_pm_link($previous_pg) . '"><< ' . __('Previous', 'PricerrTheme') . '</a>'; echo '<a href="' . PricerrTheme_get_browse_pm_link($start_me) . '"><<</a>'; } //------------------------ //echo $start." ".$end; for ($i = $start; $i <= $end; $i++) { if ($i == $pages_curent) { echo '<a class="activee" href="#">' . $i . '</a>'; } else { echo '<a href="' . PricerrTheme_get_browse_pm_link($i) . '">' . $i . '</a>'; } } //---------------------- if ($totalPages > $my_page) { echo '<a href="' . PricerrTheme_get_browse_pm_link($end_me) . '">>></a>'; } if ($page < $totalPages) { echo '<a href="' . PricerrTheme_get_browse_pm_link($next_pg) . '">' . __('Next', 'PricerrTheme') . ' >></a>'; } ?> </div> <?php } else { _e('No messages here.', 'PricerrTheme'); } ?> </div> </div> </div> <!-- page content here --> <?php } elseif ($third_page == 'sent-items') { ?> <!-- page content here --> <div class="my_box3"> <div class="padd10"> <div class="box_title"><?php _e("Sent Items", "PricerrTheme"); ?> </div> <div class="box_content"> <?php global $wpdb; $nrpostsPage = 12; $page = $_GET['pj']; if (empty($page)) { $page = 1; } $querystr2 = "select id from " . $wpdb->prefix . "job_pm where initiator='{$myuid}' AND show_to_source='1'"; $pageposts2 = $wpdb->get_results($querystr2, OBJECT); $total_count = count($pageposts2) == 0 ? 1 : count($pageposts2); $my_page = $page; $pages_curent = $page; //----------------------------------------------------------------------- $totalPages = $total_count > 0 ? ceil($total_count / $nrpostsPage) : 0; $pagess = $totalPages; $s = "select * from " . $wpdb->prefix . "job_pm where initiator='{$myuid}' AND show_to_source='1' order by id desc LIMIT " . $nrpostsPage * ($page - 1) . "," . $nrpostsPage; $r = $wpdb->get_results($s); if (count($r) > 0) { echo '<table width="100%">'; echo '<tr>'; echo '<td>' . __('To User', 'PricerrTheme') . '</td>'; echo '<td>' . __('Subject', 'PricerrTheme') . '</td>'; echo '<td>' . __('Date', 'PricerrTheme') . '</td>'; echo '<td>' . __('Options', 'PricerrTheme') . '</td>'; echo '</tr>'; foreach ($r as $row) { //if($row->rd == 0) $cls = 'bold_stuff'; //else $cls = ''; $user = get_userdata($row->user); echo '<tr>'; echo '<td class="' . $cls . '"><a href="' . PricerrTheme_get_user_profile_link($user->user_login) . '">' . $user->user_login . '</a></td>'; echo '<td class="' . $cls . '">' . $row->subject . '</td>'; echo '<td class="' . $cls . '">' . date_i18n('d-M-Y H:i:s', $row->datemade) . '</td>'; echo '<td><a href="' . $privurl_m . 'priv_act=read-message&id=' . $row->id . '">' . __('Read', 'PricerrTheme') . '</a> | <a href="' . $privurl_m . 'priv_act=delete-message&id=' . $row->id . '&return=outbox">' . __('Delete', 'PricerrTheme') . '</a></td>'; echo '</tr>'; } echo '</table>'; ?> <div class="nav"> <?php $batch = 10; //ceil($page / $nrpostsPage ); $end = $batch * $nrpostsPage; if ($end > $pagess) { $end = $pagess; } $start = $end - $nrpostsPage + 1; if ($start < 1) { $start = 1; } $links = ''; $raport = ceil($my_page / $batch) - 1; if ($raport < 0) { $raport = 0; } $start = $raport * $batch + 1; $end = $start + $batch - 1; $end_me = $end + 1; $start_me = $start - 1; if ($end > $totalPages) { $end = $totalPages; } if ($end_me > $totalPages) { $end_me = $totalPages; } if ($start_me <= 0) { $start_me = 1; } $previous_pg = $page - 1; if ($previous_pg <= 0) { $previous_pg = 1; } $next_pg = $pages_curent + 1; if ($next_pg > $totalPages) { $next_pg = 1; } //PricerrTheme_get_browse_jobs_link($job_tax, $job_category, 'new', $page) if ($my_page > 1) { echo '<a href="' . PricerrTheme_get_browse_pm_link2($previous_pg) . '"><< ' . __('Previous', 'PricerrTheme') . '</a>'; echo '<a href="' . PricerrTheme_get_browse_pm_link2($start_me) . '"><<</a>'; } //------------------------ //echo $start." ".$end; for ($i = $start; $i <= $end; $i++) { if ($i == $pages_curent) { echo '<a class="activee" href="#">' . $i . '</a>'; } else { echo '<a href="' . PricerrTheme_get_browse_pm_link2($i) . '">' . $i . '</a>'; } } //---------------------- if ($totalPages > $my_page) { echo '<a href="' . PricerrTheme_get_browse_pm_link2($end_me) . '">>></a>'; } if ($page < $totalPages) { echo '<a href="' . PricerrTheme_get_browse_pm_link2($next_pg) . '">' . __('Next', 'PricerrTheme') . ' >></a>'; } ?> </div> <?php } else { _e('No messages here.', 'PricerrTheme'); } ?> </div> </div> </div> <!-- page content here --> <?php } elseif ($third_page == 'read-message') { $id = $_GET['id']; $s = "select * from " . $wpdb->prefix . "job_pm where id='{$id}' AND (user='******' OR initiator='{$myuid}')"; $r = $wpdb->get_results($s); $row = $r[0]; if ($myuid == $row->initiator) { $owner = true; } else { $owner = false; } if (!$owner) { $wpdb->query("update " . $wpdb->prefix . "job_pm set rd='1' where id='{$row->id}'"); } ?> <!-- page content here --> <div class="my_box3"> <div class="padd10"> <div class="box_title"><?php _e("Read Message: ", "PricerrTheme"); echo " " . $row->subject; ?> </div> <div class="box_content"> <?php $mess = $row->content; $PricerrTheme_filter_urls_private_messages = get_option('PricerrTheme_filter_urls_private_messages'); if ($PricerrTheme_filter_urls_private_messages == "yes") { $mess = PricerrTheme_url_cleaner($row->content); } //----------------------- $PricerrTheme_filter_emails_private_messages = get_option('PricerrTheme_filter_emails_private_messages'); if ($PricerrTheme_filter_emails_private_messages == "yes") { $pattern = "/[^@\\s]*@[^@\\s]*\\.[^@\\s]*/"; $replacement = "[****]"; preg_replace($pattern, $replacement, $mess); } echo $mess; ?> <br/> <br/> <?php if ($owner == false) { ?> <a href="<?php echo $privurl_m; ?> priv_act=send&<?php echo 'pid=' . $row->pid . '&uid=' . $row->initiator; ?> " class="nice_link"><?php _e("Reply"); ?> </a> <?php } ?> </div> </div> </div> <!-- page content here --> <?php } elseif ($third_page == 'delete-message') { $id = $_GET['id']; $s = "select * from " . $wpdb->prefix . "job_pm where id='{$id}' AND (user='******' OR initiator='{$myuid}')"; $r = $wpdb->get_results($s); $row = $r[0]; global $current_user; get_currentuserinfo(); $myuid = $current_user->ID; if ($myuid == $row->initiator) { $owner = true; } else { $owner = false; } //if(!$owner) //$wpdb->query("update_i18n ".$wpdb->prefix."auction_pm set rd='1' where id='{$row->id}'"); ?> <!-- page content here --> <div class="my_box3"> <div class="padd10"> <div class="box_title"><?php _e("Delete Message: ", "PricerrTheme"); echo " " . $row->subject; ?> </div> <div class="box_content"> <?php echo $row->content; ?> <br/> <br/> <?php if (1) { //$owner == false): ?> <a href="<?php echo $privurl_m; ?> priv_act=delete-message&<?php echo 'id=' . $row->id . '&return=' . $_GET['return'] . "&confirm_message_deletion=yes"; ?> " class="nice_link"><?php _e("Confirm Deletion", 'PricerrTheme'); ?> </a> <?php } ?> </div> </div> </div> <!-- page content here --> <?php } elseif ($third_page == 'send') { ?> <?php $pid = $_GET['pid']; $uid = $_GET['uid']; $user = get_userdata($uid); if (!empty($pid)) { $post = get_post($pid); $subject = "RE: " . $post->post_title; } if (isset($_POST['send'])) { $subject = htmlspecialchars($_POST['subject']); $message = nl2br(htmlspecialchars($_POST['message'])); $to = $_POST['to']; if (!empty($to)) { $uid = PricerrTheme_get_userid_from_username($to); } //--- parse emails out of the private messages ------- $PricerrTheme_filter_emails_private_messages = get_option('PricerrTheme_filter_emails_private_messages'); if ($PricerrTheme_filter_emails_private_messages == "yes") { $message = PricerrTheme_parseEmails($message); } //--- parse links out of the private messages --- $PricerrTheme_filter_urls_private_messages = get_option('PricerrTheme_filter_urls_private_messages'); if ($PricerrTheme_filter_urls_private_messages == "yes") { $message = PricerrTheme_parseHyperlinks($message); } //---------------------- if ($uid != false) { global $current_user; get_currentuserinfo(); $myuid = $current_user->ID; $tm_tm = $_POST['tm_tm']; global $wpdb; $s = "select * from " . $wpdb->prefix . "job_pm where initiator='{$myuid}' and datemade='{$tm_tm}'"; $r = $wpdb->get_results($s); if (count($r) == 0) { $s = "insert into " . $wpdb->prefix . "job_pm (subject, content, datemade, pid, initiator, user) values('{$subject}','{$message}','{$tm_tm}','{$pid}','{$myuid}','{$uid}')"; $wpdb->query($s); //----------------------- PricerrTheme_send_email_when_new_PM($myuid, $uid, $subject, $message); } //----------------------- ?> <div class="my_box3"> <div class="padd10"> <?php _e('Your message has been sent.', 'PricerrTheme'); ?> </div> </div> <?php } else { echo '<div class="error">' . __('Invalid username', 'PricerrTheme') . "</div>"; } } else { ?> <div class="my_box3"> <div class="padd10"> <div class="box_title"><?php _e("Send Private Message to: ", "PricerrTheme"); ?> <?php echo $user->user_login; ?> </div> <div class="box_content"> <form method="post"> <input type="hidden" value="<?php echo current_time('timestamp', 0); ?> " name="tm_tm" /> <table> <?php if (empty($uid)) { ?> <tr> <td width="140"><?php _e("Send To", "PricerrTheme"); ?> :</td> <td><input size="20" name="to" type="text" value="" /></td> </tr> <?php } ?> <tr> <td width="140"><?php _e("Subject", "PricerrTheme"); ?> :</td> <td><input size="50" name="subject" type="text" value="<?php echo $subject; ?> " /></td> </tr> <tr> <td valign="top"><?php _e("Message", "PricerrTheme"); ?> :</td> <td><textarea name="message" rows="6" cols="50"></textarea></td> </tr> <tr> <td width="140"> </td> <td></td> </tr> <tr> <td width="140"> </td> <td><input name="send" type="submit" value="<?php _e("Send Message", 'PricerrTheme'); ?> " /></td> </tr> </table> </form> </div> </div> </div> <?php } } ?> </div> <?php PricerrTheme_get_users_links(); }
<?php get_header(); if (function_exists('bcn_display')) { echo '<div class="my_box3_breadcrumb"><div class="padd10_a">'; bcn_display(); echo '</div></div>'; } $using_perm = PricerrTheme_using_permalinks(); if ($using_perm) { $privurl_m = get_permalink(get_option('PricerrTheme_my_account_priv_mess_page_id')) . "?"; } else { $privurl_m = get_bloginfo('siteurl') . "/?page_id=" . get_option('PricerrTheme_my_account_priv_mess_page_id') . "&"; } ?> <?php if (have_posts()) { echo '<ul id="suggest_jobs">'; while (have_posts()) { the_post(); $post = get_post(get_the_ID()); $auth = $post->post_author; $lnk = $privurl_m . 'priv_act=send&pid=' . get_the_ID() . '&uid=' . $auth; $author = get_the_author(); echo '<li>'; echo '<span>' . sprintf(__('<a href="%s">%s</a> needs', "PricerrTheme"), $lnk, $author) . ':</span><br/>'; echo get_the_title(); echo '<br/> <span>';
function PricerrTheme_my_account_shopping_area_function() { global $current_user; get_currentuserinfo(); $uid = $current_user->ID; //------------------------------------- $pg = $_GET['pg']; if (!isset($pg)) { $pg = 'home'; } global $current_user; get_currentuserinfo(); $uid = $current_user->ID; $act_nr = PricerrTheme_shooping_active_nr($uid); $rev_nr = PricerrTheme_shooping_review_nr($uid); $can_nr = PricerrTheme_shooping_cancelled_nr($uid); $com_nr = PricerrTheme_shooping_completed_nr($uid); $using_perm = PricerrTheme_using_permalinks(); if ($using_perm) { $shp_pg_lnk = get_permalink(get_option('PricerrTheme_my_account_shopping_page_id')) . "/?"; } else { $shp_pg_lnk = get_bloginfo('siteurl') . "/?page_id=" . get_option('PricerrTheme_my_account_shopping_page_id') . "&"; } ?> <div id="content"> <!-- page content here --> <div class="my_box3"> <div class="padd10"> <div class="box_title3"><?php _e("My Shopping", 'PricerrTheme'); ?> </div> <div class="clear10"></div> <div class="shopping_menu_dv"> <ul id="shopping_menu"> <li><a <?php echo $pg == "home" ? 'class="actiove"' : ""; ?> href="<?php echo $shp_pg_lnk; ?> "><?php echo sprintf(__("Active Jobs (%s)", "PricerrTheme"), $act_nr); ?> </a></li> <li><a <?php echo $pg == "pending" ? 'class="actiove"' : ""; ?> href="<?php echo $shp_pg_lnk; ?> pg=pending"><?php echo sprintf(__("Pending my Review (%s)", "PricerrTheme"), $rev_nr); ?> </a></li> <li><a <?php echo $pg == "cancelled" ? 'class="actiove"' : ""; ?> href="<?php echo $shp_pg_lnk; ?> pg=cancelled"><?php echo sprintf(__("Cancelled (%s)", "PricerrTheme"), $can_nr); ?> </a></li> <li><a <?php echo $pg == "completed" ? 'class="actiove"' : ""; ?> href="<?php echo $shp_pg_lnk; ?> pg=completed"><?php echo sprintf(__("Completed (%s)", "PricerrTheme"), $com_nr); ?> </a></li> </ul> </div> <div style="overflow:hidden; width:100%; float:left"> <?php if ($pg == "home") { ?> <?php global $wpdb; $prefix = $wpdb->prefix; $s = "select * from " . $prefix . "job_orders where uid='{$uid}' AND done_seller='0' AND done_buyer='0' AND date_finished='0' AND closed='0'\n\t\t\t order by id desc"; $r = $wpdb->get_results($s); if (count($r) == 0) { echo __('No active jobs', 'PricerrTheme'); } else { foreach ($r as $row) { PricerrTheme_show_bought($row); } } ?> <?php } elseif ($pg == "pending") { ?> <?php global $current_user; get_currentuserinfo(); $uid = $current_user->ID; global $wpdb; $prefix = $wpdb->prefix; $s = "select * from " . $prefix . "job_orders where uid='{$uid}' AND done_seller='1' AND done_buyer='0' AND closed='0' \n\t\t\torder by id desc"; $r = $wpdb->get_results($s); if (count($r) == 0) { echo __('No pending review jobs.', 'PricerrTheme'); } else { foreach ($r as $row) { PricerrTheme_show_bought($row); } } ?> <?php } elseif ($pg == "cancelled") { ?> <?php global $current_user; get_currentuserinfo(); $uid = $current_user->ID; global $wpdb; $prefix = $wpdb->prefix; $s = "select * from " . $prefix . "job_orders where uid='{$uid}' AND closed='1' order by id desc"; $r = $wpdb->get_results($s); if (count($r) == 0) { echo __('No cancelled jobs.', 'PricerrTheme'); } else { foreach ($r as $row) { PricerrTheme_show_bought($row); } } ?> <?php } elseif ($pg == "completed") { ?> <?php global $current_user; get_currentuserinfo(); $uid = $current_user->ID; global $wpdb; $prefix = $wpdb->prefix; $s = "select * from " . $prefix . "job_orders where uid='{$uid}' AND completed='1' order by id desc"; $r = $wpdb->get_results($s); if (count($r) == 0) { echo __('No completed jobs.', 'PricerrTheme'); } else { foreach ($r as $row) { PricerrTheme_show_bought($row); } } ?> <?php } ?> </div> </div> </div> </div> <?php PricerrTheme_get_users_links(); }
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(); }
function widget($args, $instance) { extract($args); echo $before_widget; $nr_posts = $instance['nr_posts']; if (empty($nr_posts)) { $nr_posts = 10; } if (!is_numeric($nr_posts)) { $nr_posts = 10; } ?> <div class="request_div_widget"> <form method="post" action="<?php bloginfo('siteurl'); ?> /?jb_action=submit_request"> <div class="request_span"><?php _e("I am looking for <br/>someone who will", "PricerrTheme"); ?> :</div> <textarea class="request_mainbox big-search-select" name="request" ></textarea> <br/> <?php echo __("in", "PricerrTheme"); echo PricerrTheme_get_categories_slug("request_cat", "", "", "big-search-select"); ?> <input type="submit" value="<?php _e("Suggest", "PricerrTheme"); ?> " name="submit_prepare_request" id="suggest_job_btn" class="i_will_continue" /> </form> </div> <a href="<?php bloginfo('siteurl'); ?> /?post_type=request"><?php _e('See All Requests', 'PricerrTheme'); ?> </a><br/><br/> <?php $using_perm = PricerrTheme_using_permalinks(); if ($using_perm) { $privurl_m = get_permalink(get_option('PricerrTheme_my_account_priv_mess_page_id')) . "?"; } else { $privurl_m = get_bloginfo('siteurl') . "/?page_id=" . get_option('PricerrTheme_my_account_priv_mess_page_id') . "&"; } //-------- --------------------------------------------- $args = array('posts_per_page' => $nr_posts, 'paged' => 1, 'post_type' => 'request', 'order' => "DESC", 'orderby' => 'date'); $the_query = new WP_Query($args); if ($the_query->have_posts()) { echo '<ul id="suggest_jobs">'; while ($the_query->have_posts()) { $the_query->the_post(); $post = get_post(get_the_ID()); $auth = $post->post_author; $lnk = $privurl_m . 'priv_act=send&pid=' . get_the_ID() . '&uid=' . $auth; $author = get_the_author(); echo '<li>'; echo '<span>' . sprintf(__('<a href="%s">%s</a> needs', "PricerrTheme"), $lnk, $author) . ':</span><br/>'; echo get_the_title(); echo '<br/> <span>'; _e("Posted in", "PricerrTheme"); ?> <?php echo get_the_term_list(get_the_ID(), 'request_cat', '', ', ', ''); echo '</span>'; echo '</li>'; } echo '</ul>'; } echo $after_widget; }
function PricerrTheme_my_account_sales_area_function() { global $current_user; get_currentuserinfo(); $uid = $current_user->ID; //------------------------------------- $pg = $_GET['pg']; if (!isset($pg)) { $pg = 'home'; } global $current_user; get_currentuserinfo(); $uid = $current_user->ID; global $wpdb; $prefix = $wpdb->prefix; ?> <div id="content"> <!-- page content here --> <div class="my_box3"> <div class="padd10"> <div class="box_title3"><?php _e("My Sales", 'PricerrTheme'); ?> </div> <div class="clear10"></div> <div class="shopping_menu_dv"> <ul id="shopping_menu"> <?php $act_jb = PricerrTheme_get_number_of_active_jobs($uid); $del_jb = PricerrTheme_get_number_of_delivered_jobs($uid); $com_jb = PricerrTheme_get_number_of_completed_jobs($uid); $can_jb = PricerrTheme_get_number_of_cencelled_jobs($uid); $using_perm = PricerrTheme_using_permalinks(); if ($using_perm) { $sal_pg_lnk = get_permalink(get_option('PricerrTheme_my_account_sales_page_id')) . "/?"; } else { $sal_pg_lnk = get_bloginfo('siteurl') . "/?page_id=" . get_option('PricerrTheme_my_account_sales_page_id') . "&"; } ?> <li><a <?php echo $pg == "home" ? 'class="actiove"' : ""; ?> href="<?php echo $sal_pg_lnk; ?> "><?php echo sprintf(__("Active Jobs (%s)", "PricerrTheme"), $act_jb); ?> </a></li> <li><a <?php echo $pg == "delivered" ? 'class="actiove"' : ""; ?> href="<?php echo $sal_pg_lnk; ?> pg=delivered"><?php echo sprintf(__("Delivered (%s)", "PricerrTheme"), $del_jb); ?> </a></li> <li><a <?php echo $pg == "completed" ? 'class="actiove"' : ""; ?> href="<?php echo $sal_pg_lnk; ?> pg=completed"><?php echo sprintf(__("Completed (%s)", "PricerrTheme"), $com_jb); ?> </a></li> <li><a <?php echo $pg == "cancelled" ? 'class="actiove"' : ""; ?> href="<?php echo $sal_pg_lnk; ?> pg=cancelled"><?php echo sprintf(__("Cancelled (%s)", "PricerrTheme"), $can_jb); ?> </a></li> </ul> </div> <div style="overflow:hidden; width:100%; float:left"> <?php if ($pg == "home") { ?> <?php $s = "select distinct * from " . $prefix . "job_orders orders, " . $prefix . "posts posts\n\t\t\t where posts.post_author='{$uid}' AND posts.ID=orders.pid AND orders.done_seller='0' AND \n\t\t\t orders.done_buyer='0' AND orders.date_finished='0' AND orders.closed='0' order by orders.id desc"; $r = $wpdb->get_results($s); if (count($r) == 0) { echo __('No active jobs', 'PricerrTheme'); } else { foreach ($r as $row) { PricerrTheme_show_sale($row); } } ?> <?php } elseif ($pg == "delivered") { ?> <?php global $current_user; get_currentuserinfo(); $uid = $current_user->ID; global $wpdb; $prefix = $wpdb->prefix; $s = "select distinct * from " . $prefix . "job_orders orders, " . $prefix . "posts posts\n\t\t\t where posts.post_author='{$uid}' AND posts.ID=orders.pid AND orders.done_seller='1' AND \n\t\t\t orders.done_buyer='0' AND orders.closed='0' order by orders.id desc"; $r = $wpdb->get_results($s); if (count($r) == 0) { echo __('No delivered jobs.', 'PricerrTheme'); } else { foreach ($r as $row) { PricerrTheme_show_sale($row); } } ?> <?php } elseif ($pg == "cancelled") { ?> <?php global $current_user; get_currentuserinfo(); $uid = $current_user->ID; global $wpdb; $prefix = $wpdb->prefix; $s = "select distinct * from " . $prefix . "job_orders orders, " . $prefix . "posts posts\n\t\t\t where posts.post_author='{$uid}' AND posts.ID=orders.pid AND orders.closed='1' order by orders.id desc"; $r = $wpdb->get_results($s); if (count($r) == 0) { echo __('No cancelled jobs.', 'PricerrTheme'); } else { foreach ($r as $row) { PricerrTheme_show_sale($row); } } ?> <?php } elseif ($pg == "completed") { ?> <?php global $current_user; get_currentuserinfo(); $uid = $current_user->ID; global $wpdb; $prefix = $wpdb->prefix; $s = "select distinct * from " . $prefix . "job_orders orders, " . $prefix . "posts posts\n\t\t\t where posts.post_author='{$uid}' AND posts.ID=orders.pid AND orders.done_seller='1' AND \n\t\t\t orders.done_buyer='1' AND orders.closed='0' order by orders.id desc"; $r = $wpdb->get_results($s); if (count($r) == 0) { echo __('No completed jobs.', 'PricerrTheme'); } else { foreach ($r as $row) { PricerrTheme_show_sale($row); } } ?> <?php } ?> </div> </div> </div> </div> <?php PricerrTheme_get_users_links(); }
function PricerrTheme_show_sale($row) { $pid = $row->pid; $post = get_post($row->pid); $max_days = get_post_meta($pid, 'max_days', true); $date_made = $row->date_made; $sold = date("D jS \\of F Y", $date_made); $expected = date("D jS \\of F Y", $date_made + 24 * 3600 * $max_days); global $current_user; get_currentuserinfo(); $uid = $current_user->ID; $delivered = 0; if ($row->done_seller == 1) { $delivered = 1; } $id = $row->id; $closed = $row->closed; $completed = 0; if ($row->done_buyer == 1) { $completed = 1; } $can_request_closed = 1; if ($closed == 1) { $can_request_closed = 0; } //--------------------------------- ?> <div class="post" id="post-<?php echo $id; ?> "> <div class="padd10_only"> <div class="image_holder3"> <a href="<?php the_permalink(); ?> "><img width="65" height="50" class="<?php echo $img_class; ?> " src="<?php echo PricerrTheme_get_first_post_image($pid, 65, 50); ?> " /></a> </div> <div class="title_holder3" > <h2> <?php $days_needed = get_post_meta($pid, 'max_days', true); $instant = get_post_meta($pid, 'instant', true); if ($days_needed == 1) { echo '<span class="express_job_spn">' . __('Express', 'PricerrTheme') . '</span>'; } if ($instant == 1) { echo '<span class="instant_job_spn">' . __('Instant Delivery', 'PricerrTheme') . '</span>'; } ?> <a href="<?php echo get_permalink($pid); ?> " rel="bookmark" title=""> <?php echo PricerrTheme_wrap_the_title($post->post_title, $pid); ?> </a> </h2> <div class="sold_on"><?php echo sprintf(__("Sold on: %s", "PricerrTheme"), $sold); ?> ♦ <?php echo sprintf(__(" Expected Delivery: %s", "PricerrTheme"), $expected); ?> ♦ <?php echo sprintf(__("Order ID: #%s", "PricerrTheme"), $row->id); ?> </div> <?php if ($can_request_closed == 1) { if ($row->accept_cancellation_request != -1) { if ($row->request_cancellation_from_seller == 0 and $row->request_cancellation_from_buyer == 0) { ?> <a href="<?php echo get_bloginfo('siteurl'); ?> /?jb_action=request_mutual_cancelation&orderid=<?php echo $row->id; ?> " class="show_status"><?php _e("Request Mutual Cancelation", "PricerrTheme"); ?> </a> <?php } ?> <?php if ($row->request_cancellation_from_buyer == 1) { ?> <br/> <?php $using_perm = PricerrTheme_using_permalinks(); if ($using_perm) { $lnk7 = get_permalink(get_option('PricerrTheme_my_account_mutual_cancellation')) . "?oid=" . $row->id; } else { $lnk7 = get_permalink(get_option('PricerrTheme_my_account_mutual_cancellation')) . "&oid=" . $row->id; } $ss = $row->message_to_seller; $dt = date_i18n('d-M-Y H:i:s', $row->date_request_cancellation); printf(__('The buyer of this job has requested a mutual cancellation for this job on %s. <br/>Buyer\'s Message: <span class="en_em">%s</span> <br/><br/> <b><a href="%s">Answer this request</a></b>.', 'PricerrTheme'), $dt, $ss, $lnk7); ?> <br/><br/> <?php } ?> <?php if ($row->request_cancellation_from_seller == 1) { $dt = date_i18n('d-M-Y H:i:s', $row->date_request_cancellation); printf(__('You have requested a mutual cancellation on this job on %s. Waiting the buyer\' reply.', 'PricerrTheme'), $dt); echo '<br/><br/>'; } ?> <?php } } ?> <?php if ($delivered == 0 && $closed != 1) { if ($row->request_cancellation_from_seller == 0 and $row->request_cancellation_from_buyer == 0) { ?> <a href="<?php echo get_bloginfo('siteurl'); ?> /?jb_action=mark_delivered&oid=<?php echo $row->id; ?> " class="show_status"><?php _e("Mark as Delivered", "PricerrTheme"); ?> </a> <a href="#" class="show_status cancel_order" rel="<?php echo $row->id; ?> "><?php _e("Cancel Order", "PricerrTheme"); ?> </a> <?php } } elseif ($completed != 1 && $closed != 1) { ?> <span style="font-size:10px;"><em> <?php _e('Waiting for the buyer to confirm.', 'PricerrTheme'); ?> </em></span> <?php } ?> <a href="<?php echo get_permalink(get_option('PricerrTheme_my_account_priv_mess_page_id')); ?> ?priv_act=send&pid=<?php echo $row->pid; ?> &uid=<?php echo $row->uid; ?> " class="show_status"><?php _e("Contact Buyer", "PricerrTheme"); ?> </a> <a href="<?php bloginfo('siteurl'); ?> ?jb_action=chat_box&oid=<?php echo $row->id; ?> " class="show_buyer_notes" rel="<?php echo $id; ?> "><?php _e("Conversation Page", "PricerrTheme"); ?> </a> <br/><br/> <?php $instruction_box = get_post_meta($pid, 'instruction_box', true); if (!empty($instruction_box)) { echo '<br/><br/>' . sprintf(__('Instructions for the buyer: %s', 'PricerrTheme'), $instruction_box); } $instant = get_post_meta($pid, 'instant', true); if ($instant == "1") { $args = array('order' => 'ASC', 'orderby' => 'post_date', 'post_type' => 'attachment', 'post_parent' => $pid, 'post_mime_type' => 'application/zip', 'numberposts' => -1); $i = 0; $attachments = get_posts($args); if ($attachments) { foreach ($attachments as $attachment) { $url = wp_get_attachment_url($attachment->ID); $dnls = "<a href='" . $url . "' target='_blank'>" . $attachment->post_title . "</a>"; } } echo ' ' . sprintf(__('Download File: <b>%s</b>', 'PricerrTheme'), $dnls) . " <br/>"; } if ($row->extra1 == 1) { $extra_price = get_post_meta($pid, 'extra1_price', true); $extra_content = get_post_meta($pid, 'extra1_content', true); echo '<span class="my_extr_sh">' . $extra_content . " - " . PricerrTheme_get_show_price($extra_price) . "</span><br/>"; } if ($row->extra2 == 1) { $extra_price = get_post_meta($pid, 'extra2_price', true); $extra_content = get_post_meta($pid, 'extra2_content', true); echo '<span class="my_extr_sh">' . $extra_content . " - " . PricerrTheme_get_show_price($extra_price) . "</span><br/>"; } if ($row->extra3 == 1) { $extra_price = get_post_meta($pid, 'extra3_price', true); $extra_content = get_post_meta($pid, 'extra3_content', true); echo '<span class="my_extr_sh">' . $extra_content . " - " . PricerrTheme_get_show_price($extra_price) . "</span><br/>"; } if ($row->extra4 == 1) { $extra_price = get_post_meta($pid, 'extra4_price', true); $extra_content = get_post_meta($pid, 'extra4_content', true); echo '<span class="my_extr_sh">' . $extra_content . " - " . PricerrTheme_get_show_price($extra_price) . "</span><br/>"; } if ($row->extra5 == 1) { $extra_price = get_post_meta($pid, 'extra5_price', true); $extra_content = get_post_meta($pid, 'extra5_content', true); echo '<span class="my_extr_sh">' . $extra_content . " - " . PricerrTheme_get_show_price($extra_price) . "</span><br/>"; } if ($row->extra6 == 1) { $extra_price = get_post_meta($pid, 'extra6_price', true); $extra_content = get_post_meta($pid, 'extra6_content', true); echo '<span class="my_extr_sh">' . $extra_content . " - " . PricerrTheme_get_show_price($extra_price) . "</span><br/>"; } if ($row->extra7 == 1) { $extra_price = get_post_meta($pid, 'extra7_price', true); $extra_content = get_post_meta($pid, 'extra7_content', true); echo '<span class="my_extr_sh">' . $extra_content . " - " . PricerrTheme_get_show_price($extra_price) . "</span><br/>"; } if ($row->extra8 == 1) { $extra_price = get_post_meta($pid, 'extra8_price', true); $extra_content = get_post_meta($pid, 'extra8_content', true); echo '<span class="my_extr_sh">' . $extra_content . " - " . PricerrTheme_get_show_price($extra_price) . "</span><br/>"; } if ($row->extra9 == 1) { $extra_price = get_post_meta($pid, 'extra9_price', true); $extra_content = get_post_meta($pid, 'extra9_content', true); echo '<span class="my_extr_sh">' . $extra_content . " - " . PricerrTheme_get_show_price($extra_price) . "</span><br/>"; } if ($row->extra10 == 1) { $extra_price = get_post_meta($pid, 'extra10_price', true); $extra_content = get_post_meta($pid, 'extra10_content', true); echo '<span class="my_extr_sh">' . $extra_content . " - " . PricerrTheme_get_show_price($extra_price) . "</span><br/>"; } ?> </div></div> <div class="close_order_div" id="cancel_order_div_id_<?php echo $row->id; ?> "><div class="padd10"> <!-- <div class="box_title_special"><?php _e('Request Cancellation', 'PricerrTheme'); ?> </div> <form method="post" action="<?php bloginfo('siteurl'); ?> /?jb_action=cancel_job_request"> <input type="hidden" value="<?php echo $row->id; ?> " name="orderid" /> <table> <tr><td colspan="2"><?php _e('By using this option you are asking the buyer to cancel the order. If he agrees with this, and cancels the order, the money gets refunded into his account and you will not get a bad review over it.', 'PricerrTheme'); ?> </td></tr> <tr> <td valign="top" width="120"><?php _e('Message for Buyer', 'PricerrTheme'); ?> :</td> <td><textarea rows="3" cols="50" name="message_to_buyer" ></textarea></td> </tr> <tr> <td valign="top" width="120"> </td> <td><input type="submit" name="request_cancellation" value="<?php _e('Submit', 'PricerrTheme'); ?> " /></td> </tr> </table> </form> --> <div class="clear10"></div> <div class="box_title_special"><?php _e('Force Cancellation', 'PricerrTheme'); ?> </div> <form method="post" action="<?php bloginfo('siteurl'); ?> /?jb_action=cancel_job_request"> <input type="hidden" value="<?php echo $row->id; ?> " name="orderid" /> <table> <tr><td colspan="2"><?php _e("By using this option you are forcing cancelling this order. The money gets refunded into the buyer's account, and you will get a bad review over the job.", 'PricerrTheme'); ?> </td></tr> <tr> <td valign="top" width="120"> </td> <td><input type="submit" name="force_cancellation" value="<?php _e('Submit', 'PricerrTheme'); ?> " /></td> </tr> </table> </form> </div></div> </div> <?php }
function PricerrTheme_my_account_payments_area_function() { global $current_user, $wpdb; get_currentuserinfo(); $uid = $current_user->ID; $using_perm = PricerrTheme_using_permalinks(); if ($using_perm) { $pay_pg_lnk = get_permalink(get_option('PricerrTheme_my_account_payments_page_id')) . "/?"; } else { $pay_pg_lnk = get_bloginfo('siteurl') . "/?page_id=" . get_option('PricerrTheme_my_account_payments_page_id') . "&"; } //------------------------------------- ?> <div id="content"> <!-- page content here --> <div class="my_box3"> <div class="padd10"> <div class="box_title3"><?php _e("My Payments", 'PricerrTheme'); ?> </div> <div class="padd10"> <a class="green_btn" href="<?php echo $pay_pg_lnk; ?> pg=withdraw"><?php _e('Withdraw Money', 'PricerrTheme'); ?> </a> <a class="green_btn" href="<?php echo $pay_pg_lnk; ?> pg=transactions"><?php _e('Transactions', 'PricerrTheme'); ?> </a> </div> <div class="clear10"></div> <div class="clear10"></div> <?php $pg = $_GET['pg']; if (!isset($pg)) { $pg = 'home'; } global $wpdb; if ($_GET['pg'] == 'closewithdrawal') { $id = $_GET['id']; $s = "select * from " . $wpdb->prefix . "job_withdraw where id='{$id}' AND uid='{$uid}'"; $r = $wpdb->get_results($s); if (count($r) == 1) { $row = $r[0]; $amount = $row->amount; $cr = PricerrTheme_get_credits($uid); PricerrTheme_update_credits($uid, $cr + $amount); $s = "delete from " . $wpdb->prefix . "job_withdraw where id='{$id}' AND uid='{$uid}'"; $wpdb->query($s); echo __('Request canceled!', 'PricerrTheme') . '<br/><br/>'; } } if ($pg == 'home') { ?> <?php $bal = PricerrTheme_get_credits($uid); echo '<h1 class="balance">' . sprintf(__("Your Current Balance is: %s", "PricerrTheme"), PricerrTheme_get_show_price($bal)) . "</h1>"; ?> <div class="clear10"></div> <div class="box_title"><?php _e('Pending Withdrawals', 'PricerrTheme'); ?> </div> <div class="padd10"> <?php global $wpdb; //---------------- $s = "select * from " . $wpdb->prefix . "job_withdraw where done='0' AND uid='{$uid}' order by id desc"; $r = $wpdb->get_results($s); if (count($r) == 0) { echo __('No withdrawals pending yet.', 'PricerrTheme'); } else { echo '<table width="100%">'; foreach ($r as $row) { echo '<tr>'; echo '<td>' . date('d-M-Y H:i:s', $row->datemade) . '</td>'; echo '<td>' . PricerrTheme_get_show_price($row->amount) . ' ' . '</td>'; echo '<td>' . $row->payeremail . '</td>'; echo '<td><a href="' . $pay_pg_lnk . 'pg=closewithdrawal&id=' . $row->id . '" class="green_btn">' . __('Close Request', 'PricerrTheme') . '</a></td>'; echo '</tr>'; } echo '</table>'; } ?> </div> <!-- ###################### --> <div class="clear10"></div> <div class="box_title"><?php _e("Pending Incoming Payments", "PricerrTheme"); ?> </div> <div class="padd10"> <?php global $current_user; get_currentuserinfo(); $uid = $current_user->ID; global $wpdb; $prefix = $wpdb->prefix; $s = "select distinct * from " . $prefix . "job_orders orders, " . $prefix . "posts posts\r\n\t\t\t\t\t where posts.post_author='{$uid}' AND posts.ID=orders.pid AND orders.done_seller='0' AND \r\n\t\t\t\t\t orders.done_buyer='0' AND orders.date_finished='0' AND orders.closed='0' order by orders.id desc"; $r = $wpdb->get_results($s); if (count($r) == 0) { echo __('No payments pending yet.', 'PricerrTheme'); } else { echo '<table width="100%">'; foreach ($r as $row) { $post = get_post($row->pid); $from = get_userdata($row->uid); echo '<tr>'; echo '<td>' . $from->user_login . '</td>'; echo '<td><a href="' . get_permalink($row->pid) . '">' . $post->post_title . '</a></td>'; echo '<td>' . date_i18n('d-M-Y H:i:s', $row->date_made) . '</td>'; echo '<td>' . PricerrTheme_get_show_price($row->mc_gross) . '</td>'; echo '</tr>'; } echo '</table>'; } ?> </div> <?php } elseif ($pg == 'withdraw') { ?> <div class="box_title"><?php _e("Request Withdrawal", "PricerrTheme"); ?> </div> <div class="padd10"> <?php $bal = PricerrTheme_get_credits($uid); echo '<span class="balance">'; printf(__('Your Current Balance is: %s', 'PricerrTheme'), PricerrTheme_get_show_price($bal)); echo "</span><br/><br/>"; if (isset($_POST['withdraw']) or isset($_POST['withdraw2']) or isset($_POST['withdraw3']) or isset($_POST['withdraw4']) or isset($_POST['withdraw5']) or isset($_POST['withdraw6']) or isset($_POST['withdraw7'])) { $amount = trim($_POST['amount']); $paypal = trim($_POST['paypal']); if (isset($_POST['withdraw2'])) { $amount = trim($_POST['amount2']); } if (isset($_POST['withdraw3'])) { $amount = trim($_POST['amount3']); } if (isset($_POST['withdraw4'])) { $amount = trim($_POST['amount4']); } if (isset($_POST['withdraw5'])) { $amount = trim($_POST['amount5']); } if (isset($_POST['withdraw6'])) { $amount = trim($_POST['amount6']); } if (isset($_POST['withdraw7'])) { $amount = trim($_POST['amount7']); } $PricerrTheme_withdraw_limit = get_option('PricerrTheme_withdraw_limit'); if (empty($PricerrTheme_withdraw_limit) or !is_numeric($PricerrTheme_withdraw_limit)) { $PricerrTheme_withdraw_limit = 10; } if (!is_numeric($amount) || $amount < 0) { echo '<span class="error">' . __('ERROR: Provide a well formated amount.', 'PricerrTheme') . '</span>'; } else { if (PricerrTheme_isValidEmail($paypal) == false) { echo '<span class="error">' . __('ERROR: Invalid email provided.', 'PricerrTheme') . '</span>'; } else { if ($amount < $PricerrTheme_withdraw_limit) { echo '<span class="error">' . sprintf(__('ERROR: The amount must be higher than: %s.', 'PricerrTheme'), PricerrTheme_get_show_price($PricerrTheme_withdraw_limit)) . '</span>'; } else { $min = get_option('PricerrTheme_withdraw_limit'); if ($min == 0) { $min = "0"; } if (empty($min)) { $min = 10; } if ($bal < $amount) { echo '<span class="error">' . __('ERROR: Your balance is smaller than the amount requested.', 'PricerrTheme') . '</span>'; } else { $method = "PayPal"; if (isset($_POST['withdraw2'])) { $method = "Moneybookers"; } if (isset($_POST['withdraw3'])) { $method = "Payza"; } $method = apply_filters('PricerrTheme_withdraw_method', $method); $tm = current_time('timestamp', 0); global $wpdb; if (!empty($_POST['tm_tm'])) { $tm = $_POST['tm_tm']; } $s = "select * from " . $wpdb->prefix . "job_withdraw where uid='{$uid}' AND datemade='{$tm}'"; $r = $wpdb->get_results($s); if (count($r) == 0) { $s = "insert into " . $wpdb->prefix . "job_withdraw (payeremail, methods, amount, datemade, uid) \r\n\t\t\t\t\t\t\t\tvalues('{$paypal}', '{$method}','{$amount}','{$tm}','{$uid}')"; $wpdb->query($s); $cr = PricerrTheme_get_credits($uid); PricerrTheme_update_credits($uid, $cr - $amount); //----------------------- PricerrTheme_send_email_when_withdraw_requested($uid, $method, PricerrTheme_get_show_price($amount)); //----------------------- } echo '<span class="balance">' . __('Your request has been queued. Redirecting...', 'PricerrTheme') . '</span>'; $url_redir = $pay_pg_lnk; echo '<meta http-equiv="refresh" content="2;url=' . $url_redir . '" />'; } } } } } global $current_user; get_currentuserinfo(); $uid = $current_user->ID; $opt = get_option('PricerrTheme_paypal_enable'); if ($opt == "yes") { ?> <br /><br /> <table> <form method="post" enctype="application/x-www-form-urlencoded"> <input type="hidden" value="<?php echo current_time('timestamp', 0); ?> " name="tm_tm" /> <tr> <td><?php _e('Withdraw amount:', 'PricerrTheme'); ?> </td><td> <input value="<?php echo $_POST['amount']; ?> " type="text" size="10" name="amount" /> <?php echo PricerrTheme_get_currency(); ?> </td> </tr> <tr> <td><?php _e('PayPal Email:', 'PricerrTheme'); ?> </td><td><input value="<?php echo get_user_meta($uid, 'paypal_email', true); ?> " type="text" size="30" name="paypal" /></td> </tr> <tr> <td></td> <td> <input type="submit" name="withdraw" value="<?php _e('Withdraw', 'PricerrTheme'); ?> " /></td></tr></form></table> <?php } $opt = get_option('PricerrTheme_moneybookers_enable'); if ($opt == "yes") { ?> <br/><br/> <table> <form method="post" enctype="application/x-www-form-urlencoded"> <input type="hidden" value="<?php echo current_time('timestamp', 0); ?> " name="tm_tm" /> <tr> <td><?php _e('Withdraw amount:', 'PricerrTheme'); ?> </td><td> <input value="<?php echo $_POST['amount2']; ?> " type="text" size="10" name="amount2" /> <?php echo PricerrTheme_get_currency(); ?> </td> </tr> <tr> <td><?php _e('Moneybookers Email:', 'PricerrTheme'); ?> </td><td><input value="" type="text" size="30" name="paypal" /></td> </tr> <tr> <td></td> <td> <input type="submit" name="withdraw2" value="<?php _e('Withdraw', 'PricerrTheme'); ?> " /></td></tr></form></table> <?php } $opt = get_option('PricerrTheme_alertpay_enable'); if ($opt == "yes") { ?> <br/><br/> <table> <form method="post" enctype="application/x-www-form-urlencoded"> <input type="hidden" value="<?php echo current_time('timestamp', 0); ?> " name="tm_tm" /> <tr> <td><?php _e('Withdraw amount:', 'PricerrTheme'); ?> </td><td> <input value="<?php echo $_POST['amount3']; ?> " type="text" size="10" name="amount3" /> <?php echo PricerrTheme_get_currency(); ?> </td> </tr> <tr> <td><?php _e('Payza Email:', 'PricerrTheme'); ?> </td><td><input value="" type="text" size="30" name="paypal" /></td> </tr> <tr> <td></td> <td> <input type="submit" name="withdraw3" value="<?php _e('Withdraw', 'PricerrTheme'); ?> " /></td></tr></form></table> <?php } do_action('PricerrTheme_payments_withdraw_options'); ?> </div> <?php } elseif ($pg == 'transactions') { ?> <div class="my_box3"> <div class="padd10"> <div class="box_title"><?php _e("Transactions", "PricerrTheme"); ?> </div> <div class="padd10"> <?php $s = "select * from " . $wpdb->prefix . "job_payment_transactions where uid='{$uid}' order by id desc"; $r = $wpdb->get_results($s); if (count($r) == 0) { echo __('No activity yet.', 'PricerrTheme'); } else { $i = 0; echo '<table width="100%" cellpadding="5">'; foreach ($r as $row) { if ($row->tp == 0) { $class = "redred"; $sign = "-"; } else { $class = "greengreen"; $sign = "+"; } echo '<tr style="background:' . ($i % 2 ? "#f2f2f2" : "#f9f9f9") . '" >'; echo '<td>' . $row->reason . '</td>'; echo '<td width="25%">' . date('d-M-Y H:i:s', $row->datemade) . '</td>'; echo '<td width="20%" class="' . $class . '"><b>' . $sign . PricerrTheme_get_show_price($row->amount) . '</b></td>'; echo '</tr>'; $i++; } echo '</table>'; } ?> </div> </div> </div> <?php } ?> <!-- page content here --> </div> </div> </div> <?php PricerrTheme_get_users_links(); }
function PricerrTheme_my_account_cancel_reqq_area_function() { $oid = $_GET['oid']; global $wpdb, $current_user; get_currentuserinfo(); $uid = $current_user->ID; $s = "select * from " . $wpdb->prefix . "job_orders where id='{$oid}'"; $r = $wpdb->get_results($s); $row = $r[0]; $post_au = get_post($row->pid); $dt = current_time('timestamp', 0); //----------------------- if ($row->request_cancellation_from_seller == 1) { if ($post_au->post_author != $uid) { //i am the buyer here $s_message = __('The seller of this job has requested a mutual cancellation for this order. Please accept or deny it using the controls below:', 'PricerrTheme'); $return_me = get_permalink(get_option('PricerrTheme_my_account_shopping_page_id')); if ($_GET['accept'] == "yes") { $s1 = "update " . $wpdb->prefix . "job_orders set accept_cancellation_request='1', closed='1', date_accept_cancellation='{$dt}' where id='{$row->id}'"; $wpdb->query($s1); $current_cash = PricerrTheme_get_credits($row->uid); PricerrTheme_update_credits($row->uid, $current_cash + $row->mc_gross); $reason = sprintf(__('Payment refunded for job: <a href="%s">%s</a>', 'PricerrTheme'), get_permalink($post_au->ID), $post_au->post_title); PricerrTheme_add_history_log('1', $reason, $row->mc_gross, $row->uid); } if ($_GET['accept'] == "no") { $s1 = "update " . $wpdb->prefix . "job_orders set accept_cancellation_request='-1' where id='{$row->id}'"; $wpdb->query($s1); } } else { echo 'oups #3211!'; exit; } } if ($row->request_cancellation_from_buyer == 1) { if ($post_au->post_author == $uid) { // i am the seller here $s_message = __('The buyer of this job has requested a mutual cancellation for this order. Please accept or deny it using the controls below:', 'PricerrTheme'); $return_me = get_permalink(get_option('PricerrTheme_my_account_sales_page_id')); if ($_GET['accept'] == "yes") { $s1 = "update " . $wpdb->prefix . "job_orders set accept_cancellation_request='1', closed='1', date_accept_cancellation='{$dt}' where id='{$row->id}'"; $wpdb->query($s1); $current_cash = PricerrTheme_get_credits($row->uid); PricerrTheme_update_credits($row->uid, $current_cash + $row->mc_gross); $reason = sprintf(__('Payment refunded for job: <a href="%s">%s</a>', 'PricerrTheme'), get_permalink($post_au->ID), $post_au->post_title); PricerrTheme_add_history_log('1', $reason, $row->mc_gross, $row->uid); } if ($_GET['accept'] == "no") { $s1 = "update " . $wpdb->prefix . "job_orders set accept_cancellation_request='-1' where id='{$row->id}'"; $wpdb->query($s1); } } else { echo 'oups #3219!'; exit; } } //----------------------- ?> <div id="content"> <!-- page content here --> <div class="my_box3"> <div class="padd10"> <div class="box_title3"><?php printf(__("Answer Cancellation Request: #%s", 'PricerrTheme'), $oid); ?> </div> <div style="overflow:hidden; width:100%; float:left"> <div class="clear10"></div> <?php if (isset($_GET['accept'])) { if ($_GET['accept'] == "yes") { ?> <?php printf(__('You have accepted the cancellation request. You can <b><a href="%s">go back</a></b> now', 'PricerrTheme'), $return_me); ?> <?php } else { ?> <?php printf(__('You have not accepted the cancellation request. You can <b><a href="%s">go back</a></b> now', 'PricerrTheme'), $return_me); ?> <?php } } else { ?> <div class="job_content_page_title"> <?php echo '<span class="font_big_it">' . sprintf(__('Job Title: %s', 'PricerrTheme'), $post_au->post_title) . '</span>'; echo '<br/><br/>'; echo $s_message; $using_perm = PricerrTheme_using_permalinks(); if ($using_perm) { $lnk7 = get_permalink(get_option('PricerrTheme_my_account_mutual_cancellation')) . "?oid=" . $row->id; } else { $lnk7 = get_permalink(get_option('PricerrTheme_my_account_mutual_cancellation')) . "&oid=" . $row->id; } ?> </div> <div class="job_content_page_title"> <a href="<?php echo $lnk7; ?> &accept=yes" class="deactivate_job"><?php _e('Accept Cancellation', 'PricerrTheme'); ?> </a> <a href="<?php echo $lnk7; ?> &accept=no" class="del_job"><?php _e('Deny Cancellation', 'PricerrTheme'); ?> </a> </div> <?php } ?> </div> </div> </div> </div> <?php PricerrTheme_get_users_links(); }