Show only certain users posts in “Relationships” field of Toolset Forms.

Toolset Forms allows filtering the Posts shown in the “Relationships” fields where one can pick a related post to the currently edited or created post.
Those filters allow (in the GUI) to return either all authors posts or the current logged in users posts.

This below filter should allow you to return any users post filtered by the (single) ID of a user.
The shortcode of Forms is not able to accept an Array of users, hence you can only pass one user ID each form/field.

function load_specific_users_as_author( $force_author) {
    //Dull example of loading only posts of author with ID 1
    $force_author = 1;
 
    //Or, alter the $force_author as you like, it must return one Users ID. It does not accept arrays.
     
    //Return the $force_author 
    return $force_author;
}
 
//Apply the filter
add_filter( 'cred_force_author_in_related_post', 'load_specific_users_as_author', 10 );

This will filter posts in the selector to only the ones of user ID 1 (or as set by your custom query)

There are 4 more filters you might use, however none including the above are documented, hence this snippet is not public.

List only parent CPT that has childs in a View list

Through wpv_filter_query you can achieve that a View returns only Parent CPT’s which actually have some Childs assigned.

add_filter('wpv_filter_query', 'parent_has_childs_func', 101, 3);

function parent_has_childs_func($query, $view_settings, $view_id) {
 if ( $view_id == XX ) {
  global $wpdb;
  $ids = $wpdb->get_results( "SELECT meta_value FROM wp_postmeta WHERE meta_key = '_wpcf_belongs_city_id'" );
  $query['post__in'] = array($ids);
 }
 return $query;
}

Limit a ‘n’ of posts users can submit with CRED

Limit the number of featured posts which user can submit. This Code limit to 1 featured post for each user.
The “wpcf-mls” is the custom field which define if the post is featured or not. It should store 1 for featured.

This hook will be triggered as soon as this custom field sent “1”.
Then check how many featured posts the current user has. Limit this number to “1”.

add_filter('cred_form_validate','my_validation',10,2);
function my_validation($field_data, $form_data){
global $wpdb; 
list($fields,$errors)=$field_data;
   if ($form_data['id']==241){	
      if ($fields['wpcf-mls']['value'] == 1){
         $results = $wpdb->get_results( 'SELECT * FROM '.$wpdb->posts.' post, '.$wpdb->postmeta.' meta WHERE post.ID = meta.post_id and post.post_status = "publish" and meta.meta_key = "wpcf-mls" and meta.meta_value = "1" AND post.post_author = "'.get_current_user_id().'"', OBJECT );
         if (count($results) > 1){
            $errors['mls']='Your limit for featured posts is 1';
         }    
      }
      return array($fields,$errors);
   }
}