Thank you for that piece of code- it was very helpful.
I still have a feeling, that it could be less complex- any idea of other workaround?
There also should be change from
$limit = $data->meta_value;
to
$limit = $data->meta_value+1;
– otherwise you miss last row.
no idea? or maybe Alex can add an hook to the places where adding information to database is performed? i think it could be enough for me…