How to send an email on every 10 contents that are waiting for admin approval?
I have get all the users (uid) of particular role from the users_role table.


i.e :

$query = 'SELECT DISTINCT(ur.uid) FROM {users_roles} AS ur WHERE ur.rid IN (:rids)';
$result = db_query($query, array(':rids' =&gt; array(3,8)));



Next step, I have count nids from workbench_moderation_node_history table.


i.e  I have made one function like get_train_users() in which i have returned the above $result array. 

$trainusers = get_train_users();
foreach ($trainusers as $key =&gt; $value) {
   $tresult [] = db_query ('SELECT COUNT(nid) AS con,uid FROM  {workbench_moderation_node_history} WHERE uid = :uid AND state = :state' ,array(':uid' =&gt; $value, ':state' =&gt; $state))-&gt;fetchAll();
}



Now, In last step, I am counting the count of con, Like if it is greater then 10, then i am sending the mail when cron runs.


That's it.