After adding add_role to functions.php and creating a user, can not login into admin

That’s because the “normal” capabilites that are needed to login are missing. You should simply load the capabilites of some default role and attach them to your custom role before using it on a user.


EDIT: Solution from @dashalune (OP):

add_role('resourcerer', 'Resourcerer'); 
$role =& get_role('resourcerer'); 
$role->add_cap('read');