limit view result to only commented nodes
You don't need to code something here with powerful Views module.  


First, add relationship “Comment: Comments of the node” to current View.
Then in “Query settings” check “Distinct” option. Now you have list of nodes which have comments.  
Add contextual filter “Comment: Author uid”, set default value to “User ID from logged in user” and don't forget to check option “Exclude” in MORE fieldset.




Note that this solution works only for current logged in user.