Here's the situation:

Anonymous users are allowed to submit a certain content type but they are NOT allowed to use the location module. However, I use the location module because I will be selecting longitudes/latitudes based on their submissions which will show up on a gmap as markers.

Here is the problem: I am using the location node feature (tried CCK but it still has some glitches). I can't seem to disable node entire location for anonymous users so I disabled the longitude/latitude feature for anonymous and I hid the country select as well as disabled all of the other elements.

As admin role, the longitude/latitude - map feature shows up for me. For anonymous, the only thing that shows up is an empty collapsible with the word 'Location' on top. This is basically what I want... BUT I need to find a way to get rid of this empty collapsible.

Is this a theming issue?

Comments

rooby’s picture

Status: Active » Fixed

The easiest way would be to form_alter the locations away.

So create a custom module with the following:

<?php
/**
 * Implementation of hook_form_alter().
 */
function mymodule_form_alter(&$form, &$form_state, $form_id) {
  // For all node add/edit forms.
  if (isset($form['type']['#value']) && $form['type']['#value'] . '_node_form' == $form_id) {
    global $user;
    // Remove the Location fields on the node edit form for anonymous users.
    if (!$user->uid) {
      if (isset($form['locations'])) {
        unset($form['locations']);
      }
    }
  }
}
?>

This might cause issues if you are using revisions and the anonymous users can save new revisions after the node has been created because the new revision will not get a location.

If this solution doesn't work for you feel free to reopen this.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.