Okay
  Public Ticket #3823039
Agent Dashboard - Customer List for Subagent's Customers
Closed

Comments

  •  6
    Spencer started the conversation

    Hi there,

    Normally when an agent has customers registered, they can see a complete list of these customers on their dashboard. Can you please provide the code to also list their subagent's customers, preferrably with a signifier to show that it belongs to a specific subagent? Thanks in advance!

  •  2,361
    WebWizards replied

    Hello Spencer,

    It is possible to allow agents to also see their subagents' customers on the Customer dashboard page.

    To achieve that, please add this PHP code snippet to the site:

    add_filter('salesking_include_subagent_customers','__return_true');

     

    Regarding a identifier to know which customer belongs to which agent, you can also add this PHP snippet:

    add_action('salesking_customers_custom_columns_header', function(){
    	?>
    	<th class="nk-tb-col tb-col-md"><span class="sub-text"><?php esc_html_e('Parent Agent','salesking'); ?></span></th>
    	<?php
    });
    
    add_action('salesking_customers_custom_columns_content', function($customer){
    	?>
    	<td class="nk-tb-col tb-col-lg">
    	    <div>
    	        <?php
    	        	$agent_id = get_user_meta($customer->get_id(), 'salesking_assigned_agent', true);
    	        	if (!empty($agent_id) && !$agent_id !== 'none'){
    	        		$agent = new WP_User($agent_id);
    	        		echo $agent->user_login;
    	        	}
    	        ?>
    	    </div>
    	</td>	
    	<?php
    });

    It adds an extra Parent Agent column.

     

    Kind regards,

    Stefan