How to import a view in Drupal?

19,302

Solution 1

There is a import option in the views listing page. Just paste this url after your current url and you will see the import views page. By seeing your tags I am assuming you are using Drupal 7, so the given below url will work only for Drupal 7.

Below is the url to be added :

#overlay=admin/structure/views/import

Solution 2

For D7, if you don't want to use user #1, you can enable the 'PHP filter' core module, and then give the relevant user role the 'Use PHP for settings' permission. Users with this role will then see an 'import' link next to the 'Add new view' link on the views admin page. Or you can go to the import page directly on /admin/structure/views/import

Solution 3

I have just discovered another reason this can happen - the Paranoia module being enabled. If enabled, /admin/structure/views/import will display "You are not authorized to access this page", even if you are logged in as UID1.

Cool module. If it's enabled, you won't see it in the admin interface, even if you're logged in as UID1. You'll need to disable it with drush dis paranoia or setting the status of it to 0 in the system table.

Solution 4

For Drupal 6 you would use:

/admin/build/views/import

Solution 5

User 1 works as you have all permissions checks set to true.

To enable this for other users you need to enable the php module and make sure your user has the "use PHP for settings", this is a setting that should only be given to trusted users as it allows pretty much anything to be done on your site. Which is what happens when importing a view. For more info see this thread.

Share:
19,302
perpetual_dream
Author by

perpetual_dream

I am the co-founder and the web development specialist at Beyond Designs, a web development shop located in Jerusalem. In addition, I constantly blog about web hosting, domain names and CMS on Linux Hosting.

Updated on June 02, 2022

Comments

  • perpetual_dream
    perpetual_dream almost 2 years

    How I can Import a view to Drupal. I have an exported view that I need to import in a different Drupal Installation. I don't have an import option in the admin/structure/views?

    Thanks!

    Edit:

    I have found the solution. I have to log in as user 1 to get this option.

  • perpetual_dream
    perpetual_dream over 12 years
    Yes, but for some reason this option is only available for user/1
  • Clive
    Clive over 12 years
    @perpetual_dream: It doesn't matter who you're logged in as, what does matter is that the user you are logged in as has the Administer Views permission.
  • user151841
    user151841 about 12 years
    I just tested this with a user who has Administer views permission. Got the main views paged (i.e. it was falling back to admin/structure/views) Tried with it with user1 and it worked.
  • Matt V.
    Matt V. about 12 years
    At least with Views 7.x-3.3, you also need the "use PHP for settings" permission, according to the views_import_access function.
  • nicholaswmin
    nicholaswmin almost 9 years
    It's pretty straightforward people, just append admin/structure/views/import on your www.mysitename.com/ and it would work
  • Felix Eve
    Felix Eve over 8 years
    The module paranoia will disable that url.
  • klewis
    klewis about 2 years
    This worked for me, even today on D7. Many thanks.