How to have a field that counts the nodes submitted by the current user? My site with existing content needs a field that shows the number of nodes of a certain content type that have been created by the current user.

I can't use Views because the field needs to be able to be used in a Rules condition. 

Nor can I use Rules Actions and Flag at the time of adding nodes because so many nodes are pre-existing. 

Nor can I use Display Suite code fields because I don't think they are able to be used in Rules either.

Is a computed field and a custom query the best option? 

I have so far failed to find a code snippet and I am not experienced in PHP.
You can use the Computed Field module but you need to consider this:


  When is the field actually computed? 
  
  If you wish to store the values
  in the database then you have to update or re-submit the node to
  compute the value of the field.
  
  If it is not stored in the database then the value computes when the
  node loads and only when the node is loaded. The field will not work
  in views nor will it function properly if it depends on other
  non-stored computed fields.


This is the code of your field:

global $user;
$type = 'article';

$query = new EntityFieldQuery;
$result = $query
-&gt;entityCondition('entity_type', 'node')
-&gt;propertyCondition('status', 1)
-&gt;propertyCondition('type', $type)
-&gt;propertyCondition('uid', $user-&gt;uid)
-&gt;execute();

$cant = count($result['node']);
$entity_field[0]['value'] = $cant;


Another way that come to my mind is have a variable to store this value, and you will edit this var each time a new node is created (hook_node_insert) or deleted (hook_node_delete), so in this case you will have always the real value.

Rerefences:

Computed Field