Recently, i am working with the wordpress and i want to allowed user to comments on the post or article if he/she is register. it means if user is not register then he/she can not comment on any article or any post in the wordpress. its wordpress inbuilt option but we are not aware of it, you can easily do this using the wordpress setting.
Go to Settings and then click on the Discussion which will open page of Discussion Settings in wordpress admin panel, now here there is option like ‘Users must be registered and logged in to comment’ with checkbox option. if you want user must register and then leave comments then you need to enable this by tick on the check box and save settings.