texts:
I've got a vocabulary with 700 terms and Views term hierarchy weight field enabled (version 7.x-1.6). When adding or movind a term, it starts to recalculate depths for every term, and the "Computing the weight and depth of each term" screen takes more than 3 minutes in a site that is not in production. Vocabulary is not more than 3 levels deep. Drupal version is 7.44.

I disabled the VTHWF module for comparison, and the processing time for adding /moving terms was cut to a tenth, so I thought "great: disable it, move and create, and then re-enable it!"... BUT the missed terms' depths were not recalculated as the module was reenabled.

Any help possible?
thanks


texts:
I am using the default profile as a "user dashboard" I have a main navigation link that needs to link to the users profile so is there a way to insert a dynamic link based on the current user? I need to add something like

user/{$GLOBALS['user']->uid}

If there anyway of accomplishing something like this?


texts: Why do I get this error when I save my custom field?

texts:
I created a custom field and this is its formElement() method.

public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
  $value = isset($items[$delta]->value) ? $items[$delta]->value : '';
  $client = \Drupal::httpClient();
  $request = $client->get('http://localhost:8083/regionilist');
  $response = json_decode($request->getBody());

  $element += [
    '#type' => 'select',
    '#title' => $this->t('Select element'),
    '#options' => $response,
    //'#options' => [
    //  'Abruzzo' => $this->t('Abruzzo label'),
    //  'Lazio' => $this->t('Lazio label'),
    //  'Sicilia' => $this->t('Sicilia label'),
    //],
    '#suffix' => '

',
    '#attributes' => ['class' => ['edit-custom-field-widget']],
    '#attached' => [
      'library' => [
        'custom_field/my_js_custom_field',
      ],
    ],
  ];

  return ['value' => $element];
}

The Rest service output is this.

{
  "Abruzzo": "Abruzzo label",
  "Lazio": "Lazio label"
}

The output of json_decode() is the following one.

array (
  'Abruzzo' => 'Abruzzo label',
  'Lazio' => 'Lazio label',
)

When I add the field to a content type I get the following error.

  TypeError: Argument 1 passed to Drupal\Core\Form\OptGroup::flattenOptions() must be of the type array, object given, called in C:\xampp\htdocs\drupal8DPC\core\lib\Drupal\Core\Form\FormValidator.php on line 340 in Drupal\Core\Form\OptGroup::flattenOptions() (line 23 of core\lib\Drupal\Core\Form\OptGroup.php).
  Drupal\Core\Form\OptGroup::flattenOptions(Object) (Line: 340)
  Drupal\Core\Form\FormValidator->performRequiredValidation(Array, Object) (Line: 247)
   Drupal\Core\Form\FormValidator->doValidateForm(Array, Object) (Line: 239)
   Drupal\Core\Form\FormValidator->doValidateForm(Array, Object) (Line: 239)
   Drupal\Core\Form\FormValidator->doValidateForm(Array, Object) (Line: 239)
   Drupal\Core\Form\FormValidator->doValidateForm(Array, Object) (Line: 239)
   Drupal\Core\Form\FormValidator->doValidateForm(Array, Object, 'field_config_edit_form') (Line: 119)
  Drupal\Core\Form\FormValidator->validateForm('field_config_edit_form', Array, Object) (Line: 571)
  Drupal\Core\Form\FormBuilder->processForm('field_config_edit_form', Array, Object) (Line: 314)
  Drupal\Core\Form\FormBuilder->buildForm('field_config_edit_form', Object) (Line: 74)
  Drupal\Core\Controller\FormController->getContentResult(Object, Object) call_user_func_array(Array, Array) (Line: 123)
  Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber{closure}() (Line: 582)
  Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
  Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
  Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber{closure}() (Line: 151)
  Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
  Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
  Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
  Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
  Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
  Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
  Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 38)
  Drupal\webprofiler\StackMiddleware\WebprofilerMiddleware->handle(Object, 1, 1) (Line: 50)
  Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
  Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 664)
  Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Error does not occur when I use the fixed code (commented in the code above) instead of the REST service.


texts: How to modify HTML of specific node in Drupal 7?

texts:
I use Drupal 7 with Bootstrap Theme. I have many blocks placed on different nodes and HTML generated is as follows:

        [...]

    [...]

    [...]

    [...]

    [...]

I want to change that HTML for put some
 to enclosing some <sections>

Example:

      [...]

      [...]


texts: Paginate options in checkbox of a form field

texts:
I have a custom form with a field of type checkboxes,options for which I am getting from another function which takes an array as input, do some theming on options value and return options back to form,

Here is how my another function looks like

function mymodule_twitter_accounts_as_options($twitter_accounts) {
  $options = array();
  if (is_array($twitter_accounts)) {
    foreach ($twitter_accounts as $twitter_account) {
      $key = $twitter_account->twitter_id;
      $options[$key] = theme('image', array('path' => $twitter_account->profile_image_url)) . mymodule_twitter_account_basic_info_block1($twitter_account) . mymodule_twitter_account_basic_info_block2($twitter_account);
    }
  } return $options;
}

The array $twitter_accounts is coming from a database query, which is extending drupal pagination but I do not think the extended pagination will be helpful here as I need to show a global pagination for all the options rendered in the form later.

Edit:

The reason I am using a form is only because of the reason that once user checks checkboxes and submit the form, I am doing some operations using checkboxes key values, If there is an alternate to use of custom form that will be good too.


texts: Making certain content available to members of subspaces

texts:
maybe it should be pretty obvious, but I don't seem to be able to find a workaround.

I have a Space 'parent' and 2 Spaces 'child1' and 'child2'.
There are users that are members of 'parent' and then users members of 'child1' and 'child2'.
The parent space is set with inheritance towards the children.

I also have a content type 'acme'. I have a view that lists nodes of type 'acme' (current space and parent spaces). The view is placed (panelizer) in both spaces, 'child1' and 'child2',

When a user member of 'parent' visits one of the 'child' spaces, the view shows the 'acme' nodes created either in the parent of in the child space.

But when the user visiting the child is a member of the child, the view only displays the 'acme' nodes that where created (og_group_ref) in the child; but not the 'acme' nodes created (og_group_ref) in the parent.

What I need is the users members of 'child1' and 'child2' to be able to see all the 'acme' nodes created in 'child1' or 'child2', but also the ones created in the parent space.

Is there any obvious solution for that?

TIA!


texts:
My website has a bunch of nodes of content type member, and to each node is associated 0 or more other member nodes via a field field_big_brother_s_. How do I use graphviz to render this information into a graph. I don't need the graph to be dynamic, and it doesn't need to be rendered on-demand (since the database is only updated a few times a year).

I've tried to look into the Graphviz Filter module, but being someone new to Drupal, I have no idea how to use it or even whether it's still usable.


texts:
Somehow I can't get through the first Ajax lesson.

This is the code of a simple module that I put together:

function myajax_menu() {
  $items = array();

  $items['myajax/param/%'] = array(
    'page callback' => 'dynamic_products_ajax_callback',
    'page arguments' => array(1),
    'access arguments' => TRUE, // array('access dynamic_products content'),
    'type' => MENU_CALLBACK
  );

  return $items;
}

function myajax_ajax_callback($type = 'ajax', $param){
   if ($type == 'ajax') {
    $commands[] = ajax_command_html('#myajax_wrapper', '[Content returned for argument ' . $param . ' will be here]');
    $page = array('#type' => 'ajax', '#commands' => $commands);
    ajax_deliver($page);
  }  else {
    $output = t("This is some content delivered via a page load.");
    return $output;
  }
}

This is my markup.

drupal_add_library('system', 'drupal.ajax');

// Output a link
print l(t('AJAX 12'), 'myajax/param/12', array('attributes' => array('class' => array('use-ajax'))));
print l(t('AJAX 20'), 'myajax/param/20', array('attributes' => array('class' => array('use-ajax'))));
// Output a wrapper
print '

';
?>

All I'm getting is a JavaScript alert that informs me about AJAX error that occurred, and the result code is 200.

Is the example module missing anything?

Question revision:

After much googling I've come up with a very rudimentary working Ajax example that does what I want - it replaces HTML of a wrapper with a response obtained from a dynamic link. Hope it'll be of some help for newbies.

Module:

<?php
function myajax_menu() {
  $items = array();

  $items['myajax/param/nojs/%'] = array(
    'page callback' => 'myajax_ajax_callback',
    'page arguments' => array(2,3),
    'access arguments' => TRUE,
    'access callback' => TRUE,
    'type' => MENU_CALLBACK
  );

  $items['myajax/param/ajax/%'] = array(
    'delivery callback' => 'ajax_deliver',
  ) + $items['myajax/param/nojs/%'];

  return $items;
}

function myajax_ajax_callback($ajax, $param){
    $is_ajax = $ajax === 'ajax';

    drupal_add_library('system', 'drupal.ajax');

    if ($is_ajax) {
      $commands = array();
      $commands[] = ajax_command_html('#myajax_wrapper', "This is some content delivered via a page load with param " . $param . ".");

      return array(
        '#type' => 'ajax',
        '#commands' => $commands,
      );
    } else {
      drupal_set_message(t('JavaScript should be enabled to avoid page reloads.'));
      drupal_goto();
    }
}

The markup:

<?php
print l(t('AJAX 12 '), 'myajax/param/nojs/12', array('attributes' => array('class' => array('use-ajax'))));
print l(t('AJAX 20 '), 'myajax/param/nojs/20', array('attributes' => array('class' => array('use-ajax'))));
?>

The problem with disappearing admin_menu persists. If anyone could tell me why...


texts: Link manually uploaded file to files-private folder

texts: I have uploaded a large size folder via winscp to a external hosted server to the files-private folder in drupal. when i try to access the index file inside the folder in browser i get access denied. Is this because there is no entry in file_managed table ? however i could access the URL by doing same setup on a dev server without any issues.


texts:
Initially I implemented logic to show results summary inside the views template file

  realia-view-grid--apartments--listing-row-filtered.tpl

Since best practices is to implement it in the hook_preprocess_views_view, I moved the code there and simply print $summaryText inside the template which is coming from below pre process hook

function realia_preprocess_views_view(&$variables){
  //do nothing if not interested view-display
  if ($variables['display_id'] !=  'listing_row_filtered') return;

  $view = $variables['view'];

  isset($view->exposed_input['field_location_tid'])?$ltid = $view->exposed_input['field_location_tid']:$ltid = 'All';

  //force to all if landing directly
  $city = taxonomy_term_load($view->exposed_input['field_city_tr_tid'])->name;
  $locationName = $ltid == 'All'?'':' in ' . taxonomy_term_load($view->exposed_input['field_location_tid'])->name;
  $resultText = "Properties in $city: Your search criteria matched $view->total_rows properties$locationName";
  $variables['summaryText'] = $resultText;

}

I am setting the variable $variables['summaryText'] in the hook and when I add dpm($variables) it is showing the variable also but its not being passed to template file.

What am I missing here?


texts: I'm trying to setup a gallery where users can comment under each image. What is the best way to do this? Thank you.


texts: Add Taxonomy Term automatically based on term from user's account

texts:
I have a vocab called "state of residence" with states in the form of TN, MS, AL, etc. Each user account has one of these references to show the state of residence. I can also place this taxonomy field on a forum post. But how can I make the post pull the "state of residence" term from the account of the user who has created it? I don't want the user to have to choose. I want the choice to be made automatically based on the user's account.

Or is there a better way than a vocab. Basically, I am trying to allow content to be sorted by the geography of the user who created the post. and I don't want the user to have to make the choice.


texts: Getting nodes related to a taxonomy term selecting from a drop down into another drop down

texts:
I have a taxonomy drop down in a content type. Now when I select a particular taxonomy I want to show all nodes related to that taxonomy in another select box.

How can I implement this? If I need to do using Ajax, how can I get all contents after selecting a taxonomy? I am new to Drupal. Is there any module available for this purpose?

Or Please tell me how to get all contents using taxonomy programmatically? I have also to sort via price in a particular content type itself.

I need to do this in Drupal 7.

Thanks


texts: After D8-rc1 install, homepage work but all other links gives a "page not found"

texts:
I upgraded my Xampp to version Xampp 5.6.12 since Drupal 8 need PHP to be 5.5.9 or better.
I checked out a couple of my Drupal 7 website under the htdocs dir.  They are working fine.

I installed clean drupal 8 in the same htdoc dir under "newd8" folder. I used instructions so that I don't do make any mistakes.

The installation is fine and the default homepage came up at "http://localhost/newd8" and admin login account is working.

BUT clicking on any of the admin menu items, I get "page not found" drupal error. for example, if I click on "people", it goes to the link "localhost/newd8/admin/people" but I get a "page not found"  page.

If I modify the URL to include index.php, thus "localhost/newd8/index.php/admin/people", it works.  I get the right page.

This seem to be for all the pages.  if I manually add "index.php" at the appropriate place, I get the required page.

I have modified the base URL in the  setting.php file then its css file is not loaded properly even home page layout is totally disturbed

What am I missing?


texts: Unknown top and bottom padding in panels

texts:
I'm using the panels module in drupal 7. I'm having some problem with the css in panels. I've removed the top and bottom padding in my custom css but there still appears to be some padding. How can I remove it?
I have give the id "leftpane" and made the following CSS

#leftpane {
    margin: 0px;
    padding:0px 20px;
    background:#17532E;
    border-radius:17px;
    float: left;
    }

How do I remove the unknown top and bottom padding?


texts:
I am trying to find a way of altering the output of a hook_field_insert. In my exact example, I'm trying to hook into the link_field_insert hook, in the Link module:

/**
* Implements hook_field_insert().
*/
function link_field_insert($entity_type, $entity, $field, $instance, $langcode, &$items) {
  foreach ($items as $delta => $value) {
    _link_process($items[$delta], $delta, $field, $entity);
  }
}

and make a modification to the _link_process function, without actually having to hack the Link module. Is thi possible?

Just to have some background, what my end goal is to add a new form field on the node page for the user to enter link classes, and these classes would be autmatically applied to the link. I have already overridden the theme_link_field to add this form field and its value shows up in the $items array in the above function, so I just need to know how to override the above function.


texts: Content Aware Caching for Commerce Related Views

texts:
Views Content Cache Project Page reads

  This module implements a views cache plugin that is aware of content
  and can provide caching for views, until the content in those views
  changes.

Do we have an equivalent for Drupal Commerce. So that when I have a view listing of Commerce Orders or Products, I can provide caching until the content(orders or products) in those views changes.


texts:
I have many field for my custom module.

And output:

    if($slides->rowCount() > 0 ){
        $output .= '
';
        foreach($slides as $sld):
            $nd = node_load($sld->nid);
            if(count($nd->field_simage) >  0){
                $img_url = image_style_url('img_960x378',$nd->field_simage['und'][0]['uri']);
            }
            $output .= '
title.'" />
';
        endforeach;
        $output .= '
';
    }

    return $output;
}

Content type has url field. It's name field_surl When users insert a link to this field, must wrap this link to my output.

I tried this but not working:

$output .= '
title.'" />
';

Result of this output:

...

How can I fix it?


texts: How to load a view's ajax when the view is programmatically loaded

texts:
I am embedding a (calendar) view withing another view by using the following code (in a theme)..

        <div class="calendar-calendar">
          <?php echo views_embed_view('event_calendar', 'year_plan'); ?>
        </div>

The calendar itself is loading perfectly, however, it does have "Prev" and "Next" year links, which increment the year.  When you click on them, they navigate to a new page, with JUST this calendar view displayed.

I'd like them to navigate the years using the ajax it uses when I load the view without embedding.   Is it possible to load the ajax associated with these navigation links programmatically?


texts: Is it possible for a site owner's user account to **ever** have a permissions issue?

texts:
I continually read posts like this:

  This may sound dumb, but have you set the proper permissions to use it? I spent a good two hours trying to figure out what I was doing wrong before realizing I hadn't checked the '[whatever]' box.

As a Han-Solo of D-developers, I never think of permissions, but at desperate moments when Views repeats the same imperious error, doubt creeps in. Could it be permissions?


texts: Restrict access to admin pages by IP from .htaccess

texts: I am trying to lock down a Drupal 7 site so that only users on a certain range of IPs can login. I tried using the Restrict IP module to block the /user and ?q=user routes but this did not work. Is there a way to do this with .htaccess and if so can someone point me in the right direction please?


texts:
I have a custom field that is an entity reference, when using

  print render($content['field_call_to_action_1']);

in a content type template it prints out the title Call to Action 1, and the Title of the content that the entity reference is linked too.

How can I just get it to print out the NID instead?

Thanks for your time!


texts: How do I expose a variable to html.html.twig?

texts: I want to add different css styles to my edit/create pages. The easiest way I can think to do that would be to add 'edit/create' classes to the body tag when the node is being edited or created by adding them to html.html.twig. hook_node_access() has the variable $op which defines the current operation, so the question is how do I expose that variable to my html.html.twig template so I can add the classes only when update/create?


texts: Create referenced node on the fly in Drupal 7?

texts:
I have a node called "house" which references another node called "room". When I create a house, i.e. go to node/add/house, there will be a block where I can choose all the rooms I've created. What I want instead is to create the room on the fly, right on that page, and then reference it automatically. So basically, next to where you can choose rooms, you must be able to click a button that says "create new" and then ajaxically it must then open a an area on the page where you can create room.

Does that make sense? Is there a way to do this? I have the entity reference part of things setup, but before I look into trying to figure out which hook to plug into, perhaps someone knows of an inherent way that already uses entity?


texts:
I currently cannot access http://example.com/admin/reports/dblog as I cannot authenticate as an admin as my page is getting a 500 error.

I wonder if there is an actual location on my production server where Drupal errors are logged.


texts: How to get all rows from a database table?

texts:
I have the table where I store uid column. I want to get all the values from that table, but I only get the frist element.

My query:

$sql = db_select('voting_nomination_counter', 'v')
->fields('v', array('uid'))
->execute()
->fetchAssoc();

Where is my problem?


texts: Setting custom permissions in a view on a per-display basis

texts:
Context

D7
Views (latest version as of this writing 2017-02)

Scenario

SingerRegarn has a D7 view with five displays, where the access control on each display is set to:

Access:Permission | View published content

SingerRegarn creates another display, but she wants access control to be set to:

Access:Permission | Administer users

SingerRegarn configures the permissions for the newly created display, using the setting:

For: This page (override)

SingerRegarn then saves the newly created display.

Problem

After saving the newly created display, the permissions for the newly created display do not differ from the other displays, as desired.

Question

Is there a bug-fix or workaround to prevent this unexpected behavior?

See also

https://www.drupal.org/node/1174588
https://www.drupal.org/node/1380402
In Drupal 7 Views how do you set permissions via roles for an attachment display?


texts:
Is it possible to import blog posts from POP/IMAP?

I found two modules Mailhandler and Inmail, but can not make them work together. Both are in dev-state and Mailhandler and it seems that no new commits were added for some time (since summer 2016).

Maybe there are other modules for implementing this functionality?


texts: BigPipe messing up JS, is there a BigPipe ready() equivalent function?

texts:
I'm experimenting with BigPipe on D8 and it seems that the regular jQuery $(document).ready() function fires before the BigPipe has finished loading all the elements causing quite a few difficulties.

For instance I have buttons with activation trigger element ID's which are loaded into a variable, but the trigger elements don't seem to get loaded by the time JS runs and they aren't present yet,breaking the functionality.

Is there a simpler workaround than rewriting all the JS libraries I'm using, that rely on the ready() function? Maybe something BigPipe specific solution I haven't found yet?


texts:
I have searched through all the questions, but I can't seem to find the information, I need. Accept my apology, if this has already been covered.

On a site for a law firm, I have a content type, called "People" (not the same as User) with multiple fields containing information about each individual.
I want to display part of a node in a page view, and other parts (such as image, contact details etc) in a block view. The page and the block view has to be related, obviously.
I can only find answers on how to relate nodes/files with each other. Not just from a single node.

I cannot get my head around how to filter it, and how to use the contextual filter function. I understand as much, that the context must be with the NID. I just need a 1,2,3 ...

Drupal version 7.22, Views 3

I'll appreciate any help, thanks

Christian

EDIT: OK, it's solved. And in the end, it wasn't as complicated. Thanks to Rémy, to steer me in the right direction just using normal node (no need for a Page view here)

Here's what I found:

1) No need to fiddle with PHP templates here. Under Content type, just decide which fields, you want to see on your page. Make the others hidden.

2) In Views, create a block view (in this case), under Advanced - Contextual filters, select Content: NID, select Provide default value - Content ID from URL.

The main source of confusion for me was I 'wanted' it to rely on alias in the path. It doesn't. Views isn't checking for that at all, but only for actual node ID - e.g. 108, 109 ...


texts: OpenLayers Locator proximity search(content) and map display within tab

texts:
I got correct result when i based on  search with mile and distance.

Output displayed openlayer content views and map .

I need to displayed result like tab view that List and Map both are tab titles

 Click list -> displayed  ** Content **
 Click Map  -> displayed  ** Map **


texts: taxonomy with image field is not translating

texts:
I have a taxonomy term with an image field in it.

The problem is when I try to translate the taxonomy term and choose an image, the term is not translated and the language is set back to Language Neutral on save action.

Here is the message who came up when I hit the save button

Created new term testtttttt.
You are not authorized to access this page.

It's only happened when I fill the Image field, otherwise the taxonomy is translated correctly.

It's seem to be a new bug in drupal
https://www.drupal.org/node/2227181

Thanks


texts: Batch operations: callback_batch_operation() not invoked

texts:
I have a batch process where the callback_batch_operation() functions are never called, as showed when logging with some Devel dd() calls.

Here is the involved code fundamental parts (all this in the same multilang.admin.inc file):

function multilang_default_form_submit($form, &$form_state) {
  $operations = array();
  if ($categories = $form_state['values']['default']) {
    foreach ($categories as $category) {
      if ($category) {
        $operations[] = array('multilang_default_process', $category);
      }
    }
  }
  $batch = array(
    'title' => '...',
    'init_message' => '...',
    'operations' => $operations,
    'finished' => 'multilang_default_finished',
    'file' => drupal_get_path('module', 'multilang') . '/multilang.admin.inc',
  );
  dd($batch, '$batch'); ## log
  batch_set($batch);
}

function multilang_default_process($category, &$context) {
  dd(func_get_args(), 'default_process'); ## log
  // ...do the desired job...
}

function multilang_default_finished($success, $results, $operations) {
  dd(func_get_args(), 'multilang_default_finished() args'); ## log
  // ...send appropriate messages...
}

And here is the log result, in a case where only one operation was required:

$batch: Array
(
    [title] => Resetting Multilang configuration
    [operations] => Array
        (
            [0] => Array
                (
                    [0] => multilang_default_process
                    [1] => multilang_exclude_paths
                )

        )
    [finished] => multilang_default_finished
    [file] => sites/all/modules/multilang/multilang.admin.inc
)

default_finished: Array
(
    [0] => 1
    [1] => Array
        (
        )
    [2] => Array
        (
        )
    [3] => 0 sec
)

The above log shows that the multilang_default_process() function is not called, though correctly stated as callback_batch_operation in $batch.

Obviously the first suspicion after the function's correct spelling, goes to its localization through the file index in $batch.
But not only I multiple checked it, but also we can notice that the default_finished() function gets called, while it is localized through the same file index.
This is also ensured by the fact that, if I intentionally set file to another, incorrect value, then the default_finished() function is not called.

Another puzzling thing (at least at my eyes) is the default_finished() passed arguments: despite no callback_batch_operation was called, $success (index 0) is set to TRUE and (remaining to process) $operations (index 2) is empty.

Am I missing (like it happens too often :-) something stupidly obvious...?


texts:
I am having difficulties to filter data with views. I have made several video lessons on a subject and managed to display on the side of each video all other related videos in a block.
However i wish to see displayed in this block all related AND Previous videos.

I created a field called "order" (integer) in my content type, and i wonder how i can add a filter to make sure that the related videos have an "order" value lower than the "order" value of the video being displayed.

I 'd be greateful if anybody could help me with that.


texts: Programmatically make a proximity search with Solr

texts:
I'm using Search Api Solr to do programmatic searches with the following example code. How can I include a proximity search with this approach? I've installed Search API Location - I'm looking through the code to see how it's done but I'm not seeing it.

I'm using geofield and the latlng is being indexed correctly by Solr and I can make a direct filter with it, but need proximity.

Any help would be great!

Current code:

$index = search_api_index_load('solr_index');
$query = $index->query();
$query->keys('My search term');

$filter = $query->createFilter('OR');
$filter->condition('field_my_field', 'value');
$query->filter($filter);
$results = $query->execute();


texts: how to propose when editing content 2 possible media style for an image field?

texts:
My content type has an image field.
I'd like to propose to the editor two possible displays for that uploaded image, either 100% width or 50% width
How can i achieve that?

EDIT:
i found out this module :
https://www.drupal.org/project/field_image_style
Is this module stable enough?

How can I make this behavior compatible with the field formatter from colorbox module?


texts: drupal_http_request with basic authorization receives 401 response

texts:
I am trying to use drupal_http_request to connect to a remote rest-based webservice that uses http basic authorization. The following curl command works every time from a command line, and I'm trying to figure out how to do the same the "drupal 7 way".

    curl 'https://XXXXXXXX/login' -H 'Authorization: Basic XXXXXXXX==' \
      -H 'Content-Type: application/x-www-form-urlencoded' \
      --data 'username=XXXXXXXX&password=XXXXXXXX'

Here is the code I am using in Drupal

    class XXXXXX {
      function login($username='', $password='') {
        // construct url - returns https://XXXXXXXX/login
        $url = $this->constructLoginUrl();

        $data = array(
          'username' => $username,
          'password' => $password
        );

        $headers = array(
          'Authorization' => "Basic XXXXXXXX==",
          'Content-Type'  => "application/x-www-form-urlencoded"
        );

        $response = drupal_http_request( $url, $headers, 'POST', http_build_query( $data )

        return $response;
      }
    }

When I run the curl request, I get a json_encoded response. When I run the second bit of code, I get a 401 unauthorized error from the other server. So, my intent is to make the Drupal request work exactly the same as the curl request above. Is there something I should be doing differently?


texts: Required taxonomy term fields for node publishing?

texts:
I want to create content which has shared some aspects. I am doing this through a taxonomy reference. The taxonomy has certain fields that describe each piece of content (in my case used cars).

In my workflow, I only want the content published if the taxonomy term reference has all its fields filled out. How can I automate this workflow?


texts: Is is possible to access views from a module file?

texts:
I have created a view in drupal. My question is, is it possible to access the contents of the view or value stored in the view from the module file..
Need any details or code plss comment.


texts:
Given the following code:

function hook_search_execute($keys = NULL, $conditions = NULL) {
  // Build matching conditions
  $query = db_select('search_index', 'i', array('target' => 'slave'))->extend('SearchQuery')->extend('PagerDefault');
  $query->join('node', 'n', 'n.nid = i.sid');
  $query
    ->condition('n.status', 1)
    ->addTag('node_access')
    ->searchExpression($keys, 'node');

  // Insert special keywords.
  $query->setOption('type', 'n.type');
  $query->setOption('language', 'n.language');
  if ($query->setOption('term', 'ti.tid')) {
    $query->join('taxonomy_index', 'ti', 'n.nid = ti.nid');
  }
  // Only continue if the first pass query matches.
  if (!$query->executeFirstPass()) {
    return array();
  }

  // Add the ranking expressions.
  _node_rankings($query);

  // Load results.
  $find = $query
    ->limit(10)
    ->execute();
  $results = array();
  foreach ($find as $item) {
    // Build the node body.
    $node = node_load($item->sid);
    node_build_content($node, 'search_result');
    $node->body = drupal_render($node->content);

    // Fetch comments for snippet.
    $node->rendered .= ' ' . module_invoke('comment', 'node_update_index', $node);
    // Fetch terms for snippet.
    $node->rendered .= ' ' . module_invoke('taxonomy', 'node_update_index', $node);

    $extra = module_invoke_all('node_search_result', $node);

    $results[] = array(
      'link' => url('node/' . $item->sid, array('absolute' => TRUE)),
      'type' => check_plain(node_type_get_name($node)),
      'title' => $node->title,
      'user' => theme('username', array('account' => $node)),
      'date' => $node->changed,
      'node' => $node,
      'extra' => $extra,
      'score' => $item->calculated_score,
      'snippet' => search_excerpt($keys, $node->body),
    );
  }
  return $results;
}

Where does $node->rendered come from? Where is it defined and what does it contain?


texts:
How do I change a data type for a field in a table?

To change the field name we can use db_change_field().


texts: node permission based on a cck user reference field

texts:
I have a cck user reference field in a content type in drupal 6. I want only the user selected by that field can view the node content.

How can I achieve this?


texts: With optimized js enabled, my javascript code not working

texts:
I have a drop down list. On the change event of the drop down list I have written some javascript code. When I select an option from the drop down list a site opens in the new window.

So for this I wrote some javascript code on the change event of the drop down list.

But the problem is that when I enable the optimize js files then my drop down change event does not work and when I disable the optimize js files then the change event of the drop down works.

So what should I do for this to work in both condition?

UPDATED:

Drupal.behaviors.change = function (context) {

    $(".test").change(function(){
        var page = $(".test").val();
        window.open(''+page+'', '_blank');
    }) ;

};


texts:
I have a Drupal 7 installation that, for the purposes of this question, has just the core modules.

Using the Structure->Menus->Main Menu form, I added some items to the menu and, using a Mytheme_links__system_main_menu($main_menu) in the template file, dumped the menu items using print_r, just to check what is being passed through.

So far so good.

Now, in the Structure->Menus->Main Menu form, I add some child items beneath one of the top level items by dragging these items to the right one space under the parent. Then I clicked "Show as expanded" on the parent item and saved the configuration.

When I dump the $main_menu variable again, only the parent items are shown. The child items are never shown.

Can anyone help me understand how to ensure that the child items are rendered to the $main_menu array?

I don't really want to add pre-themed menu modules as there is a very simple but very specific layout that I need to achieve. Can the default Drupal menu module handle sub-menu items?


texts: Display the URL of where the content is located in my search results

texts:
I'm using SOLR search/search API on my Drupal 8 site and I've set the view to display the following two fields:

Content datasource: Title (The title & link to the page)
Search: Excerpt (Highlighted text of the searched keywords found on the page)

I would also like to display the URL of the page that the content is located below those two fields. However, there is no URL field to add. I've also tried to get just the URL from the 'Title' field, but can't seem to get it from there either.

Below is an example of what I'm trying to achieve.

Would anyone have any ideas as to how to add that at all?


texts: How can I assign pages to templates like in WordPress?

texts:
I've just made the jump from WordPress to Drupal, and though I love what I'm seeing there's a basic piece of functionality that's obvious in WordPress but is escaping me in Drupal- How does one, for a given page or piece of content, assign it to a specific template?

Please note that I'm not trying to design a template for a specific content type, rather I want the ability to choose a template at the individual content/node level, in the edit screen.

It doesn't look like this is part of out-of-the-box Drupal, so does anyone have suggestions as to how to go about implementing it?


texts: How to change the look of second article at front page

texts:
I generate articles with the help of VIEWS at front-page. But I want that the second article has a different look. So I want to add div-Tags and additional css-classes to that second article.
I have tried to do this with a boolean field but the teaser does not have the possibility to check whether boolean field is true or false.
Any idea how I can realize it??


texts: SQL query copied from views, does not work in Phpmyadmin

texts:
I created a simple view filtered by a specific day( I will switch this out for a variable when I use this on the website). The field is a CCK date field. The view works great. The SQL it generates is as follows: It just prints a list of titles from published nodes on a specific date (cck date field, not node date)

SELECT node.nid AS nid,
node.title AS node_title
FROM node node
LEFT JOIN content_field_event_date_time node_data_field_event_date_time ON node.vid = node_data_field_event_date_time.vid
WHERE (node.status = 1) AND(DATE_FORMAT(ADDTIME(FROM_UNIXTIME(node_data_field_event_date_time.field_event_date_time_value), SEC_TO_TIME(-25200)), '%Y-%m-%%d') = '2012-08-21')

I took this query and pasted it into the Query box in Phpmyadmin and it returns 0 rows. If I remove this part:

AND(DATE_FORMAT(ADDTIME(FROM_UNIXTIME(node_data_field_event_date_time.field_event_date_time_    value), SEC_TO_TIME(-25200)), '%Y-%m-%%d') = '2012-08-21')

and it returns all the rows excluding the date filtering (which is what I really need).

Eventually I want to do a count operation and use php to have this printed in a custom view field (or other places) to show the total events on a specific day.

Is there something specific I need to do with the formatting to make this query work in Phpmyadmin like it does in views? Or is something else wrong?


texts: Customize the HTML of a link field from a custom theme

texts:
I've a Link field named field_home_link, attached to a Content Type named Home, and I'm trying to customize how it is rendered as HTML from inside a custom theme.

Instead of the default generated HTML:

Link text

I need to render this HTML, adding custom CSS classes on it:

  Link text

But I would like to have most flexibility as possible on the rendered HTML, not only adding classes. For example I might need to add other attributes on the tag  or maybe also change the tag  with something else.

Would be enough having access to the link's properties (url and text) and arrange them in some custom HTML code.

How can I do this?

I tried to create a template for the link field:

field--field-home-link.html.twig

but inside this template I don't know how to access link's elements (url and text) and I'm stuck with this:

{% for item in items %}

  {{ item.content }}
{% endfor %}

Is there no way to do something like this?:

{% for item in items %}

    {{ item.content.text }}

{% endfor %}


texts:
You can use Views for search results by using "Search Keywords" as a Contextual Filter.

This works fine when you search using a single word. But when entering multiple words with spaces, you don't get the correct results (usually no results).

Any idea how to solve this huge problem?


texts: Create picture module responsive styles programmatically

texts: I could not find any documentation anywhere on how to programmatically create a new picture module responsive style set so am adding what I've discovered here.


texts:
I would like to create a content type that has some unique fields but its other fields are references to other existing nodes (not a parent-child relationship but many to many relationship).

I have looked in entity reference module or field collection? Is there another way of doing this?

For example I have a synthesis report made up of smaller topics. I want this report to have a name and author but then it needs to reference multiple of these smaller topics (which are a content type of their own).

I could maybe make a Taxonomy term for every synthesis report?


texts: How call a custom function after input got validated in hook_form_alter?

texts:
I want to call custom functions for doing some profile filed updation on user registration. So i used to implement my custom functions in hook_form_alter. The code is here

<?php
function calculation_form_alter(&$form, &$form_state, $form_id) {
switch ($form_id) {
case 'user_register':
$form['#validate'][1] = 'do_database_updation';
break;
}
return $form;
}

function do_database_updation($form, &$form_state){
/* perform database updation here... */
}

It works fine, but the problem is when the validation fails, the database updation cannot be retrieved back. I want to call the custom function after validate the input values. How it to do ?


texts: How create form elements in form theme hook

texts:
I have a custom module with a from, form submit handler and for theme hook

In some case I need to create multiple form elements (textfields for example with name like "user_input_1"-"user_input_n")

What I did is change $form array in form theme hook and render new elements. But these elements are missing in the post and form submit processing form (even if shown on a page). I realize what it might be not appropriate way of creating new form elements in theme hook OR maybe there is something(function) what will allow me to properly prepare new form elements in theme hook on a fly.

Or maybe there is another way as I know how many elements do I need in submit processing function which rebuild the form and doing something like $form_state['storage']['wizard_step'] = 'step3' (multi-step form). But I don't know drupal very well, just started..

Stuck and spend few hours trying to find appropriate way of solving this. Any help appreciated.
Thanks


texts: Set form elements of type 'container' to readonly

texts: I want to set some of the form elements readonly. The problem is, that they are saved as type=container. So i'm not able to just set #attributes to readonly=readonly, like i've done at another element.


texts:
I have a problem. I'm trying to attach file to node field by this code

function calculator_page_form_validate($form, &$form_state) {
$file = file_save_upload('file', array(
    // Validate extensions.
    'file_validate_extensions' => array(),
    ));
    // If the file passed validation:
    if ($file)
    {
            // Move the file into the Drupal file system.
            if ($file = file_move($file, 'public://cunning_files', FILE_EXISTS_RENAME)) {
            // Save the file for use in the submit handler.
            $form_state['storage']['file'] = $file;
        }
        else
        {
            form_set_error('file', t("Failed to write the uploaded file to the site's file folder."));
        }
    }
    else
    {
        form_set_error('file', t('No file was uploaded.'));
    }
}
function calculator_page_form_submit($form, &$form_state)
    {
        $file = $form_state['storage']['file'];
        // We are done with the file, remove it from storage.
        unset($form_state['storage']['file']);
        // Make the storage of the file permanent.
        $file->status = FILE_STATUS_PERMANENT;
        // Save file status.
        file_save($file);
        $file->display = 1;
        $file->description = "";
        // Set a response to the user.
        drupal_set_message(t('The form has been submitted and the image has been saved, filename: @filename.', array('@filename' => $file->filename)));
        global $user;
        $node = new stdClass();
        $node->title = $file->filename;
        $node->type = "file";
        //node_object_prepare($node); // Sets some defaults. Invokes hook_prepare() and hook_node_prepare().
        $node->language = LANGUAGE_NONE; // Or e.g. 'en' if locale is enabled
        $node->uid = $user->uid;
        $node->status = 1; //(1 or 0): published or not
        $node->promote = 0; //(1 or 0): promoted to front page
        $node->comment = 0; // 0 = comments disabled, 1 = read only, 2 = read/write
        // Term reference (taxonomy) field
        //$node->field_tag[$node->language][]['tag'] = $form_state['values']['tag'];
        add_terms_for_node($form_state['values']['tag'], &$node);
        $file->display = 1;
        $file->description = "";
        $node->field_file[$node->language][0] = (array)$file;
        // 'node' is default,
        // Other possible values are "user" and  "taxonomy_term"
        $node = node_submit($node); // Prepare node for saving
        node_save($node);
        //drupal_set_message( "Node with nid " . $node->nid . " saved!\n");
    }

What am i doing wrong? Thank you for help and sorry for my poor engrich it isn't my natural language.


texts:
How can I change the owner of an anonymously submitted node upon the initial node creation?

Goal:

Anonymous user completes form.
Node owner is changed to a specific user id.
Node is inserted into DB.

Can this be done with hook_form_FORM_ID_alter();


texts: How do I change the output of a database query from an integer to a string?

texts:
I'm working on a module that has a form that that submits to a database table and then queries that database to place that information in a table on another page. Everything works like I want with the exception of the 'country' entry which is a select box on the form and returns a numeric value (0,1,2, or 3). I would like to display in the table the text of the country instead of the numeric value. I have tried elseif statements and arrays and have been able to get the text string to display on the page but not replace the number in the table. I just learning to write modules and any insight would be greatly appreciated.

function drupalform_form1_submit($form, $form_state) {
  $d_id = db_insert('drupalform')
    ->fields(array(
      'name' => $form_state['values']['name'],
      'last_name' => $form_state['values']['last_name'],
      'email' => $form_state['values']['email'],
      'country' => $form_state['values']['country'],
    ))
    ->execute();
   drupal_set_message("Form has been submitted");
}

function drupalform_submissions() {
  $query = db_select('drupalform', 'df_list');
  $query
    ->fields('df_list', array('d_id', 'name', 'last_name', 'email', 'country'))
    ->range(0, 50)
    ->orderBy('df_list.d_id');
  $results = $query->execute();

  $header = array(t('ID'), t('First Name'), t('Last Name'), t('Email'), t('Country'));
  $rows = array();

  foreach ($results AS $result) {
    $rows[] = array(
      check_plain($result->d_id),
      check_plain($result->name),
      check_plain($result->last_name),
      check_plain($result->email),
      $result->country,
    );
  }

  return theme('table', array('header' => $header, 'rows' => $rows));
}


texts:
I can't create/update nodes, taxonomy, users, etc., with Drupal Services. I can log in, retrieve system connection info and log out. Also, I can retrieve a node, user (all details), taxonomy term, index, etc. I have read a lot of internet pages like this, and this, but It doesn't work for me. I have used firefox httprequester, firefox restclient, but nothing changed.

Thouse are the problems I have:

If I send a GET to http:< my path >/node  I get all nodes in json format. Good.
If I send a GET to http:< my_path >/node/23  I get Status 200 Ok but "[false]" returned. The same with .../23.json. But it I put the same url on a browser I get the node in json format.
If I send a GET to http:< my_path >/node?parameters[nid]=23 Then, I get the full json node.
If I send a POST to http:< my_path >/node with X-CSRF-token and with the json right data to create a page, I always get 404 error: could not find the controller.
If I send a PUT to http:< my_path >/node/23 with X-CSRF-token and with the body data to node[title]=Prueba, I get 401 unauthorized: Missing required argument entity (but I'm logued in as admin as system/connec.json said).

I have checked all items when I configured the resources page of the service configuration. I'm using Drupal Commerce Kickstart installation.

What could I do? Thanks.


texts: I'm using the jPlayer module with Drupal 7's built-in private files functionality and it's working nice and everything except that private files won't stream. They just get downloaded, which is kind of the opposite of what I want to happen. I want them to stream, not be easily downloaded in their entirety.


texts:
On a site I manage we have a view of recently updated products. The problem is that once a user purchases a product, that product is updated, which shoots it to the top of the list.

As far as I can tell there's no reason for a node update to be triggered simply because the product was purchased.

My first thought was the stock. However, uc_stock is directly calling db_query on uc_product_stock table and not touching node, or is it doing a node_load/node_save.

The closest I've found is that the update is triggering the nodeapi hook with the 'update' op. nodewords is picking it up as an update operation and I can see it in the dblog.

Any ideas?


texts: User registration form at a new menu path got error after submit

texts:
I'm creating an employee directory. I created a menu path which renders user registration form with profile fields.
When I submit the form, I got some unknown errors. I did fill out every fields in the form, but drupal shows "required" errors.

  Error
  The website encountered an unexpected error. Please try again later.

  Password field is required.
  You must enter a username.
  You must enter an e-mail address.
  Notice: Undefined index: array_parents in field_default_form_errors() (line 369 of
  D:\fakepath\testsite\modules\field\field.form.inc).
  Recoverable fatal error: Argument 2 passed to drupal_array_get_nested_value() must be an array, null given, called
  in D:\fakepath\testsite\modules\field\field.form.inc on line 369 and
  defined in drupal_array_get_nested_value() (line 6490 of
  D:\fakepath\testsite\includes\common.inc).

I have hook_form_alter in which some fields are made hidden.
Here is my code snippet in my custom module.

<?php
/*
 * Implementation of hook_menu()
 */
function mymodule_menu(){
    $items['employee/create'] = array(
        'title' => t('Create Directory'),
        'page callback' => 'drupal_get_form',
        'access callback' => 'mymodule_access_directory',
        'page arguments' => array('mymodule_employee_create_form'),
        'type' => MENU_NORMAL_ITEM,
        'weight' => 0,
    );
    return $items;
}
/*
 * Implementation of access callback for the menu
 */
function mymodule_access_directory(){
    global $user;
    # administrator can only access this
    if( in_array('administrator', $user->roles) ){
        return TRUE;
    }
    return FALSE;
}
/**
 * Home page which shows latest entered ten legs with cheapest tickets
 */
function mymodule_employee_create_form(){
    drupal_set_title('Create Employee Directory');
    return drupal_get_form('user_register_form');
}

/**
 * Implementation of hook_form_alter
 * Override form structure
*/
function mymodule_form_alter(&$form, &$form_state, $form_id) {

    if($form_id == 'user_register_form'){
        if($_GET['q'] == 'employee/create'){ # admin only can access this page
            # hide drupal default role selection; default role is employee
            $form['account']['roles']['#default_value'] = array(6);
            _mymodule_hide_elem($form, 'roles', 'account');
            # hide auto assign role selection; default role is employee
            $form['autoassignrole_user']['user_roles']['#default_value'] = 6;
            _mymodule_hide_elem($form, 'autoassignrole_user');
            # hide Status
            _mymodule_hide_elem($form, 'status', 'account');
            # hide Notify
            _mymodule_hide_elem($form, 'notify', 'account');

            # Change "Create new account" to "Create"
            $form['actions']['submit']['#value'] = 'Create';
        }

    }
}

function _mymodule_hide_elem(&$form, $name, $group=NULL){
    if($group){
        $form[$group][$name]['#prefix']     = '
';
        $form[$group][$name]['#suffix']     = '
';
        $form[$group][$name]['#required']   = FALSE;
    }else{
        $form[$name]['#prefix']     = '
';
        $form[$name]['#suffix']     = '
';
        $form[$name]['#required']   = FALSE;
    }
}
?>


texts: How to bulk change display mode in existing embedded media filter tags?

texts:
Background

I'm coming back to a site that was built (a) before media_wysiwyg_view_mode was added to the Media module stack, and (b) also before the site builder (gulp, that was me) fully understood how to utilise custom view modes for file entity types. Going forward, I now have a small set of custom view modes set up for image file entities, and I've restricted the media browser modal to use only these view modes. W00t!

Problem

However, there are about 500 legacy nodes with previously-embedded images, most of which have been embedded using one of the default view modes. I can't just reconfigure those old view modes specifically for my use case, though (image style, custom fields, markup overrides, etc.), since they're used by other parts of the system.

Does anyone have any hints as to how I might go about programmatically changing - and then re-rendering - the media tags in these old pieces of content? I'd like to replace any pre-existing view modes with one of the custom view modes I'm using now: em_img_caption.

Currently using:

D7.36
File Entity 7.x-2.0-beta1+26-dev (2015-Mar-31)
Media 7.x-2.0-alpha4+30-dev (2015-Mar-31) with the following enabled:
-- Media
-- Media WYSIWYG
-- Media WYSIWYG View Mode
Ckeditor Module 7.x-1.16+9-dev (2015-Apr-01) using Ckeditor 4.3.2


texts: Uploaded pdf file with multiple dots (.) in name are renamed for security reason

texts:
Authorized user gets an error each time when uploading a PDF with more than one dot in the name (other than the PDF extension, i.e this.is.an.example.10.pdf) but there are no disallowed extensions in the file name.

The error says "For security reasons, your upload has been renamed to..." (surprisingly the renamed file is the SAME as the original upload name!)
Since there are no exe php etc in the filename, why is this PDF being flagged? I searched for some time to no avail. Thanks!


texts: required modules to develop a ecommerce website

texts: I am beginning to create a new website which will serve as basically an Ecommerce website like display of products and sell products online and gift cards and all. Please let me know which are the module which i need basically and which are best suited for this.


texts: Filtering link associated with view based on permissions

texts:
I have a view, print a list of meetings. Using the 'custom text' option I added a link related to the meeting - 'clone meeting'. If the person has a particular permission for the meeting then I would like display the link, but only then.

I don't want to filter the whole record, so can't see a way using hook_views_pre_render(). I could regex the rendered content in hook_views_post_render(), but this seems error prone. How should the conditional link be added?

Drupal 7. Views 7.x-3.5.


texts: Add trailing slash to URLs when generating Sitemap with Simple XML sitemap

texts:
I am trying to generate Sitemap for my site using Simple XML Sitemap module. I have checked the Documentation for Extending the module features. Since I am newbie to Drupal 8, I am in confusion how to get this achieved. tried some hooks but failed it may be my lack of understanding regarding drupal8 module development. Can anyone help me to get this done. What are the namespaces I should add to my custom module.

Currently my URLs are generated like www.mysite.com/country/india but I want it to be like www.mysite.com/country/india/ since I use trailing slash with URLs.

I've used htaccess to add trailing slash to URLs with 301 redirect.


texts: preprocess views view field find view block name

texts:
I need the to find the block view name so I can add it to the if statement in hook_preprocess_views_view_field in Drupal 8. How would I do this? When I use kint($variables['field']) to find the variables Drupal explodes so I don't even know if the variables exists

/**
 * Implements hook_preprocess_views_view_field()
 *
 */
function mytheme_preprocess_views_view_field(&$variables) {
    //-- I need the to find the view name
    //-- so I can add it to the if statement
    if ($variables['field']->field == 'nid') {
    }
}


texts: How do I display real names instead of usernames for referenced users?

texts:
Here are the steps which I followed:

Added the user referenced field in the content type so one author can add multiple users who contributed in that content.
Using views i am showing the content and showing the users who contributed in this node.

My issue is that the view is showing the usernames of all the users. I want to convert those usernames to the Display name.


texts: How to use arguments of exposed page filters as contextual filter for block on that same page

texts:
I have a Views map page which correctly shows markers filtered by Destination and Category through exposed filter criteria of the kind:
/en/full-map?field_geographic_hierarchy_tid%5B%5D=18&field_location_type_tid%5B%5D=1

Under that map I want to place a block that uses the provided term-ID's (in bold) to create a LIST that shows the same selection as on the map.

My guess was to achieve that through "Contextual Filters" (block is same view as page).
I have tried several options under "configure contextual filter - when filter value is NOT available" but couldn't work it out.

How can I tell Contextual Filters to just read those term-ID's after the:

?field_geographic_hierarchy_tid%5B%5D=

and &field_location_type_tid%5B%5D= ??

Is this the right strategy or should Relationships be considered (as well)?


texts: How do you populate a multi-value field with a specific number of empty fields?

texts: How would you go about generating a specific number of empty fields inside of a multi-value field on page load? In my case this multi-value field is a simple text field, and I'll be passing a URL param to the form page with the number of empty fields it should display.


texts: Alter views limit using hook_views_query_alter

texts:
I've used display specified number of items for set limit in views.
I want to change limit and also display all items using hook_views_query_alter().
I've tried this:

function test_views_query_alter(&$view, &$query) {
  if ($view->name == 'sample') {
    $query->set_limit(20);
    //~ $view->set_items_per_page(20);
  }
}

But i've no luck. How to solve this?


texts: How can I present a screen that asks users to confirm their account details upon registration?

texts:
I have a site for which I would like to display a "confirm details" screen when users create an account.  Basically, I would like something similar to the "required preview" option for adding a node-- just for user registration instead.

I was unable to find a module to do this.  Any ideas?


texts: How to limit a user to one vote when using Fivestar?

texts:
In Drupal 7 I have enabled the fivestar module to allow users to vote in their comments. The results are tallied and give an average vote. Cool stuff.

Problem is a person can just keep voting over and over in each new comment or reply.

How do I limited a person to just one vote per node, via the comments. In other words, once they have voted, either the stars disappear, or the persons other vote is the default and cannot be edited?

Thanks


texts: Drupal Signup: how to signup to multiple events at once?

texts:
I've been looking all over the internet for this, but couldn't find anything about it. The thing is like this:

I am creating a Drupal 7 website for a training institute. On the website I am showing the trainings in a calendar with the Calendar, Views and Date modules (see also http://drupal.org/node/998334#part1 )

With the Signup module users can signup for a single training by leaving their name, address, etc. But I would like to make it possible to signup for multiple events at once. The available events should be listed on the signup page and can individually be checked. The user will then be signed up for all the selected events with only once filling in the form.

Does anybody know if there is a workaround for this?

Thanks in advance!


texts: IP Restricting admin pages with whitelist in custom module

texts:
This needs to be done within Drupal as my architecture does not allow for htaccess restriction.

I'm coming over from wordpress here so I've sort've Frankensteined this together from my wordpress code. Any thoughts or help on why this wouldn't be working?

Or maybe there is a much better way of doing this in code somewhere else? Or with some other function?

I'm on drupal 7.

function hook_init() {
if (path_is_admin(current_path()))
{
    // Whitelist
    $whitelist = array(
        'SOME IP ADDRESS',
    );

    // Check if current user IP is out of the whitelist, then redirect to home
    if(!in_array($_SERVER['REMOTE_ADDR'], $whitelist))
    {
        drupal_goto('frontpage', 302);
        drupal_exit();
    }
}
}


texts: How to access field values from an entity reference field in a custom module?

texts:
I'm making a custom payment module for Commerce that references a Credit Card entity. I have the entity reference form field in there and working but I cannot pass on the selected Credit Card entity to the "message" field. If I could just print whatever the title of the entity reference they select, that would work, or if I could access one of the 5 fields in the entity itself, that would be ideal.

Here is my module: http://pastebin.com/373WDAzA and this is the error message I get:

  Warning: htmlspecialchars() expects parameter 1 to be string, array given in check_plain() (line 1559 of C:\xampp\htdocs\includes\bootstrap.inc).


texts:
I am using Drupal 7 and I have a block view in my home page. This block view selects nodes from two different content types. Only the titles from these nodes are appearing in the block view. By clicking on these titles I want to redirect in two different pages, based on the content type each view node belongs.

e.g For the view node with title : "Meeting on 3th September", I want to redirect on ".../drupal/meetings" page,but for the view node with title "Announcement of program" I want to redirect on ".../drupal/news" page

What is the way for redirection from view nodes to different links according the content type of the view nodes?

Thank you.


texts: How to display add node form below the view in Drupal 6?

texts: I have a very similar functionality to stackoverflow - i.e. I have a a view that display question and below it there are answers (seperate nodes references). The user can comment on both the question and answers. Below it I would like to display a form that is used to add another answer by the user. This node will simply create an 'answer' node and display it above (just as stackoverflow) How can I add such a form below the view?


texts: I am showing content from product content type of commerce module using view but view is showing some repeated content.how to solve this problem.


texts: Which table contains all of the module permission data?

texts: I'm coming into an existing project and the previous developer totally messed up the site. There was a custom module made for a custom field and it shows up in the People > Permissions page. I cannot set this new entity type to Viewable by anonymous users via the gui interface. I would need to go into the database to make this change. Which tables do I need to look at to find this setting?


texts: How to prevent caching of field element data in custom field formatter?

texts:
I have a custom field formatter that performs dynamic calculations to determine the output. However, for anonymous user's the previous data is always stored until a cache clear is performed.

in the field formatter viewElements() function I have the $elements #cache max-age set to 0. I thought this would resolve the issue but it does not. Am I missing something?

 public function viewElements(FieldItemListInterface $items, $langcode) {

    $elements = [];

    foreach ($this->getEntitiesToView($items, $langcode) as $delta => $file) {
      // Check if gate cookie is set

      if (isset($_COOKIE['Drupal_visitor_resource_gate'])){

        //$tags = $file->getCacheTags();
        //Cache::invalidateTags($tags);
        $item = $file->_referringItem;

        $elements[$delta] = [
          '#theme' => 'file_link',
          '#file' => $file,
          '#description' => $this->getSetting('use_description_as_link_text') ? $item->description : NULL,
          '#cache' => [
            'max-age' => 0,
          ],
        ];

        // Pass field item attributes to the theme function.
        if (isset($item->_attributes)) {
          $elements[$delta] += ['#attributes' => []];
          $elements[$delta]['#attributes'] += $item->_attributes;
          // Unset field item attributes since they have been included in the
          // formatter output and should not be rendered in the field template.
          unset($item->_attributes);
        }
        $elements['#cache']['max-age'] = 0;
        return $elements;
      }else{
...
}


texts: Drupal prevents file save on chunked upload because of php.ini max upload size

texts:
I'm encountering a tricky problem with my custom file widget (which extends the core file widget).  It chunks files so that I don't have to raise upload_max_filesize and post_max_size in php.ini, and puts them together.  The problem is, even though the files now exist remotely (and have also been saved as file entities in Drupal) it refuses to save them into the field, because even though the file field's settings are set to 500 MB, php.ini's uploads are maxed at 20 MB.

The problem is in FileItem.php:

public function getUploadValidators() {
  $validators = array();
  $settings = $this->getSettings();

  // Cap the upload size according to the PHP limit.
  $max_filesize = Bytes::toInt(file_upload_max_size());
  if (!empty($settings['max_filesize'])) {
    $max_filesize = min($max_filesize, Bytes::toInt($settings['max_filesize']));
  }

  // There is always a file size limit due to the PHP server limit.
  $validators['file_validate_size'] = array($max_filesize);

  // Add the extension check if necessary.
  if (!empty($settings['file_extensions'])) {
    $validators['file_validate_extensions'] = array($settings['file_extensions']);
  }

  return $validators;
}

Which calls file_validate_size in file.module.  I've already tried using ini_set() to change the file size ini values, but that doesn't seem to work.

So, to recap:

Drupal has the file

My widget tells it to save the file by its fileID for the file field

Drupal tells me it won't save the file that it already has because of php file upload limits

Can anyone think of something I can do to get around this without modifying core?


texts:
I am trying to figure out a way to allow content editors to add menu items that link to Windows shared drive, example path:

file:///w:/documents/001.pdf

Any ideas how to best do this in Drupal 7?


texts: Drupal 8 customize duplicate view fields

texts:
I have view for taxonomy and it has default name field duplicated, one with link and the other without link.

I have changed the one without link by creating views-view-field--myviewname--name.html.twig template file and it is ok.

But I need to change the other one with link, with some classes and I want to keep the link but want to have custom text for the link. The views-view-field--myviewname--name.html.twig file only applies to the first one(the one without link). I want to customize other one(with link) differently. How to do that? Is there any naming convention? The debug comments does not suggest anything.


texts: Displaying grouped view of node comments in a view listing nodes

texts:
I've created a view that lists a number of nodes.  I've added the relationship of "comments on node" and then added the comments as a field in the view. The problem I'm having is that if there are multiple comments on the node, the view lists the node multiple times. For instance currently the view displays likes this

Node Title: Title 1
Nid: 1
Node Image: Image
Comment: Comment 1

Node Title: Title 1
Nid: 1
Node Image: Image
Comment: Comment 2

I would like it to be displayed like this;

Node Title: Title 1
Nid: 1
Node Image: Image
Comment: Comment 1
Comment: Comment 2

I know it has something to do with grouping, and that other similar posts have simply recommended grouping by the title field, but this does not achieve the desired results. Am I missing something?


texts: White screen of death when uploading a file attachment

texts:
I am currently experiencing a problem when adding file attachments to nodes in Drupal 6. When attaching a file and clicking the upload button, the screen goes white. I checked the files directory and the file does not appear there so it would seem it never gets uploaded. This problem occurs on the production server but not the test server. I have tried displaying php errors by modifying the index.php file but that does not display anything. I have the php memory set to 154MB but still no dice. I have Googled and searched this site but can't find a solution. Has anyone else experienced this problem? Can anyone provide some insight as to what the cause of this might be (and hopefully how to fix it)?

System setup

Ubuntu 10.4,
Apache,
PHP 5.3,
MySQL 5.1

Drupal 6.22,
CKK 6.x-2.9,
jQuery UI 6.x-1.5,
jQuery Update 6.x-2.0-alpha1,
plus a whole boatload of other modules (that may or may not be relevant).

Thanks for any possible insight into this.


texts: Why are my webform conditionals not always working?

texts:
We have 2 partially same webforms with conditional fields, opening a number of components depending on the selection with radio buttons. When logged on as administrator, both forms work fine. when logged on as simple user, only one webform all works fine, the other shows all components as it were designed.

We did recreate the conditionals already and the permissions are same on both forms.  Also no error message is generated in any way.
Anyone has similar problem or has ideas?


texts: Creating entity in Rules causes PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry

texts:
My application based on CRM-Core.
I am using several rules which launch on the event "After saving a new crm core contact" and each has a crm_core_activity entity created as the rule's action.

Is it possible that the rules happen simultaneously which causes SQL error - trying to set same activity_id (which is primary key)?

Here is the error:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '879' for key 'PRIMARY': INSERT INTO {crm_core_activity} (activity_id, revision_id, uid, type, title, created, changed, uuid) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7); Array ( [:db_insert_placeholder_0] => 879 [:db_insert_placeholder_1] => 1552 [:db_insert_placeholder_2] => 0 [:db_insert_placeholder_3] => email [:db_insert_placeholder_4] => תודה שפנית אלינו! [:db_insert_placeholder_5] => 1465830228 [:db_insert_placeholder_6] => 1465830228 [:db_insert_placeholder_7] => 4e87b796-fc8d-49f4-85f4-9ac944563576 ) in drupal_write_record() (line 7316 of /home/roi/sites/staging/0108-ormil/drupal-7.38/includes/common.inc).

The error happens randomly which makes me think this is a timing issue between multiple rules on the same trigger.


texts:
I'm looking for the most absolute basic way to create a custom theme.  By this I mean, what are the absolute bare minimum requirements for Drupal to run my theme.  So, basically, I guess what files does Drupal need and what settings absolutely need to be specified?  I tried looking at the Theming Guide over at drupal.org but I didn't find it to be very helpful.

Cheers.


texts:
In drupal 7, I created block in views and add field Global: Custom text, and write some text in this field.

When display this block and inspect show Global: Custom text in span tag.

How to display Global: Custom text but not in span tag.


texts:
I've assembled a content type with a Field Collection (image, text and link). I installed the Field Collection Views module and duplicated the view it came with. I added a block display to the view and in the Content Display set the name to the view machinename and the id to the block machine name.

It works fine on my node page but the block won't show up when I place it on the page. How do I go about getting it to render?


texts:
Has anyone else run into an accessibility issue when using the form API tableselect element ('#multiple' => FALSE)? The resulting markup is a table with the first column as an input of type radio, but no corresponding label.

Looking at the form_process_tableselect function, I see there is an if block with the following check:

if ($element['#multiple']) {

Within that block it does pull a title out of the options array:

if (!empty($element['#options'][$key]['title']['data']['#title'])) {
  $title = t('Update @title', array(
    '@title' => $element['#options'][$key]['title']['data']['#title'],
   ));
}

That only applies if #multiple is TRUE. In the else block it renders the radio column with no title at all:

$element[$key] = array(
  '#type' => 'radio',
  '#title' => '',
  '#return_value' => $key,
  '#default_value' => ($element['#default_value'] == $key) ? $key : NULL,
  '#attributes' => $element['#attributes'],
  '#parents' => $element['#parents'],
  '#id' => drupal_html_id('edit-' . implode('-', $parents_for_id)),
  '#ajax' => isset($element['#ajax']) ? $element['#ajax'] : NULL,
);

Am I missing something? Is Drupal core really missing such a basic accessibility feature? Any recommendations on working around this?


texts:
I have a view with exposed filter to a field as follows :

I want to change the text 'Deployment date from' and 'And' to 'From' and 'To'

Can i do this with hook_views_query_alter or hook_views_pre_render


texts:
I am able to retrieve taxonomy terms programmatically, (as long as I only want to reference the default fields, 'tid' and 'name'). But how do I access custom taxonomy fields?

$vid = 'MACHINE_NAME';
$terms = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadTree($vid);
foreach ($terms as $term) {
    $tid = $term->tid;
    $term_name = $term->name;

    // REFERENCE CUSTOM FIELD VALUES HERE...

}

I have tried all manor of ways I have seen, but can't get any of them working, eg:

$value = $term->FIELD_NAME->value;
$value = $term->get('FIELD_NAME')->getValue();

How do I reference custom taxonomy term fields by their machine name, from what is returned by getStorage('taxonomy_term')->loadTree($vid)?


texts:
I am stuck in the following situation:

I have the following structure for Shoes Store:

Men: which has under it specific categories;
Women: has the same categories like Men
Kids: has different categories.

I made a taxonomy tree as:
Vocabulary: Shoes

Shoes > Men > Categories

Shoes > Women > Categories

Shoes > Kids> Categories

But in this case I am stuck in filtering those taxonomy terms in my view. Any solution that suppose to work with this? or other taxonomy structure?

Best


texts: How do I alter the title of a menu link?

texts:
In my website, users can collect some 'points' over time. I have a top-bar menu with some links (e.g. "home", "profile", "logout"). I want to alter the menu item "profile" and add the number points owned by the current connected user.

I tried several hook, and I almost succeeded in getting what I wanted with hook_link_alter().

function mycustommodule_link_alter(&$variables) {
  if ($variables['text'] == "profile") {
    // Do some work.
    $variables['text'] = $variables['text'] . " (you have $nb_points points)";
  }
}

I cleared the cache (with drush cr), and the menu item shows the value I want. But, if the value changes for some reason, it shows the old value. I must clear the cache all the times to update its value.

How can I avoid cleaning the cache to update the menu title all the times the points gained from the user change?


texts: How do I assign a specific role to each newly registered user?

texts: Is it possible in Drupal 8 to assign a specific role to each newly registered user?


texts: How do I set a picture as a background image/wallpaper?

texts:
I've been trying to set a picture as a background image/wallpaper. I added the module 'Background Images' but am confused since it hasn't done anything. I tried pointing it to a new content type I created that has an image, but nothing happened. I installed Dynamic Background which did what I wanted to happen, but only for admin...

So without any access to the CSS files, is there a way to set a picture as a background wallpaper? I don't have access to the website's CSS, not even through FTP yet.

My knowledge on Drupal is very limited, so if you could have detailed explanations that would be great


texts:
we want the "message sent" message that comes out after you submit the sitewide contact form to come out in a popup instead of in a div on the front page.  How can I achieve that?

I have googled everywhere and asked questions on drupal.org but no one has answered me.


texts: There is this content type and it has a field (decimal). I want to apply a uniqueness validation on it (no two nodes with the same "National Code" value). Apparently Field Validation module is the way to go. How do I achieve this ?


texts: How to create pages with images in the content?

texts:
I'm trying to create a page with content that looks like this:

I'm using CKEditor to edit the content, and it allows me to add images to the article. However, the images need to be already present at some URL.

Is there a way I can upload an image (the image of the doctor with a pad) to my drupal site separately, and then use its URL to insert the image in my article?

In other words, how do I upload just an image to my drupal site so that it can be used elsewhere?


texts:
I am looking for days the PHP file which characterizes the Field label with the  tag.
From a certain number of  tags that SEO is technically quite counterproductive.

Can Someone show me how or where to
 Taxonomy Term:
in
 Taxonomy Term:
can change?

I found this solution, among other things, but nothing works.
Change a label element to an <h2>?...

Im using Commerce Kickstart 2.39 on AT-Commerce

Thank you very much


texts:
I have a year calendar view (loaded programmatically within the parent template) where the paging is done via ajax.

When I click on the navigation links (i.e 2013 / 2015) the template for the parent view is reloaded via ajax into a container div, by Drupal.  But this is undesirable as it resets things which could have dynamically changed.

Ideally I'd like just the child calendar view reloaded. However, I can live with the parent view being reloaded if I can determine (by looking at the arguments passed, or some other method) whether it's being loaded because of a click on the nav buttons.

So how can a template know it's being reloaded via ajax?  Preferably finding the "arguments" passed in the ajax call.

Or..  How can I make sure that JUST the child view is reloaded, not the parent.


texts: What is the equivalent of hook_menu_alter() to change a menu item type?

texts:
I want to change the menu type in Drupal 8. In Drupal 7 we can achieve this using hook_menu_alter

function module_menu_alter(&$items) {
  $items['admin/config/people/ip-blocking/default'] = array(
    'title' => 'Block IP Address',
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
}

Similarly I want to change the menu type in Drupal 8. How can I do it.
Thank You.


texts: form_get_errors() is NULL when calling it in an AJAX form callback

texts:
I have a form with a bunch of required fields that all have the same callback. Here's a single field example:

$form['name'] = array(
    '#type' => 'textfield',
    '#title' => t('Name'),
    '#required' => TRUE,
    '#ajax' => array(
      'callback' => 'callback_show_buttons',
      'wrapper' => 'formwrapper',
    ),
  );

formwrapper is a wrapper around the entire form:

$form['#prefix'] = '
';
$form['#suffix'] = '
';

Here's the callback, inspired by this guy's code:

function callback_show_buttons($form, &$form_state) {
    $allajaxchanges = array( '#type' => 'ajax', '#commands' => array() );

    if ( form_get_errors() ) {
        $form_state['rebuild'] = TRUE;
        $allajaxchanges['#commands'][] = ajax_command_replace( "#formwrapper", render($form) );
    }

 return $allajaxchanges;

If I inspect form_get_errors(), it is always NULL, no matter if I validate the form in code or not. drupal_get_messages() is also completely empty, and theme('status_messages') also has nothing in it (these solutions were suggested here). These methods do return something if I submit the form in a non-AJAX way.

Anyone have any idea how to check if a form has errors in it if these don't work?


texts: why is admin not bypassing restrictions at views?

texts:
I have a problem of admin not having full access to content nodes.
I wanted to create a view so that a user can see nodes he created and cannot see other users' nodes. However, 'admin' should be able to see all available nodes without any restricts, even if made.

My problem is that, when it comes to restricting the users to see only their nodes posted. Strangely the admin was included to see only his own posts as well!
(even though the settings where telling me that whatever setting I make, the admins will not be affected) but that doesn't seem to be the case.

Does any one have any idea or suggestion?

I have gone to permissions, and checked ALL values to be selected. I rebuild the permission. Yet, this is happening.

Just in case I thought some module might be interfering, I had NodeAccessdisabled and some other modules, but the result is the same! The admin is not getting a full view as supposed to when restricting!

Here's a screen shot of a user view and admin, currently as an admin (aziz here), this is what I see (3 nodes created by admin):

and those are the setting:

While on the other hand, when I created another view WITHOUT restrictions, it shows all nodes:

and here are the settings for it:

Anyone has any idea why the admin is included in restriction?

Let me know if you think there's anything wrong here. Because based on my other question is the post " how to view data row table related to user only?"
I was advised to follow these setting  (as in image, and the user who advised is working very well with him). But I think that there's something interfering with my admin role for not letting it bypass restrictions made (at least, even when I do restrict the view for users, admin shouldn't have been included).

My last hope in the admin restriction is creating 2 views for every content type, which is quite troublesome.

I hope I gave clear picture.


texts:
The Book and the Taxonomy modules are very similar for organising content in a hierarchy structure.

Both modules:

Allow Multi level hierarchies
Can be accessed by Views
All custom theming via node.tpl.php files
Offer the means for promoting or demoting content within a hierarchy, or moving it to another hierarchy

The Book module has the added advantage of creating navigation system (Although you could probably recreate this with taxonomy and Views).

My question is this: Which is the better to use for organising content in a hierarchical structure? Does one have any disadvantages or advantages over the other?

It seems odd to me that two similar modules exist in core. Why aren't they just combined into one?


texts: Views - Clicked element + corresponding content

texts:
I have a content type which contains the following fields

title
text body
image

An I need to achieve something like below

The 4-image grid is a view which covers 50% of the page. The green coloured box represents the clicked image. I need the text-area right next to the view to contain the the text corresponding to the image which is clicked.

Is it possible to achieve this using views alone?


texts:
I am a Drupal newbie using Drupal 7.

I made a taxonomy for documents, and then a view in the views module to list the documents. When the view searches by the taxonomy term, it seems to sort by the term's ID number, rather than the name of the term. I want an alpha sort on the term, not the ID number. Is there a setting to change this that I've missed, or do I need to do programming to change it? Seems like a pretty common situation.

ID   Name
1    Homeland Security
2    Criminal Justice
3    Violence Against Women

will sort as above, not with Criminal Justice first.


texts: Conditional Stylesheets Set-up: Using the Module

texts:
Problem

I'm trying to set-up conditional stylesheets. I've followed the instructions but it's still not registering. What have I done wrong?

Set-Up

I installed and enabled the conditional stylesheets module. I'm running a Tao sub-theme.

I then added the following lines to my theme.info file:

//these are my original stylesheets
stylesheets[all][] = reset.css
stylesheets[all][] = typography.css

//these are my conditional stylesheets
conditional-stylesheet [IE][all][] = styleie7.css
conditional-stylesheets [if !IE][all][] = style.css

I then cleared my cache and no style sheets were loaded.

At the moment I'm just trying to have one stylesheet for IE and one for everything else.

I took the syntax from the [link] in the conditional css directory.1

NOTE:

It's not clear whether you should put

conditional-stylesheet OR stylesheet-conditional

The documentation says one, a lot of posts suggest the other. However I can't get either of them to work.


texts: How do I get the router name from the internal path?

texts:
If I know the internal path of my page (e.g. 'node/1') how do I get the router name?

I need it it to generate an internal url:

$url = Url::fromRoute($router_name);

I found Url::getRouteName, but I'm not sure if this is what I need?

Thanks.


texts:
On a site there are some pages from a Content-type. Some of those pages (for the Belgium language only) need to be only accessible for Dokters.

So when you try to reach the URL of one of those pages you are redirected to a login-page.

But the role 'dokters' needs to have an extra login-field. Or only this field to login is even better if thats possible! It should be a field with 11 digits. Or if this is to complicated (Username, Password, 11-digit field).

How (which modules) are best practices to built this functionality?

UPDATE:

Now i managed to do a workaround with Content Access module. I made a role 'doctor'. And now only users with role 'doctor' can access those pages.

But is there something to do like when the Doctors visit those restricted pages they are redirected to a custom login-page. On this page you have a small form: Fill in your 11-digit code to access this page.

Because all doctors have their own 11-digit code. We don't have to send all doctors the username name and password for role 'doctor', instead they can access the content directly, with their 11-digit code! The only validation should be that the field contains 11 digits.

How do i manage this in the simplest/best way?


texts: Which permission do I need to give to see all open tasks in the Maestro taskconsole

texts:
It is unclear to me which permission I do need to give to a specific role, to see all open tasks in the Maestro taskconsole, just like an admin sees all tasks.

Thanks for your help


texts: Cant login to my sites on AWS but I CAN login with the same database on my local machine

texts:
I've loaded two different Drupal 7 sites on Amazon Web Services (AWS) Ubuntu instances. They both work fine and are configured mostly correctly.

The only problem is, I can't login to either site using my Drupal username/password combinations! (either site). I've double and triple checked my passwords/making sure CAPS LOCK isn't on, etc. I cleared cookies and even tried the permissions suggestion given in this article.

No matter what I do when I try to login to either site on AWS I get a silent login fail. No errors, the browser just reloads and prompts me to login again. I know the username/password work because on my local machine for both sites I can login easily using the same database.

Note: I, of course, imported the databases for both projects so they SHOULD have the same user data.

Anyone know what else I can try?


texts: How can I prevent composer from detaching a module's head?

texts:
How can I prevent composer from leaving a module's git status as a "detached head" when updating

Whenever I use composer to install or update one of my modules or themes, it downloads and overwrites the module's files into the expected directory but leaves the git status in a 'detached head' state and so subsequent development work is not staged to the expected commit until I reset the head ... which only takes a moment but ... I would prefer not to have to remember to do this each time.

Could it be the way I tag the commit of latest dev work? I git push the commit; git tag it; and git push --tags in the belief that git will not push tags and the commit simultaneously.

As an example:

A theme's complete composer.json on GitHub.

{
  "name": "iainhouston/pellucid_monoset",
  "description": "Drupal 8 Theme for pellucid_build",
  "type": "drupal-theme",
  "license": "GPL-2.0+",
  "keywords": ["pellucid", "php"],
  "homepage": "https://iainhouston.com",
  "minimum-stability": "dev",
  "authors": [
    {
      "name": "Iain Houston",
      "email": "iainhouston@mac.com"
    }
  ],
  "require": { }
}

The theme's entries extracted from the project's composer.json

"repositories": [{
    "type": "composer",
    "url": "https://packages.drupal.org/8"
    },
    ...
    {
    "type": "git",
    "url": "https://github.com/iainhouston/pellucid_monoset.git"
    },
    ...


texts:
I'm using the following code to display a (success) message, it's working quite nicely, however I want it to disappear after, lets say 3 seconds.

  $commands = array();
  $commands[] = ajax_command_html('.ajax_messages', ' message ');
  $page = array(
  '#type' => 'ajax',
  '#commands' => $commands,
  );

  ajax_deliver($page);

How can I achieve this?


texts:
I keep getting an error in a site I am trying to work on, which is base don another. The error is in a custom module, and the code line is

if (!function_exists('user_mail_tokens'))
{
    include_once(drupal_get_path('module', 'modulename').'/modulename_e.inc');
 }

As I said this is a copy of another site, which runs. grep shows that the file _e.inc doesn't exist in the other project, so I can only assume that the tokens are defined elsewhere. a Google search implies that the method is sttandard, so I don't want to create a new inf file that redefines it. So where should 'user_mail_tokens' be defined?


texts:
I'm having an issue with theming our node edit forms. We are converting a Drupal 6 theme to Drupal 7 and its causing a lot of problems.

In our template.php we have

function dupublic_theme($existing, $type, $theme, $path) {
    return array(
            'page_node_form' => array(
                    'arguments' => array('form' => NULL),
                    'template' => 'page-node-form',
                    'render_element' => 'form',
            ),
    );
}

This successfully points Drupal at 'page-node-form.tpl.php'

Our goal is to pull out some fields into labeled areas to make our editor's job easier. We had a more complex layout, but I've simplified it for the following example.
In page-node-form.tpl.php I have the following:

    <?php print drupal_render($form['title']);?>

    <?php print drupal_render_children($form); ?>

This, however, does not work. $form does not appear to exist, and dpm($form); displays as an empty array. We do not get any form fields at all - unless I remove everything from the tpl file, then I get some sort of default form display, which doesn't make sense. If the tpl file is empty no form should be displayed, but everything I am reading states that drupal_render($form['field']) and drupal_render_children($form) should work! They aren't!

This is what is rendered on page load:

<form class="node-form node-page-form" action="/node/5/edit" method="post" id="page-node-form" accept-charset="UTF-8" data-thmr="thmr_33">

</form>

As you can see, no form fields!


texts: How to fill checkout form fields with values from a previous custom form?

texts:
Basically I have a few landing pages with forms with fields that are a subset of the checkout page form fields. I'd like for the user to submit the form and be redirected to the checkout page with the form values already filled.

I'm using Übercart and I think it's this function here that controls it:

function uc_checkout_pane_delivery($op, &$arg1, $arg2) and the values of $arg1 needs the be set by the previous form. My question is how? What would be an appropriate method for populating the checkout form fields? Thanks.


texts: Search API Views - How to display facets on a views block?

texts:
I am using Search Api Views and Facet API to achieve that.

I am trying to enable facets to a views block, or when calling a view programmatically, but unfortunately they are not displayed as expected.

However facets are correctly displayed on the page created under views interface:

I tried to create a block via views interface, and then adding it through blocks, but the facets block doesn't appear.

Either if a try to print the view programmatically this way:

$view = views_get_view('news_search_api_');
$view->set_display('page');
$preview = $view->preview('page');
print $preview;

The facets are not loaded at all.


texts: Display Signup info in custom node template

texts:
I seek help on how to display the signup's module info in a custom node template.

I have created a node template for a specific content type, but by looking the variables inside $content I cannot seem to find something useful. There are several signup variables but not one "central" that can print the whole signup info. Plus the signup variables change whether the signups for the specific event are closed or open. I was hoping to be able to use something like print render($content['signup']) but that doesn't seem possible.

I have already asked help on the module's queue but without any luck. I have found several similar problems but some of the are really old versions and others refer on views integration.

Reference:

Node templates don't display Signup link
$node->signup_view available to view template
expose signup form to views
How to display the signup status of nodes in views templates?

I have searched a lot but I am still unaware how I can include the signup info into my node template. With so many people usually templating their nodes I am weird how the solution to this problem is not available.

I would appreciate any help to the right direction. Is there anything I can test out?


texts:
I need to load and print drupal 'internal' form on the page, which id is "node_type_form"
I have:

$form = drupal_get_form("node_type_form");

$html = drupal_render($form);

echo $html;

it only prints "Menu settings" and "Save and add fields" button.

I get:

Notice: Undefined index: node_type_form in drupal_retrieve_form()

Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'node_type_form' not found or invalid function name in drupal_retrieve_form()

Notice: Trying to get property of non-object in menu_form_node_type_form_alter()
Notice: Undefined index: #node_type in menu_form_node_type_form_alter()


texts:
There is a node type with hidden fields. Anyone can find nodes of that content type from the search form, and see open information. To see all the fields, users must make a request to the node owner, who decides the users who can see, or not those fields.

Is there any module with this purpose? Is there any other way?


texts:
Reading the guide, this seemed like it would be a walk in the park but I can't get to an install screen for my subdirectories.

I have created my database and users without any issue, I've got my httpd setup and ready for when I get Drupal to pick this up.

I followed the guide https://www.drupal.org/documentation/install/multi-site and followed steps through to 6 except I do not get a install page I simply get the root site that is installed already.

My current url is dev.sitename.com and I am trying to get it to work with dev.sitename.com/fr and dev.sitename.com/de

All permissions are correct so I believe my issue is how I have done the /sites/ step? In this folder I have "all", "default", "sitename.fr" and "sitename.de". The codebase I want to use is "default" and within the "sitename.fr/.de" directories I have the settings.php file setup which looks to be correct. I got my 2 symbolic links by running the command "ln -s . de" and "ln -s . fr".

If I can get to the install page my problems will be sorted. Any help would be appreciated.