function mlmNetworkDetailsPage()
{
    //get loged user's key
    $key = get_current_user_key();
    //Total my personal sales
    $personalSales = totalMyPersonalSales($key);
    //Total my personal sales active users
    $activePersonalSales = activeUsersOnPersonalSales($key);
    //show five users on personal sales
    $fivePersonalUsers = myFivePersonalUsers($key);
    //get logged in user info
    global $current_user, $wpdb;
    $table_prefix = mlm_core_get_table_prefix();
    get_currentuserinfo();
    $username = $current_user->ID;
    $user_info = get_userdata($current_user->ID);
    $_SESSION['ajax'] = 'ajax_check';
    $add_page_id = get_post_id('mlm_registration_page');
    $sponsor_name = $current_user->user_login;
    /**********Affiliate URL CODE***********************/
    $affiliateURLold = site_url() . '?page_id=' . $add_page_id . '&sp=' . $key;
    $affiliateURLnew = site_url() . '/u/' . $sponsor_name;
    $permalink = get_permalink(empty($_GET['page_id']) ? '' : $_GET['page_id']);
    $postidparamalink = strstr($permalink, 'page_id');
    $affiliateURL = $postidparamalink ? $affiliateURLold : $affiliateURLnew;
    /*********E O F Affiliate URL Code************************/
    $view_memberpage_id = $wpdb->get_var("SELECT id FROM {$table_prefix}posts  WHERE `post_content` LIKE '%mlm-view-child-level-member%'\tAND `post_type` != 'revision'");
    // Check Payment Method
    $mlm_method = get_option('wp_mlm_payment_method');
    $mlm_general_settings = get_option('wp_mlm_general_settings');
    $mlm_no_of_level = $mlm_general_settings['mlm-level'];
    $mlm_pay_settings = get_option('wp_mlm_payment_settings');
    //Check If USER is Not PAid then will show option for Payment
    $check_paid = $wpdb->get_var("SELECT payment_status FROM {$table_prefix}mlm_users WHERE user_id = '" . $username . "'");
    if ($check_paid == 0) {
        PayNowOptions($username, 'dashboard');
    }
    ?>
	     <?php 
    if (function_exists('Update_Paypal_Notification')) {
        Update_Paypal_Notification();
    }
    ?>
	
<p class="affiliate_url"><strong>Affiliate URL :</strong> <?php 
    echo $affiliateURL;
    ?>
 </p><br /> 
		<table width="100%" border="0" cellspacing="10" cellpadding="1">
		  <tr>
			<td width="40%" valign="top">
				<table width="100%" border="0" cellspacing="10" cellpadding="1">
				  <tr>
					<td colspan="2"><strong><?php 
    _e('Personal Information', 'unilevel-mlm-pro');
    ?>
</strong></td>
				  </tr>
				  <tr>
					<td scope="row"><?php 
    _e('Title', 'unilevel-mlm-pro');
    ?>
</td>
					<td><?php 
    _e('Details', 'unilevel-mlm-pro');
    ?>
</td>
				  </tr>
				  <tr>
					<td scope="row"><?php 
    _e('Name', 'unilevel-mlm-pro');
    ?>
</td>
					<td><?php 
    echo $user_info->first_name . ' ' . $user_info->last_name;
    ?>
</td>
				  </tr>
				  <tr>
					<td scope="row"><?php 
    _e('Address', 'unilevel-mlm-pro');
    ?>
</td>
					<td style="white-space:normal;"><?php 
    echo $user_info->user_address1 . "<br>" . $user_info->user_address2;
    ?>
</td>
				  </tr>
				  <tr>
					<td scope="row"><?php 
    _e('City', 'unilevel-mlm-pro');
    ?>
</td>
					<td><?php 
    echo $user_info->user_city;
    ?>
</td>
				  </tr>
				  <tr>
					<td scope="row"><?php 
    _e('Contact No', 'unilevel-mlm-pro');
    ?>
.</td>
					<td><?php 
    echo $user_info->user_telephone;
    ?>
</td>
				  </tr>
				  <tr>
					<td scope="row"><?php 
    _e('DOB', 'unilevel-mlm-pro');
    ?>
</td>
					<td><?php 
    echo $user_info->user_dob;
    ?>
</td>
				  </tr>
				  
				  
				  
				  <tr>
		<td><a href="<?php 
    echo get_post_id_or_postname('mlm_update_profile_page', 'unilevel-mlm-pro');
    ?>
" style="text-decoration: none"><?php 
    _e('Edit', 'unilevel-mlm-pro');
    ?>
</a></td>
		<td><a href="<?php 
    echo get_post_id_or_postname('mlm_network_genealogy_page', 'unilevel-mlm-pro');
    ?>
" style="text-decoration: none"><?php 
    _e('View Genealogy', 'unilevel-mlm-pro');
    ?>
</a></td>
		</tr>
				</table> 
					<table width="100%" border="0" cellspacing="10" cellpadding="1">
				  <tr>
					<td colspan="2"><strong><?php 
    _e('My Payouts', 'unilevel-mlm-pro');
    ?>
</strong></td>
				  </tr>
				  <tr>
					<td scope="row"><?php 
    _e('Date', 'unilevel-mlm-pro');
    ?>
</td>
					<td><?php 
    _e('Amount', 'unilevel-mlm-pro');
    ?>
</td>
       <td><?php 
    _e('Action', 'unilevel-mlm-pro');
    ?>
</td>
				  </tr>
<?php 
    $detailsArr = my_payout_function();
    //_e("<pre>");print_r($detailsArr); exit;
    //$page_id = get_post_id('mlm_my_payout_details_page');
    if (count($detailsArr) > 0) {
        $mlm_settings = get_option('wp_mlm_general_settings');
        ?>
			<?php 
        foreach ($detailsArr as $row) {
            $amount = $row->commission_amount + $row->bonus_amount;
            ?>
		<tr>
			<td><?php 
            echo $row->payoutDate;
            ?>
</td>
			<td><?php 
            echo $mlm_settings['currency'] . ' ' . $amount;
            ?>
</td>
			<td><a href="<?php 
            echo get_post_id_or_postname_for_payout('mlm_my_payout_details_page', $row->payout_id);
            ?>
">View</a></td>
			
		</tr>
		
		<?php 
        }
        ?>
	<?php 
    } else {
        ?>
	<div class="no-payout"><?php 
        _e('You have not earned any commisssions yet.', 'unilevel-mlm-pro');
        ?>
 </div>
	
	<?php 
    }
    ?>
				</table>
			</td>
			<td width="40%">
				<table width="100%" border="0" cellspacing="10" cellpadding="1">
				  <tr>
					<td><strong><?php 
    _e('Network Details', 'unilevel-mlm-pro');
    ?>
</strong></td>
				  </tr>
				  
				  

				 	<tr>
					<td>
						<table width="100%" border="0" cellspacing="10" cellpadding="1">
							<tr>
								<td colspan="2"><strong><?php 
    _e('Personal Sales', 'unilevel-mlm-pro');
    ?>
</strong></td>
							</tr>
							
							<tr>
								<td><?php 
    _e('My Personal Sales', 'unilevel-mlm-pro');
    ?>
: <?php 
    echo $personalSales;
    ?>
</td>
			<td><?php 
    _e('Active', 'unilevel-mlm-pro');
    ?>
: <?php 
    echo $activePersonalSales;
    ?>
</td>
							</tr>
							<?php 
    foreach ($fivePersonalUsers as $key => $value) {
        _e("<tr>");
        foreach ($value as $k => $val) {
            _e("<td>" . $val . "</td>");
        }
        _e("</tr>");
    }
    ?>
							<tr>
		<td colspan="2"><a href="?page_id=<?php 
    echo $view_memberpage_id;
    ?>
&lvl=1" style="text-decoration: none"><?php 
    _e('View All', 'unilevel-mlm-pro');
    ?>
</a></td>
		</tr>
							
						</table>
					</td>
				  </tr> 
				  
				</table>
			</td>
		  </tr>
		</table>

<?php 
}
    function widget($args, $instance)
    {
        extract($args);
        $table_prefix = mlm_core_get_table_prefix();
        global $wpdb;
        $title = apply_filters('widget_title', $instance['title']);
        $textarea = $instance['textarea'];
        $ckemail = get_option('ckemail');
        echo $before_widget;
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        if ($textarea) {
            echo '<p>' . $textarea . '</p>';
        }
        if (!empty($_GET['sp_name'])) {
            $sp_name = $_GET['sp_name'];
        } else {
            if (!empty($_GET['sp'])) {
                $sp_name = getusernamebykey($_GET['sp']);
            } else {
                if (!empty($_COOKIE["sp_name"])) {
                    $sp_name = $_COOKIE["sp_name"];
                }
            }
        }
        //$sp_name = empty($_COOKIE["sp_name"])?'':$_COOKIE["sp_name"];
        if (is_user_logged_in()) {
            $current_user = wp_get_current_user();
            $cuserid = $current_user->ID;
            $cusername = $current_user->user_firstname . ' ' . $current_user->user_lastname;
            $cemail = $current_user->user_email;
            $all_meta_for_user = get_user_meta($cuserid);
            ?>
  
            <div class="join_box">
                <div class="join_box_left" style="width:90px;float:left;">
                    <?php 
            echo get_avatar($cuserid, 80);
            ?>
                </div>
                <div class="join_box_right">
                    <?php 
            echo '<span class="swname">' . ucwords(empty($cusername) ? '' : $cusername) . '</span><br/>';
            if (!empty($ckemail)) {
                ?>
                        <span class='swemail'><?php 
                echo empty($cemail) ? '' : $cemail;
                ?>
</span><br/><br/>
                        <?php 
            } else {
                echo '<br/>';
            }
            ?>
                    <input type="button" value="Join Now" class="primary button" onclick="window.location = '<?php 
            echo get_post_id_or_postname('mlm_registration_page', 'binary-mlm-pro');
            ?>
'" />
                </div>
            </div>
            <?php 
        } else {
            if (!empty($sp_name)) {
                $userid = $wpdb->get_var("SELECT user_id FROM {$table_prefix}mlm_users WHERE username = '******'");
                if (!empty($userid)) {
                    $all_meta_for_user = get_user_meta($userid);
                    $fname = $all_meta_for_user['first_name'][0];
                    $lname = $all_meta_for_user['last_name'][0];
                    $fullname = $fname . ' ' . $lname;
                    $user_info = get_userdata($userid);
                    $email = $user_info->user_email;
                    $permalink = get_permalink(empty($_GET['page_id']) ? '' : $_GET['page_id']);
                    $postidparamalink = strstr($permalink, 'page_id');
                    $concat = $postidparamalink ? '&' : '/?';
                }
                ?>
                <div class="join_box">
                    <div class="join_box_left" style="width:90px;float:left;">
                        <?php 
                echo get_avatar($userid, 80);
                ?>
                    </div>
                    <div class="join_box_right">
                        <?php 
                echo '<span class="swname">' . ucwords(empty($fullname) ? '' : $fullname) . '</span><br/>';
                if (!empty($ckemail)) {
                    ?>
                            <span class='swemail'><?php 
                    echo empty($email) ? '' : $email;
                    ?>
</span><br/><br/>
                            <?php 
                } else {
                    echo '<br/>';
                }
                ?>
                        <input type="button" value="Join Now" class="primary button" onclick="window.location = '<?php 
                echo get_post_id_or_postname('mlm_registration_page', 'binary-mlm-pro');
                echo empty($concat) ? '/?' : $concat;
                ?>
sp_name=<?php 
                echo $sp_name;
                ?>
'" />
                    </div>
                </div>
                <?php 
            }
        }
        echo $after_widget;
    }
Пример #3
0
    function widget($args, $instance)
    {
        global $current_user;
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        $textarea = $instance['textarea'];
        $ckemail = get_option('ckemail');
        echo $before_widget;
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        if ($textarea) {
            echo '<p>' . $textarea . '</p>';
        }
        if (is_user_logged_in()) {
            $sp_name = $current_user->user_login;
        } else {
            if (!empty($_GET['sp_name'])) {
                $sp_name = $_GET['sp_name'];
            } else {
                if (!empty($_GET['sp'])) {
                    $sp_name = getusernamebykey($_GET['sp']);
                } else {
                    $sp_name = $_COOKIE["s_name"];
                }
            }
        }
        if (is_user_logged_in()) {
            $current_user = wp_get_current_user();
            $cuserid = $current_user->ID;
            $cusername = $current_user->user_firstname . ' ' . $current_user->user_lastname;
            ?>
  
			<div class="join_box">
				<div class="join_box_left" style="width:90px;float:left;">
					<?php 
            echo get_avatar($userid, 80);
            ?>
				</div>
				<div class="join_box_right">
					<?php 
            echo '<p>' . $cusername . '</p>';
            if (!empty($ckemail)) {
                ?>
                        <span class='swemail'><?php 
                echo empty($cemail) ? '' : $cemail;
                ?>
</span><br/><br/>
                        <?php 
            } else {
                echo '<br/>';
            }
            ?>
					<a class="subscribe button-primary" href="<?php 
            echo get_post_id_or_postname('mlm_registration_page', 'unilevel-mlm-pro');
            ?>
/">Join Now</a>
				</div>
			</div>
	<?php 
        } else {
            if (!empty($sp_name)) {
                $user = get_user_by('login', $sp_name);
                if (!empty($user)) {
                    $userid = $user->ID;
                    $all_meta_for_user = get_user_meta($userid);
                    $fname = $all_meta_for_user['first_name'][0];
                    $lname = $all_meta_for_user['last_name'][0];
                    $fullname = $fname . ' ' . $lname;
                    $user_info = get_userdata($userid);
                    $email = $user_info->user_email;
                    $permalink = get_permalink(empty($_GET['page_id']) ? '' : $_GET['page_id']);
                    $postidparamalink = strstr($permalink, 'page_id');
                    $concat = $postidparamalink ? '&' : '/?';
                }
                ?>
				<div class="join_box">
					<div class="join_box_left" style="width:90px;float:left;">
						<?php 
                echo get_avatar($userid, 80);
                ?>
					</div>
					<div class="join_box_right">
						<?php 
                echo '<p>' . $fullname . '</p>';
                if (!empty($ckemail)) {
                    ?>
                            <span class='swemail'><?php 
                    echo empty($email) ? '' : $email;
                    ?>
</span><br/><br/>
                            <?php 
                } else {
                    echo '<br/>';
                }
                ?>
						<a class="subscribe button-primary" href="<?php 
                echo get_post_id_or_postname('mlm_registration_page', 'unilevel-mlm-pro');
                echo $concat;
                ?>
sp_name=<?php 
                echo $sp_name;
                ?>
">Join Now</a>
					</div>
				</div>
	<?php 
            }
        }
        echo $after_widget;
    }
function mlmNetworkDetailsPage()
{
    //get loged user's key
    $key = get_current_user_key();
    //Total Users on My left leg
    $leftLegUsers = totalLeftLegUsers($key);
    //Total users on my right leg
    $rightLegUsers = totalRightLegUsers($key);
    //paid users on my left leg
    $leftLegActiveUsers = activeUsersOnLeftLeg($key);
    //paid users on my right leg
    $rightLegActiveUsers = activeUsersOnRightLeg($key);
    //Total my personal sales
    $personalSales = totalMyPersonalSales($key);
    //Total my personal sales active users
    $activePersonalSales = activeUsersOnPersonalSales($key);
    //show five users on left leg
    $fiveLeftLegUsers = myFiveLeftLegUsers($key);
    //show five users on right leg
    $fiveRightLegUsers = myFiveRightLegUsers($key);
    //show five users on personal sales
    $fivePersonalUsers = myFivePersonalUsers($key);
    //get logged in user info
    global $current_user, $wpdb;
    get_currentuserinfo();
    $username = $current_user->ID;
    $user_info = get_userdata($current_user->ID);
    $_SESSION['ajax'] = 'ajax_check';
    $add_page_id = get_post_id('mlm_registration_page');
    $sponsor_name = $current_user->user_login;
    $affiliateURLold = site_url() . '?page_id=' . $add_page_id . '&sp=' . $key;
    $affiliateURLnew = site_url() . '/u/' . getusernamebykey($key);
    $permalink = get_permalink(empty($_GET['page_id']) ? '' : $_GET['page_id']);
    $postidparamalink = strstr($permalink, 'page_id');
    $affiliateURL = $postidparamalink ? $affiliateURLold : $affiliateURLnew;
    ?>
    <?php 
    if (function_exists('Update_Paypal_Notification')) {
        Update_Paypal_Notification();
    }
    ?>
    <p class="affiliate_url"><strong>Affiliate URL :</strong> <?php 
    echo $affiliateURL;
    ?>
 </p><br />

    <table width="100%" border="0" cellspacing="10" cellpadding="1">
        <tr>
            <td width="40%" valign="top">
                <table width="100%" border="0" cellspacing="10" cellpadding="1">
                    <tr>
                        <td colspan="2"><strong> <?php 
    _e('Personal Information', 'binary-mlm-pro');
    ?>
</strong></td>
                    </tr>
                    <tr>
                        <td scope="row"><?php 
    _e('Title', 'binary-mlm-pro');
    ?>
</td>
                        <td> <?php 
    _e('Details', 'binary-mlm-pro');
    ?>
</td>
                    </tr>
                    <tr>
                        <td scope="row"> <?php 
    _e('Name', 'binary-mlm-pro');
    ?>
</td>
                        <td><?php 
    echo $user_info->first_name . ' ' . $user_info->last_name;
    ?>
</td>
                    </tr>
                    <tr>
                        <td scope="row"> <?php 
    _e('Address', 'binary-mlm-pro');
    ?>
</td>
                        <td style="white-space:normal;"><?php 
    echo $user_info->user_address1 . "<br>" . $user_info->user_address2;
    ?>
</td>
                    </tr>
                    <tr>
                        <td scope="row"> <?php 
    _e('City', 'binary-mlm-pro');
    ?>
</td>
                        <td><?php 
    echo $user_info->user_city;
    ?>
</td>
                    </tr>
                    <tr>
                        <td scope="row"> <?php 
    _e('Contact No', 'binary-mlm-pro');
    ?>
.</td>
                        <td><?php 
    echo $user_info->user_telephone;
    ?>
</td>
                    </tr>
                    <tr>
                        <td scope="row"> <?php 
    _e('DOB', 'binary-mlm-pro');
    ?>
</td>
                        <td><?php 
    echo $user_info->user_dob;
    ?>
</td>
                    </tr>



                    <tr>
                        <td><a href="<?php 
    echo get_post_id_or_postname('mlm_update_profile_page', 'binary-mlm-pro');
    ?>
" style="text-decoration: none"><?php 
    _e('Edit', 'binary-mlm-pro');
    ?>
</a></td>
                        <td><a href="<?php 
    echo get_post_id_or_postname('mlm_network_genealogy_page', 'binary-mlm-pro');
    ?>
" style="text-decoration: none"><?php 
    _e('View Genealogy', 'binary-mlm-pro');
    ?>
</a></td>
                    </tr>
                </table>
                <table width="100%" border="0" cellspacing="10" cellpadding="1">
                    <tr>
                        <td colspan="2"><strong><?php 
    _e('My Payouts', 'binary-mlm-pro');
    ?>
</strong></td>
                    </tr>
                    <tr>
                        <td scope="row"><?php 
    _e('Date', 'binary-mlm-pro');
    ?>
</td>
                        <td><?php 
    _e('Amount', 'binary-mlm-pro');
    ?>
</td>
                        <td><?php 
    _e('Action', 'binary-mlm-pro');
    ?>
</td>
                    </tr>
                    <?php 
    $detailsArr = my_payout_function();
    //_e("<pre>");print_r($detailsArr); exit;
    //$page_id = get_post_id('mlm_my_payout_details_page');
    if (count($detailsArr) > 0) {
        $mlm_settings = get_option('wp_mlm_general_settings');
        ?>
                        <?php 
        foreach ($detailsArr as $row) {
            $amount = $row->commission_amount + $row->bonus_amount + $row->referral_commission_amount - $row->tax - $row->service_charge;
            ?>
                            <tr>
                                <td><?php 
            echo $row->payoutDate;
            ?>
</td>
                                <td><?php 
            echo $mlm_settings['currency'] . ' ' . $amount;
            ?>
</td>
                                <td><a href="<?php 
            echo get_post_id_or_postname_for_payout('mlm_my_payout_details_page', $row->payout_id);
            ?>
"><?php 
            echo __('View', 'binary-mlm-pro');
            ?>
</a></td>

                            </tr>

                        <?php 
        }
        ?>
                        <?php 
    } else {
        ?>
                        <div class="no-payout"><?php 
        _e('You have not earned any commisssions yet.', 'binary-mlm-pro');
        ?>
 </div>

                        <?php 
    }
    ?>
                </table>
            </td>
            <td width="40%">
                <table width="100%" border="0" cellspacing="10" cellpadding="1">
                    <tr>
                        <td><strong><?php 
    _e('Network Details', 'binary-mlm-pro');
    ?>
</strong></td>
                    </tr>
                    <tr>
                        <td>
                            <table width="100%" border="0" cellspacing="10" cellpadding="1">
                                <tr>
                                    <td colspan="2"><strong><?php 
    _e('Left Leg Sales', 'binary-mlm-pro');
    ?>
</strong></td>
                                </tr>

                                <tr>
                                    <td><?php 
    _e('Total on Left Leg', 'binary-mlm-pro');
    ?>
: <?php 
    echo $leftLegUsers;
    ?>
</td>
                                    <td><?php 
    _e('Active', 'binary-mlm-pro');
    ?>
: <?php 
    echo $leftLegActiveUsers;
    ?>
</td>
                                </tr>
                                <?php 
    foreach ($fiveLeftLegUsers as $key => $value) {
        _e("<tr>");
        foreach ($value as $k => $val) {
            _e("<td>" . $val . "</td>");
        }
        _e("</tr>");
    }
    ?>
                                <tr>
                                    <td colspan="2"><a href="<?php 
    echo get_post_id_or_postname('mlm_left_group_details_page', 'binary-mlm-pro');
    ?>
" style="text-decoration: none"><?php 
    _e('View All', 'binary-mlm-pro');
    ?>
</a></td>
                                </tr>

                            </table>
                        </td>
                    </tr>

                    <tr>
                        <td>
                            <table width="100%" border="0" cellspacing="10" cellpadding="1">
                                <tr>
                                    <td colspan="2"><strong><?php 
    _e('Right Leg Sales', 'binary-mlm-pro');
    ?>
</strong></td>
                                </tr>

                                <tr>
                                    <td><?php 
    _e('Total on Right Leg', 'binary-mlm-pro');
    ?>
: <?php 
    echo $rightLegUsers;
    ?>
</td>
                                    <td><?php 
    _e('Active', 'binary-mlm-pro');
    ?>
: <?php 
    echo $rightLegActiveUsers;
    ?>
</td>
                                </tr>
                                <?php 
    foreach ($fiveRightLegUsers as $key => $value) {
        _e("<tr>");
        foreach ($value as $k => $val) {
            _e("<td>" . $val . "</td>");
        }
        _e("</tr>");
    }
    ?>
                                <tr>
                                    <td colspan="2"><a href="<?php 
    echo get_post_id_or_postname('mlm_right_group_details_page', 'binary-mlm-pro');
    ?>
" style="text-decoration: none"><?php 
    _e('View All', 'binary-mlm-pro');
    ?>
</a></td>
                                </tr>

                            </table>
                        </td>
                    </tr>


                    <tr>
                        <td>
                            <table width="100%" border="0" cellspacing="10" cellpadding="1">
                                <tr>
                                    <td colspan="2"><strong><?php 
    _e('Personal Sales', 'binary-mlm-pro');
    ?>
</strong></td>
                                </tr>

                                <tr>
                                    <td><?php 
    _e('My Personal Sales', 'binary-mlm-pro');
    ?>
: <?php 
    echo $personalSales;
    ?>
</td>
                                    <td><?php 
    _e('Active', 'binary-mlm-pro');
    ?>
: <?php 
    echo $activePersonalSales;
    ?>
</td>
                                </tr>
                                <?php 
    foreach ($fivePersonalUsers as $key => $value) {
        _e("<tr>");
        foreach ($value as $k => $val) {
            _e("<td>" . $val . "</td>");
        }
        _e("</tr>");
    }
    ?>
                                <tr>
                                    <td colspan="2"><a href="<?php 
    echo get_post_id_or_postname('mlm_personal_group_details_page', 'binary-mlm-pro');
    ?>
" style="text-decoration: none"><?php 
    _e('View All', 'binary-mlm-pro');
    ?>
</a></td>
                                </tr>

                            </table>
                        </td>
                    </tr> 

                </table>
            </td>
        </tr>
    </table>

    <?php 
}