0

I'm trying to allow an user with the editor role on my site the ability to access the dashboard settings for the Unbounce Landing Pages plugin.

Here is the code that controls the settings tab pulled from the main plugin php file:

add_action('admin_menu', function () {
  // Main admin page
    $print_admin_panel = function () {
        $domain = UBConfig::domain();
        $domain_info = UBConfig::read_unbounce_domain_info($domain, false);

        echo UBTemplate::render(
            'main',
            array('domain_info' => $domain_info,
            'domain' => $domain)
        );
    };

    add_menu_page(
        'Unbounce Pages',
        'Unbounce Pages',
        'manage_options',
        'unbounce-pages',
        $print_admin_panel,
        UBIcon::base64_encoded_svg()
    );

  // Diagnostics page
    $print_diagnostics_panel = function () {
        $domain = UBConfig::domain();
        $domain_info = UBConfig::read_unbounce_domain_info($domain, false);

        echo UBTemplate::render(
            'diagnostics',
            array('img_url' => plugins_url('img/unbounce-logo-blue.png', __FILE__),
                                  'checks' => UBDiagnostics::checks($domain, $domain_info),
                                  'details' => UBDiagnostics::details($domain, $domain_info),
                                  'domain' => $domain,
                                  'permalink_url' => admin_url('options-permalink.php'),
            'curl_error_message' => UBUtil::array_fetch(
                $domain_info,
                'failure_message'
            ))
        );
    };

    add_submenu_page(
        'unbounce-pages',
        'Unbounce Pages Diagnostics',
        'Unbounce Pages Diagnostics',
        'manage_options',
        'unbounce-pages-diagnostics',
        $print_diagnostics_panel
    );
});

How should I edit this to allow editors to access the settings in the dashboard?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.