[Urgent] Dashboard shows homepage for non-admin users after Bricks 2 upgrade

When having a custom dashboard set using BricksForge > Backend Designer, the dashboard is showing the homepage for users with non-admin role.

We created this script to fix the issue, but we would like to see this solved in a new BricksForge release:

add_action('admin_head-index.php', function () {
// user role
if (!current_user_can('editor') && !in_array('sb_office', wp_get_current_user()->roles)) {
return;
}
echo '<style>#wpbody-content { display: none; }</style>';
});

add_action('admin_footer-index.php', function () {

// User role
if (!current_user_can('editor') && !in_array('sb_office', wp_get_current_user()->roles)) {
return;
}

// Change template id.
$template_id = 20932;
$template_url = get_permalink($template_id) . '?backend=true';

?>
<script>
document.addEventListener('DOMContentLoaded', function () {
const wpBodyContent = document.getElementById('wpbody-content');
if (wpBodyContent) {
wpBodyContent.innerHTML = `
<iframe
src="<?php echo esc_url($template_url); ?>"
style="
border: none;
bottom: 0;
height: calc(100vh - 32px);
left: 0;
margin-left: 160px;
margin-top: 32px;
overflow: hidden;
position: fixed;
right: 0;
top: 0;
width: calc(100vw - 160px);
"
frameborder="0"
scrolling="auto"
></iframe>
`;
wpBodyContent.style.display = 'block';
}
});
</script>
<?php
});

Hi there :slight_smile:

could you try either setting “Public Templates” to true in the Bricks Settings or using a Private Page instead of a template? Also, I assume you’ve already done this, check the permissions in the Admin page settings.

Personally I’d go the private page route as it offers the most control without having to publish templates. If neither of the approaches work, feel free to open a support ticket with some logins so I can take a closer look and debug :slight_smile:

Thank you for helping out! The private page did the trick indeed. :partying_face: