Call current_user_can after init()

This error appears on wordpress when I activate debug mode, and using bbpress and buddypress, the error was a requiremnt on using the init function before use a restriction related with the function current_user_can

After having this using on a theme development, I have check some pages like

Finally my solution was create a function as says and warning disappear

function restrict_admin(){
//if not administrator, kill WordPress execution and provide a message
if ( ! current_user_can( 'manage_options' ) ) {
wp_die( __('You are not allowed to access this part of the site') );
add_action( 'admin_init', 'restrict_admin', 1 );