# Question
Title: Responsive CSS in Bootstrap theme (more specifically "Tweme")
I am running the Bootstrap theme "Tweme" (however, this question will most likely apply to all Bootstrap themes) and would like to add responsive CSS. Adding commands like

```
@media (min-width: 1200px) {
  body {
    background: rgb(0,0,0);
  }
}
```

to my style.css does not have any effect. What is the best way to add responsive CSS to Drupal themes that are built on the Bootstrap library?

# Answer
> 2 votes
Your basic CSS is right. I would check to make sure:

1- Your css file is actually loading

I go to view source and look for my file name. If the file name appears in a giant weird JS object, but not in the css declarations that means the file can't be found (most likely a 404)

2- Your base theme isn't writing some overly specific CSS that you need to override.

Using the web inspector or a similar tool inspect the element you're trying to change, get your width where it should be to have your change apply (in that case greater than 1200 width) and see if there are styles overriding the one you wrote.

An easy temporary way to get around #2 would be to use !important at the end of your style, just to see if you're in the neighborhood, but that !important should be deleted of course :)

# Answer
> 1 votes
Just to clarify how bootstap works, it uses the less variables which is where you set the media breakpoints.

you can customize your bootstrap download from the link below

http://getbootstrap.com/customize/#variables-basics

Set your breakpoints in the \> Media queries breakpoints section

the less code is then compiled to CSS where the @screen-sm-min and @screen-lg-min is replaced to actual css pixel format corresponding to your tablet and widescreens.

```
@media (min-width: 768px) {
  .container {
    width: 750px;
  }
}

@media (min-width: 1200px) {
  .container {
    width: 1170px;
  }
}

```

# Answer
> 0 votes
Tweme and Bootstrap are already responsive. No need to add more CSS code. What you need to do is add classes to your html tags for them to apply the bootstrap styling. See http://twitter.github.io/bootstrap/scaffolding.html#fluidGridSystem

You need to use span1, span2, etc to tell bootstrap how many "sections" each item will take up. It allows for 12 "sections" in total per row and will automatically adapt to the viewport.

Hope that helps!

---
Tags: theming
---


# Question
Title: Custom Drupal Analytics with Views- how to track the number of users by role over time?
I am building a social networking website in Drupal. As users complete their profile, they are awarded different roles. Now that I have launched the site and have some members, I would like to track the number of users by role over time so that I can see how my site is growing.

I built a view to do this and it shows me the information I want. However, since I want to measure membership growth I would like to do this over time. So, currently I simply log into my site and then type the numbers I need into Excel.

Is there a better way to do this? Ideally, I would like to automatically save an Excel-ready snapshot every week (or in a dream world, have a graph automatically prepared). Is there some other way (even without views) to track the number of users by role over time?

# Answer
> 1 votes
You should record custom variables in Google Analytics. Download the GA Module https://www.drupal.org/project/google\_analytics and Tokens https://www.drupal.org/project/token in the bottom of the configuration \[yoursite\].com/admin/config/system/googleanalytics expand the SHOWCUSTOM DIMENSIONS section populate the values with tokens like \[current-user:roles\] You can also record an event upon account creation which identifies the type of account https://developers.google.com/analytics/devguides/collection/analyticsjs/events you can do a JS event on submit that will record or it probably makes more sense to create a library to record all instances of certain types the way Google Developers is implying.

---
Tags: users, nodes
---


# Question
Title: Instructions to install a ready-made site in localhost
I am trying to install a ready-made instructional site on my local Linux webserver. How should I proceed?

Thank you J.Reynolds for answer.

Please understand that after I posted question I did some homework and read the article you mention, that is why I am editing question.

mod-rewrite is enabled and so is AllowOverride, the site is correctly chowned and I opened the perms to 777 to get it going, I will correct that later.

I imported the db and edited settings.php to "glue" files and db, basically I replicated the settings of another settings.php file from a site that I created from scratch and virtualized same as this one, the differences are only the site customizations of course.

I entered correct $base\_url.

The site is still failing and here is the error message:

> "The specified file temporary://fileK7hduG could not be copied, because the destination directory is not properly configured. This may be caused by a problem with file or directory permissions. More information is available in the system log."

This message keeps repeating for 6 times with different temp files. I looked at the apache2 log and there is nothing useful there.
I cannot figure out how to launch this site correctly.

# Answer
You need to tell Drupal where the database is that you imported.

1. Make sure to copy default.settings.php in `sites/default` to `settings.php` (if it does not already exist, in which case you can skip this step.).
2. Edit $databases array (lines 213 or so) in `setttings.php`. You should add the username and password of a user with full privileges on your MySQL installation (usually it will be user root, with password root).

For instance:

```
$databases = array (
  'default' =>
  array (
    'default' =>
    array (
      'database' => 'NAME OF DATABASE YOU IMPORTED',
      'username' => 'USERNAME',
      'password' => 'PASSWORD',
      'host' => 'localhost',
      'port' => '',
      'driver' => 'mysql',
      'prefix' => '',
    ),
  ),
);

```

You should now browse to `admin/reports/status` which, will give you instructions to change file permissions for `settings.php` so that it is not publicly writable, and maybe to run Cron or Drupal updates.

Please also look at Migrating a site for more in-depth instructions.

Chances are that the default root username and password for your MySQL instance would be: root, and root. If it is not, then please open PHPMyAdmin and have a look at the User tab section/or google for assistance on how to create a new user with 'ALL Privileges'.
> 1 votes

# Answer
The above piece by J. Reynolds is of course correct and I had to check all those steps.
Migrating a site created by another user in a completely different environment than my Linux Apache webserver will have settings that will crash the site and are difficult to find.
In my case the error was caused by permissions on /sites/default/files folder.
I chmoded recursively the whole site to 777 just to troubleshoot the perms issue but it was still there.
A second look to the perms in the mentioned folder showed that they were not 777 like the rest of the site, the folder was 555 write-protected, why?
This folder holds a .htaccess file which does not allow a user without elevated privileges to change the perms, I chmoded as my user because drush does not like to be ran as root.
In this case I had to become root to chmod 775 recursively the folder, which fixes the issue.
> 0 votes

---
Tags: installation
---


# Question
Title: How do I get the count of all messages in the inbox?
How can I get the count of all the inbox messages, with the Private message module?

Below the inbox messages, I need to display the count of total messages, such as:

> 10 of 55

`_privatemsg_get_new_messages()` is the function to get new messages in Drupal 5.

Is there any function to get the count of all messages in Drupal 6?

# Answer
> 2 votes
This code is used to get the list of all the messages in the inbox.

```
global $user;
$query = _privatemsg_assemble_query('list', $user, 'inbox');
$total_count = db_result(db_query($query['count']));
echo $total_count;

```

# Answer
> 3 votes
There is a `privatemsg_unread_count()` function in Drupal 7. If that doesn't work in Drupal 6, check the module file for the name of the function.

# Answer
> 0 votes
This Should Work:

$query = db\_select('pm\_index', 'pmi');

```
$query
        ->fields('pmi', array('thread_id'))
        ->condition('pmi.deleted', 0)
        ->condition('pmi.recipient', $account->uid)
        ->condition('pmi.type', array('hidden', 'user'));
$results = $query->execute()->rowCount();
return $results;

```

# Answer
> -1 votes
```
print privatemsg_unread_count($account = NULL);

```

;)

;)

---
Tags: 6, privatemsg
---


# Question
Title: How can I ensure that availability calendar only show one month at a time?
I'm displaying a calendar on a basic page and I have specified that I want the monthly views to show only 1 at a time. 1 per col / 1 per row.

For some reason 3 are displayed.

my calendar can be seen at seosolutions.london

How can I only display 1 month at a time? can I hard code this anywhere?

# Answer
> 0 votes
I found a css fix for this:

availability\_calendar.base.css

adding

.cal-viewport { width: 220px !important; }

---
Tags: theming, datetime
---


title: remove unwanted path

text:
# Question
Title: remove unwanted path
I have tried a lot to **remove path** that you can see in below picture:

I am **new** to drupal and **learning** it.So right now I am converting **HTML template** in to **Drupal theme**.

So for that I have copied `bartik` folder and I am changing in that.

For the content, I have used an **article** and from **configuration** I have set that article on front and removed title using function in template.php.

But I am not able to find, **from where** that path is coming from.

Inspect element of that specific part :

My `page--front.tpl.php` and `template.php`.

Ask me if more code is needed.

I have also tried by clearing cache but it did not help me out.

# Answer
> 1 votes
since it's not in either of those two file you linked, try node.tpl.php

failing that, see if you have a block defined to show in the content area, or content-top, etc.

---
Tags: 7
---


# Question
Title: Views Filter by Field value (content type A) = Field value (content type B)
I am getting exhausted trying to filter views by matching 2 fileds value from 2 different content types.

For Example:

* Content Type (Employee A), with the following fields:

+ ID *(integer)*
    + Name
    + phone Number
    + Address
* Content Type (Employee B), with the following fields:

+ ID *(integer)*
    + Position
    + Skills
    + Salary

What I need to do is a View that show

**ID, Name, phone Number, Address, Position, Skills, Salary** ... By comparing ID integer value from (Employee A) **=** ID integer value from (Employee B)

Please help me doing this.

# Answer
> 4 votes
Install Equi Join.

> The Equi Join module allows you to create relationships between different entities based on an arbitrary field. This allows the use of relationships in Views without having to add Node References to a content type, which may not be an option when displaying data stored on a third-party database or data provided through custom Views handlers. That said, it works with nodes as well.

I must confess, I have never used this module before now, so my method of getting it to work was by trial and error. Here goes:

In your view, add a relationship `Equi Join: Content`, and configure both `left field` and `right field` to be on field 'ID' (I am assuming you re-used the ID field for both Employee A and Employee B. If not, adjust as appropriate). Make sure to provide a unique Identifier (will be used later to identify the relationship).

Add all the fields from Employee A and Employee B. For each of the fields of Employee B, make sure to add the relationship of the equi join.

Add Filter Criteria for each of the fields (AND). For all of them, Operator must be `Is not empty (NOT NULL)`. For each of the Filter Criteria using fields on Employee B make sure to add the relationship of the equi join. If you have a required field on any of the Employee Types, then adding just that one required field would be sufficient for that Employee Type. If none of the fields are required, then you might end up filtering out a legitimate row with empty values. So best if each employee type has at least one required field on it.

---
Tags: views
---


# Question
Title: open a modal just before submit to get an answer yes or no and then submit
I'm altering a comment form and on my page i want to show a modal to ask the user for an answer then i will submit.

I tried to drupal\_get\_form on a ctools modal but a lot of problem on submit it will return to the same submit page and an outher problem with the form\_i can not get.

is there any good example or a good idea to do that?

# Answer
Create a file named as 'search\_result.js' and include it into the particular module using drupal\_add\_js(path/filename.js); and the copy and phaste the following code into search\_result.js

```
 (function($, Drupal, window, document, undefined) {

Drupal.behaviors.searchResults = {
  attach: function(context, settings) {

       $("#elementID").click(function(){
        if(confirm("Are you sure that you want to proceed?")){
            return true;
            }
        else {
            return false;
            }
        });
  }

}
})(jQuery, Drupal, this, this.document);
```

Note: "#elementID" is the id of the element on which when you click the confirm window is shown
> 0 votes

---
Tags: javascript, chaos-tool-suite, forms
---


title: Multilanguage In Drupal

text:
# Question
Title: Multilanguage In Drupal
Now, I'm trying to translate my content pages into Burmese language. But, the problem is there is no language option appear in "Publishing Options" Tab. I enabled Content translation, Locale and Multilingual Internationalization, Variable modules. Although I enabled all these modules and clear the cache, it still doesn't appear. Please, help me!

# Answer
1. If your language is not already added, you can do it in this interface **admin/config/regional/language/add**
2. You have to check that your new language is activated in the languages manager **admin/config/regional/language**
3. Check that this modules are activated : **Local, i18n**
4. In your content type manager, check that **multilingual settings** tab exist
5. In this tab, choose the elements suitable for your case
6. In **Publishing options** tab, check that multilingual support is activated
> 3 votes

# Answer
**Enabling entity translation for a content type**

With Entity Translation enabled for "Node", you can set the translation mode (Entity Translation or Content Translation) for each Content Type. To enable translation mode for a particular content type, you need to edit the content type and click on the 'Publishing options' tab and choose under Multilingual support:

see the resource here
> 1 votes

---
Tags: multi-sites, i18n-l10n
---


title: Unable to generate og:image

text:
# Question
Title: Unable to generate og:image
I have installed the Metatag module, along with ImageCache Token, but it just does not work.

I have tried many of the different available tokens in the Open Graph image field for my node, and none of them generate a og:image tag. For instance, I have tried:

\[node:my\_image\]
\[node:my\_image:large:path\]
\[node:my\_image:large\]
\[node:my\_image:thumbnail\]

if I hard-code a URL rather than use a token then it works, but that rather defeats the purpose. My logs contain no errors, and I remember to clear the cache each time. This is driving me nuts. Anyone know what might be wrong?

# Answer
> 1 votes
Check that your image has **at least 200x200** as defined in the error provided by Facebook debugger. Also use **Ctrl+U** in your browser to check that the **og:image** tag print the correct url

---
Tags: media, meta-tags
---


# Question
Title: Convenience of inserting external data (products) as Drupal nodes
I am building a multisite/multidomain site in Drupal 7. We have a section which will show details of thousand of products of the company and clients. We manage these products with an independent management tool. Is it recommended to insert these products in the database as nodes in order to get full capability of Views listings, search functions, etc.? I was going to use just PHP to manage listing, details page, etc., but I am no sure if keeping them outside of Drupal is a good idea. If it is better to include them as nodes, or any other entity... what contributed modules would be recommended and what would be the best approach? (Import them as csv files in a commerce module, insert them directly in nodes and related tables...).

# Answer
> 0 votes
IMHO, you have this choices :

1. Use the Feeds module to import data to nodes via CSV file, and you can use the powerful Views module to list all your product, or develop a simple module that can do that.
2. Use can develop a module that build entities based on your tables, with this approach, you can use your database without creating nodes/terms or other stuffs, but you need to create an admin interface to manage all your tables
3. If you plan to sell your products online, try to use Drupal Commerce, and import with **Feeds module**

---
Tags: commerce
---


title: How to create a "navicon" effect

text:
# Question
Title: How to create a "navicon" effect
I would to create a "navicon menu", like in this article.

It seems to be a standard for mobile and responsive sites. Is there some module that do this?

# Answer
> 1 votes
The Superfish module does that. It integrates the Superfish jQuery script into Drupal. It has two responsive menu options for small screens; either rendering it has an accordion or a drop-down. I strongly recommend using the Dev version as it is 'production ready' and has multiple improvements over the older release.

---
Tags: 7, navigation
---


# Question
Title: Get entity id in hook_form_BASE_FORM_ID_alter()
I am working on porting a D7 module to D8. As in Drupal 8 all things are represented as entity, menu items are also represented as entity. Now I added a `hook_form_BASE_FORM_ID_alter()` implementation to alter the menu creation and edit form. On the menu edit form, I want to get the entity ID of the menu that is currently being edited.

I tried to get the entity id ID with the following code, but I am getting an error. (See line 43.)

```
$entity = $form_state['controller']->getEntity();

```

For above snippet I followed https://www.drupal.org/node/1734556.

How can I get the entity ID?

# Answer
> 12 votes
That CR is outdated, probably there's a later CR updating it: now you should use `$form_state->getFormObject()->getEntity()`.

---
Tags: forms, 8
---


# Question
Title: Drupal 7 dynamic dropdown list options An illegal choice has been detected
I have created a node type of Advertisement which holds all the information for adding new advertations to the website, including categories.

there are 3 levels of categories and i need to make a seperate box for them. The content type which i created through the GUI of drupal already has a term reference select box for category, sub category, and level 3 category.. So i made a module and implemented hook\_form\_alter and i added the #ajax attributefunction

```
<?php
adverts_form_alter(&$form, &$form_state, $form_id) {
  if($form_id == 'advertisement_node_form') {
      $topLevelTermArray = array('_none' => ' - Select a value -');
      $topLevelTerms = array(5275, 5245, 5299, 5341, 5702, 5681, 5826, 5555, 6039, 5592, 5776, 5994, 6027, 5451, 5852, 6016, 5496, 5475, 6049);
      foreach($topLevelTerms AS $value) {
        $term = taxonomy_term_load($value);
        $topLevelTermArray[$term->tid] = $term->name;
      }
      $form['field_specific_category']['und']['#prefix'] = '<div id="field_specific_category_replace">';
      $form['field_specific_category']['und']['#suffix'] = '</div>';
      $form['field_sub_category']['und']['#ajax'] = array(
        'callback' => 'ajax_sub_category_callback',
        'wrapper' => 'field_specific_category_replace',
      );
      $form['field_sub_category']['und']['#prefix'] = '<div id="field_sub_category_replace">';
      $form['field_sub_category']['und']['#suffix'] = '</div>';
      $form['field_sub_category']['und']['#options'] = array('_none' => t('- Please select a category -'));
      $form['field_specific_category']['und']['#options'] = array('_none' => t('- Please select a sub category -'));
      $form['field_category']['und']['#options'] = $topLevelTermArray;
      $form['field_category']['und']['#ajax'] = array(
        'callback' => 'ajax_category_callback',
        'wrapper' => 'field_sub_category_replace',
      );
  }
}
?>

```

And 2 callback functions

```
function ajax_category_callback($form, $form_state) {
  $subCats = array();
  $tree = taxonomy_get_tree(5, $form_state['values']['field_category']['und'][0]['tid']);
  foreach($tree AS $term) {
    $subCats[$term->tid] = $term->name;
  }
  $element = $form['field_sub_category']['und'];
  $mainCatTerm = taxonomy_term_load($form_state['values']['field_category']['und'][0]['tid']);
  $element['#title'] = t('Sub categories for @cat.', array('@cat' => $mainCatTerm->name));
  $element['#options'] = $subCats;

  return $element;
}

function ajax_sub_category_callback($form, $form_state) {
  $subCats = array();
  $tree = taxonomy_get_tree(5, $form_state['values']['field_sub_category']['und'][0]['tid']);
  //var_dump($form_state['values']['field_sub_category']['und'][0]['tid']);
  foreach($tree AS $term) {
    $subCats[$term->tid] = $term->name;
  }
  $element = $form['field_specific_category']['und'];
  if(empty($tree)) {
    $element['#options'] = array('_none' => '- No specific category -');
  } else {
    $mainCatTerm = taxonomy_term_load($form_state['values']['field_sub_category']['und'][0]['tid']);
    $element['#title'] = t('Sub categories for @cat.', array('@cat' => $mainCatTerm->name));
    $element['#options'] = $subCats;
  }
  return $element;
}

```

But when i go to node/advertisement/edit and i select a category and sub category is show's:

```
An illegal choice has been detected. Please contact the site administrator.

```

How can i get that error too dissapear?

# Answer
The value you are submitting was not present during the page or form loading time.

If you populate some values using ajax which was not present in initial page loads and try to submit the form, then Drupal will not allow you to submit the form. It will always shows "An illegal choice has been detected" message.
> 3 votes

# Answer
I'm afraid there is only one solution and that's to comment out line 1388 & 1389 of form.inc
> -1 votes

---
Tags: 7, taxonomy-terms, forms, ajax
---


# Question
Title: Can failure to increase new user's UID consistently by one be related to this line inside user.module file?
I have noticed at my Drupal 7 that there are gaps between the uid's of new users. The UID of a new user should increase by one from the highest assigned UID in database. However, I have noticed gaps of even a thousand.

Inside **user.module** file, there is the following code:

```
// Allow 'uid' to be set by the caller. There is no danger of writing an
      // existing user as drupal_write_record will do an INSERT.
      if (empty($account->uid)) {
        $account->uid = db_next_id(db_query('SELECT MAX(uid) FROM {users}')->fetchField());
      }

```

I have made the QB query read like this:

```
$account->uid = db_next_id(db_query('SELECT MAX(uid) FROM users')->fetchField());

```

It appears that this solves the issue. My question, is there really a mistake inside the core **user.module** file? Is it safe to modify the file the way I did? Thanks.

**UPDATE:**

The above does not make a difference after all. I have changed the line to this:

```
$account->uid = db_query('SELECT MAX(uid) FROM users')->fetchField() + 1;

```

This works with no reference to db\_next\_id. For me it is very important to increase the uid's always by one and this is one way to do it.

# Answer
uid and other identifiers are not sequential since Drupal 7. Identifiers are generated using a sequence API, see this issue: https://www.drupal.org/node/356074

If you check the db\_next\_id you'll see that the number passed as argument is just de *minimum* id that is considered valid.

See also this question and answer: What could cause uids to not be numbered consecutively?
> 1 votes

---
Tags: database, users
---


# Question
Title: drupal webservice error Access denied for user anonymous
experts:

I am new to drupal webservice,when I have set up the backend drupal webservice,I am trying to use firefox poster plugin to test the user/login function but I always get "Access denied for user anonymous" message ,after what I have check and searched the solution all around internet I can't find out why this error happen,could anyone who kindly take a look and help me?thank you so much in advance.

1 using firefox poster to post message and get response like below snapshot:

2 after checked the http message in fiddler,I still confused that every thing seems correct but still error message for "Access denied for user anonymous"

3 here is my webservice configration:

# Answer
> 0 votes
This most likely has to do with permissions for anonymous user. Try updating permissions and it should solve your issue.

---
Tags: users
---


# Question
Title: Drupal 8 Theme Header Background Image Upload
I'm upgrading the Mayo theme to Drupal 8. For Drupal 7 it worked like this in theme-settings.php with hook\_form\_system\_theme\_settings\_alter():

```
  $form['adv_header']['header_bg'] = array(
    '#type' => 'file',
    '#title' => t('Upload header background image'),
    '#size' => 40,
    '#attributes' => array('enctype' => 'multipart/form-data'),
    '#description' => t('If you don\'t jave direct access to the server, use this field to upload your header background image'),
    '#element_validate' => array('mayo_header_bg_validate'),
  );

```

# element\_validate in the above called:

```
/**
 * Check and save the uploaded header background image
 */
function mayo_header_bg_validate($element, &$form_state) {
  global $base_url;

  $validators = array('file_validate_is_image' => array());
  $file = file_save_upload('header_bg', $validators, "public://", FILE_EXISTS_REPLACE);

  if ($file) {
    // change file's status from temporary to permanent and update file database
    $file->status = FILE_STATUS_PERMANENT;
    file_save($file);

    $file_url = file_create_url($file->uri);
    $file_url = str_ireplace($base_url, '', $file_url);

    // set to form
    $form_state['values']['header_bg_file'] = $file_url;
  }
}

```

For the Drupal 8 version I have added `use Drupal\Core\Form\FormStateInterface;` at the top of theme-settings.php and some changes to mayo\_header\_bg\_validate(). So far it looks like this:

```
/**
 * Check and save the uploaded header background image
 */
function mayo_header_bg_validate($element, FormStateInterface $form_state) {
  global $base_url;

  $validators = array('file_validate_is_image' => array());
  $file = file_save_upload('header_bg', $validators, "public://", NULL, FILE_EXISTS_REPLACE);
  if ($file) {
    //change file's status from temporary to permanent and update file database
    $file->status = FILE_STATUS_PERMANENT;
    //file_save($file);

    $file_url = file_create_url($file->uri);
    $file_url = str_ireplace($base_url, '', $file_url);

     //set to form
    //$form_state['values']['header_bg_file'] = $file_url;
    $form_state->setValue(['header_bg_file'], $file_url);

  }
}

```

It does upload the image to /sites/default/files and put an entry into the file\_managed table. file\_save() is gone for Drupal 8 and I couldn't find a change log showing how to replace it for Drupal 8. 'header\_bg' just shows a value of "/" in mayo.settings.

# Answer
`file_save_upload()` returns an array of Drupal\file\Entity\File objects; you need to use `File::getFileUri()`.

```
// ...
$file = file_save_upload('header_bg', $validators, "public://", NULL, FILE_EXISTS_REPLACE);
$uri = $file[0]->getFileUri();
$form_state->setValue('header_bg_file', $uri);
// ...

```
> 1 votes

# Answer
I suggest you look at ThemeSettingsForm, which is where the code lives for the logo and favicon. Doing something similar there would work.

Note that it doesn't save the file, it just uses the file entity that it gets from the widget and puts it in a permanent place using `file_unmanaged_copy()`.

Make sure to keep the conditional, so that you don't get a fatal error when not providing an image (I assume that's the problem with @dmouse's code example).
> 4 votes

---
Tags: 8, forms, files
---


# Question
Title: Display Author Pane in view (with Display Suite View Mode)
I'm new to Drupal, but I couldn't find an answer for my problem in any other thread.

I've installed and configured Author Pane and I'm able to see it in places like a node page or advanced forum topic.

Now I'm creating a View that returns a list of nodes, and configured one of its Display Suite view modes for displaying each result (this view mode includes the Author Pane block for that content type).

The list of nodes is displayed OK, but the Author Pane is not being shown. The section of the view mode layout where the Author Pane should be displayed is empty.

I've already tried making a relationship with Author and setting the `Author:name` as one of the view's fields (I've read sth like that in some other posts), but nothing changed. It's like Author Pane cannot find any user context information.

Can someone help me with this issue ?

As a (maybe) related issue, I have another view that ends up in a block, which should also display the Author pane. This block appears at the bottom of a node page, which also has Author Pane configured. In that view block, Author Pane is actually being display for each results but always with the information of the user of the page's node! So, every secondary node related with the primary node displays the same Author information as the primary node, instead of its own author's information. I think both issues are related. There is some problem with Author Pane trying to get user information from views.

Thanks everybody in advance!

# Answer
> 0 votes
For anyone who ends up in my same situation, I will post the answer.

Author Pane is only prepared to be displayed on full view nodes, but not in View's lists or Display Suite custom view modes. This is because calling the function "menu\_get\_object()" will not retrieve anything.

What you need to do is to alter Author Pane's function "author\_pane\_get\_block()" or find a way to implement a hook to do the same thing properly.

I quickly edit the first condition removing the numerical condition of arg(1) and after $node = menu\_get\_object() line, I check if node is not set, and in that case, I assign $node variable the current view node from somewhere in the context. (in my case, I could get it from Display Suite context, but you can get it from anywhere, including (in the worst case) the stacktrace arguments.

Hope this helps someone!

---
Tags: views, users
---


# Question
Title: How to show event title and time in calendar block?
I have create a view based on the template. The events are shown up properly as a link in the calendar block:

How to I add also the event name and time (similar to the month page)? i.e.:

# Answer
Do you mean you would like to add the event name and time to the calendar you have provided on the top? If that's what you're asking, I don't think you can, and that is what the month page is there for. In Views, can you make the month page a block instead and place that wherever you need it?
> 1 votes

# Answer
Go to `Structure -> Views -> Calendar View` and then under `Displays` click `Block`. Next, under heading `Format` click `Settings` next to **`Format: Calendar`** and choose **`No`** for ***`Display as mini calendar`***
> 1 votes

---
Tags: 7, views, datetime
---


# Question
Title: Is there a stable way to fill a filefield/imagefield via bulk upload in D7
OK, here's the deal. I've implemented image gallery nodes in D7 the straight-forward way, i.e. create node type 'gallery' and add an imagefield with unbounded number of values. Nice markup via Views/EVA, done.

Now, to make the image upload convenient, I tried the following ways and got the respective results:

Multiupload Filefield Widget: The uplaod goes through, images appear on server side, but php runs out of memory while computing the ajax response for the upload.

Plupload widget: Upload works, but side crashes on save. I get lot's of visible json instead of the saved side.

Plupload via Fielfield Resources: Upload goes through, after that no visible response. On save, I get a long list of copy/rename error messages above the actual side.

The problems are present for pure file fields, on a otherwise pure D7 installation, so image processing is off the table as well as memory polluting modules (up to the ones mentioned above, appearently).

So the question is, why is it so memory consuming to compute a not so lengthy ajax response? The side shall collect several galleries containing each around 200-400 pics, so a nice way to bulk upload those jpgs would be great.

# Answer
> 0 votes
For completeness, the only stable way I found (and it's still not perfect, though) is to use **plupload** in combination with **block\_upload** to get a **PLUpload widget** on the content site once it is created. It still is not the perfect workflow, but it currently allows me to dump 100s of photos/files into one filefield. Using PLUpload during node creation didn't work, btw.

---
Tags: 7, ajax, media, files
---


title: Access control based on session

text:
# Question
Title: Access control based on session
Currently I am making a website for restaurants. In the site, each restaurant is a node type and a menu item is another node type. The relationship between restaurant and menu items is one to many.

What I am doing is that after user creates and saves a restaurant node, the user session will keep the newly-created restaurant node id, based on that id, user can create multiple menu items for this restaurant.

What I want to make is that only when there is a restaurant id in user's session can user go to menu item add page, otherwise they cannot do that.

So how can I add this menu-item-add-page access control based on user's session?

Cheers!

# Answer
I might suggest using Rules, Node Limit and Field Permissions for this... something like:

* limit the user to creating one node (restaurant) type
* create a field for the user, alter its access using Field Permissions, so they can't see or change it
* use Rules on the event of new content created (restaurant), assign that user Field the node id of the newly created node
* using Rules again, assign the appropriate field in any further node creation (menu item) using the user field value (which now contains the node id of the restaurant)
* using Rules again, check url for /node/\[menu-item\]/add and see if that user has a user field containing a node id - if no id, redirect to a message screen saying they have to create a restaurant first

In this way, you limit each user to one restaurant, assign a permanent value to that user for the restaurant they create, and make some checks to ensure they have an assigned node id before they are able to create a menu item.

Rules:

> The Rules module allows site administrators to define conditionally executed actions based on occurring events (known as reactive or ECA rules). It's a replacement with more features for the trigger module in core and the successor of the Drupal 5 workflow-ng module

Node LImit:

> The Node Limit module allows administrators to restrict the number of nodes of a specific type that roles or users may create. For example, if a site has an "Advertiser" role that can create "advertisement" nodes, then the node limit administrator can restrict all users in that role to a specific number of nodes. He may also restrict users on a per-user basis.

Field Permissions

> The Field Permissions module allows site administrators to set field-level permissions to edit, view and create fields on any entity.
> 0 votes

---
Tags: users, sessions
---


title: Altering routing of user/login

text:
# Question
Title: Altering routing of user/login
I have a use case where I need to adjust the landing of the route, user/login to direct to a custom developed user/register page once clicked. What's the quickest method of doing this without overloading the core User module with changes?

# Answer
> 0 votes
You can also use Login Destination module to redirect without touching any code

> The Login Destination module allows you to customize the destination that a user is redirected to after logging in, registering to the site (7.x), using a one-time login link or logging out (7.x). The destination can be an internal page or an external URL. It is possible to specify certain conditions like referring pages or user roles and make the destination depend upon them. You may use PHP snippets to provide custom conditions and destinations. It is also possible to keep users on the currently visited page after logging in or out.

# Answer
> 0 votes
You could easily use Rules if you don't want to touch code

event: drupal initializes

condition: url: user/login and user/register

action: redirect to your url

Rules:

> The Rules module allows site administrators to define conditionally executed actions based on occurring events (known as reactive or ECA rules). It's a replacement with more features for the trigger module in core and the successor of the Drupal 5 workflow-ng module.

---
Tags: 7, routes, users
---


# Question
Title: How to Rebuild Registry On Admin Form Submit
I would like to initiate theme registry rebuild(drupal\_theme\_rebuild) on a particular form submit. This is admin form for my custom settings:

```
function HOOK_menu(){
 $items['admin/some-url'] = array(
        'title' => 'Custom Settigns',
        'page callback' => 'drupal_get_form',
        'page arguments' => array('my_admin_interface'),
        'access arguments' => array('administer users'),
        'type' => MENU_NORMAL_ITEM,
    );
 return $items;
}

function my_admin_interface($form, $form_state)
{
    $form['some_settings'] = array(...);
    return system_settings_form($form);
}

```

The form works well and the settings are being saved, however. The changes involve theme functions, so I need to rebuild the registry whenever the form is submited. What is the best approach? Can I attach to form element function drupal\_theme\_rebuild or there is hook I can use to call drupal\_theme\_rebuild(). What is the best way rebuild theme registry after a form is processed and new settings saved. Thank you for your help

# Answer
> 2 votes
In order to fire a submit callback you have to add it to `#submit` array within your form. Here is an example.

```
/**
 * Form builder.
 */
function my_admin_interface($form, $form_state) {
  $form['#submit'][] = 'my_admin_interface_submit';
  return system_settings_form($form);
}

/**
 * Submit handler.
 */
function my_admin_interface_submit($form, $form_state) {
  drupal_set_message(t('Hey there!'));
}

```

Here is a link to the manual.

---
Tags: forms, theming
---


# Question
Title: Difference between bootstrap carousels and how to set up?
I have tried to add the bootstrap\_carousel to the Bootstrap Business template. I have researched every possible forumpost about this slider, but can't get it to work.

Now, the slider works perfectly just as content, but I want to create a view in order to implement it on every page as a banner. Therefore, I followed this guide.

My view does not work. I get to see this:

My settings for that view are:

Anyone with an idea about what's going wrong? Again, my content type itself is displaying fine, as you can see in the following screenshot. It is the view that is not working.

# UPDATE

I inserted a custom block with PHP code, but now I have a new problem. Sometimes, two images become active:

# Answer
Solution (credit also goes to J. Reynolds., however I went for a different solution so I'm adding it here)

1. set jquery to 1.7
2. disable js CDN load in theme settings
3. add "scripts\[\] = js/bootstrap.min.js" in theme info file
4. copy paste bootstrap.min.js version 3.0.2 into js folder of your theme
5. insert custom block, copy paste custom block number 14 (slideshow) from here
6. include this custom block as banner on homepage
7. See the carousel in action
> 0 votes

# Answer
Do not use Views Bootstrap module. Rather just display the node (of type Carousel) full content.

Construct your view as follows:

**Format:** Unformatted list, show Content, Full Content

**Filter Criteria:** Content:type (= Carousel)

**Pager:** show 1 item only.

Set jQuery update to 1.9 and load jquery-migrate

Your theme pulls Boostrap from CDN. Bootstrap Carousel requires another Bootstrap library in libraries folder. Is this optimal? I don't think so.
> 0 votes

---
Tags: views, blocks
---


# Question
Title: How to show "Add to compare" button in views using "dynamic properties" module in d7?
I need to list the products to compare using views. I have used "Dynamic Properties" module to compare the products.

On each product node I can see a "Add to compare" button. But how to show this button in views?

I've referred this demo site http://p.worldempire.ch/products

# Answer
It will not support by views at the moment, see the Issues for Dynamic properties.

Check this also http://drupal.org/node/1852656
> 1 votes

# Answer
I want this feature too,and finally use this method I am used php views field to achieve this job,first add nid field to list of field, exclude it from display then add php field ,in php value field I wrote

```
<?php
$node=node_load($row->nid);
 print drupal_render(drupal_get_form('properties_compare_add_form_node_' . $node->nid, 'node', $node))
?>

```

and work correctly for me.
> 0 votes

---
Tags: 7, views
---


# Question
Title: site returns 404 on every request, except /
After my site is moved from a shared hosting plan to VPS (dreamhost), all request returns:

> Not Found
>
> The requested URL /index.php was not found on this server.
>
> Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

For example.com/, it does returns some content. Any other requests (e.g. example.com/install.php) returns 404.

Rewrite settings are as default:

```
RewriteEngine on

# RewriteBase /

# Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

```

What should I check?

Update:

If I request example.com/? or example.com/?q=user, it returns:

> Site Temporarily Unavailable
> We apologize for the inconvenience. Please contact the webmaster/ tech support immediately to have them rectify this.
>
> error id: "bad\_httpd\_conf"

# Answer
About the "Site Temporarily Unavailable" error, the DreamHost site reports the following:

> ## The Root Cause of the Error
>
> This error means that the IP your domain is resolving to on our system points to an Apache web server not configured for your domain. When this happens, the Apache web server just shows the first domain listed in its config file. So, to make sure nobody's site ever shows some other random site we host, we made the first domain in all our config files just show that page. In fact, DreamHost made up the error id: "bad\_httpd\_conf" stuff ourselves just so we'd know what the problem was when reported to us! Of course, if everything is working right in our system, this should never happen. If it is happening, don't feel bad about contacting us to fix it! However, there are some ways you can possibly fix it yourself immediately…
>
> ## Resolving the issue
>
> There are several ways to solve this problem.
> **IMPORTANT**: If this problem appears shortly after making a configuration change for that domain in the control panel this could be caused by the IP address for that domain changing. If that's the case this error should go away within about 2 hours - once the DNS change propagates throughout the Internet. This is normal. If it doesn't go away after 2 hours then try these troubleshooting techniques.
>
> ### Pro tip
>
> Check for the correct IP. Linux and Mac users can use the "dig" command in a terminal. Example:
>
> ```
> $ dig +short domain.com
> x.x.x.x
> $ dig +short @ns1.dreamhost.com domain.com
> x.x.x.x
>
> ```
>
> The first command shows the IP you're getting to your computer. The second command shows the IP that is setup in DreamHost's system. If domain.com is using DreamHost nameservers, you should be getting the same IP with both commands.
>
> Windows users can use the "nslookup" command in a command prompt. Example:
>
> ```
> C:\Users\user>nslookup domain.com
> Name: domain.com
> Address: x.x.x.x
> C:\Users\user>nslookup domain.com ns1.dreamhost.com
> Name: domain.com
> Address: x.x.x.x
>
> ```
>
> The first command shows the IP you're getting to your computer. The second command shows the IP that is setup in DreamHost's system. If domain.com is using DreamHost nameservers, you should be getting the same IP with both commands.
>
> ### If you're not using DreamHost's DNS
>
> If you aren't using DreamHost to manage your domain's DNS, most likely the IP they are serving your domain from changed. It's up to you to notice this and fix it! You can figure out the correct IP by querying the DreamHost nameserver with one of the commands in the above section (depending on your OS). Another way to find the correct IP is just login to panel.dreamhost.com and go to Domains -\> Manage Domains -\> DNS (for the domain in question) and find the A record in the "non-editable" section. Then, update your A record to point to that IP and once DNS propagates, the bad\_httpd\_conf error should go away!
> 1 votes

# Answer
Check to make sure that the directory containing Drupal on your server can read the contents of your .htaccess files (the AllowOverride directive in your httpd.conf controls what will be processed). In my experience, AllowOverride None set for that directory or a parent directory is the most common culprit (remember: directives are inherited).
> 3 votes

# Answer
If apache2 installed on your server make sure mod\_rewrite (rewrite) enabled. In Ubuntu case you can check this by commend:

```
ls /etc/apache2/mods-enabled/ | grep rewrite

```

If result is empty, you have to enable mod\_rewrite and reload apache config:

```
sudo a2enmod rewrite
sudo service apache2 reload

```
> 0 votes

---
Tags: 6
---


title: Shopping cart form footer

text:
# Question
Title: Shopping cart form footer
I wanto to display Prices with no decimal Places, in shopping cart footer (commerce order: order total ), but in the shopping cart view i found nothing to which does this. what shoud i do?

# Answer
Editing the view could be one solution but you can also do it via jquery i.e. capture the html inside the relevant div or span , then truncate the decimal part and then resupply the altered price value to the div or span. I think that should be very easy to do.
> 0 votes

# Answer
It is because it set in line\_item theme module ,go to `line_item` module directory(folder) in `commerce` module (it is in commerce module submodules), then go to theme folder copy "commerce-line-item-summary.tpl.php" to your current theme, edit it.there is a where that the price will show.

this line exactly what you should change \**(change $total) \**

```
  <span class="line-item-total-label"><?php print $total_label; ?></span> <span class="line-  item-total-raw"><?php print $total; ?></span>

```

some thig like below work for you :

```
<span class="line-item-total-label"><?php print $total_label; ?></span> <span class="line-  item-total-raw"><?php print intval($total); ?></span>

```
> 0 votes

---
Tags: commerce
---


title: How disable creating new terms (tags)?

text:
# Question
Title: How disable creating new terms (tags)?
I am using drupal 6,How can I disable creating new terms during node submit? Is there any option to do this? I do not see it in vocabulary settings.

I found, that Content taxonomy module have to do it, but I can figure how! Thank you for your attention

# Answer
By default terms not add in drupal,Properly you are using active tag module,install autocomplete\_deluxe module and use it as that field widget.
> 0 votes

---
Tags: 6, taxonomy-terms
---


# Question
Title: select list - content outputs key instead of label
Drupal 7 v. 7.34 - content type. In my content type I use at least 3 fields with select lists. In each case the key is output instead of the label. I would expect the label to be displayed to the user. E.g. the field 'theme' has the following available options:

wedding|wedding first dance dancepromo|let's dance

The content shows 'wedding' instead of 'wedding first dance' and 'dancepromo' instead of 'let's dance'.

What am I doing wrong ? Should I change the key|label order to label|key ?

# Answer
Go to the display settings for your content type, and look at the display formatter for the field. it should be set to `Default`. The other option is Key.
> 2 votes

---
Tags: 7
---


# Question
Title: Webform depending on Select List - Number of delegates
Webform 4.x

On a Webform booking form how would one add the functionality where from a dropdown list of number of delegates (1,2,3...) would then add the necessary number fields on the form. So if 1 was selected from a list then only 1 set of fields is presented, but if 2 is selected from the list then 2 set of fields is presented.

For example:

Booking Contact Name:
Booking Email address:
Number of Delegates:(Select options: 1,2,3,4,5...) Number 2 Selected!

Delegate Name:
Delegate Date of Birth:

Delegate Name:
Delegate Date of Birth:

# Answer
I would create conditionals. E.g. if Number of Delegates is 2, then show the second pair of fields. If it is 3, show the third...

You can consider this solution if the number of delegates is limited.
> 0 votes

---
Tags: webforms
---


# Question
Title: Is it possible to give inactive accounts a custom error message upon login?
I have a site where, when a user is flagged as spam, that user account is blocked.

This is fine, but sometimes a user is blocked by mistake. When the user tries to log in, since the account is blocked, they just get the default Drupal "wrong username/password" message.

However, I would like to give a custom message ("Sorry, it looks like someone thought your account was spam. If this is a mistake, please contact us.") when the user account is inactive and attempts to log in. I'm using the latest version of Drupal 7 and I tried to find a way to do this in Rules but I couldn't come up with anything.

# Answer
You can alter the login form and add a custom validator where you check if user is blocked and show the error message you want.

If you check the code you'll see that login validator are set by the user\_login\_default\_validators() function. Those validators are:

* user\_login\_name\_validate
* user\_login\_authenticate\_validate
* user\_login\_final\_validate

What I don't understand is why are you getting the "wrong username/password" (actually the message is "Sorry, unrecognized username or password. Have you forgotten your password?"). The first validator checks if the user is blocked:

```
/**
 * A FAPI validate handler. Sets an error if supplied username has been blocked.
 */
function user_login_name_validate($form, &$form_state) {
  if (!empty($form_state['values']['name']) && user_is_blocked($form_state['values']['name'])) {
    // Blocked in user administration.
    form_set_error('name', t('The username %name has not been activated or is blocked.', array('%name' => $form_state['values']['name'])));
  }
}

```

As you can see when a user is blocked the message es "The username %name has not been activated or is blocked".

Anyway, to achieve what you want I think you ca follow the steps:

Implement hook\_form\_FORM\_ID\_alter adding your custom validator as FIRST validator. You have to alter two forms, 'user\_login' and 'user\_form\_block' (tose are the form ids). Use:

```
array_unshift($form['#validate'], 'my_custom_user_validation');

```

to add your custom validator as first validator.

Then code your custom validator. It should be same as user\_login\_name\_validate but using your custom message.

**Edit**: As I've pointed out in my answer and J. Reynolds says the blocked message is not the standard wrong user/password. If you get the blocked user message you can go with J. Reynolds suggestion (just altering the standard user blocked message). If you need to check for any other different condition (for example, blocked and spam role) you can use what I say in this answer.
> 3 votes

---
Tags: users
---


title: List of creators + link

text:
# Question
Title: List of creators + link
I want my user to create content in which he can select a creator (in a select list) of products displayed on his article. If he selects an existing creator during creation of the article, the publised article has to display the name of this creator + information about the creator (website + adress + maybe more). That means I have to enter this information into X fields for each creators.

If my user wants to add a new creator in this select list, he can do it directly when he creates his article. He enters the name of the creator + link to website + adress

My problem is that I don't know how to do it.

I've tried with that : \*new taxonomy + 2 Link fields added fopr this taxonomy

But how can I enter the content of these fields linked to the taxonomy ? How can I allow my user to add content on new creators he wants to add ?

# Answer
If I understand your question correctly, and you are using Drupal 7, you need the Entity reference and Entity connect module.

The Entity reference module provides a field type with which you can reference other entities. When attached to your 'article' content type, your users can select an instance of the 'creator' content type.

To allow your users to dynamically create instances of the 'creator' content type, the Entity connect module comes in handy. Two buttons will be provided next to the Entity reference field, one to create a new instance and the other to edit existing content.

Please let me know if you need more information/help.
> 1 votes

---
Tags: taxonomy-terms
---


title: Taxonomy or database table?

text:
# Question
Title: Taxonomy or database table?
My problem is not technical but structural.

The idea is that users can submit an ad (to sell a car for instance) with entityForm, or webform.

To define the car to sell, I want a predefined list to avoid misspelled words.

The first solution I tested was to use Taxonomy like that:

-Audi
--A1
--A3
--A4
-Seat
--Ibiza
--Leon

I used "Hierarchical Select" and then "Simple Hierarchical Select" and even "Term Reference Tree" but my problem is still the same.

When I want to use a view to display the EntityForm Submissions, it shows the car in one column like that:

Car

---

.Audi
..A1

---

.Audi
..A3

And I want it on 2 columns like that:

Brand | Model

---

Audi | A1
Audi | A3

Does taxonomy allow that and how?

Should I use a database table with another module?

Thanks for any help!

# Answer
> 0 votes
You don't need any changes to your database, with HS Or SHS you already store enough data to built a template answering your needs.

From my point of view, once your view is configured, you can alter the display of your field while overriding the default TPL file.

From the view edit page, if you go into "Theme: Information", you can find the name of the file you need to create and place into your theme folder.

The file name should look like this:

*views-view-field--**name-of-your-view**--**name-of-your-field**.tpl.php*

As a base for you file, you should use `views-view-field.tpl.php` (located in `sites/all/modules/views/theme`). In that template, there's some variables available to help you build what you want (like `$row` or `$field`).

If you have Hierarchical Select installed, you can simply render the field, it will display data the way you want.

Here's some untested code:

```
$field = field_view_field('entity_name', $fully_loaded_entity, 'your_field_name');
print render($field);

```

For that chunck of code to work, you need to specify if you're working with a node, user or term, pass the loaded entity and give the corresponding field name.

The rendered HTML should be enough to build something like this (made with the exact same method):

---
Tags: views, taxonomy-terms
---


title: How to remove PAGE SUM in Views Calc?

text:
# Question
Title: How to remove PAGE SUM in Views Calc?
How can I remove the `Page SUM` row in my Views Calc?

I have upgraded Views Calc module to its latest version.

# Answer
You can achieve this in two ways

1) Add following style in your CSS

```
tr.view-subfooter-number{ display: none; }

```

**OR**

2) Go to *views-calc-table.tpl.php* file under **views\_calc** module directory and find the following code (PAGE SUM row code)

```
  <tr class="view-subfooter-number">
    <?php foreach ($row as $field => $content): ?>
      <td class="view-subfooter views-field views-field-<?php print $fields[$field]; ?>  <?php print $options['info'][$field]['align'] ?>">
        <?php print $content; ?>
      </td>
    <?php endforeach; ?>
  </tr>

```

You can comment/remove the above code to hide 'PAGE SUM' row at view output.
> 2 votes

# Answer
As the page sum is used with the *pager*, therefore it should really *only* appear when using a pager so:

copy the `views-calc-table.tpl.php` to your theme folder and edit the footer part to :

```
<tfoot>

<?php if ($view->query->pager->plugin_name != 'none' ): ?>

  <?php foreach ($sub_totals as $type => $row): ?>
    <tr class="view-subfooter-number">
      <?php foreach ($row as $field => $content): ?>
        <td class="view-subfooter views-field views-field-<?php print $fields[$field]; ?>  <?php print $options['info'][$field]['align'] ?>">
          <?php print $content; ?>
        </td>
      <?php endforeach; ?>
    </tr>
  <?php endforeach; ?>

<? endif; ?>

  <?php foreach ($totals as $type => $row): ?>
    <tr class="view-footer-number">
      <?php foreach ($row as $field => $content): ?>
        <td class="view-footer views-field views-field-<?php print $fields[$field]; ?>  <?php print $options['info'][$field]['align'] ?>">
          <?php print $content; ?>
        </td>
      <?php endforeach; ?>
    </tr>
  <?php endforeach; ?>

</tfoot>

```

the line `if ($view->query->pager->plugin_name != 'none' ):` means that it shows the page sum row only the views uses one of the pager plugins.

This way you are not relying on CSS and you can still use the page sum row when using a pager.
> 1 votes

---
Tags: views
---


# Question
Title: How to show fields in different regions?
I've tried the `Display Suite module`, which only comes with regions per display suite layout template (also the extra module did not change this) which basically just changes the body/ content region... making the themes regions available was not possible. It still would be a bit overkill for what I want anyways.

All I want to do is make a field from within any content type available to be put in any region. No blocks. No views.

Just as the `display suite module` offers a new column in the `manage display tab` "region" with a drop down to pick which region the field shall be put in.

How come there is no module like that?

Thanks!

Edit: I've read this thread but I want to do it without views and if possible without blocks.

# Answer
As with anything in Drupal there are many ways of doing this. Display suite and Panels (as mentioned by Serpiente above) are great. However, if you are not already using them for your project, they are indeed overkill to get what you need.

You can use the CCK Blocks or Field as Block module. These essentially turn any field (you set) into a block to be placed in another region.

You can also use the Views module to create a block with a contextual filter based on the nid in the url and display whatever fields you choose.
> 2 votes

# Answer
I believe you can achieve this with Display Suite by converting field into a block which you can then place in other regions using the block admin page. Information on how to do this can be found in the Add fields to a block page of the Display Suite documentation
> 0 votes

# Answer
If you really want to avoid using blocks at all cost, you could print separate fields using the theme. For example, in page.tpl.php or node.tpl.php you can access the $node or $page variable and use this to print fields. This is not considered a beautiful solution, but it can be quite effective.

The reason it is not so beautiful is that we like to keep code, configuration and theming separate.
> 0 votes

---
Tags: entities, theming
---


# Question
Title: Upgrading drupal 8 beta3 to beta4 table user__roles not exists
When I upgrade my drupal site to beta4 release, it says that table user\__roles is not exits.

It's look like that new beta version alter table name from **users\_roles** to **user\__roles**. how is possible to apply this change (*How is possible to migrate schema of drupal to latest version*).

Thanks.

# Answer
There is no upgrade path yet.

You could try to alter the table manually, or copy it from a new install, but you will very likely run into other issues as well.
> 2 votes

---
Tags: 8, updating, upgrading
---


# Question
Title: Views: list all nodes based on relationship
I have a datastructure where "Courses" has many "Activities". I've accomplished this by using entity reference to add a course\_field to the activity content type.

I am pretty conused, however, as to how to set up a view listing all activities belonging to a certain course.

I've created a view that displays activities and I've set the relationship on the view to "Entity Reference: Referenced Entity". I am a bit confused though, as to whether I should set it to "Entity Reference: Referencing Entity", but I figured the first one made more sense as activities are referencing courses with a field on the activity model.

Now I set the contextual filter to "Content: Course", but when I preview the contextual filter, typing the name of one of the courses does not filter the activities.

What is the correct way to filter activities according to what course they belong to?

# Answer
You are correct in setting your relationship as "Entity Reference: Referenced Entity". To recap: you have a view of nodes filtered by Activity. Activity has the entity relationship field that references Course. The direction is from Activity to Course and you are building a bridge from activities to course.

Normally one would set the contextual filter up as node:nid. As you want to list all activities associated with a course, you therefore need to pass in a context that uniquely identifies the Course. Nid fits this perfectly. The nid coming in as the contextual filter needs to be of type Course. So how do you tell Views. You already have a bridge from activities to course (your relationship), and to indicate to views that the nid contextual filter is of type Course you set the relationship that you added on it. Using nid as contextual filter makes more sense in most cases, as it is the unique identifier. It could be taken from the url as a default, or could be sent in via a panel etc.

You can if you wish add another field as the contextual filter, as in the title (it may or may not be unique). But always you will need to add the relationship to the contextual filter to identify the context as belonging to Course.

Now to explain what you did with setting the contextual filter to 'Content Course'. You added the field that appears on the Activity type and which is your entity relationship field to Course, as the contextual filter. This field does not exist in the Course type, so you will never get a result from it. As you want to show a view of activities associated with a Course type, you have to add the relationship that links activities with courses (which you did), and then your contextual filter has to be of a field that appears in Course type. So you must first select a field that does indeed appear in Course type, and then you have to tell Views to use the relationship on that field (remember, your relationship takes you from an Activity type, which is the begin-point, to the Course type, which is an end-point, and your context needs to be on the end-type). Imagine using the nid or the title as the contextual filter. Both course and activity have both of these fields, so which type's should Views use?

The relationship is also considered when adding Fields, Filter Criteria, and Sort Criteria on your view. You have to decide whether the field, filter, or sort belongs to your base type, or to a type that you are bringing in with a relationship.

For a brilliant video tutorial series on Views, have a look at Johan Falk's Taming the Beast: Learn Views with NodeOne
> 0 votes

---
Tags: views
---


# Question
Title: How to create several <ul>-lists in one display with Views?
I display a list of news which have a category. I wish to have over my news list , a list of all categories. Is this possible in one single view , and therefore with one single SQL query ?

What I want :

```
<ul> Cat1; Cat2; Cat3; .....</ul> //1st list

<ul> //2nd list
Title 1
Cat 1
Body 1

Title 2
Cat 2
Body 2

Title 3
Cat 3
Body 3
</ul>

```

All of that with one display of a view with Views module.

I get to see the first list. But not the list of categories above. I don't want several block and combine them in a template, wich means several query.

My view :

# Answer
> 1 votes
You can do it in one view as the content for the first list is contained in the second list.

Your view needs to bring in only the second list. You will then override one of the theme functions for your view

probably one in the list of 'Style Output'.

As you can see from this code, it prints out the HTML list format:

```
<?php print $wrapper_prefix; ?>
  <?php if (!empty($title)) : ?>
    <h3><?php print $title; ?></h3>
  <?php endif; ?>
  <?php print $list_type_prefix; ?>
    <?php foreach ($rows as $id => $row): ?>
      <li class="<?php print $classes_array[$id]; ?>"><?php print $row; ?></li>
    <?php endforeach; ?>
  <?php print $list_type_suffix; ?>
<?php print $wrapper_suffix; ?>

```

You will treat this code as printing out the second list, so you have to add code to this to print out the first list. You will have to dig through the variables available in the template to find the Category field for each row and isolate it. If the row has already been fully rendered and you don't have access to the category variable, you can then either parse out the category out of the row, or look into the `row style output` views templates.

Alternatively, you could overrride one of the views hooks that fires after the sql has been run but before the rendering has taken place (hook\_views\_post\_execute is a likely candidate). You will loop through the result and load all of the categories into a list which you then add as an attachment before ($view-\>attachment\_before) the view.

# Answer
> 1 votes
As far as I know you need two views, one for the first list and another for the second. You can *"embed"* the first view in the *Header* of the second view using the Views Field View module.

**Views Field View:**

> This module allows you to embed a view as a field in a view. A new field handler is made available, so this can also be used in area (header/footer/empty) handlers as well as rows.
>
> This view handler can accept arguments from fields of the parent view using tokens and pass them into the child view for each row. Raw or rendered token values can be used, as well as static values.
>
> It's highly recommended to use this module in conjunction with views caching. Views Content cache and Cache Actions are good ways of caching views.

---
Tags: views
---


# Question
Title: migrate drupal site , error occured, the site was down
I migrate my site from WinServer2003 to CentOS , with the following step: 1. migrate the database to the CentOS server with .sql files backup. 2.copy all the website root file to the new server.

when i visited some node an error occured:

according to the message there was a table or view was missing, but there was no such a table or view in the old system(win2003)

how can i fix the problem, any suggestions are appreciated, Thanks in advanced.

when i do some config (i delete the text format: filter HTML), the site was completely down. when visit it just show an error:

i am really confused.

# Answer
> 0 votes
I solved the problem, the link : https://www.drupal.org/node/1882292 i just follow the #11 's method and create the image\_dimensions table.

---
Tags: migrations
---


# Question
Title: how to request multiple public image sizes from a field's filename?
this node endpoint - http://cms.tripchi.com/drupalgap/node/35921 \- in my Service includes...

```
field_photo: {
und: [
{
fid: "810",
uid: "1",
filename: "dxb-airport_1.jpg",
uri: "public://dxb-airport_1.jpg",
filemime: "image/jpeg",
filesize: "64389",
status: "1",
timestamp: "1408433735",
uuid: "697b5fd7-a968-4f6d-b5a0-558ff0f76680",
rdf_mapping: [ ],
alt: "DXB",
title: "DXB Airport",
width: "390",
height: "270"
}
]
},...

```

using javascript - similiar to this http://cms.tripchi.com/mobile-app/js/index.js \- I want to be able to request the large/medium/small dimensions of this public image dynamically - without changing the field\_photo's settings in Drupal's.

I have the content-type's image style configured per the image below:

When the field's "Preview image style" is set to "Thumbnail (100x100)", I can do

```
var size = 'thumbnail';
sDomain + '/sites/default/files/styles/'+size+'/public/' + utils.getLang('field_photo', obj, 'uri');

```

**However, when I change the size variable to 'large', I get an Access Denied error.**

Changing the field\_photo settings to the "Large (480x480)" size does fix that, but I only want this size returned for the API via JavaScript and this changings the Drupal's front-end view/template as well.

When I change the API's Display-Suite I get no difference to what the API returns and manually reconstructing the URL with 'large' still returns Access Denied.

Is there a way to expose requesting multiple image sizes without changing Drupal's field configurations? I would accept a solution that includes a Drupal hook to create the other image sizes on the presence of a parameter.

# Answer
> 0 votes
But avoid … Asking for clarification,

Really? What a joke! I hate this forum so much

There are a few things happening here. When you make a change to the field in the content type UI the imagecache is being manipulated/cleared. Changing the javascript manually does not do this so the path is not pushed through the system.

The easiest way to do this is to have separate fields for each size in the content type to make them available to your js. Hide the display of the fields not needed on the page (use hook\_alter or the admin UI).

Then in your js call them programmatically. To ease the JS call I would name the fields so they can be iterated, ie. field\_photo\_1(lrg),field\_photo\_2(med),field\_photo\_3(sml)

---
Tags: 7, entities, media, display-suite
---


# Question
Title: How to show separate values in Views from multi-value field
I made Multi-valued field in content type. I created image type of field and let it has unlimited number of images. Is it possible in Views to show only first image from this field? And only 5th?

# Answer
Adjust these settings in your view for the image field:
> 2 votes

---
Tags: views
---


title: Exposed filter as dependent dropdown?

text:
# Question
Title: Exposed filter as dependent dropdown?
Is it possible to create a view with exposed filter similar to the image given, where location field is a taxonomy term and rest of it are content types with location field as term reference.

# Answer
> 0 votes
Views Dependent Filter Module integrates this functionality with views

> Allows the presence of exposed filters on a view to be controlled by values in another exposed filter. Dependent filters are hidden when not relevant, and their values are not considered when the exposed form is submitted.

---
Tags: views
---


# Question
Title: "The form has become outdated. Copy any unsaved work..." when saving/deleting content
I have a site where saving or deleting content frequently displays an error message "The form has become outdated. Copy any unsaved work and then reload this page"

* It does not seem to matter what type of content.
* It happens on new content, as well as editing existing content.
* It doesn't matter how long the page is open before Save/Delete is clicked.
* There is only one person editing at a time.

Can someone suggest a way to track down this bug as it's proving difficult to find.

# Answer
> 1 votes
Take a look at the answer provided by warwickshaw on D.O https://www.drupal.org/node/2241311#comment-8791165

> To fix the error message: 'The form has become outdated. ...' try moving the 'drupal\_private\_key' in to the Drupal 7 settings.php file.
>
> The Issue See https://api.drupal.org/api/drupal/includes!common.inc/function/drupal\_ge... drupal\_get\_private\_key() is not a safe function.
>
> When variable\_get() doesn't return a $key (some outage, maybe a memcached restarted) you suddenly and silently get assigned a new drupal\_get\_private\_key.
>
> If you are using multiple server Drupal system where each server has it's own MySql database replicated from a Master DB, a Slave DB can end up with it's own key (which Master doesn't see) and when the slave gets it's key cached in memcached the fun begins.
>
> Mean while back in the D7 Admin, forms and menus that once worked start failing!
>
> The Fix The only safe place in D7 whether using a single or multi-server setup is to move 'drupal\_private\_key' value to the settings.php file.
>
> Add $conf\['drupal\_private\_key'\] = '...';
>
> To get the value execute on the Staging server (MySql master) drush ev 'print drupal\_get\_private\_key();' and assign the value above.
>
> You should have something like this (these are example values, don't use) $drupal\_hash\_salt = 'j8lnCx-XF3gq\_2NmnnHZ61Q3xlbKHFSzZ9EmUouPwKU'; $conf\['drupal\_private\_key'\] = 'Fnll-1ZETTb03CgO6PW4COWT7CjTBeRSAQzXqerq6FA';
>
> Check the hash\_salt is behaving correctly (should match $drupal\_hash\_salt) drush ev 'print drupal\_get\_hash\_salt();'
>
> Copy these setting to all other servers in the same Drupal cluster.
>
> On Stage update 'drupal\_private\_key' row with value used in the settings.php file. This will replicate and reset any MySql slaves out of sync. update variable set value = '\[drupal\_private\_key\]' where name = 'drupal\_private\_key';
>
> On Stage execute drush cc all
>
> Clear your browser cache.
>
> You are good to go!
>
> New D7 Projects When ever you create a new Drupal project make this the first task after installation.
>
> Other Symptoms of the Same Bug Multiple Save, Cancel buttons appears after clicking Save or Cancel in Page layouts.

---
Tags: 7, nodes
---


# Question
Title: Keep less files of Bootstrap in productions site after compiling?
i'm new to Bootstrap, Drupal and Subthemeing so maybe this question is a bit noob. ;-) I did a Subtheme for Bootstrap 3-Base-Theme with the local bootstrap-files etc. Makes completely sense for developing. But when i'm finished with editing and compiled my styles.css it doesn't make sense to upload also the less-files to my webserver as they are no longer needed, are they? (I just keep them local for developement)

I'm not so sure about the js files, those are still referenced at the info-file. But i keep thinking that one could drop the less-folder - do you agree?

# Answer
Yes, you can drop the less-folder on the production site. It is only used as source for compiling the css files. If you do that on the local dev-site, they're never used on the production site.
> 1 votes

# Answer
Technically you will not need the less files on your production unless you need to Drupal to modify your theme. For instance, if you are integrating the color module that with your theme to allow administrators user to change the colors of the theme using the color module. You need the less files and you need to use less module. Otherwise you **don't need them less files on your production site.**
> 2 votes

---
Tags: 7, theming
---


# Question
Title: Region for Main page content block field is required Error?
I have created a custom region called latest. And when I am assigning some block to that region from admin, while saving it returns this error

> Region for Main page content block field is required.

What might be the reason?

# Answer
I did a search for the error message "region for main page content block field is required" which produced theses results:

It appears that you need to assign content/block to the "Main page" region as it's currently empty.
> 3 votes

# Answer
This post helped me get closer, but I thought I would provide a more concise answer for those following the same path.

If you are looking to remove all blocks from Drupal 7, like you would want to do if you were placing blocks by using Context, you want to make sure that core's "Main page content" is the last block removed.

Steps:

1. Select "- None -" for all other blocks, then click Save.
2. Then change the "Main page content" block's region to "- Select -" and click Save.
> 5 votes

# Answer
To get rid from this error, just assign a "main page content" block to the *content* region in administrator \>\> structure \>\> blocks; then press the "Save block" button at bottom.
> 3 votes

# Answer
Looks like the region `content` is compulsory in the theme-name.info file. I added that and everything got solved. Just had to add the following

```
regions[content] = Content

```
> 2 votes

# Answer
You could use the Context module for assignment of blocks, make sure to remove the Main content block of the blocks overview page as the last one.
> 1 votes

# Answer
Just enable the "Main Content Page" block in Structure\>Blocks then save. That will save the problem.
> -1 votes

---
Tags: 7, blocks, theming
---


title: get parent's siblings of term in views

text:
# Question
Title: get parent's siblings of term in views
I want to create a views that termId passed from url to it and then show parent and parent's siblings(uncle aunt) of that term,,I can handle that show parent term id ,but I don't any idea that how can I get parent's siblings,I can handle it finally with `php_views` but first ask here maybe somebody has better solution.

**tnx for your attetions**

# Answer
> 0 votes
I did some a quick search and stumbled onto this comment in this thread, which led to the Views arg parent term module. From what I read on the module page

*..this module provides another default plugin argument, to get associated parent terms.*

I think it can be helpful in your case.

---
Tags: views, taxonomy-terms
---


# Question
Title: How do I make a single page use ssl in Drupal 7?
I have a form I created with Webform, and I need it to be secure. I don't need a login for everyone, only SSL for that one page. Is that possible? How do I use https:// for that one page?

# Answer
Take a look at the Secure Pages module. The module enables you to:

*A small process which will redirect the required pages to a SSL version of the page.*

To make use of it, take into account though that your webserver / webhost will need to support SSL and it should be configured for your site.
> 1 votes

---
Tags: webforms, ssl
---


# Question
Title: adding media content to a Drupal Commons Group page header?
I've been playing with Drupal for a bit, and have gotten used to the idea of Content and fields. I am now trying to use Drupal Commons 7 to up my game some and improve how my site looks. Im a bit stumped however on how I can edit the look of my Group page. Id like to add a big image at the top, before the group content. I *think* this is done using panelizer but Im not sure.

First is this right? Second, if so, where can I look for getting started tutorial type stuff that explains panelizer and how it works with the underlying field system? Do I have to add a field to content somewhere? If so, what and where?

Thanks

# Answer
> 0 votes
I solved it by enabling the Media component and then adding its widget in the CKEditor configuration.

---
Tags: panels, 7
---


# Question
Title: Need to redirect the homepage to a different url but keep the site live and accessible
A website built in drupal now client has come back and said the url needs to direct to another address. We want to keep the site up and working for various reasons so how do I go about doing this?

1. homepage needs to redirect to another site
2. the existing website homepage needs to be moved to a different page /main or /homepage and accessible only thru the direct link

how do I do this?

# Answer
> 2 votes
They are many solution to redirect from the page.

1. If you are using Apache you can use **.htaccess** to redirect the front page to a different website. This would be the faster due that is on the server level. Here is more information about redirects on Apache.
2. If you are using Nginix here are some instructions
3. Another option would be doing it on the theme level. If have access to the theme you can write sites/all/themes/YOURTHEME/page.tpl.php.

```
<?php
   if(drupal_is_front_page()) {
     header("location: http://www.RedirectPage.com");
     exit;
   }
?>

```
4. If you dont have access to the theme or to the server. The easiest way to have a redirect is by using the meta tag. You can add a block to the front page and add the following code.

```
     <meta http-equiv="refresh" content="10; url=http://www.RedirectPage.com/">

```

For more information about Redirect check this article.

# Answer
> 1 votes
Simplest way I could think to achieve this would be:

1. Create a directory inside the webroot with the name you wish your site to have `main` or `homepage`.
2. Copy the entire site inside this directory.
3. Change the value of `$base_url` in sites \> default \> settings.php if it is already set.
4. In the webroot create a index.php file and just enter the following code:

```
<?php
header('Location: http://www.example.com/');
exit;
?>

```

which will redirect the homepage of the current site to example.com

# Answer
> 0 votes
Go to your themes folder. i.e., sites/all/themes/YOURTHEME/page.tpl.php, Put this on top of the page.

```
<?php
if(drupal_is_front_page()) {
header("location: http://www.google.com");
exit;
}
?>

```

Or you looking for this or any else?

# Answer
> 0 votes
Redirect to another site using .htaccess redirect rule. About the home page to be show in another url, go and edit the node and simply change the url in the url alias.

# Answer
> 0 votes
Go to `admin/config/system/site-information` and set `front page address` to what you want.

---
Tags: uri
---


# Question
Title: May I use Bootstrap-CDN on Subtheme for production site?
Follow up of my other question with less files ;-)

As I don't need de less files on production site, could I then switch to BootstrapCDN for js files? Or would it overrule style.css too?

Thx for your support guys!!

# Answer
Yes you can use the BoostrapCDN for js and your own style.css. I'm not sure if would overwrite but if those you can create a separate file that is not style.css on the info file to add your CSS or your JavaScript.

If you are using the Bootstrap project by default it allow you to use the CDN.
> 0 votes

---
Tags: 7, cdn, theming
---


# Question
Title: drupal image field the image doesn't show?
My drupal site has a content type called Published which has a image field.When I migrate the site from Win2003 server to CentOS , all the Published node's image field doesn't show. It appears like this:

when I click the image name it shows in a now tab.

I had do some google,but no result . someone said the directory sitename/default/files should be set 777

but it is 777.

Any suggestions Thanks in advance.

# Answer
> 0 votes
Download raw drupal form drupal.org website, then copy `.htaccess` file from it to your root directory.

# Answer
> 0 votes
You should check if the **Public file system path** is correct on Drupal. If you go to admin/config/media/file-system and change the file path to the sites/default/files.

**Here Recommended Permissions for Drupal Files and Folders**

* sites/default 750
* sites/default/files (including sub folders & files) 755 or 770 *

---
Tags: entities, media
---


title: Trouble installing on localhost

text:
# Question
Title: Trouble installing on localhost
I am having trouble installing drupal on my localhost, using PHP Version 5.6.0-1, system Linux notosh 3.16-2-amd64 #1 SMP Debian 3.16.3-2 (2014-09-20) x86\_64 Installing standard 7.31, no distro. Upon completion cannot login as user1 with password to access admin interface.

# Answer
I just used drush to install on localhost and it solved all my problems. At present my PHP Version 5.6.4-1, it works fine.
> 0 votes

---
Tags: installation
---


# Question
Title: How to bulk install modules from local machine?
Is there a way to install multiple modules at one from a local machine?

I've seen quickupdate but that is not from a local install, and relied on FTP which I cannot use.

# Answer
This can be done quite simply.

1. Unzip and untar all the modules.
2. Copy them all into `apps\drupal\htdocs\sites\all\modules`.
3. Enable them on the modules page.
> 0 votes

# Answer
You can just put them in one zip file, and upload using Drupal UI just as if they were one. Drupal will store them together, in subdirectories just as you packed them. That's all, never been a problem for me.

Perfect example is, well, Examples project: http://ftp.drupal.org/files/projects/examples-7.x-1.x-dev.zip one zip, many functionally unrelated modules.
> 3 votes

# Answer
Use Drush.

```
drush dl x y z
drush en x y z

```
> 0 votes

---
Tags: installation
---


# Question
Title: Restrict editor user to only edit contents in one specific language
I'm trying to create a role for editors where one editor only has access to edit English contents and the other only has access to contents in another language.

I've been researching for quite a while, checked out Content Access too, but I haven't found any solution.

How can I make this happen?

Thank you!

# Answer
The answered Specified here would help you give-permission-to-translate-a-specific-language

After installing Translation Management Module,

> You can create users with their translation capabilities
>
> You can specify that a user can only translate from English to Spanish and another user can translate from English to French while creating the user

* Create a new user with *user role:* **Translator** (which is created when `tmgt module` is installed)
* Then Choose his/her Translation skills as shown below :
> 2 votes

# Answer
perhaps you may use the 7.x-dev version of this https://www.drupal.org/project/i18n\_access
> 1 votes

# Answer
You can replace or change the access callback for node edit forms using hook\_menu\_alter.

To make a permission that will show up in the permissions screen based on your available languages you would need a custom module with this hook in it:

```
/**
 * Implements hook_permission().
 */
function MODULENAME_permission(){

  //do something here to get an array of language names: $languages (I'm not familiar with i18n)

  foreach ($languages as $lang) {
    $permissions[$term->name] = array(
      'title' => t($lang->name), //Or wherever the langauge name is stored
      'description' => t('Edit content in '. $lang->name), //Again, adjust as needed
    );
  }

  return $permissions;
}

```

This will put a tick box in the permissions page under your module name for each language on the site. I'm going to assume language names don't change in which case this is safe to do.

Then you just need to use them to block access if the user is not allowed like this:

```
/**
 * Implements hook_node_access($node, $op, $account).
 */
function MODULENAME_node_access($node, $op, $account){

  //Get the language name for the node and store in variable $lang (again, I don't know how)

  //Then see if the user can do anything except view it
  if ($op != 'view'){
    if (!user_access($lang)){
      return NODE_ACCESS_DENY;
    }
  }

  return NODE_ACCESS_IGNORE;
}

```

Note, doing it this way, the role will need the 'edit nodes' permission AND the language based permission to edit any node.
> 0 votes

---
Tags: 7, users, i18n-l10n
---


# Question
Title: Only admin can see bulk operations in view
I have a view that includes bulk operations that involve flagging (Flag module) or unflagging nodes. I originally created this in Drupal 6 for another site and have been using it for several years. I recently re-created this in Drupal 7 whereby four different bulk operations can be carried out in a view on a specific type of node. This works flawlessly for administrative users. Authenticated users, however, cannot see the four "operations" buttons in the view I've created.

I've checked permissions everywhere, even "loosening" them to see if they were too tight. For example, I granted "Edit any node" permission to authenticated users, even though they shouldn't need that for the flag action. I've checked the view permissions, etc.

The operation calls a simple flag or unflag action and I'm unable to find any other permission(s) that might be impacting this. I'm hoping someone's going to jog my memory with something simple I've missed.

---

Edited to add: I have a similar view on the same site that allows users (through VBO) to send an email to multiple users. They're able to see the button for this functionality just fine. Again, leading me to believe this is a permissions issue.

# Answer
You need to install the sub module in VBO called **Actions Permissions**.

> ACTIONS PERMISSIONS
>
> A module called actions\_permissions is included in the package. This module generates a permission for each action, and VBO honors those permissions before showing or executing the corresponding actions. This is useful if you want to provide your VBO to several groups of users with different privileges: the same view will accommodate those different groups, showing to each the actions that they are permitted to see.

For your view make sure that you add the relationship to the flag

something like this (adjust as appropriate)

Afterwards navigate to the permissions screen, and enable **Execute Flag (or unflag) a node** for your roles

For your view of content you need to add the field **Bulk Operations: Content** (NOT bulk Operations:Flag').

And last but not least, make sure your flag permissions are set for your roles.
> 2 votes

---
Tags: 7, flags, views
---


title: Add labels to superfish sub-menu <ul>s

text:
# Question
Title: Add labels to superfish sub-menu <ul>s
Long story short, I'm building a Superfish menu structure that looks like the following:

https://i.stack.imgur.com/hXdaz.png

I'm using superfish & have everything in order except the labels on each of the sub-menus (GUIDES and BUSINESS STRATEGIES in the image)

How can one duplicate the parent link & add it to the sub-menu as a label above the links?

Ideally the strcture would look something like:

```
<ul>
  <li><a href="">Link 1</a></li>
  <li><a href="">Link 2</a></li>
  <ul>
    <span class="label">Link 2</span>
    <li><a href="">Link 3</a></li>
    <li><a href="">Link 4</a></li>
    <ul>
      <span class="label">Link 4</span>
      <li><a href="">Link 5</a></li>
      <li><a href="">Link 6</a></li>
    </ul>
  </ul>
</ul>

```

Thanks All, I'm stuck on this one, open to any & all solutions.

Edit: I should have specified that the labels need to be added automatically. I don't want to make the client add a bunch of duplicate labels by hand if I don't have to.

# Answer
> 0 votes
Take a look at the Special Menu Items module. What does it do?

*"Special menu items is a Drupal module that provides placeholder and separator menu items" ()*

A placeholder is defined as

*"A placeholder is a menu item which is not a link. It is useful with dynamic drop down menus where we want to have a parent menu item which is not linking to a page but just acting as a parent grouping some menu items below it." ()*

Which matches your description of 'labels' in your question.

---
Tags: routes, navigation
---