Notifications
Clear all
wpForo Advanced Attachments
3
Posts
1
Users
1
Reactions
755
Views
Jul 06, 2023 5:06 pm
2 Replies
Jul 06, 2023 5:28 pm
Found the issue, this code was running in snippits:
function restrict_dashboard_access() {
if (is_user_logged_in()) {
$current_user = wp_get_current_user();
$user_roles = $current_user->roles;
if (!in_array('administrator', $user_roles)) {
wp_redirect(home_url());
exit;
}
}
}
add_action('admin_init', 'restrict_dashboard_access');
This was stopping the upload feature.
Jul 06, 2023 5:58 pm
To fix add an additional check to ensure that the redirection is only performed if it's an admin page and not an AJAX request. This allows the attachment uploads in wpForo to proceed.