예제 #1
0
파일: header.php 프로젝트: simplix-fr/o-g
"><i class="blog-awsome" ></i><?php 
    echo __("Blog", 'ProjectTheme');
    ?>
</a></li> 
							<?php 
}
?>
							<?php 
if (is_user_logged_in()) {
    global $current_user;
    get_currentuserinfo();
    $u = $current_user;
    ?>
									
									<li><a href="<?php 
    echo projectTheme_my_account_link();
    ?>
"><i class="account-awsome" ></i><?php 
    echo __("MyAccount", 'ProjectTheme');
    ?>
</a></li>
									<li><a href="<?php 
    echo wp_logout_url();
    ?>
"><i class="logout-awsome" ></i><?php 
    echo __("Log Out", 'ProjectTheme');
    ?>
</a></li>
									
									<?php 
} else {
예제 #2
0
function ProjectTheme_get_users_links()
{
    global $current_user, $wpdb;
    get_currentuserinfo();
    $rd = projectTheme_get_unread_number_messages($current_user->ID);
    if ($rd > 0) {
        $ssk = "<span class='notif_a'>" . $rd . "</span>";
    } else {
        $ssk = '';
    }
    $uid = $current_user->ID;
    //-----------------------
    $query = "select id from " . $wpdb->prefix . "project_ratings where fromuser='******' AND awarded='0'";
    $r = $wpdb->get_results($query);
    $ttl_fdbks = count($r);
    if ($ttl_fdbks > 0) {
        $ttl_fdbks2 = "<span class='notif_a'>" . $ttl_fdbks . "</span>";
    }
    $ProjectTheme_enable_2_user_tp = get_option('ProjectTheme_enable_2_user_tp');
    $user_tp = get_user_meta($uid, 'user_tp', true);
    ?>
    
	<div id="right-sidebar" class="account-sidebar">
			<ul class="xoxo">
			
			<li class="widget-container widget_text"> 
			<p>
			
            <ul id="my-account-admin-menu">
            	<li><a href="<?php 
    echo projectTheme_my_account_link();
    ?>
" <?php 
    echo $current_page == "home" ? "class='active'" : "";
    ?>
><?php 
    _e("MyAccount Home", 'ProjectTheme');
    ?>
</a></li>
                
                <?php 
    $pmnts_lnk = get_permalink(get_option('ProjectTheme_my_account_payments_id'));
    $pmnts_lnk = apply_filters('ProjectTheme_my_account_payments_id_link', $pmnts_lnk);
    $ProjectTheme_enable_credits_wallet = get_option('ProjectTheme_enable_credits_wallet');
    if ($ProjectTheme_enable_credits_wallet != 'no') {
        ?>
             
                <li><a href="<?php 
        echo $pmnts_lnk;
        ?>
"><?php 
        _e("Finances", 'ProjectTheme');
        ?>
</a></li>    
                <?php 
    }
    ?>
                            
                <li><a href="<?php 
    echo get_permalink(get_option('ProjectTheme_my_account_private_messages_id'));
    ?>
"><?php 
    echo sprintf(__("Private Messages %s", 'ProjectTheme'), $ssk);
    ?>
</a></li>
               	<li><a href="<?php 
    echo get_permalink(get_option('ProjectTheme_my_account_personal_info_id'));
    ?>
"><?php 
    _e("Personal Info", 'ProjectTheme');
    ?>
</a></li>
                <li><a href="<?php 
    echo get_permalink(get_option('ProjectTheme_my_account_feedback_id'));
    ?>
"><?php 
    printf(__("Reviews/Feedback %s", 'ProjectTheme'), $ttl_fdbks2);
    ?>
</a></li>
                
                
                <?php 
    do_action('ProjectTheme_my_account_main_menu');
    ?>
                
            </ul>
            
            </p>
			</li>
            
            <!-- ###### -->
			<?php 
    if (ProjectTheme_is_user_business($uid)) {
        ?>
            <li class="widget-container widget_text"><h3 class="widget-title"><?php 
        _e("Service Contractor Menu", 'ProjectTheme');
        ?>
</h3>
			<p>
			<?php 
        global $wpdb;
        $querystr = "\n\t\t\t\t\tSELECT distinct wposts.ID \n\t\t\t\t\tFROM {$wpdb->posts} wposts, {$wpdb->postmeta} wpostmeta2, {$wpdb->postmeta} wpostmeta3\n\t\t\t\t\tWHERE wposts.post_author='{$uid}' AND wposts.ID = wpostmeta2.post_id AND\n\t\t\t\t\twpostmeta2.meta_key='paid_user' AND wpostmeta2.meta_value='0'\n\t\t\t\t\t\n\t\t\t\t\tAND wposts.ID = wpostmeta3.post_id AND\n\t\t\t\t\twpostmeta3.meta_key='delivered' AND wpostmeta3.meta_value='1'\n\t\t\t\t\t\n\t\t\t\t\t AND wposts.post_type = 'project' ";
        $pageposts = $wpdb->get_results($querystr, OBJECT);
        $ttl_prj = count($pageposts);
        if ($ttl_prj > 0) {
            $scn = "<span class='notif_a'>" . $ttl_prj . "</span>";
        }
        //------------------------------------------------
        $querystr = "\n\t\t\t\t\tSELECT distinct wposts.ID \n\t\t\t\t\tFROM {$wpdb->posts} wposts, {$wpdb->postmeta} wpostmeta2\n\t\t\t\t\tWHERE wposts.post_author='{$uid}' AND wposts.ID = wpostmeta2.post_id AND\n\t\t\t\t\twpostmeta2.meta_key='paid' AND wpostmeta2.meta_value='0' AND wposts.post_type = 'project' AND wposts.post_status = 'draft' ";
        $pageposts = $wpdb->get_results($querystr, OBJECT);
        $ttl_prj2 = count($pageposts);
        if ($ttl_prj2 > 0) {
            $scn2 = "<span class='notif_a'>" . $ttl_prj2 . "</span>";
        }
        //------------------------------------------------
        $querystr = "\n\t\t\t\t\tSELECT distinct wposts.ID \n\t\t\t\t\tFROM {$wpdb->posts} wposts, {$wpdb->postmeta} wpostmeta2\n\t\t\t\t\tWHERE wposts.post_author='{$uid}' AND wposts.ID = wpostmeta2.post_id AND\n\t\t\t\t\twpostmeta2.meta_key='outstanding' AND wpostmeta2.meta_value='1' AND wposts.post_type = 'project' ";
        $pageposts = $wpdb->get_results($querystr, OBJECT);
        $ttl_prj2 = count($pageposts);
        if ($ttl_prj2 > 0) {
            $compl = "<span class='notif_a'>" . $ttl_prj2 . "</span>";
        }
        ?>
            <ul id="my-account-admin-menu_seller">
            	 <li><a href="<?php 
        echo projectTheme_post_new_link();
        ?>
" ><?php 
        _e("Post New Project", 'ProjectTheme');
        ?>
</a></li>  
                 <li><a href="<?php 
        echo get_permalink(get_option('ProjectTheme_my_account_active_projects_id'));
        ?>
"><?php 
        _e("Active Projects", 'ProjectTheme');
        ?>
</a></li>
                 <li><a href="<?php 
        echo get_permalink(get_option('ProjectTheme_my_account_closed_projects_id'));
        ?>
"><?php 
        _e("Closed Projects", 'ProjectTheme');
        ?>
</a></li>
                 <li><a href="<?php 
        echo get_permalink(get_option('ProjectTheme_my_account_unpublished_projects_id'));
        ?>
"><?php 
        printf(__("Unpublished Projects %s", 'ProjectTheme'), $scn2);
        ?>
</a></li>
                 <li><a href="<?php 
        echo get_permalink(get_option('ProjectTheme_my_account_awaiting_completion_id'));
        ?>
"><?php 
        printf(__("Awaiting Completion %s", 'ProjectTheme'), $compl);
        ?>
</a></li>
                 <li><a href="<?php 
        echo get_permalink(get_option('ProjectTheme_my_account_outstanding_payments_id'));
        ?>
"><?php 
        printf(__("Outstanding Payments %s", 'ProjectTheme'), $scn);
        ?>
</a></li>
                 <li><a href="<?php 
        echo get_permalink(get_option('ProjectTheme_my_account_completed_payments_id'));
        ?>
"><?php 
        _e("Completed Payments", 'ProjectTheme');
        ?>
</a></li>
                 
                 <?php 
        do_action('ProjectTheme_my_account_service_contractor_menu');
        ?>
                 
            </ul>
            
            </p>
			</li>
            
            <!-- ###### -->
			<?php 
    }
    if (ProjectTheme_is_user_provider($uid)) {
        ?>
            <li class="widget-container widget_text"><h3 class="widget-title"><?php 
        _e("Freelancer Menu", 'ProjectTheme');
        ?>
</h3>
			<p>
			<?php 
        $querystr = "\n\t\t\t\t\tSELECT distinct wposts.ID \n\t\t\t\t\tFROM {$wpdb->posts} wposts, {$wpdb->postmeta} wpostmeta2, {$wpdb->postmeta} wpostmeta3\n\t\t\t\t\tWHERE wposts.ID = wpostmeta2.post_id AND\n\t\t\t\t\twpostmeta2.meta_key='winner' AND wpostmeta2.meta_value='{$uid}' AND\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\twposts.ID = wpostmeta3.post_id AND\n\t\t\t\t\twpostmeta3.meta_key='outstanding' AND wpostmeta3.meta_value='1' \n\t\t\t\t\t\n\t\t\t\t\tAND wposts.post_type = 'project' ";
        $pageposts = $wpdb->get_results($querystr, OBJECT);
        $outsnr = count($pageposts);
        if ($outsnr > 0) {
            $outsnr = "<span class='notif_a'>" . $outsnr . "</span>";
        } else {
            $outsnr = '';
        }
        //---------------------------------------
        $querystr = "\n\t\t\t\t\tSELECT distinct wposts.ID \n\t\t\t\t\tFROM {$wpdb->posts} wposts, {$wpdb->postmeta} wpostmeta2, {$wpdb->postmeta} wpostmeta3, {$wpdb->postmeta} wpostmeta4\n\t\t\t\t\tWHERE wposts.ID = wpostmeta2.post_id AND\n\t\t\t\t\twpostmeta2.meta_key='winner' AND wpostmeta2.meta_value='{$uid}' AND\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\twposts.ID = wpostmeta3.post_id AND\n\t\t\t\t\twpostmeta3.meta_key='delivered' AND wpostmeta3.meta_value='1' AND\n\t\t\t\t\t\n\t\t\t\t\twposts.ID = wpostmeta4.post_id AND\n\t\t\t\t\twpostmeta4.meta_key='paid_user' AND wpostmeta4.meta_value='0' \n\t\t\t\t\t\n\t\t\t\t\tAND wposts.post_type = 'project' ";
        $pageposts = $wpdb->get_results($querystr, OBJECT);
        $awnr = count($pageposts);
        if ($awnr > 0) {
            $awnr = "<span class='notif_a'>" . $awnr . "</span>";
        } else {
            $awnr = '';
        }
        ?>
            <ul id="my-account-admin-menu_buyer">
                   
                 <li><a href="<?php 
        echo get_permalink(get_option('ProjectTheme_my_account_won_projects_id'));
        ?>
"><?php 
        _e("Won Projects", 'ProjectTheme');
        ?>
</a></li>
                 <li><a href="<?php 
        echo get_permalink(get_option('ProjectTheme_my_account_outstanding_projects_id'));
        ?>
"><?php 
        printf(__("Outstanding Projects %s", 'ProjectTheme'), $outsnr);
        ?>
</a></li>
                 <li><a href="<?php 
        echo get_permalink(get_option('ProjectTheme_my_account_awaiting_payments_id'));
        ?>
"><?php 
        printf(__("Awaiting Payments %s", 'ProjectTheme'), $awnr);
        ?>
</a></li>
                 <li><a href="<?php 
        echo get_permalink(get_option('ProjectTheme_my_account_delivered_projects_id'));
        ?>
"><?php 
        _e("Delivered & Paid Projects", 'ProjectTheme');
        ?>
</a></li>
                 
                 
                 <li><a href="<?php 
        echo get_permalink(get_option('ProjectTheme_my_account_bid_projects_id'));
        ?>
"><?php 
        _e("My Proposals", 'ProjectTheme');
        ?>
</a></li>
                 
                 <?php 
        do_action('ProjectTheme_my_account_service_provider_menu');
        ?>
                 
            </ul>
             
            </p>
			</li>
            <?php 
    }
    ?>
            
			</ul>
		</div>
		<?php 
}
예제 #3
0
function ProjectTheme_get_users_links()
{
    global $current_user, $wpdb;
    get_currentuserinfo();
    $rd = projectTheme_get_unread_number_messages($current_user->ID);
    if ($rd > 0) {
        $ssk = "<span class='notif_a'>" . $rd . "</span>";
    } else {
        $ssk = '';
    }
    $uid = $current_user->ID;
    //-----------------------
    $query = "select id from " . $wpdb->prefix . "project_ratings where fromuser='******' AND awarded='0'";
    $r = $wpdb->get_results($query);
    $ttl_fdbks = count($r);
    if ($ttl_fdbks > 0) {
        $ttl_fdbks2 = "<span class='notif_a'>" . $ttl_fdbks . "</span>";
    }
    $ProjectTheme_enable_2_user_tp = get_option('ProjectTheme_enable_2_user_tp');
    $user_tp = get_user_meta($uid, 'user_tp', true);
    ?>

    

	<div id="right-sidebar" class="account-sidebar">

			<ul class="xoxo">

			

			<li class="widget-container widget_text"> 

			<p>

			

            <ul id="my-account-admin-menu">

            	<li><a href="<?php 
    echo projectTheme_my_account_link();
    ?>
" <?php 
    echo $current_page == "home" ? "class='active'" : "";
    ?>
><?php 
    _e("MyAccount Home", 'ProjectTheme');
    ?>
</a></li>

                

                <?php 
    $pmnts_lnk = get_permalink(get_option('ProjectTheme_my_account_payments_id'));
    $pmnts_lnk = apply_filters('ProjectTheme_my_account_payments_id_link', $pmnts_lnk);
    $ProjectTheme_enable_credits_wallet = get_option('ProjectTheme_enable_credits_wallet');
    if ($ProjectTheme_enable_credits_wallet != 'no') {
        ?>
             

                <li><a href="<?php 
        echo $pmnts_lnk;
        ?>
"><?php 
        _e("Finances", 'ProjectTheme');
        ?>
</a></li>    

                <?php 
    }
    ?>

                            

                <li><a href="<?php 
    echo get_permalink(get_option('ProjectTheme_my_account_private_messages_id'));
    ?>
"><?php 
    echo sprintf(__("Private Messages %s", 'ProjectTheme'), $ssk);
    ?>
</a></li>

               	<li><a href="<?php 
    echo get_permalink(get_option('ProjectTheme_my_account_personal_info_id'));
    ?>
"><?php 
    _e("Personal Info", 'ProjectTheme');
    ?>
</a></li>

                <li><a href="<?php 
    echo get_permalink(get_option('ProjectTheme_my_account_feedback_id'));
    ?>
"><?php 
    printf(__("Feedback/Reviews %s", 'ProjectTheme'), $ttl_fdbks2);
    ?>
</a></li>

                

                

                <?php 
    do_action('ProjectTheme_my_account_main_menu');
    ?>

                

            </ul>

            

            </p>

			</li>

            

            <!-- ###### -->

			<?php 
    if (ProjectTheme_is_user_business($uid)) {
        ?>

            <li class="widget-container widget_text"><h3 class="widget-title"><?php 
        _e("Project Owner Menu", 'ProjectTheme');
        ?>
</h3>

			<p>

			<?php 
        global $wpdb;
        //				 $querystr = "
        //
        //					SELECT distinct wposts.ID
        //
        //					FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta2, $wpdb->postmeta wpostmeta3
        //
        //					WHERE wposts.post_author='$uid' AND wposts.ID = wpostmeta2.post_id
        //
        //					AND wpostmeta2.meta_key='paid_user' AND wpostmeta2.meta_value='0'
        //
        //
        //
        //					AND wposts.ID = wpostmeta3.post_id AND
        //
        //					wpostmeta3.meta_key='delivered' AND wpostmeta3.meta_value='1'
        //
        //
        //
        //					 AND wposts.post_type = 'project' ";
        $querystr = "\n\n\t\t\t\t\tSELECT distinct p.ID \n                    \n                    FROM {$wpdb->posts} AS p\n                        \n                    LEFT JOIN " . $wpdb->prefix . "project_bids AS pb ON p.ID = pb.pid\n                        \n                    WHERE   p.post_author = '{$uid}'\n                        AND pb.winner = '1'\n                        AND pb.paid = '0'\n                        AND pb.delivered = '1'\n                        AND p.post_type = 'project' ";
        $pageposts = $wpdb->get_results($querystr, OBJECT);
        $ttl_prj = count($pageposts);
        if ($ttl_prj > 0) {
            $scn = "<span class='notif_a'>" . $ttl_prj . "</span>";
        }
        //------------------------------------------------
        /*$querystr = "
        
        					SELECT distinct wposts.ID 
        
        					FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta2
        
        					WHERE wposts.post_author='$uid' AND wposts.ID = wpostmeta2.post_id AND
        
        					wpostmeta2.meta_key='paid' AND wpostmeta2.meta_value='0' AND wposts.post_type = 'project' AND wposts.post_status = 'draft' ";*/
        $querystr = "\n\n\t\t\t\t\tSELECT distinct wposts.ID \n\n\t\t\t\t\tFROM {$wpdb->posts} wposts\n\n\t\t\t\t\tWHERE wposts.post_author='{$uid}' AND  wposts.post_type = 'project' AND wposts.post_status = 'draft' ";
        $pageposts = $wpdb->get_results($querystr, OBJECT);
        $ttl_prj2 = count($pageposts);
        if ($ttl_prj2 > 0) {
            $scn2 = "<span class='notif_a'>" . $ttl_prj2 . "</span>";
        }
        //------------------------------------------------
        $querystr = "\n\n\t\t\t\t\tSELECT distinct wposts.ID \n\n\t\t\t\t\tFROM {$wpdb->posts} wposts, {$wpdb->postmeta} wpostmeta2, {$wpdb->postmeta} wpostmeta3\n\n\t\t\t\t\tWHERE wposts.post_author='{$uid}' AND wposts.ID = wpostmeta2.post_id AND wposts.ID = wpostmeta3.post_id AND\n\n\t\t\t\t\twpostmeta2.meta_key='outstanding' AND wpostmeta2.meta_value='1' AND wposts.post_type = 'project' AND wposts.post_status= 'publish' " . " AND wpostmeta3.meta_key='mark_coder_delivered' AND wpostmeta3.meta_value = '1'";
        $pageposts = $wpdb->get_results($querystr, OBJECT);
        $ttl_prj2 = count($pageposts);
        if ($ttl_prj2 > 0) {
            $compl = "<span class='notif_a'>" . $ttl_prj2 . "</span>";
        }
        $querystr = "\n\n\t\t\t\t\tSELECT distinct wposts.ID \n\n\t\t\t\t\tFROM {$wpdb->posts} wposts, {$wpdb->postmeta} wpostmeta2\n\n\t\t\t\t\tWHERE wposts.post_author='{$uid}' AND wposts.ID = wpostmeta2.post_id AND\n\n\t\t\t\t\twpostmeta2.meta_key='closed' AND wpostmeta2.meta_value='1' AND wposts.post_type = 'project' AND wposts.post_status = 'publish'";
        $pageposts = $wpdb->get_results($querystr, OBJECT);
        $ttl_prj2 = count($pageposts);
        if ($ttl_prj2 > 0) {
            $closed_number = "<span class='notif_a'>" . $ttl_prj2 . "</span>";
        }
        $querystr = "\n\n\t\t\t\t\tSELECT distinct wposts.ID \n\n\t\t\t\t\tFROM {$wpdb->posts} wposts, {$wpdb->postmeta} wpostmeta2\n\n\t\t\t\t\tWHERE wposts.post_author='{$uid}' AND wposts.ID = wpostmeta2.post_id AND\n\n\t\t\t\t\twpostmeta2.meta_key='closed' AND wpostmeta2.meta_value='0' AND wposts.post_type = 'project' AND wposts.post_status = 'publish'";
        $pageposts = $wpdb->get_results($querystr, OBJECT);
        $ttl_prj2 = count($pageposts);
        if ($ttl_prj2 > 0) {
            $active_number = "<span class='notif_a'>" . $ttl_prj2 . "</span>";
        }
        //				$querystr = "
        //
        //					SELECT distinct wposts.ID
        //
        //					FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta3, $wpdb->postmeta wpostmeta4
        //
        //					WHERE
        //
        //					wposts.ID = wpostmeta4.post_id AND
        //
        //					wpostmeta4.meta_key='paid_user' AND wpostmeta4.meta_value='1'
        //
        //					AND wposts.post_type = 'project' AND wposts.post_author='$uid'";
        $querystr = "\n                        SELECT pb.ID \n                        FROM {$wpdb->posts} AS p\n                        LEFT JOIN {$wpdb->prefix}project_bids AS pb ON p.ID = pb.pid\n                        WHERE   p.post_author = '{$uid}'\n                            AND pb.winner = '1'\n                            AND pb.paid = '1'\n                            AND p.post_type = 'project' ";
        $pageposts = $wpdb->get_results($querystr, OBJECT);
        $paid = count($pageposts);
        if ($paid > 0) {
            $paid = "<span class='notif_a'>" . $paid . "</span>";
        } else {
            $paid = '';
        }
        ?>

            <ul id="my-account-admin-menu_seller">

            	 <li><a href="<?php 
        echo projectTheme_post_new_link();
        ?>
" ><?php 
        _e("Post New Project", 'ProjectTheme');
        ?>
</a></li>  

                 <li><a href="<?php 
        echo get_permalink(get_option('ProjectTheme_my_account_active_projects_id'));
        ?>
"><?php 
        printf(__("Active Projects %s", 'ProjectTheme'), $active_number);
        /*_e("Active Projects",'ProjectTheme');*/
        ?>
</a></li>

                 <li><a href="<?php 
        echo get_permalink(get_option('ProjectTheme_my_account_closed_projects_id'));
        ?>
"><?php 
        printf(__("Closed Projects %s", 'ProjectTheme'), $closed_number);
        /*_e("Closed Projects",'ProjectTheme');*/
        ?>
</a></li>

                 <li><a href="<?php 
        echo get_permalink(get_option('ProjectTheme_my_account_unpublished_projects_id'));
        ?>
"><?php 
        printf(__("Unpublished Projects %s", 'ProjectTheme'), $scn2);
        ?>
</a></li>

                 <li><a href="<?php 
        echo get_permalink(get_option('ProjectTheme_my_account_awaiting_completion_id'));
        ?>
"><?php 
        printf(__("Awaiting Completion %s", 'ProjectTheme'), $compl);
        ?>
</a></li>

                 <li><a href="<?php 
        echo get_permalink(get_option('ProjectTheme_my_account_outstanding_payments_id'));
        ?>
"><?php 
        printf(__("Outstanding Payments %s", 'ProjectTheme'), $scn);
        ?>
</a></li>

                 <li><a href="<?php 
        echo get_permalink(get_option('ProjectTheme_my_account_completed_payments_id'));
        ?>
"><?php 
        printf(__("Completed Payments %s", 'ProjectTheme'), $paid);
        /*_e("Completed Payments",'ProjectTheme');*/
        ?>
</a></li>

                 

                 <?php 
        do_action('ProjectTheme_my_account_service_contractor_menu');
        ?>

                 

            </ul>

            

            </p>

			</li>

            

            <!-- ###### -->

			<?php 
    }
    if (ProjectTheme_is_user_provider($uid)) {
        ?>

            <li class="widget-container widget_text"><h3 class="widget-title"><?php 
        _e("QA Engineer Menu", 'ProjectTheme');
        ?>
</h3>

			<p>

			<?php 
        $querystr = "\n\n\t\t\t\t\tSELECT distinct wposts.ID \n\n\t\t\t\t\tFROM {$wpdb->posts} wposts, {$wpdb->postmeta} wpostmeta2\n\n\t\t\t\t\tWHERE wposts.ID = wpostmeta2.post_id AND\n\n\t\t\t\t\twpostmeta2.meta_key='winner' AND wpostmeta2.meta_value='{$uid}'\n\n\t\t\t\t\tAND wposts.post_type = 'project' AND wposts.post_status = 'publish' ";
        $pageposts = $wpdb->get_results($querystr, OBJECT);
        $won = count($pageposts);
        if ($won > 0) {
            $won = "<span class='notif_a'>" . $won . "</span>";
        } else {
            $won = '';
        }
        $querystr = "\n\t\t\t\t\tSELECT p.ID\n                    FROM {$wpdb->posts} AS p\n                    LEFT JOIN {$wpdb->prefix}project_bids AS b ON p.ID = b.pid\n                    LEFT JOIN {$wpdb->prefix}postmeta AS wpostmeta2 ON p.ID = wpostmeta2.post_id\n                    LEFT JOIN {$wpdb->prefix}postmeta AS wpostmeta3 ON p.ID = wpostmeta3.post_id\n                    WHERE \n                    b.uid = '916' AND b.outstanding = '1'\n                    AND wpostmeta2.meta_key='winner' AND wpostmeta2.meta_value='916'\n                    AND wpostmeta3.meta_key='outstanding' AND wpostmeta3.meta_value='1' \n                    AND p.post_type = 'project' AND p.post_status = 'publish' ";
        $pageposts = $wpdb->get_results($querystr, OBJECT);
        $outsnr = count($pageposts);
        if ($outsnr > 0) {
            $outsnr = "<span class='notif_a'>" . $outsnr . "</span>";
        } else {
            $outsnr = '';
        }
        //---------------------------------------
        //					$querystr = "
        //
        //					SELECT distinct wposts.ID
        //
        //					FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta2, $wpdb->postmeta wpostmeta3, $wpdb->postmeta wpostmeta4
        //
        //					WHERE wposts.ID = wpostmeta2.post_id AND
        //
        //					wpostmeta2.meta_key='winner' AND wpostmeta2.meta_value='$uid' AND
        //
        //
        //
        //
        //
        //					wposts.ID = wpostmeta3.post_id AND
        //
        //					wpostmeta3.meta_key='delivered' AND wpostmeta3.meta_value='1' AND
        //
        //
        //
        //					wposts.ID = wpostmeta4.post_id AND
        //
        //					wpostmeta4.meta_key='paid_user' AND wpostmeta4.meta_value='0'
        //
        //
        //
        //					AND wposts.post_type = 'project' ";
        $querystr = "\n                        SELECT distinct p.ID \n                        FROM {$wpdb->posts} AS p\n                        LEFT JOIN {$wpdb->prefix}project_bids AS pb ON p.ID = pb.pid\n                        WHERE   pb.uid = '{$uid}'\n                            AND pb.winner = '1'\n                            AND pb.paid = '0'\n                            AND pb.delivered = '1'\n                            AND p.post_type = 'project' ";
        $pageposts = $wpdb->get_results($querystr, OBJECT);
        $awnr = count($pageposts);
        if ($awnr > 0) {
            $awnr = "<span class='notif_a'>" . $awnr . "</span>";
        } else {
            $awnr = '';
        }
        //				$querystr = "
        //
        //					SELECT distinct wposts.ID
        //
        //					FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta2, $wpdb->postmeta wpostmeta3, $wpdb->postmeta wpostmeta4
        //
        //					WHERE wposts.ID = wpostmeta2.post_id AND
        //
        //					wpostmeta2.meta_key='winner' AND wpostmeta2.meta_value='$uid' AND
        //
        //
        //					wposts.ID = wpostmeta3.post_id AND
        //
        //					wpostmeta3.meta_key='delivered' AND wpostmeta3.meta_value='1' AND
        //
        //
        //					wposts.ID = wpostmeta4.post_id AND
        //
        //					wpostmeta4.meta_key='paid_user' AND wpostmeta4.meta_value='1'
        //
        //					AND wposts.post_type = 'project' ";
        $querystr = "\n                        SELECT distinct p.ID \n                        FROM {$wpdb->posts} AS p\n                        LEFT JOIN {$wpdb->prefix}project_bids AS pb ON p.ID = pb.pid\n                        WHERE   pb.uid = '{$uid}'\n                            AND pb.winner = '1'\n                            AND pb.paid = '1'\n                            AND pb.delivered = '1'\n                            AND p.post_type = 'project' ";
        $pageposts = $wpdb->get_results($querystr, OBJECT);
        $deliv = count($pageposts);
        if ($deliv > 0) {
            $deliv = "<span class='notif_a'>" . $deliv . "</span>";
        } else {
            $deliv = '';
        }
        $s = "select * from " . $wpdb->prefix . "project_bids where uid='{$uid}'";
        $r = $wpdb->get_results($s);
        $pids = array();
        foreach ($r as $k => $rr) {
            $pids[] = $rr->pid;
        }
        $pids = implode(',', $pids);
        $querystr = "\n\n\t\t\t\t\tSELECT distinct wposts.ID \n\n\t\t\t\t\tFROM {$wpdb->posts} wposts\n\n\t\t\t\t\tWHERE wposts.ID IN ({$pids})\n\n\t\t\t\t\t\n\n\t\t\t\t\tAND wposts.post_type = 'project' AND wposts.post_status = 'publish'";
        $pageposts = $wpdb->get_results($querystr, OBJECT);
        $prop = count($pageposts);
        if ($prop > 0) {
            $prop = "<span class='notif_a'>" . $prop . "</span>";
        } else {
            $prop = '';
        }
        ?>

            <ul id="my-account-admin-menu_buyer">

                   

                 <li><a href="<?php 
        echo get_permalink(get_option('ProjectTheme_my_account_won_projects_id'));
        ?>
"><?php 
        printf(__("Projects I’ve Won %s", 'ProjectTheme'), $won);
        /*_e("Projects I’ve Won",'ProjectTheme');*/
        ?>
</a></li>

                 <li><a href="<?php 
        echo get_permalink(get_option('ProjectTheme_my_account_outstanding_projects_id'));
        ?>
"><?php 
        printf(__("Projects in progress %s", 'ProjectTheme'), $outsnr);
        ?>
</a></li>

                 <li><a href="<?php 
        echo get_permalink(get_option('ProjectTheme_my_account_awaiting_payments_id'));
        ?>
"><?php 
        printf(__("Awaiting Payments %s", 'ProjectTheme'), $awnr);
        ?>
</a></li>

                 <li><a href="<?php 
        echo get_permalink(get_option('ProjectTheme_my_account_delivered_projects_id'));
        ?>
"><?php 
        printf(__("Delivered & Paid Projects %s", 'ProjectTheme'), $deliv);
        /*_e("Delivered & Paid Projects",'ProjectTheme');*/
        ?>
</a></li>

                 <li><a href="<?php 
        echo get_permalink(get_option('ProjectTheme_my_account_bid_projects_id'));
        ?>
"><?php 
        printf(__("My Proposals %s", 'ProjectTheme'), $prop);
        /*_e("My Proposals",'ProjectTheme');*/
        ?>
</a></li>

                 

                 <?php 
        do_action('ProjectTheme_my_account_service_provider_menu');
        ?>

                 

            </ul>

             

            </p>

			</li>

            <?php 
    }
    ?>

            

			</ul>

		</div>

		<?php 
}
예제 #4
0
function projectTheme_template_redirect()
{
    global $wp;
    global $wp_query, $post, $wp_rewrite;
    $my_pid = $post->ID;
    $parent = $post->post_parent;
    $paagee = $wp_query->query_vars['my_custom_page_type'];
    $p_action = $wp_query->query_vars['p_action'];
    $ProjectTheme_my_account_page_id = get_option('ProjectTheme_my_account_page_id');
    $ProjectTheme_post_new_page_id = get_option('ProjectTheme_post_new_page_id');
    $ProjectTheme_my_account_page_id = get_option('ProjectTheme_my_account_page_id');
    //-------------
    if ($parent == $ProjectTheme_my_account_page_id) {
        if (!is_user_logged_in()) {
            wp_redirect(ProjectTheme_login_url());
            exit;
        }
    }
    //-------------
    $ProjectTheme_enable_2_user_tp = get_option('ProjectTheme_enable_2_user_tp');
    if ($ProjectTheme_enable_2_user_tp == "yes" && $p_action != 'choose_user_tp') {
        if (is_user_logged_in()) {
            global $current_user;
            get_currentuserinfo();
            $user_tp = get_user_meta($current_user->ID, 'user_tp', true);
            if (empty($user_tp) && !current_user_can('level_10')) {
                wp_redirect(get_bloginfo('siteurl') . "/?p_action=choose_user_tp");
                exit;
            }
        }
    }
    if (isset($_GET['notify_chained'])) {
        if ($_POST['status'] == "COMPLETED") {
            $trID = $_POST['tracking_id'];
            $trID = explode("_", $trID);
            $pid = $trID[0];
            update_post_meta($pid, 'paid_user', "1");
            update_post_meta($pid, "paid_user_date", current_time('timestamp', 0));
            $projectTheme_get_winner_bid = projectTheme_get_winner_bid($pid);
            ProjectTheme_send_email_when_on_completed_project($pid, $projectTheme_get_winner_bid->uid, $projectTheme_get_winner_bid->bid);
        }
    }
    if (isset($_GET['return_chained'])) {
        $ret_id = $_GET['return_chained'];
        $pid_d = get_option('adaptive_payment_ID_thing_' . $ret_id);
        wp_redirect(projectTheme_my_account_link());
        exit;
    }
    //------------
    if ($my_pid == $ProjectTheme_post_new_page_id) {
        if (!is_user_logged_in()) {
            wp_redirect(ProjectTheme_login_url());
            exit;
        }
        global $current_user;
        get_currentuserinfo();
        if (!ProjectTheme_is_user_business($current_user->ID)) {
            wp_redirect(get_bloginfo('siteurl'));
            exit;
        }
        if (!isset($_GET['projectid'])) {
            $set_ad = 1;
        } else {
            $set_ad = 0;
        }
        if (!empty($_GET['projectid'])) {
            $my_main_post = get_post($_GET['projectid']);
            if ($my_main_post->post_author != $current_user->ID) {
                wp_redirect(get_bloginfo('siteurl'));
                exit;
            }
        }
        if ($set_ad == 1) {
            $pid = ProjectTheme_get_auto_draft($current_user->ID);
            wp_redirect(ProjectTheme_post_new_with_pid_stuff_thg($pid));
        }
        include 'lib/post_new_post.php';
    }
    //-------------
    if ($my_pid == $ProjectTheme_my_account_page_id) {
        if (!is_user_logged_in()) {
            wp_redirect(ProjectTheme_login_url());
            exit;
        }
    }
    //----------------------------------------------------
    if ($p_action == "choose_user_tp") {
        include 'lib/choose_user_tp.php';
        die;
    }
    if (isset($_GET['autosuggest'])) {
        include 'autosuggest.php';
    }
    if ($p_action == "mark_delivered") {
        include 'lib/my_account/mark_delivered.php';
        die;
    }
    if ($p_action == "mark_completed") {
        include 'lib/my_account/mark_completed.php';
        die;
    }
    if ($p_action == "credits_listing") {
        include 'lib/gateways/credits_listing.php';
        die;
    }
    if ($p_action == "relist_this_done") {
        include 'lib/my_account/relist_this_done.php';
        die;
    }
    if ($p_action == "mb_listing_response") {
        include 'lib/gateways/moneybookers_listing_response.php';
        die;
    }
    if ($p_action == "mb_listing") {
        include 'lib/gateways/moneybookers_listing.php';
        die;
    }
    if ($p_action == "paypal_listing") {
        include 'lib/gateways/paypal_listing.php';
        die;
    }
    if ($p_action == "pay_for_project_paypal") {
        include 'lib/gateways/pay_for_project_paypal.php';
        die;
    }
    if ($p_action == "edit_project") {
        include 'lib/my_account/edit_project.php';
        die;
    }
    if ($p_action == "rate_user") {
        include 'lib/my_account/rate_user.php';
        die;
    }
    if ($p_action == "choose_winner") {
        include 'lib/choose_winner.php';
        die;
    }
    if ($p_action == "user_profile") {
        include 'lib/user-profile.php';
        die;
    }
    if ($p_action == "user_feedback") {
        include 'lib/user-feedback.php';
        die;
    }
    if ($p_action == "delete_project") {
        include 'lib/my_account/delete_project.php';
        die;
    }
    if ($p_action == "repost_project") {
        include 'lib/my_account/repost_project.php';
        die;
    }
    if ($p_action == "paypal_deposit_pay") {
        include 'lib/gateways/paypal_deposit_pay.php';
        die;
    }
    if ($p_action == "mb_deposit_response") {
        include 'lib/gateways/mb_deposit_response.php';
        die;
    }
    if ($p_action == "mb_deposit_pay") {
        include 'lib/gateways/mb_deposit_pay.php';
        die;
    }
    if ($paagee == "pay_projects_by_credits") {
        include 'lib/pay-projects-by-credits.php';
        die;
    }
    if ($paagee == "show-all-categories") {
        include 'lib/show-all-categories.php';
        die;
    }
    if ($paagee == "show-all-locations") {
        include 'lib/show-all-locations.php';
        die;
    }
    if ($paagee == "post-new") {
        include 'post-new.php';
        die;
    }
    if ($paagee == "pay_paypal") {
        include 'lib/gateways/paypal.php';
        die;
    }
    if ($paagee == "advanced_search") {
        include 'lib/advanced-search.php';
        die;
    }
    if ($paagee == "alert-pay-return") {
        include 'lib/gateways/alert-pay-return.php';
        die;
    }
    if (isset($_GET['get_files_panel'])) {
        include 'lib/get_files_panel.php';
        die;
    }
    if (isset($_GET['get_bidding_panel'])) {
        include 'lib/bidding-panel.php';
        die;
    }
    if (isset($_GET['get_message_board'])) {
        include 'lib/message-board.php';
        die;
    }
    if ($paagee == "all-blog-posts") {
        include 'lib/blog.php';
        die;
    }
    if ($paagee == "all_featured_projects") {
        include 'lib/all_featured_projects.php';
        die;
    }
    if ($paagee == "user_feedback") {
        include 'lib/user-feedback.php';
        die;
    }
    if ($paagee == "buy_now") {
        include 'lib/buy-now.php';
        die;
    }
    if ($paagee == "pay-for-project") {
        include 'lib/gateways/paypal-project.php';
        die;
    }
    if ($paagee == "deposit_pay") {
        include 'lib/gateways/deposit-pay.php';
        die;
    }
}