How to unpublish all nodes of a user after is assigned a role?
I would instead create a Views Loop using the Views Rules module. You can create a view and have the rule loop through all the rows that the view outputs.

Edit:


  For Example, I want to send an e-mail to all user's attached to a node
  registration. So I needed to do the following:
  
  
  Create a view with a Rules Display. Field: User E-mail. Contextual Filter: NID (Screenshot: http://i.imgur.com/rcvdMyn.jpg).
  In the Views Rule Settings - Parameters: I specified the parameter's label and name, that wil need to match the Views Loop Data
  selector (Step 4) for the Views Contextual filter. (Screenshot:
  http://i.imgur.com/MFA7mxk.jpg)
  In the Views Rule Settings - Row Variables: I specified which field should be enabled for Rules, and how it should be passed back to
  Rules. (Screenshot: http://i.imgur.com/U7fkzjj.jpg)
  I then created a Views Loop in my Rule matching the Parameters and Row Variables in my view (Screenshot: http://i.imgur.com/hGziOtK.jpg)
  I then created the action "Send mail" under the Views loop using the now available token that was specified in the View. (Screenshot:
  http://i.imgur.com/chlKc7x.jpg)
  


And that's it. If you want to test your output rather than your unpublish action. I would recommend using the action "Show a message on the site".

In your case your contextual filter is most likely your UID and NID as your field. I used my example as a proof of concept.

Edit 2:

Exported View:

$view = new view();
$view-&gt;name = 'waiting_list_user_list';
$view-&gt;description = '';
$view-&gt;tag = 'default';
$view-&gt;base_table = 'users';
$view-&gt;human_name = 'Waiting List User list';
$view-&gt;core = 7;
$view-&gt;api_version = '3.0';
$view-&gt;disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view-&gt;new_display('default', 'Master', 'default');
$handler-&gt;display-&gt;display_options['use_more_always'] = FALSE;
$handler-&gt;display-&gt;display_options['access']['type'] = 'perm';
$handler-&gt;display-&gt;display_options['access']['perm'] = 'access user profiles';
$handler-&gt;display-&gt;display_options['cache']['type'] = 'none';
$handler-&gt;display-&gt;display_options['query']['type'] = 'views_query';
$handler-&gt;display-&gt;display_options['exposed_form']['type'] = 'basic';
$handler-&gt;display-&gt;display_options['pager']['type'] = 'full';
$handler-&gt;display-&gt;display_options['style_plugin'] = 'default';
$handler-&gt;display-&gt;display_options['style_options']['default_row_class'] = FALSE;
$handler-&gt;display-&gt;display_options['style_options']['row_class_special'] = FALSE;
$handler-&gt;display-&gt;display_options['row_plugin'] = 'fields';
/* Relationship: User: Registration */
$handler-&gt;display-&gt;display_options['relationships']['registration']['id'] = 'registration';
$handler-&gt;display-&gt;display_options['relationships']['registration']['table'] = 'users';
$handler-&gt;display-&gt;display_options['relationships']['registration']['field'] = 'registration';
$handler-&gt;display-&gt;display_options['relationships']['registration']['label'] = 'User Registration';
/* Relationship: Registration: Registration to Node */
$handler-&gt;display-&gt;display_options['relationships']['registration_related_node']['id'] = 'registration_related_node';
$handler-&gt;display-&gt;display_options['relationships']['registration_related_node']['table'] = 'registration';
$handler-&gt;display-&gt;display_options['relationships']['registration_related_node']['field'] = 'registration_related_node';
$handler-&gt;display-&gt;display_options['relationships']['registration_related_node']['relationship'] = 'registration';
/* Field: User: E-mail */
$handler-&gt;display-&gt;display_options['fields']['mail']['id'] = 'mail';
$handler-&gt;display-&gt;display_options['fields']['mail']['table'] = 'users';
$handler-&gt;display-&gt;display_options['fields']['mail']['field'] = 'mail';
$handler-&gt;display-&gt;display_options['fields']['mail']['label'] = '';
$handler-&gt;display-&gt;display_options['fields']['mail']['alter']['trim_whitespace'] = TRUE;
$handler-&gt;display-&gt;display_options['fields']['mail']['alter']['strip_tags'] = TRUE;
$handler-&gt;display-&gt;display_options['fields']['mail']['element_label_colon'] = FALSE;
$handler-&gt;display-&gt;display_options['fields']['mail']['element_default_classes'] = FALSE;
$handler-&gt;display-&gt;display_options['fields']['mail']['link_to_user'] = '0';
/* Contextual filter: Content: Nid */
$handler-&gt;display-&gt;display_options['arguments']['nid']['id'] = 'nid';
$handler-&gt;display-&gt;display_options['arguments']['nid']['table'] = 'node';
$handler-&gt;display-&gt;display_options['arguments']['nid']['field'] = 'nid';
$handler-&gt;display-&gt;display_options['arguments']['nid']['relationship'] = 'registration_related_node';
$handler-&gt;display-&gt;display_options['arguments']['nid']['default_argument_type'] = 'fixed';
$handler-&gt;display-&gt;display_options['arguments']['nid']['summary']['number_of_records'] = '0';
$handler-&gt;display-&gt;display_options['arguments']['nid']['summary']['format'] = 'default_summary';
$handler-&gt;display-&gt;display_options['arguments']['nid']['summary_options']['items_per_page'] = '25';
/* Filter criterion: User: Active */
$handler-&gt;display-&gt;display_options['filters']['status']['id'] = 'status';
$handler-&gt;display-&gt;display_options['filters']['status']['table'] = 'users';
$handler-&gt;display-&gt;display_options['filters']['status']['field'] = 'status';
$handler-&gt;display-&gt;display_options['filters']['status']['value'] = '1';
$handler-&gt;display-&gt;display_options['filters']['status']['group'] = 1;
$handler-&gt;display-&gt;display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: Registration: State entity */
$handler-&gt;display-&gt;display_options['filters']['state']['id'] = 'state';
$handler-&gt;display-&gt;display_options['filters']['state']['table'] = 'registration';
$handler-&gt;display-&gt;display_options['filters']['state']['field'] = 'state';
$handler-&gt;display-&gt;display_options['filters']['state']['relationship'] = 'registration';
$handler-&gt;display-&gt;display_options['filters']['state']['value'] = array(
  'waitlist' =&gt; 'waitlist',
);

/* Display: Rules */
$handler = $view-&gt;new_display('views_rules', 'Rules', 'views_rules_1');
$handler-&gt;display-&gt;display_options['pager']['type'] = 'some';
$handler-&gt;display-&gt;display_options['rules_parameter'] = array(
  'nid' =&gt; array(
    'enabled' =&gt; 1,
    'type' =&gt; 'integer',
    'label' =&gt; 'nid',
    'name' =&gt; 'nid',
  ),
);
$handler-&gt;display-&gt;display_options['rules_variables'] = array(
  'mail' =&gt; array(
    'enabled' =&gt; 1,
    'rendered' =&gt; 0,
    'type' =&gt; 'token',
    'label' =&gt; 'User: E-mail',
    'name' =&gt; 'mail',
  ),
);


Exported Rule

{ "rules_waiting_list_e_mail_after_registration_deletion" : {
    "LABEL" : "Waiting List E-mail after Registration Deletion",
    "PLUGIN" : "reaction rule",
    "ACTIVE" : false,
    "REQUIRES" : [ "rules", "rules_i18n", "registration" ],
    "ON" : { "registration_delete" : [] },
    "IF" : [
      { "data_is" : { "data" : [ "registration:state:name" ], "value" : "complete" } }
    ],
    "DO" : [
      { "entity_fetch" : {
          "USING" : { "type" : "node", "id" : [ "registration:entity-id" ] },
          "PROVIDE" : { "entity_fetched" : { "node_id" : "node_id" } }
        }
      },
      { "VIEW LOOP" : {
          "VIEW" : "waiting_list_user_list",
          "DISPLAY" : "views_rules_1",
          "USING" : { "nid" : [ "node-id:nid" ] },
          "ROW VARIABLES" : { "mail" : { "mail" : "User: E-mail" } },
          "DO" : [
            { "mail" : {
                "to" : [ "mail" ],
                "subject" : "test",
                "message" : "Test",
                "language" : [ "" ]
              }
            }
          ]
        }
      }
    ]
  }
}