View Categories

User cannot upload an image

If a user cannot upload an image to a topic or reply, make sure that the role of your forum members has permissions to upload images. Roles and capabilities can be managed using a plugin or be done in code.

Here is a snippet to add upload capabilities to the “contributor” role.

// Allow Contributors to Upload Media.
if ( current_user_can('contributor' ) && ! current_user_can( 'upload_files' ) ) {
add_action( 'admin_init', 'allow_contributor_uploads' );
}

function allow_contributor_uploads() {
$contributor = get_role( 'contributor' );
$contributor->add_cap( 'upload_files' );
}