Instantly share code, notes, and snippets.
Created
June 19, 2014 14:04
-
Star
0
(0)
You must be signed in to star a gist -
Fork
0
(0)
You must be signed in to fork a gist
-
Save iBobik/b982908ba97638e5adba to your computer and use it in GitHub Desktop.
Batch change author on multiple Drupal contents. This is view export code. Requires views_bulk_operations module.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$view = new view(); | |
$view->name = 'batch_change_content_author'; | |
$view->description = ''; | |
$view->tag = 'default'; | |
$view->base_table = 'node'; | |
$view->human_name = 'Batch change content author'; | |
$view->core = 7; | |
$view->api_version = '3.0'; | |
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ | |
/* Display: Master */ | |
$handler = $view->new_display('default', 'Master', 'default'); | |
$handler->display->display_options['title'] = 'Batch change content author'; | |
$handler->display->display_options['use_more_always'] = FALSE; | |
$handler->display->display_options['access']['type'] = 'perm'; | |
$handler->display->display_options['cache']['type'] = 'none'; | |
$handler->display->display_options['query']['type'] = 'views_query'; | |
$handler->display->display_options['exposed_form']['type'] = 'basic'; | |
$handler->display->display_options['pager']['type'] = 'full'; | |
$handler->display->display_options['pager']['options']['items_per_page'] = '50'; | |
$handler->display->display_options['style_plugin'] = 'table'; | |
/* Relationship: Content: Author */ | |
$handler->display->display_options['relationships']['uid']['id'] = 'uid'; | |
$handler->display->display_options['relationships']['uid']['table'] = 'node'; | |
$handler->display->display_options['relationships']['uid']['field'] = 'uid'; | |
/* Field: Bulk operations: Content */ | |
$handler->display->display_options['fields']['views_bulk_operations_1']['id'] = 'views_bulk_operations_1'; | |
$handler->display->display_options['fields']['views_bulk_operations_1']['table'] = 'node'; | |
$handler->display->display_options['fields']['views_bulk_operations_1']['field'] = 'views_bulk_operations'; | |
$handler->display->display_options['fields']['views_bulk_operations_1']['label'] = ''; | |
$handler->display->display_options['fields']['views_bulk_operations_1']['element_label_colon'] = FALSE; | |
$handler->display->display_options['fields']['views_bulk_operations_1']['vbo_settings']['display_type'] = '1'; | |
$handler->display->display_options['fields']['views_bulk_operations_1']['vbo_settings']['enable_select_all_pages'] = 1; | |
$handler->display->display_options['fields']['views_bulk_operations_1']['vbo_settings']['force_single'] = 0; | |
$handler->display->display_options['fields']['views_bulk_operations_1']['vbo_settings']['entity_load_capacity'] = '10'; | |
$handler->display->display_options['fields']['views_bulk_operations_1']['vbo_operations'] = array( | |
'action::node_assign_owner_action' => array( | |
'selected' => 1, | |
'postpone_processing' => 0, | |
'skip_confirmation' => 0, | |
'override_label' => 0, | |
'label' => '', | |
), | |
'action::views_bulk_operations_delete_item' => array( | |
'selected' => 0, | |
'postpone_processing' => 0, | |
'skip_confirmation' => 0, | |
'override_label' => 0, | |
'label' => '', | |
), | |
'action::views_bulk_operations_delete_revision' => array( | |
'selected' => 0, | |
'postpone_processing' => 0, | |
'skip_confirmation' => 0, | |
'override_label' => 0, | |
'label' => '', | |
), | |
'action::views_bulk_operations_script_action' => array( | |
'selected' => 0, | |
'postpone_processing' => 0, | |
'skip_confirmation' => 0, | |
'override_label' => 0, | |
'label' => '', | |
), | |
'action::flag_node_action' => array( | |
'selected' => 0, | |
'postpone_processing' => 0, | |
'skip_confirmation' => 0, | |
'override_label' => 0, | |
'label' => '', | |
), | |
'action::node_make_sticky_action' => array( | |
'selected' => 0, | |
'postpone_processing' => 0, | |
'skip_confirmation' => 0, | |
'override_label' => 0, | |
'label' => '', | |
), | |
'action::node_make_unsticky_action' => array( | |
'selected' => 0, | |
'postpone_processing' => 0, | |
'skip_confirmation' => 0, | |
'override_label' => 0, | |
'label' => '', | |
), | |
'action::views_bulk_operations_modify_action' => array( | |
'selected' => 0, | |
'postpone_processing' => 0, | |
'skip_confirmation' => 0, | |
'override_label' => 0, | |
'label' => '', | |
'settings' => array( | |
'show_all_tokens' => 1, | |
'display_values' => array( | |
'_all_' => '_all_', | |
), | |
), | |
), | |
'action::views_bulk_operations_argument_selector_action' => array( | |
'selected' => 0, | |
'skip_confirmation' => 0, | |
'override_label' => 0, | |
'label' => '', | |
'settings' => array( | |
'url' => '', | |
), | |
), | |
'action::node_promote_action' => array( | |
'selected' => 0, | |
'postpone_processing' => 0, | |
'skip_confirmation' => 0, | |
'override_label' => 0, | |
'label' => '', | |
), | |
'action::node_publish_action' => array( | |
'selected' => 0, | |
'postpone_processing' => 0, | |
'skip_confirmation' => 0, | |
'override_label' => 0, | |
'label' => '', | |
), | |
'action::node_unpromote_action' => array( | |
'selected' => 0, | |
'postpone_processing' => 0, | |
'skip_confirmation' => 0, | |
'override_label' => 0, | |
'label' => '', | |
), | |
'rules_component::scheduler_remove_publish_date_component' => array( | |
'selected' => 0, | |
'postpone_processing' => 0, | |
'skip_confirmation' => 0, | |
'override_label' => 0, | |
'label' => '', | |
), | |
'rules_component::scheduler_remove_unpublish_date_component' => array( | |
'selected' => 0, | |
'postpone_processing' => 0, | |
'skip_confirmation' => 0, | |
'override_label' => 0, | |
'label' => '', | |
), | |
'action::node_save_action' => array( | |
'selected' => 0, | |
'postpone_processing' => 0, | |
'skip_confirmation' => 0, | |
'override_label' => 0, | |
'label' => '', | |
), | |
'action::system_send_email_action' => array( | |
'selected' => 0, | |
'postpone_processing' => 0, | |
'skip_confirmation' => 0, | |
'override_label' => 0, | |
'label' => '', | |
), | |
'rules_component::scheduler_set_publish_date_component' => array( | |
'selected' => 0, | |
'postpone_processing' => 0, | |
'skip_confirmation' => 0, | |
'override_label' => 0, | |
'label' => '', | |
), | |
'rules_component::scheduler_set_unpublish_date_component' => array( | |
'selected' => 0, | |
'postpone_processing' => 0, | |
'skip_confirmation' => 0, | |
'override_label' => 0, | |
'label' => '', | |
), | |
'action::node_unpublish_action' => array( | |
'selected' => 0, | |
'postpone_processing' => 0, | |
'skip_confirmation' => 0, | |
'override_label' => 0, | |
'label' => '', | |
), | |
'action::node_unpublish_by_keyword_action' => array( | |
'selected' => 0, | |
'postpone_processing' => 0, | |
'skip_confirmation' => 0, | |
'override_label' => 0, | |
'label' => '', | |
), | |
'action::pathauto_node_update_action' => array( | |
'selected' => 0, | |
'postpone_processing' => 0, | |
'skip_confirmation' => 0, | |
'override_label' => 0, | |
'label' => '', | |
), | |
); | |
/* Field: Content: Title */ | |
$handler->display->display_options['fields']['title']['id'] = 'title'; | |
$handler->display->display_options['fields']['title']['table'] = 'node'; | |
$handler->display->display_options['fields']['title']['field'] = 'title'; | |
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE; | |
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE; | |
/* Field: User: Name */ | |
$handler->display->display_options['fields']['name']['id'] = 'name'; | |
$handler->display->display_options['fields']['name']['table'] = 'users'; | |
$handler->display->display_options['fields']['name']['field'] = 'name'; | |
$handler->display->display_options['fields']['name']['relationship'] = 'uid'; | |
$handler->display->display_options['fields']['name']['label'] = 'Current author'; | |
/* Sort criterion: Content: Post date */ | |
$handler->display->display_options['sorts']['created']['id'] = 'created'; | |
$handler->display->display_options['sorts']['created']['table'] = 'node'; | |
$handler->display->display_options['sorts']['created']['field'] = 'created'; | |
$handler->display->display_options['sorts']['created']['order'] = 'DESC'; | |
/* Filter criterion: Content: Published */ | |
$handler->display->display_options['filters']['status']['id'] = 'status'; | |
$handler->display->display_options['filters']['status']['table'] = 'node'; | |
$handler->display->display_options['filters']['status']['field'] = 'status'; | |
$handler->display->display_options['filters']['status']['value'] = 1; | |
$handler->display->display_options['filters']['status']['group'] = 1; | |
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE; | |
/* Filter criterion: Content: Author uid */ | |
$handler->display->display_options['filters']['uid']['id'] = 'uid'; | |
$handler->display->display_options['filters']['uid']['table'] = 'node'; | |
$handler->display->display_options['filters']['uid']['field'] = 'uid'; | |
$handler->display->display_options['filters']['uid']['value'] = ''; | |
$handler->display->display_options['filters']['uid']['exposed'] = TRUE; | |
$handler->display->display_options['filters']['uid']['expose']['operator_id'] = 'uid_op'; | |
$handler->display->display_options['filters']['uid']['expose']['label'] = 'Filter by author'; | |
$handler->display->display_options['filters']['uid']['expose']['operator'] = 'uid_op'; | |
$handler->display->display_options['filters']['uid']['expose']['identifier'] = 'uid'; | |
$handler->display->display_options['filters']['uid']['expose']['remember_roles'] = array( | |
2 => '2', | |
1 => 0, | |
4 => 0, | |
3 => 0, | |
17 => 0, | |
7 => 0, | |
6 => 0, | |
8 => 0, | |
9 => 0, | |
10 => 0, | |
11 => 0, | |
12 => 0, | |
13 => 0, | |
14 => 0, | |
15 => 0, | |
16 => 0, | |
); | |
/* Display: Page */ | |
$handler = $view->new_display('page', 'Page', 'page'); | |
$handler->display->display_options['path'] = 'admin/content/batch-change-author'; | |
$handler->display->display_options['menu']['type'] = 'normal'; | |
$handler->display->display_options['menu']['title'] = 'Batch change content author'; | |
$handler->display->display_options['menu']['name'] = 'management'; | |
$translatables['batch_change_content_author'] = array( | |
t('Master'), | |
t('Batch change content author'), | |
t('more'), | |
t('Apply'), | |
t('Reset'), | |
t('Sort by'), | |
t('Asc'), | |
t('Desc'), | |
t('Items per page'), | |
t('- All -'), | |
t('Offset'), | |
t('« first'), | |
t('‹ previous'), | |
t('next ›'), | |
t('last »'), | |
t('author'), | |
t('- Choose an operation -'), | |
t('Title'), | |
t('Current author'), | |
t('Filter by author'), | |
t('Page'), | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment