Public Ticket #3823039

Agent Dashboard - Customer List for Subagent's Customers

Closed
Comments
12 Tickets 6
Spencer started the conversation 2 years ago on February 18, 2025 at 5:24pm

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,762
KingsPlugins replied 2 years ago on February 21, 2025 at 1:28pm

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

Sign In