Okay
  Public Ticket #4562571
Access to panels allowed by default
Closed

Comments

  •  1
    Tabard started the conversation

    Hi,

    When adding a team member to the store, can they be automatically granted access to all dashboard panels?

    This would prevent the access restriction message if the administrator forgets to activate the panels in the member's settings.

    Thank you in advance for your response

  •  2,725
    WebWizards replied

    Hi Tabard,

    Thanks for reaching out. You can achieve this with a small code snippet. Please add the following to your theme's functions.php or any code snippets plugin:

    add_action('marketking_after_member_created', 'mk_grant_all_panels_to_new_member', 10, 3);
    function mk_grant_all_panels_to_new_member($user_id, $parent_agent_id, $parentaggroup) {
        if (!function_exists('marketkingpro')) {
            return;
        }
    
        $panels = marketkingpro()->get_all_vendor_available_dashboard_panels();
    
        foreach ($panels as $panel_slug => $panel_name) {
            update_user_meta($user_id, 'marketking_teammember_available_panel_' . $panel_slug, 1);
        }
    }

    This will automatically grant access to all available dashboard panels whenever a new team member is created.

    Let me know if you run into any issues,

    Kind regards,
    Stefan