texts: Drupal 7 cache page for anonymous users causes issues when loading different css files based on browser version

texts: If you have "cache page for anonymous users" on and are using server logic(http_user_agent) to load different css based on the browser version, that logic will not fire and you will get the css that was cached from the last visitor. This seems as if this will also cause some issues when loading js and css based on browser version and for responsive design...more specifically to browsers that don't understand media queries....pre IE 9 browsers. Does anyone have any solution on a work-around for using anonymous cache and loading the correct css based on server logic?


texts: Webform2pdf and CiviCRM fields: pdf empty

texts:
I have a Drupal website with CiviCRM. I created a webform and installed webform2pdf to create a pdf and CiviCRM integration module to add CiviCRM fields to my webform. After submission the webform fields are correctly added to the pdf but the CiviCRM fields are not.

Any idea? You think you could fix it or give me any advise?


texts:
I've created a views page of a search index (Drupal7). On this page are five search facets (using facetapi_multiselect).

facet1 is filtering by an entity_reference field
facet2 is filtering by the postal code

The problem:
Selecting a value for both facets (1+2) will never return any result, but there are matches.

Both facets are set to an 'OR' condition. Any ideas where to start debugging this?

Thanks, Marc


texts:
I'm looking for a way to force an empty region to display. I notice Omega does this via a theme-settings checkbox, but I'm unable to track down how it's done.

Regardless of removing the if ($page['regionname']): around print render, the region still does not display unless it's populated with block content. Perhaps injecting content into the $content var somehow?

Example:

In a custom theme, the header variables such as logo, sitename and secondary links are placed in a region template called region--branding.tpl.php.. (the variables have to be passed from preprocess_page to preprocess_region so this can work and a template suggestion needs to be made). Once this region is printed in page.tpl.php, it must always be rendered even if there is no block content in that area.


texts:
I'm doing a db_select() query of Commerce orders in Drupal 7.

$query = db_select('commerce_order', 'corder');
$query->fields('corder', array('order_id', 'uid'));
$query_result = $query->execute();
$results = $query_result->fetchAllAssoc('order_id');
dsm(print_r($results,TRUE));
dsm($results);

I execute this code in the devel/php page. print_r() prints out some actual results with the user ID; dsm($results) shows the user ID is always 1; my code always gets 1 for $result[$order_id]->uid.

The output of dsm(print_r($results,TRUE)) is the following.

[89143] => stdClass Object
    (
        [order_id] => 89143
        [uid] => 62791
    )

dsm($results) gives the following.

Does anyone know why it happens?

I'm trying to create a programmatically generated report, and I want the user ID to later lookup the user object.

if (count($results)) {
  foreach ($results as $order_id => $result) {
    try {
      $account = user_load($result->uid); // $result->uid always = 1
    }
  }
}

The code runs with a registered user, with full permissions for viewing/editing everything in the commerce order.


texts: How to control editing access when node ownership keeps changing?

texts:
I'm working on a project that involves group ownership and editing of nodes.  The rules that determine the visibility and editability of nodes are complicated, such that I'm having to roll my own node access code (that is, I couldn't find a module that would provide the kinds of control I need).

The following scenario is causing me some grief:

Alice and Bob are part of a group, and are working on node 123.  Node access entries exist that allow Alice and Bob to both edit the node under "normal" circumstances.
Alice edits node 123, and so becomes the "owner" of the node, in the sense that the uid field of the database entry for node 123 points to her.
Bob now edits node 123; he becomes the owner.
Alice, who has some degree of admin privileges in the group, takes the node private: She should be able to edit it, but Bob shouldn't.  "Taking the node private" means setting up some node access entries that are meant to deny access to the node to everyone but her.
However, since Bob is the most recent person to have edited the node, he's still the "owner of record", and node/123/edit is available to him, as a result of the standard node access rules regarding node ownership.  (This is how I'm thinking about it, anyway.)

Any ideas for how I can get around this, and keep Bob blocked from editing the node?  I've thought about:

adding some node_insert and node_update hooks that would force the uid of the node to always point to Alice; the node access entries would allow Bob to edit the node when he's supposed to be able to.  Might work, but this seems questionable/risky/horrifically hackish at best.
Maybe there's a hook that would reach down into the access system and let me test whether a request for node/123/edit should be permitted based on the current user and system state?

Any other possibilities out there?  Thanks!


texts: Automatically show one selection of a field based on the selection of another field in a view

texts:
Sorry if this is a repeat question but I'm stuck!

Ok, I have a content type named 'Media' that is basically a bunch of videos, pictures, podcasts as well as a small write up that explains what it is. I have a view that lists these media files according to most recently added. My problem is that in this view, I display an icon according to whichever type of media it is (a camera logo for videos, and podcast logo for podcasts, etc.) but I have to choose which one it is every time I create a new 'Media' content type.

I have a field called 'icons' within this 'Media' content type, which is just a term reference with a select list widget. The taxonomy terms are the file types (video, podcast, picture) and they are linked to the correct image/logo/thumbnail whatever you want to call it.

What I want to do is have it so that when I am adding a new 'Media' content type, it will automatically figure out the correct image/logo to display once I select the type of Media it is (the 'type' is a list(float) field and also uses a select widget). I hope this makes sense!


texts:
Let's say I have a simple form with some id like myform. This form has field called Mobile number with id mobile_number.If a user enter mobile number less than 10, it will prompt error like It must be 10 digits.

Form validation snippet:

public function validateForm(array &$form, FormStateInterface $form_state) {

  if (strlen($form_state->getValue('mobile_number')) < 10) {
    $form_state->setErrorByName('mobile_number', $this->t('It must be 10 digits.'));
  }

}

On inspect I found something like below markups

Error message

                It must be 10 digits.

I want to manipulate markups in either of two scenarios:

1) For whole website

2) Only for form with id myform.

How can I achieve that?

I am using 8.1.3


texts:
Does anyone know if its possible to attach a link to a specific node in a custom view and have that link be the path auto link?

I have a custom view that pulls in a title text field from an article. I want to have that text field be a link to go to that article and I only seem to be able to create a link to the node via a token the references the 'Content: nid' which outputs my link as www.site.com/node/66. I instead need the path to be my pathauto link.

Is this possible?


texts: Migrate a CSV into two entities with reference

texts:
I have a CSV as below:

chapter, headings, sentences
1, heading one, "1,2,3,4,5,6,7"
2, heading two, "1,2,3,4,5"
2, heading three, "6,7,8"

I want to migrate it to Drupal. The heading columns have to be migrated to the taxonomy heading. Once a heading is added, it should loop through the value in sentences and update the sentence entity by adding a reference to it.

The entity to be updated should be loaded matching the sentence column and chapter column. The sentences entity is already pre-populated with data.

Fields in each entity:

Taxonomy:
heading(string)

Entity(sentences):
sentence_no(int)
heading_reference(entity_reference)
sentence(string)
chapter_no(entity_reference)

I tried this tutorial. While the link is straight forward it doesn't really help my need.

I am ok if I migrate to D7 or D8. However D8 is preferred.


texts: How to send an email to an Organic Group admin for every comment of their group?

texts:
Drupal 7.x
Organic Groups / Rules 7.x-2.9

What is the best method to send an email to the 'Administrator Member' role of a group every time a comment is posted in their group?

I am looking to specify the exact groups that this rule works for.


texts: Different Image on each Mainmenu entry in Drupal 7

texts:
there is a Logo and a variable picture in the header of my design. This picture depends on the current page.

Is there a plugin or even a build in setting, where i can configure this behavior?


texts:
I have integrate Drupal 7 Site with Google Merchant by using the following instructions:

https://www.drupal.org/project/commerce_gmerchant

but after integration with this when I add the new product using the content type created for Google Merchant. It shows me the following error

Google Merchant error: Not Found

I googled it but couldn't find any material which can help me. So, I created a view that exports the products in .txt and .xml extensions. When I imports these files to Google Merchant account (Products -> Feeds) it shows me the error for XML File XML formatting error
 and for TXT File Delimiter detection failed

Kindly help me to solve these issues and feel free to ask me questions about this issue.

Thanks.


texts: How can I make a template for a product type in Commerce?

texts:
I want to be able to write my own markup for the fields (see image below) of each product type – how do I do this? My main reason for this is that I want to group them with my own HTML rather than the default provided.

I've tried using <?php print render($content['field_available_colors']); ?> and <?php print render($content['product:field_available_colors']); ?> in the regular node--[content_type].tpl.php and that didn't work.

I've also tried making a template specific for the product type, but nothing happens. I've been looking at the latest post in this thread, but I can't get any of the suggestion to work either...

I'd very much appreciate some help here, what am I missing?

Tried to add the following to template.php, but have no clue what to do with it really. Haven't worked in this way before at all, and this seems pretty steep.

function mythemename_preprocess_node(&$vars) {
  $product_display_types = commerce_product_reference_node_types();
  if (isset($vars['type']) && isset($product_display_types[$vars['node']->type])) {
    $vars['theme_hook_suggestions'][] = 'node__product__type__' . $vars['node']->type;
    $vars['classes_array'][] = 'node-product-type';
    if ($vars['view_mode'] == 'product_list') {
      $vars['theme_hook_suggestions'][] = 'node__product__type__product__list';
      $vars['classes_array'][] = 'node-product-type-product-list';
    }
  }
}


texts:
I've been looking up and down for hours now trying to figure out what I am doing wrong.

Every time I submit a form via AJAX, the submit function gets invoked twice. In other words, the form gets submitted twice. Here is an example I have been working with in my attempt to boil everything down to the basics in hope of finding the root of this very annoying issue (the example assumes AJAX requests, and is not really geared towards graceful degradation).

This is not an issue with multiple AJAX requests being sent from the browser. The browser only sends one single request when i click on the form's 'submit' button.

/**
 * Page callback for 'welcome'. This path has been registered
 * as a plain MENU_CALLBACK.
 */
function us_welcome() {

  // This is where the user arrives at first when navigating to
  // 'welcome'. The user is simply presented with a link which
  // will load the registration for via AJAX and show that form
  // on the very same page.

  $html[] = l(t('Register'), 'welcome/register/nojs', array(
    'attributes' => array(
      'class' => array(
        'use-ajax'
      ),
    ),
  ));

  $html[] = '

';

  return implode($html);

}

/**
 * Page callback for 'welcome/register'. This path has been registered
 * as a plain MENU_CALLBACK.
 */
function us_register($mode = 'nojs') {

  // This callback is responsible for the path 'welcome/register'
  // and is the one which the link invokes. If invokation happens
  // from the link, then $mode is 'ajax'. Otherwise, it is 'nojs'.

  // Get form.
  $form = drupal_get_form('us_register_form');

  if ($mode != 'ajax') {
    return $form;
  }

  // Generate commands array.
  $commands = array(
    ajax_command_replace('#form-register-wrapper', drupal_render($form)),
  );

  $page = array('#type' => 'ajax', '#commands' => $commands);
  ajax_deliver($page);

}

function us_register_form($form, &$form_state) {

  // A plain old form builder function. Nothing magical
  // going on here.

  $form['#prefix'] = '
';
  $form['#suffix'] = '
';
  $form['#action'] = '/welcome/register/nojs';

  $form['messages'] = array(
    '#markup' => '

',
  );

  $form['basic'] = array(
    '#type' => 'fieldset',
    '#title' => t('Basic Details'),
  );

  $form['basic']['name'] = array(
    '#type' => 'textfield',
    '#title' => t('Your Name'),
  );

  $form['basic']['email'] = array(
    '#type' => 'textfield',
    '#title' => t('Your E-mail'),
    '#required' => TRUE,
  );

  $form['basic']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Submit'),
    '#ajax' => array(
      'callback' => 'us_register_form_submit',
      'wrapper' => 'form-register-wrapper',
      'effect' => 'fade',
    )
  );

  return $form;

}

function us_register_form_submit($form, &$form_state) {

  // This is the form submit function. The weird thing is that it gets
  // called twice every time the form is submitted via AJAX.

  // This block of code will only apply to AJAX requests. Normal requests will
  // return from the validation function(s) if validation error(s) should occur,
  // and by the time normal requests get to this point everything have been
  // validated. AJAX requests, on the other hand, goes through the validation
  // function(s) but will still reach this point even though validation error(s)
  // occur. Thus, we need to check for errors and return error messages in case
  // of validation errors. In case of errors, return the form again.
  $errors = form_get_errors();
  if (!empty($errors)) {
    return $form;
  }

  // @todo : carry out registration here.

  $content = array();
  $content[] = t('Thank you for registering!');

  // Process form submission.
  $commands = array(
    ajax_command_replace('#form-register-wrapper', implode($content)),
  );
  $page = array('#type' => 'ajax', '#commands' => $commands);
  return $page;
}


texts: "Uncaught ReflectionException: Class DOMDocument does not exist" error

texts:
On Ubuntu 16.04, I installed Drush using Composer: composer global require drush/drush:~8. Installation succeeded, but running drush --version, I got this error:

  PHP Fatal error:  Uncaught ReflectionException: Class DOMDocument does
  not exist in
  /.../composer/vendor/consolidation/output-formatters/src/Transformations/DomToArraySimplifier.php:24

What do I do now?


texts: syslog to a different location for each site than on /var/log/syslog

texts:
We have many sites on our server and we are hoping that we can save syslogs of each site on the root of each site than all logs being dumped on /var/log/syslog

Is it possible?

For example, logs for each site would be on /srv/site_name/sitelog?

Many Thanks!


texts: expose filter work with ajax only on inner pages but work with button submit on front page

texts: What I want is to work expose filter with ajax only on inner pages but work with  button submit on front page i.e when I want my expose filter on front page to work like normal form but on inner page i want it to work with ajax


texts:
I'm lost on how to configure advanced ranges in Facet API displays. I see this page, which supposedly quotes from the README

  For example [100 200] will produce a range between 100 and 200.
  For example [100 *] will produce a range of "100 and above"

I've configured my ranges like this:

But the drop down menu appears like this:


texts: Advice on latest drupal security advisory having followed most of the instructions do I rebuild the server?

texts:
I was unfortunately on holiday on the week of drupageddon / drupalgeddon / security advisory SA-CORE-2014-005. So my site was a week without having core updated/ patch applied at all. I started off reading through this post and, apart from the Hacked module which I couldn't understand and therefore didn't try, nothing seemed to have happened. Nothing seems to be a breach, but as I read - that's the point... So generally speaking I'm preparing to rebuild the server, but in all this it will take ages as I'll have to check through all the user submitted data. How is the hack able to lead to everything possibly being vulnerable? Looking through the permissions the only things that are owned by "apache" are the "sites/default/files" files. Do I need to rebuild the server?

I updated core immediately, then used the Drupalgeddon module which found nothing (and again found nothing just now):

"Site did not test positive. Good luck!                               [ok]"

I checked through the live source against our development repository and I couldn't see anything obvious that was suspicous.

I used Toad for MySQL to do a comparison of my live db with a dump of the database before the 15th of October and that did not show anything that I thought might be a problem. I kept doing what I was shown (!) in terms of permissions:

Group: root[0]; Owner: root[0]; Octal: "0755" for

/sites/all/modules
/sites/all/themes
/sites/all/libraries

Group: root[0]; Owner: root[0]; Octal: "0444" for

settings.php

Group: root[0]; Owner: root[0]; Octal: "0644" for

all root of web directory stuff like...
/install.php
/index.php
the files within the other folders off the root of the web directory

The folders:

/themes
/scripts
/includes
etc.

have Group: root[0]; Owner: root[0]; Permissions: Octal:"0755"

Which I thought (and which is why I deliberately kept it like that) made everything quite locked down in terms of file access and permissions etc.

So after all this I was struck with a similar scepticism as this article on ZDNET.

Any suggestions? Do those permissions/ ownership help to protect? Do I really need to rebuid? The latest claims are if you didn't update within 7 hours, you've been hacked. The sites are actually fairly new and atm get roughly 5000 sessions a month. Also, coincedentally, I removed user/register to prevent spam because our setup uses a bespoke arrangement for registration.


texts: View of nodes and all their taxonomy terms

texts:
There is a vocabulary which has an additional field 'field_icon'
I have a view that displays nodes of a certain content type.

I am looking to display all the term's field_icon associated with each node.

I have then added the relationship of Content: Taxonomy terms on node and added the field_icon using this relationship. But it is only displaying 1 icon. Not all.

When you look to configure that field, there is no MULTIPLE FIELD SETTINGS option.

How do I display all terms associated with a node in views.

EDIT
See screenshot attached
The vocabulary the field_icon is in is call 'Key Elements'


texts: How to insert block into Article content type?

texts:
I haven't found any option or module to achieve this yet.

I started to think I should do this by inserting code directly into article, but this would not be really good/easy solution on regular basis, for Adsense for example....


texts: Get content type field value without entity

texts:
I have a exposed form and want to use my field "field_region" for the breadcrumbs. If a user now selects the exposed "field_region", my URL looks like "?q=news&field_region=2". Now I want to get the value behind the key "2" from the field_region.

Everything runs on a view-page, so I don't have any node / entity id to load the field value with. How can I get the value behind key "2" from the field_region? Or is there any other secure way of getting the selected value from the exposed filter?


texts:
I have my main navigation menu setup with 2 levels with only one level expanded by default. I then placed a second version of the menu in a different block and set the Initial Menu Level to 2 so on this one I only see the second level menu. It's working as I want it but I've run into an issue trying to style it. The problem is that both menu levels are using the same template so there's no way for me to differentiate them. I can change the wrapping block template, but I also need to be able to edit the menu template for each level.

I was hoping I could use a preprocess function to pass the block id of where the menu is placed so then I could use some logic on the menu template. However since I'm fairly new to Drupal I'm not sure how to do this or if it's even possible.

This was one of the issues the gentleman asking this question had.

Any help would be appreciated.

Thanx


texts: add field to bundle through hook_entity_bundle_field_info

texts:
I am trying to add two fields to one of the node bundles.

I define the fields in this function:

function concertbeheer_entity_bundle_field_info(\Drupal\Core\Entity\EntityTypeInterface $entity_type, $bundle, array $base_field_definitions){
    if($entity_type->id()=="node" && $bundle == "concert")
    {
        $concert_fields['laatste_uitvoering'] = \Drupal\Core\Field\BaseFieldDefinition::create('datetime')
                ->setLabel('Laatste uitvoering')
                ->setRequired(TRUE)
                ->setDisplayConfigurable('view', TRUE)
                ->setDisplayConfigurable('form', FALSE)
                ->setDisplayOptions('view', array(
                    'label'=>'inline',
                    'type' => 'datetime_plain',
                    'weight' => '999',
                ));
        $concert_fields['eerste_uitvoering'] = \Drupal\Core\Field\BaseFieldDefinition::create('datetime')
                ->setLabel('Eerste uitvoering')
                ->setRequired(TRUE)
                ->setDisplayConfigurable('view', TRUE)
                ->setDisplayConfigurable('form', FALSE)
                ->setDisplayOptions('view', array(
                    'label'=>'inline',
                    'type' => 'datetime_plain',
                    'weight' => '999',
                ));

        return $concert_fields;

    }

}

but the documentation on https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Entity%21entity.api.php/function/hook_entity_bundle_field_info/8.2.x says I also need to provide a fieldStorageDefinition through hook_entity_field_storage_info()

I can actually configure the visibility of the fields but when I save something to them it isn't saved in DB. Probably because of the lack of a FieldStorageDefinition

But I don't know how to get started on that and, as usual, there seems to be no documentation available on how to do it


texts:
I have a vocabulary with a user reference field. In a content type I have a field that references one or more terms from this vocabulary with a select widget. I would like to restrict the options to only the terms that are referencing the logged in user.

Drupal 7, Entityreference module is used for the user reference in the term and the select widget that I want to customize in the node is a Term reference.


texts: Using Views to Filter on a property of all relationships

texts: Let's say I have a node Exercise that has multiple-entity reference field, pointing to Skill nodes.  Those Skill nodes have a field Skill Score.  I want to only show the Exercises where every Skill referenced has a Skill Score > 3.  Is there a way to do this with views?


texts: Tree with linked structure and node leafs

texts:
I am working with Drupal 6 and i need to create a 3 level tree with 2 levels of links(topic and subtopic) and a third level of faqs.
Example:

Topic1
--Subtopic1
----FaqA
----FaqB
--Subtopic2
----FaqC
----FaqD
----FaqE
--Subtopic3
----FaqF
----FaqG
Topic2
--Subtopic4
----FaqH
----FaqI
----FaqJ
--Subtopic5
----FaqK
----FaqL
--Subtopic6
----FaqM
----FaqN
----FaqO

The thing important to me is that:
I am in the root(home)-> I need to see all the topics and subtopics;
I click on a topic -> I need to see all the subtopics of that topic;
I click on a subtopic -> I need to see all titles of the faqs of that subtopic;
I click on a faq title -> I need to see the full faq node;

Each page need to have a breadcrumb that shows where the user is.
The topic and subtopic pages have just a list of links to childrens, so i don't know if they have to be nodes, so maybe i just need the Faqs to be node, but i don't know how to build the topic and subtopic structure and from my tests i didn't find anything fitting (i have checked "book" content, cck, custom breadcrumb, node hierarchy and many other)
Can anyone help me?


texts: drupal_goto is not refreshing the webform on submit

texts:
I have a webform node. I need the users to fill it and on submit, the user will be redirected to some link.

if ($form_id == 'webform_client_form_970') {
    $form['#submit'][] = 'dl_pdf';
}

function dl_pdf(){
        drupal_goto("http://dev.site.com/ar/printpdf/9", $options);
    }

When the form is submitted, drupal_goto works ( it actually just downloads a PDF file automatically ) but the form does not get refreshed.

What i have been doing wrong. Any clue?

Solution:

if ($form_id == 'webform_client_form_970') {
        //$form['#submit'][] = 'dl_pdf';
        drupal_add_js(
            'jQuery(document).ready(function () {
                jQuery(".webform-submit").on("click", function(){
                    var win = window.open("'.dl_pdf().'", "_blank");
                    win.focus();
                });
            });',
        array(
            'type' => 'inline',
            'scope' => 'footer',
            'weight' => 5
            )
        );
    }

function dl_pdf(){
        return "http://dev.site.com/ar/printpdf/9?name=".$userinfo->title."&date=".$course_date."&course_type=off-non-reg&course_name_ar=".$courseinfo->title."";
}


texts: How to modify image field in field_attach_preprocess_alter

texts:
I have an image field called field_grid_image on a custom node type "event". I want to populate this field when not available but I don't want to use a default image.
I want to add a default image based on the node's taxonomy. I have written the following code to load the image from node's taxonomy field but it doesn't show up in the final output.

function custom_event_field_attach_preprocess_alter(&$variables, $context) {
    if($context['entity_type'] == "node" && $context['entity']->type == "event" && sizeof($context['entity']->field_grid_image) == 0){
        $tid = $context['entity']->field_event_type['und'][0]['tid'];
        $taxonomy_term = taxonomy_term_load($tid);

        $values = field_get_items('taxonomy_term', $taxonomy_term, 'field_generic_image');
        $variables['field_grid_image']['und'][0] = $values[0];

        dpm ($values);
        dpm( $variables);
    }
}

When I print $variables I see the field populated from the taxonomy as follows.

Any ideas why the image is not rendered in the final output?

Thanks,


texts: How to add class in li element (for page where I am) in menu for drupal 8

texts:
I would like to add class in li element in menu for drupal 8 for page where I am. For example if i am on page Start, that li have active class. Or If I am on Join page that li element for join have active class.

START

About

join

So, How to ask if li is active or no?

{% for item in items %}
  {% if item=SOMETHING %}

      {{ item.title }}

  {% else %}

      {{ item.title }}

{% endfor %}


texts: Module requires Composer install of third-party library

texts:
I am trying to learn about drupal 8 and composer within aegir. It seems like aegir has some support for it but the problem that I am running into right now is that aegir doesn't seem to install composer dependencies for modules. For instance, I am using the "real_aes" module in my first drupal 8 deploy which requires that defuse php-encryption be required. Normally, I would just use composer require and everything would be no problem. However, I am trying to use aegir to manage all of this.

My question is really this. Is there a way in aegir to specify composer requirements or to get aegir to install all module requirements based on the module's composer.json file? And if not, what is the best way to handle this via aegir? Will i need to alter the composer.json file in the drupal root directory after I deploy the drupal 8 platform and run composer update via the command line or are there any other work-arounds that would be better?

I should say that I found the hosting_composer module and installed it and it's dependencies. However, I immediately got several warnings right after install. Since this is going to be managing live drupal sites, I am hesitant to rely on so many dev modules especially since they are showing issues right after install.

I have about 20-30 drupal 7 sites that I am looking to migrate to d8 over the next year.


texts: Syntax for getting plain field value in computed field

texts:
I have a couple of simple computed fields that combine other fields (such as first name and last name) but I'm not getting the right values from the fields. I sometimes get only the first letter of a text field (maybe just on the Title field), and when I call a longtext field I'm getting all the HTML markup when I really only want the plain text version of the field.

Here's an example where I'm trying to combine a pile of fields for purposes of searching them from one box:

$omnisearch = $entity->title[LANGUAGE_NONE][0]['value']."
".$entity->body[LANGUAGE_NONE][0]['value']."
".$entity->field_prerequisites[LANGUAGE_NONE][0]['value']."
".$entity->field_keywords[LANGUAGE_NONE][0]['value']."
".$entity->field_teachers[LANGUAGE_NONE][0]['value']."
".$entity->field_organizing_center[LANGUAGE_NONE][0]['value']."
".$entity->field_location[LANGUAGE_NONE][0]['value'];
$entity_field[0]['value'] = $omnisearch;

So is there a better parameter than 'value' to pull the plain/sanitized text from the field? And why am I only getting the first character of the title? I only theoretically grok arrays, so the answer may be obvious to others. Thanks for your help!


texts:
I remember that, in previous versions of the Search API and Search API Solr, by default not entering any search term would return the entire list of items.

I have tried with new empty Drupal 8.5.1 using Search API and Search API Solr, using the default configuration, with MariaDB and Postgresql, using the default view pages /search/content and /solr-search/content, but it shows an empty list and the message Please enter some keywords to search. message.

Does somebody know how to change it to the previous behavior to get again the whole list of elements when no search terms are used?


texts:
Our Drupal 7.5 website is having an issue where users click logout but they are sent to the front page still logged in. I believe it's related to a bakery module, however, the question I am asking here is this: how do I force logout for specific users (not all users) via command line?

I tried:

drush uinf <username>

(To get user ID)

drush sql-query "DELETE FROM sessions WHERE uid = <uid>;"

The end result was a sql deadlock that crashed the site momentarily, and when it came back up, the user was still logged in. Should the sql command have worked? If so, then I may need to troubleshoot other issues.

Update: I disabled the bakery module and the problem went away, so the command was correct, but something about the module was wrong. I don't know why.


texts: How do I use CCK fields with the form API?

texts:
Does anyone know how to use OpenLayers CCK fields with the form API?
I want to get a coordinate and some other data from users in my custom form.


texts: Upgrading Drupal 7.43 to 8 error: Source database is Drupal version 8 but version 7 was selected

texts:
I am new to Drupal, but I am trying to upgrade a site with the version 7.43 to 8, flowing these steps: https://www.drupal.org/docs/8/upgrade/upgrade-using-web-browser

After installing the Migrate modules and defining the source site, I have the following error message:

  Source database is Drupal version 8 but version 7 was selected.

In my old site's database, the drupal_version table is empty.

Any help?


texts: How to make a logo resize properly in a responsive theme

texts:
I am creating my first responsive website http://islamabadpools.com; I have used the Omega theme as a starter theme, and it works almost perfectly for the layout.

I used the absolute image module for adaptive images but it's not working for views banner slideshow.
I am also unable to make the logo responsive so I removed the logo from theme options.

I created a new article content, and added a logo as an image and given it a title logo; then, I created a view block with an article image field and filtered that with the title "logo"
and in field properties; in the view, I selected adaptive as the format.
Now my logo is responsive/adaptive but it's getting very small on lower screen sizes.

I repeated this for the quick assistance block displaying in the right corner of the header.

I just want to know what the right way to make the logo responsive is.


texts:
Is there a way to use Drupal Queue API to sequence the execution of tasks, like in a pipeline?

My use case is pretty simple: I have a number of tasks executing in the background, doesn't matter their order because they are self-contained. However, I'd like a single task (of a different function) to execute after all the others are done.

How would this be done?


texts: How do I assign a region to programmatically created block?

texts:
Hi after following this guide I was able to create multiple blocks.
But I have couple of issues.

Blocks are not created instantly need to clear cache but cant find a way to do it instantly (solution might be clearing block cache but how ?).
I need to assign region to the block while creating itself but cant do so .
I want to have x content for x block id and y content for y block id cant write a filter condition as I cant get block id of the blocks.

Basically I want to achieve all the D7 module's functionality in D8.

If anyone have an idea please help me.


texts: Custom commerce payment methods based on item

texts:
In my Drupal commerce website, I have 2 payment methods, Payment Method #1, Payment Method #2

This is working just fine but the thing is I need to make it custom for a specific product type, for example if I'm selling Asus products, I want to get 40% pay with Payment Method #1 and the rest via Payment Method #2.

I'm not a module developer so I thought I can make it happen with some customization and/or rules.

I'd like to know if it's possible without module development,what's the best approach and how to do it properly.

thanks in advance.


texts: Select options not loading when using callback function

texts:
I am creating the select box form element as following

$form['select-user-group'] = array(
       '#type' => 'select',
       '#title' => t('Select a group'),
       '#options' => select_user_dropdown_options(),
       '#description' => t('Select a group to send the mail.'))

and am trying load the options for select box like follwing

function select_user_dropdown_options(){
    db_set_active('drupal');
    $result = db_query("select * from {content_type_usergroup}");
    $record = db_fetch_object($result);
    $str = '<select><option>-- Select a user group--</option>';
    while ($obj = db_fetch_object($result)) {
        $str .= '<option>'+$obj->field_p_group_name_value+'</option>';
     }
     $str .='</select>';
     return $str;
}

  But its not loading options to the select box , please help


texts: Using content type fields within page.html.twig

texts:
I am new to Drupal 8, and relatively new to Drupal templating in general.

Here's what I am trying to do:
I have a content type, called "Property" with a "header_color" field.  When I add a property, I set the color that I want for that property's header.
When I then navigate to that node, the background color of the page's header would be whatever I set the color to.

My understanding is that this needs to take place in page.html.twig, and that there is a way to grab the data from the content type and use it within page.html.twig, using:

{{ node.field_header_color.value }}.

This is the tag I have in my page.html.twig:

<header id="header" class="header" role="banner" aria-label="{{ 'Site header'|t }}" style='background-color:{{ node.field_header_color.value }}'>

When I inspect it in the Chrome Dev, it shows:

"style='background-color:''"

Can someone give me some guidance on what I am doing wrong here?

I am using Drupal 8.6.4


texts: I am creating more than 50 entity forms and major parts (contains 20 fields) of these forms are exactly same. Forms are different from each others only one or two field. If I need to edit major and exactly same part of these forms I must repeat editing process for all forms. Are there any aproach to solve this problem? I need edit major part of forms only one time.


texts:
I have an xml feed and i want to display it with a view.
I have created a content type with the fields that are in the feed but how can i tell the view to get the data from this feed. I don't want to insert my feed data into the database. How can this be done programmatically? Maybe from the theme section in views? Maybe with some hooks like hook_views_data_alter?
Any help would be much appreciated.

Thanks


texts: Adding content to a database table during module install

texts:
I created a custom module and in the ".install" file, I create a table using hook_schema().

I have about 90 error codes that I have to associate with an error message.

What is the most effective way to populate my table with those values during module install?

Thank you!


texts:
I have a content type called "project" . I want to change the title of the submit button of the edit form.
I wrote a module with the following:

function MYMODULE_form_alter(&$form, $form_state, $form_id) {
  if ($form_id == 'project-node-form') {
     $form['actions']['submit']['#value'] = t('Publish');
  }
}

I enabled this module but no change of the button title.

please help...thanks.


texts: how to alter notification email in search api saved search module. I want to add more details about the search

texts:
I m using search api saved search module to save my search selected using facets.
In the notification email i want to add selected search options which i saved, Ex: country or city name which i selected while saving the search.


texts: Maximum on date field and Views aggregation issue

texts:
I am running a Drupal 8.0.5, I have a content type called show which has fields title, an entity referenced called movie and a date time.
I am trying to create a view of the latest shows of each movie. The initial view is like this which shows the movie and show time

I enabled aggregation. Aggregation functions i used are For movie - group results together and for datetime - maximum. The result is as follows

it just gives 2,016 as date time field where i was expecting Mon 03/21/2016 15:00:00. Are we not supposed to aggregate on date field? I thought since MAX usually works in database for timestamp, it is valid here also. Can anything be done to achieve this result?


texts: is this possible to create full view formatter for taxonomy reference field? I've tried default formatters but it only prints title of the term and nothing else...


texts: What's the best way to add an alert box to a link in D7

texts:
I have a link, which is rendered via the l function. It's a link which calls a function that deletes a node. Before the function is called, I want an alert box to pop up and give the user the option to 'Cancel' or 'Confirm'. Adding this as an argument to the l function works:

array('attributes' => array('onclick' => 'return confirm("Are you sure?")'))

...but is there an existing function, or something, that does a nicer job?

I'd rather not add a contrib module for such a small task.


texts: Change the order of menus in sitemap page for visitors view

texts:
I have installed Sitemap module and enable some menus to display for HTML sitemap page.

Now I need to change the order of titles (Menu) that are displaying on sitemap page.

Is there any way we can change the order of these menus?


texts: Userpoints: deduct points programmatically

texts:
Is there a way to programmatically deduct points from user points?

I want to deduct points from users if a certain "featured Item" field is checked when they create a new content, but don't want to deduct points from users that created content without "featured Item" checked.


texts: How to manage multisite themes from master Drupal installation

texts:
I have Drupal 8 multisite to benefit from a single codebase. Also they share the same database. How can I change themes of all the other sites from my main domain/site?

Parent and child domain :

- mainsite.com
-- childsite1.com
-- childsite2.com
-- childsite3.com


texts: Custom form adding extra field and in database table also extra field

texts:
function countries_form($form, &$form_state,$id=0) {

if($id!=0){
 $result =  db_query('SELECT * FROM {countries} WHERE id = '.$id.'')->fetch();
// print_r($result);exit;

 $form['country_name'] = array(
    '#type' => 'textfield', //you can find a list of available types in the form api
    '#title' => 'Country name',
    '#size' => 30,
    '#maxlength' => 30,
    '#default_value' => $result->country_name,
    '#required' => TRUE, //make this field required
  );

  }else{
  $form['country_name'] = array(
    '#type' => 'textfield', //you can find a list of available types in the form api
    '#title' => 'Country name',
    '#size' => 30,
    '#maxlength' => 30,
    '#required' => TRUE, //make this field required
  );
  $form['description'] = array(
    '#type' => 'text_format',
    '#title' => t('Description'),
    '#format'=> 'full_html',
    '#pre_render' => array('ckeditor_pre_render_text_format'),
  );
  }
  $form['submit_button'] = array(
    '#type' => 'submit',
    '#value' => t('Click Here!'),
  );

  return $form;
}

I am using above form for drupal 7 ...which inserting country name ..now i want add one more form fields which is description with some text editor.... I tried adding below code for textarea with editor..i was this in else part...

$form['body'] = array(
    '#type' => 'text_format',
    '#title' => t('Body'),
    '#format'=> 'full_html',
    '#pre_render' => array('ckeditor_pre_render_text_format'),
  );

enter link description here

function countries_form_submit($form, &$form_state) {

if(arg(2)!=0){

  $query = db_update('countries')->fields(array('country_name'=>$form_state['values']['country_name'],'description'=>$form_state['values']['description']))->condition('id',arg(2))->condition('country_name','%d');
 $query->execute();

 drupal_set_message(t('Country %name has been updated.', array('%name' => $form_state['values']['country_name'])));
}else{
  $query = db_insert('countries')->fields(array('country_name'=>$form_state['values']['country_name'],'description'=>$form_state['values']['description']));
$query->execute();
 drupal_set_message(t('Country %name has been saved.', array('%name' => $form_state['values']['country_name'])));
 }

   //$form_state['redirect'] = 'mypages/table';
  }

I was tried like the above insert and update..but not getting insert its showing error..when i submit...even the country_name also not updating if form submits well... my question is .. 1) i want insert new field description 2) country_name if exists need to update..


texts: I want to put some custom information in the content area of book pages (so, after the author info and before the add child page, etc. links). In the node template, the content comes in with both the body content and the following links already merged. I've dug through the core template directories and I can't find the template for just the body content itself. Anyone know what it is? Thanks!


texts: Trigger Rule with Filefield 'when field has changed'

texts:
This problem has been giving me a headache for four days now, so I thought it'd be best to see if somebody knows of a better answer than me :)

I've got a set of different rules that check if various field types have been updated 'after updating existing content'. The problem is that each one works fine, except for the only filefield type which will not work. The condition used is a 'NOT Data comparison' on the field checking the 'node-unchanged' version against the new 'node' version. This works with every other type of field and actions appropriately (that I have used at least), just not the filefield type; the rule just fires regardless of changes or not on the filefield.

I also found this post about a very similar problem: https://www.drupal.org/node/1011014#comment-10040082

I think I have the makings of a workaround, but I just wanted to check this with some fellow developers first as my PHP isn't the best.

If I were to enable the PHP module then add a condition in rules that checks the 'source' attribute to see if a new file has been added... would this work? The code I have is:

if (isset($object->field_FILEFIELD_NAME[0]['source'])) {
  //Check for new files
}

I believe that $object is the node passed on by rule function as argument.

Is this a good idea/best approach? Any ideas or workarounds would be great as I'm stumped :(

Thanks guys!


texts: How do I remove gid from og_group_ref field's autocomplete?

texts:
At first I thought this was a job for hook_preprocess_field(); however, it then occurred to me that this field is populated by an ajax look up.

Where might be the best place to remove the group id from this? That is, how do I remove the (2) from the "TEST GROUP, Private" result pictured below?

I keep having users ask me why it's there.

I've also explored this in the Firefox Inspector. When I key in test, I see that requests are being sent to /og/autocomplete/tags/og_group_ref/node/post/default/NULL/test

And going a bit of work, I see that that path maps to these callbacks:

mysql> select path, page_callback from menu_router where path like 'og%';
+--------------------------------+------------------------------------------+
| path                           | page_callback                            |
+--------------------------------+------------------------------------------+
| og/autocomplete/single/%/%/%/% | og_entityreference_autocomplete_callback |
| og/autocomplete/tags/%/%/%/%   | og_entityreference_autocomplete_callback |
+--------------------------------+------------------------------------------+
2 rows in set (0.00 sec)

Which I find in these files:

$ grep -Rin 'og_entityreference_autocomplete_callback' *
profiles/commons/modules/contrib/og/includes/og.field.inc:313:function og_entityreference_autocomplete_callback($type, $field_name, $entity_type, $bundle_name, $field_mode, $entity_id = '', $string = '') {
profiles/commons/modules/contrib/og/og.module:100:    'page callback' => 'og_entityreference_autocomplete_callback',
profiles/commons/modules/contrib/og/og.module:107:    'page callback' => 'og_entityreference_autocomplete_callback',

And the callback function returns entityreference_autocomplete_callback_get_matches.


texts: Migrate Drupal locator content to Wordpress site

texts:
I use the migrate module to populate locator data to other Drupal sites. We have a main site that allows members to update their locations. Each location can also be flagged so that if its checked as an "A" location, when Cron runs it populates on the "A" site and the same for the "B" site. This keeps the content updated on the other sites when any changes are made and allows us to only have to update on one site. All the sites are running on Drupal 7.

Now if we added a WordPress site and wanted to route the "A" locations content to that site instead, can this be done the same way?

Thanks!


texts:
I created custom module to make simple Ajax call. This module looks like this:

<?php

/**
 * Implements hook_menu().
 */
function module_ajax_contact_menu() {
  $items['node/get/ajax/%'] = array(
    'page callback' => 'module_ajax_contact_ajax_get_ajax', // Render HTML.
    'page arguments' => array(3),
    'type' => MENU_CALLBACK,
    'access arguments' => array('access content'),
    'delivery callback' => 'module_ajax_contact_ajax_callback',
  );
  return $items;
}

function module_ajax_contact_ajax_get_ajax($nid) {
  $node = node_load($nid);
  return node_view($node, 'default');
}

function module_ajax_contact_ajax_callback($page_callback_result) {
  // Only render content
  $content = drupal_render($page_callback_result);

  // Add CSS and JS files, add some markup
  $html = '<title></title>' . drupal_get_css() . drupal_get_js() . '' . $content . '


texts: Is it possible to exclude module settings when migrating database?

texts: Our dev server is on an internal network that is not connected to the WWW. As such, I have the Google Analytics module turned off on the dev server, because it really slows down page loads when enabled, since it can't reach the Google servers.  Occasionally, when I migrate site changes up to the production server, I will forget to enable the module on the live site.  It gets disabled because it's disabled on dev.  Is there a way to exclude module settings from a database backup?  (We're using the Backup and Migrate module.)


texts:
I have created a thumbnail like image style in Drupal 7 (glossy_footer_sublogo).Also i have coded a module that has a block to display the 'logo.png' file that comes with my theme and converted by 'glossy_footer_sublogo' style. after enabling the block and clearing cache no image is displayed although the 'sites/all/themes/glossy/' path created in my style directory.
Following are the codes that i used to display the block:

/**
 * Implementation of hook_block_view().
 */
function glossy_helper_block_view($delta = '') {
  switch ($delta) {
    case 'glossy_footer_sublogo':
            $img_url = 'public://sites/all/themes/glossy/logo.png';
            $style = 'footer_sublogo';

            return array(
                'subject' => '',
                'content' => "<img src=" . image_style_url($style, $img_url) . ">",
            );
      break;
  }
}

Can anyone point me to what is the problem?
Thanks!


texts: Apply formatting to tables generated by tablefield module

texts:
I am using the tablefield module to allow the user to create a "programme schedule" in a table format. The only issue I'm facing now is that the user would like to be able to apply text formatting like bold or italics to certain fields.

The only thing I can think of is styling through CSS, however, given the dynamic nature of this table, it does not seem very feasible. Is there any other table modules that could provide such functionality?


texts: Can i create custom content type without define .yml file in module?

texts:
Sorry for my bad english grammar.
I write a module, allows the user to upload a file that contain list of content types infomation. Then my module will auto create content type for user.
But i don't know how to create content type without hard define many .yml file.


texts:
I've struggled to find a really straight answer that makes me super comfortable to this question after searching SE, PCI basics, drupal.org, AWS resources, and reading the Drupal PCI Compliance White Paper.

I think I am just looking for some confirmation or denial from folks who have set up eCommerce environments before. Perhaps this is because I am overthinking it (I really don't want to expose a small business to unnecessary liability), and perhaps because environments are all different so it's difficult to say.

I'd like to be sure to create a PCI compatible environment using Drupal Commerce with an onsite payment gateway (Authorize.net). In our MOU it will be up to the site owner to ultimately write down their business processes and take the SAQ (recommended, as they should qualify for level 4 from Visa/Mastercard) to say they are PCI compliant, but since I am building the site out I would like to make sure they don't have any trouble with that piece of it.

As long as we are...

Hosted in a PCI compliant environment (AWS EC2 in this example)
Have firewall properly configured
Serving all relevant (but ideally all) pages over SSL
Use good passwords, no users are shared
All security updates are made for Drupal and modules promptly

Is that a recipe for a PCI compatible environment? Have I forgotten any pieces?

My second but related question is - Does using Drupal Commerce with Authorize.net (onsite processing) mean the business should use:

SAQ-A (Card-not-present merchants: all payment processing functions fully outsourced, no electronic cardholder data storage)

or

SAQ-EP (E-commerce merchants re-directing to a third-party, PCI compliant service provider for payment processing, no electronic cardholder data storage)

I know Drupal Commerce provides the 'no cardholder data storage' by design, but i'm very unclear on the definition difference between 'all payment processing functions fully outsourced' and 'merchants re-directing to a third-party compliant service provider for processing'.

Thanks for your thoughts!


texts: PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'fmotors_fms.block_node_type' doesn't exist:

texts: This was working fine last night but when i login to my computer again I got this error now. What is this table {block_node_type} I cant find it in the database but it is in the drupal code in node.module. PLease help


texts: drupal_get_form in a condition won't trigger the form submit

texts:
I'm trying to understand why when I call a form through drupal_get_form the submit part of it reload the page and if I don't call the form with drupal_get_form on that page again, it won't trigger the submits :(

function myFunction()
{
    if (isset($_POST['token'])) {
        return drupal_get_form('my_form');
    }

//why do I need to do that in order to get the submit form working?
    elseif($_POST['form_id']){
        return drupal_get_form('my_form');
    }
//why do I need to do that in order to get the submit form working?

    else drupal_goto('wherever');
}

In that case the first condition display my form but if I don't use that code below it won't trigger the submit form.

    elseif($_POST['form_id']){
        return drupal_get_form('my_form');
    }

The form is working fine, same goes for the submit, it's somehow related to that condition. I've got the feeling that because the submit is a button it will reload in order to get the form_submit but will fail to retrieve it as the condition is not working anymore.
Does the drupal_retrieve_form would be more appropriate?


texts: How to Display a pdf, rft, doc, txt on a overlay?

texts:
I collect user resumes by using a file field. That field is been display it on view and when you click on it it would download the resume file (either pdf, rft, doc, txt). I would like to open that document a overlay instead of downloading the document.

How can I achieve this ?


texts:
Drupal 7: Privatemsg.

The following statement, when included in the privatemsg-view.tpl.php template prints the author's picture:

print theme('user_picture', array('account' => $message->author));

How do I modify it to include an image style?

Any help is greatly appreciated. Thank you. :)


texts: Shrinking the '_webform_submissions' database table?

texts:
I manage a large Drupal7 website for a radio station and I built a few custom PHP pages that piggy back onto Drupal's webform module for dealing with giveaways (we give away tickets, CDs, books, etc. a few times a week, listeners submit an online form, etc). Folks submit a single Drupal form, the form contains a dropdown menu for the giveaway items where the key is the nid of the giveaway item node. Our staff then uses my PHP script to select giveaway winners at random and then they email them.

The PHP script is getting slower and slower and it's because the database of submissions is getting really really big.

Do you think it's alright to delete most of the older entries in the database table? BTW, there's a separate table that stores only the giveaway winners in case we need to pull up their contact info.

What's the easiest/best way to do that? We can probably assume that all entries from 2017 and ealier are no longer needed. I would want to use phpMyAdmin.

Drupal's webform module works by putting all webform submission in one table, _webform_submissions, and all data in another table, _webform_submitted_data. Both have a nid field so I could say if nid=30 maybe, but only the first one has a date file ('submitted')

Maybe this?

DELETE FROM live_webform_submissions WHERE nid=30 AND submitted < 1483228800;

1483228800 = 1/1/17

And should I only shrink the live_webform_submissions table and not the _webform_submitted_data table? That may depend on what webform_get_submissions() sorts through.

I can test it on a testing copy of the site first before doing this operation to the live table. Save a backup first of course.

The PHP script works by getting all submissions via the webform_get_submissions() function, with a filter for the giveaways form (that is used for all giveaway items). Then my code sorts out the ones for the specific giveaway item via it's nid - this is where there's some major slow down probably.

Here's how that works (the actual code is a lot longer, message me if you would like to see the whole thing)

function print_giveaway_winners($nid) {
  $form = node_load(30); // giveaway entry is always for one form, node # 30
  $num = $_REQUEST['number'];

  print "
Number of winners to choose: ".$num."
";

  // first we need to get all submission for the
  $submissions = webform_get_submissions($form->nid);

  // filter out ones that are for our giveaway $nid
  $maybes = array();
  foreach($submissions as $submission) {
    if ($submission->data[1]['value'][0] == $nid) {
      $maybes[] = $submission;
    }
  }

  // unpublish it now
  unpublish_node($nid);

  $winners = array();
  for ($i=0; $i<$num; $i++) {

    $winner = get_giveaway_winner($maybes);
    $output = webform_submission_render($form, $winner, NULL, 'html');
    print render($output);
}

// choose a random winner from an array of potential winners
function get_giveaway_winner(&$maybes) {

  // choose one at random
  $rand_key = array_rand($maybes, 1);
  $winner = $maybes[$rand_key];

  // remove it from the list of potential winners so it can't be selected again
  unset($maybes[$rand_key]);

  return $winner;
}


texts:
I am using linkchecker and revisioning modules on a website with plenty of redirects.
At the moment when linkchecker detects a redirect, it changes the link in the body field...This creates a new revision, which is not published.

Can I influence the behaviour somehow and whenever linkchecker creates a revision, to publish the revision.

EDIT:
Sample logic ?:

Add new user "linkchecker"
Under Linkchecker configuration,impersonate Linkchecker with this user.
Delete all of the current unpublished revisions, after that run the linkchecker from cron, it will create new unpublished revisions with user Linkchecker
Programmatically change to that revision all of the nodes that have revisions from "linkchecker user"

Best regards.

Oleg


texts: How to prevent users from accessing content?

texts:
Newbie doing tutorial.

I want to deny anonymous access to my site.
My Tutorial (not up to date for V7) says unCheck "Access Content" to disallow access.
This permission does not exist (or I could not find it).
Is unChecking "Access Content" the same as unChecking "View Published Content"?

Have I found the wrong permission?


texts: How to check if a user has ever ordered a product/list of products

texts:
Given a list of product IDs, I'm trying to determine if a user has ever purchased any of them.

At the moment my logic consists of loading all the orders related to a user, then looping through the order lines to check individual product IDs:

$ordered = FALSE;

$node_wrapper = entity_metadata_wrapper('node', $node);
$product_ids = array();
foreach ($node_wrapper->field_products as $product) {
  $product_ids[] = $product->product_id->value();
}

$orders = commerce_order_load_multiple(array(), array('uid' => $account->uid, 'status' => 'checkout_checkout'));
foreach ($orders as $order) {
  $wrapper = entity_metadata_wrapper('commerce_order', $order);
  foreach ($wrapper->commerce_line_items as $order_line) {
    $product = $order_line->commerce_product;
    if (in_array($product->product_id->value(), $product_ids)) {
      $ordered = TRUE;
    }
  }
}

This feels like a long way round, and that perhaps I'm missing a helper function somewhere in Commerce that would get me this information.

Anyone know if such a function exists, or if there's a more elegant method to get this data?

NB. I know 'checkout_checkout' isn't the right order status for the production code, this is just test code at the moment.

I'm looking for an API solution to this; building up an SQL query would obviously be very easy, but more verbose and error-prone. What I'm looking for is a more elegant solution than my existing one (if one exists; it might not).


texts: How to group and merge results together in Views?

texts:
I have Views setup to list only nodes of a certain type and group them by a field. It looks somewhat like this:

Group 1:
Title A
Title B

Group 2:
Title C

Now I want to merge the Titles togehter so it looks like this:

Group 1:
Title A & Title B

Group 2:
Title C

How can I do this?


texts: pathauto patterns showing an empty page drupal 7

texts:
When loading admin/config/search/path/patterns no content/form is showing up.
Is there any way to show up the content of the patterns...?


texts: Restricting node access for nodes that are associated with other nodes which have user reference

texts:
I have one content type Jobs. These include a user reference field which is the contact.

I have another content type called Job Applications. The include a node reference field that links to Jobs.

How can I make so that public if someone attempts to read a URL for a job application, they won't be able to access that node unless they are contained in the user reference in the job node associated with that job application node.

I know that nodeaccess modules offers restrictions for content types containing user reference. I could add a contact user reference field in the job application content type BUT how do I keep it hidden (I think there is a module for hidding fields) AND more importantly how do I automate things so that when a job is selected (or used through node reference auto url) the hidden contact user reference field will automatically adjust based on that job node's user reference field.

Note: I don't want to restrict access by roles.

Update:

Job
Contact (user reference)

Job Applications
Job (node reference)
Contact (user reference) <-------- I need this to be copied automatically from the job (that is referenced in the node reference) contact user reference


texts: How can I render a birthday field to display only Day and month

texts:
I am trying to render a birthday field to display only Day and month.

user's birthday is 07/21/1971

When I print:

<?php print render($user_profile['field_birthday']);

I get this: Wednesday, July 21, 1971

I added this to get only day and month:

<?php print date("F jS", mktime(0,0,0,$account->profile_birthday["month"],$account->profile_birthday["day"])); ?><br>

it gives me this:
November 30th

Any idea why?
Thanks for any help, RJ


texts: CCK Node Reference options not showing "this post can't be referenced."

texts:
I have a CCK field of node reference. As user 1 I can set the node ference field to a node. I will see something like Node Title[nid:123]. When I go in as another user I see [nid:123]. When I go to save the node I get the message:

  Field: this post can't be referenced.

I can't work out why I am getting this. Any ideas?


texts: Where does the value $ds_content come from in display suite templates?

texts:
After updating to the newest version of display suite I noticed that in display suite ds-reset.tpl.php the value for $ds_content is now blank.

<?php

/**
 * @file
 * Display Suite reset template.
 */
?>
<?php print $ds_content; ?>
<?php if (!empty($drupal_render_children)): ?>
  <?php print $drupal_render_children ?>
<?php endif; ?>

Where is this value assigned so I can better troubleshoot what the problem is.


texts: Sensitive data on configuration managment

texts: How can I prevent some sensitive data (e.g. password for the SMTP module) from getting into my repo as part of the Configuration Management system?


texts: Why are we getting anonymous account creation on a site where this is turned off?

texts:
On one of our Drupal 7 sites (it's at v. 7.32) we're getting occasional 'bot based account creation requests. This is an information-only site where regular users will never log in, only administrators should be allowed to create accounts and only administrators and content creators can log in.

In Configuration under People "Who can register accounts?" is set to "Adminstrators only." Is that not sufficient to stop this from happening?

The accounts are being created but the admin email is being contacted to approve them, so these users are not actually able to log in, but we'd like to stop this account creation altogether.

Has anyone ever seen this?


texts: How do I use an absolute URL to set as breadcrumb link?

texts:
I would like to use absolute URL instead of relative URL as the breadcrumb link on my website. Right now, I am using Drupal 7 and Path Breadcrumb 7.x-3.0 Module. All my breadcrumbs are set by Module.

This is a sample of my breadcrumb right now.

You are here

                Home »
                Category

       &gt;
      Dimmer

How can I make the breadcrumbs like these?

You are here

                Home »
                Category

       &gt;
      Dimmer

EDIT

My breadcrumb code is generated by print $breadcrumb; in the page.tpl.php file. How can I convert the breadcrumb link from Relative to Absolute in this case?


texts: newly created fields values are not loaded with node_load

texts:
I am loading nodes with node_load in one of my tpl.php, so i can get custom built teasers of nodes of specific content type in that tpl. Everything works fine, but from some unknown point of time i am not able to pull field values with node_load. Fields are included in node object, but there are no values in array!

For other custom fields i am able to get values, but for every newly created field- no value! (value is present in edit form and in database)

I am node_load-ing from tpl file of another content type. When i am trying to load those new fields from the tpl.php of its own content type, they are appearing.

But i see no logic because i have other custom fields that are being read with no problem.

Help please, i am pulling my hairs!


texts: Content Type based template not working for Medical Zymphonies Theme

texts:
I downloaded the Medical Zymphonies Theme and has been modifying that to create my own theme.

In the past, I have successfully used content type-specific template files with themes that I created. However, it is not working the current theme.
This is the template file for the theme.

I want a template specifically to basic page. So something like page--basic-page.tpl.php.


texts: An illegal choice has been detected when I submit my webform module

texts:
I am getting this error

  An illegal choice has been detected

when I am submitting my webform and that is happening only on the select fields , as i read on the internet it suppose to have default value but i don't know how to put it in the code I am editing my webform-form-16.tpl and I have the code like this.

$form['submitted']['material']['#title']='';
$form['submitted']['material']['#prefix']='
Material:
&nbsp;';
$form['submitted']['material']['#options'] = array('Steel'=>'Steel','Yellow Gold'=>'Yellow Gold','White Gold'=>'White Gold','Steel and Yellow Gold'=>'Steel and Yellow Gold');
$form['submitted']['material']['#suffix']='
';


texts:
Currently I maintain 10 different Drupal 7 web sites. They were designed and built by 3 different developers. These sites are running on 3 different platform types. Some are on a dedicated server, some on a VPS server and some on Pantheon. The dedicated and VPS servers are running Apache 2 and Pantheon uses Nginx. They are on various versions of the Drupal core, between 7.43 - 7.56.

All of these sites are experiencing the same issue, at some point the main navigation menu which displays on all the site pages just stops displaying. When this happens there are no errors in the Apache or Drupal logs.

On the dedicated server and the VPS servers clearing the Drupal cache (sometimes more than once) will bring the menus back. On the Pantheon servers, clearing the Drupal cache (even multiple times) does not work. The only way to do it is to clear the cache for the site in the Pantheon dashboard for that particular site.

The only common things between these sites are:

There is nothing "special" about these menus. They were all designed using the standard Drupal utility in the Structure menu
They are all sub-themed using the Drupal Bootstrap 3 as the base theme, currently at 7x-3.13

Google hasn't helped so I'm wondering if anyone has seen this error and if so, where I can start looking to correct the issue.


texts: How to edit a field--field-xxx.tpl file when the content is rendered with Display Suite?

texts:
I want to show up to 3 images in my teasers. For that I override the field--field-image.tpl file in my theme directory and it works perfectly.

<?php

if ($element['#view_mode'] == 'teaser') {
    $items = array(array_slice($items, 0,3));
    }

    print "
".render($items)."
";
?>

I would like to use a Display Suite layout instead for the teaser, but the field--field-image.tpl has no effect anymore. Where should I put this code to achieve the same effect (up to 3 thumbnails) using a Display Suite layout?


texts:
Below is my form and form submission function. The form is displayed in page-front.tpl.php. Using this code i could print $_POST variable in the front page. But i would like to submit to some other page say page-result.tpl.php. How could i do that without using $_session variables

    function q_search_form($form_state) {

$form['category'] = array(
    '#type' => 'select',
    '#options' => array('' => 'Any', 2 => 'Automotive', 1 => 'Real Estate'),
    '#attributes' => array('class' => 'drop-box'),
    '#prefix' => '

Select Category	',
    '#suffix' => '
'
);
$form['city'] = array(
    '#type' => 'select',
    '#options' => array('' => 'Any', 'kozhikode' => 'Kozhikode', 'kochi' => 'Kochi'),
    '#attributes' => array('class' => 'drop-box'),
    '#prefix' => '
City	',
    '#suffix' => '
'
);
$form['property'] = array(
    '#type' => 'select',
    '#options' => array('' => 'Any', 18 => 'Land and House', 17 => 'Land'),
    '#attributes' => array('class' => 'drop-box'),
    '#prefix' => '
Property	',
    '#suffix' => '
'
);
$form['wanto'] = array(
    '#type' => 'select',
    '#options' => array('' => 'Any', 'sell' => 'Sell', 'buy' => 'Buy'),
    '#attributes' => array('class' => 'drop-box'),
    '#prefix' => '
Want to	',
    '#suffix' => '
'
);
$form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Search'),
    '#attributes' => array('id' => 'Search', 'class' => 'srch-button'),
    '#prefix' => '
Advance Search	',
    '#suffix' => '

'
);

return $form;
}

  function q_search_form_submit($form, &$form_state) {
    $wantto = $form_state['values']['wanto'];
    $property = $form_state['values']['property'];
    $city = $form_state['values']['city'];
    $category = $form_state['values']['category'];

    $sql = ' SELECT A.nid FROM node A
        LEFT JOIN content_type_item B ON A.vid = B.vid
        LEFT JOIN term_node C ON A.vid = C.vid
        LEFT JOIN term_hierarchy D ON D.tid = C.tid
        WHERE A.type = "item"
        AND B.field_tr_type_value = "'.$wantto.'"
        AND B.field_city_value = "'.$city.'"
        AND D.parent = '.$category.'
        AND C.tid = '.$property.'
      ';
   $result = db_query($sql);
  while ($row = db_fetch_array($result)) {
     $output['srch_result_nid'][] = $row['nid'];
    }

  $form_state['rebuild'] = TRUE;

  }


texts: Is it safe to apply last update when a module has several updates available?

texts:
Have an old Drupal 6 site that has a lot of available updates for modules, core and theme.

When a module has several updates available from the currently installed one to the latest, I understand it's safer to apply them in order. Can I skip this and just install the latest version of the module? Is there a way to know when it's safe, and when not? Visiting updating notes tells about bug fixed, but no info about this. Is there a way to know if the update will make changes to database, so if I have a pre-production and production enviroment, can plan accordingly?

Also for core Drupal updates, I think that in that case applying every update in order is mandatory. Am I right?

I've checked official Drupal information abaout updates, but doesn't state anything about it (it says that you can update multiple modules at the same time, but beware of dependencies between them).


texts: Give permission to translate a specific language

texts:
I want to give an editor the permission to translate only (a) specific language(s).
By default a user can translate content to all available languages.

Any ideas?


texts:
How can I create a form for a specific content type so that it can be accessed publicly, I mean by user that has no administrative rights but on this content type only?
I specificly need to hide all options like publication options, menu options etc from the basic form.

Thanks


texts: Drupal 8 Forms/Webforms Ajax Callback Elements

texts:
I'm looking to add/edit elements on a Drupal 8 webform with Ajax Callbacks, I've read up on the buildForm technique, however my problem is a little more complicated, in that I am actually trying to do all of this inside of a custom composite element, not a form object.

Adding a new element via HtmlCommand is no problem, however any '#ajax' callbacks I add to this new element do not get initialised.

Thanks.


texts: How DO I store/retrieve data and display them in templates?

texts: Coming from THE MVC pattern of Django, I am unable to grasp the concept in Drupal 8. I know Twig is used for templating, but what about storing/retrieving data in Drupal 8 and displaying them in templates? Suppose I have a content type (Activity) with fields like Image, Body, Files, etc. Someone can create multiple activities with a WYSIWYG editor. How do I retrieve all these nodes and display them in a page applying my own styles (not using views). Django Views are suitable for this. Can I do this without developing a module?


texts: Feeds: use custom field as unique field for mapping

texts:
I am using D7, Feeds, XPath Parser.
For mapping, I need to use a custom field as the unique field. I am retreiving data from booking.com and the unique value their is the hotel id, so i need to save this hotel id from the user as well as retrieve data from booking.com bsed on this unique field and map to my contents based on this unique field.

In the documentation of feeds i found this -
Use field other than nid as unique node field in feeds for 7.x-2.x

It says you need to apply a patch from this comment - http://drupal.org/node/661606#comment-5921904

This patch applies to a file called field.inc in the mappers folder of feeds. However this file is not even present there.
The patch also applies to another file, however running the patch gives errors.

Is field.inc actually present in feeds/mappers?
Am I making some mistake in applying the patch?
Is there any other way of achieving  - custom field as unique field for mapping?

Any help on this would be greatly appreciated. Thank you.


texts: Debugging a custom module with XDebug and PHPUnit

texts:
How can I debug a custom module in Drupal 7 using Xdebug and PHPUnit? That is, I would like to debug and perhaps write some unit tests to eliminate some basic potential problems.

This is a code I inherited that is misbehaving. I am relatively new to Drupal but have some PHP skills.

Any advice is appreciated.


texts: Drush suddenly stopped working can't use PM command

texts:
Suddenly having errors in drush with aquia dev desktop...it's been working fine for a year at least and now this:

C:\aquiasites\fixing\sites\all\modules>drush en color_field -y
Command pm-enable needs a higher bootstrap level to run - you will [error]
need to invoke drush from a more functional Drupal environment to run
this command.
The drush command 'en color_field' could not be executed. [error]

Any idea what is happening?

Runnin WIndows 7 64


texts: Rules: Send mail to author when value in date field has passed

texts:
So, I have a content type "contest" which has an "end date" field. I want to setup rules so the author of a "contest" gets an e-mail as a reminder that the contest ended.

As event I used "Cron maintenance tasks are performed" and as condition I try to use "Data Comparison" to check the value of the end date to be smaller than current site time. The problem is I can't use the token of the "end date" field as my event is not node-related. I tried to add a "Content is of type" condition, but also here, I can't select anything node-related.

I feel like overlooking something small but I've been searching now several hours and could use some help..


texts: Webform 7x-4.10: adding a field type to webforms

texts:
I'm trying to add an existing field type into the list of available fields Webform can access.

I have a field type of "field_attachment". In my other content types, this allows me to upload a file and all user types can download it.

For one of my webforms, I would like the user (any type) to be able to download a file. They do not need to have answered any questions, so I don't need a protected download lock on it. In fact, that would be counterproductive for what I need.

I can't figure out how to add this field type in admin/config/content/webform. Any help would be appreciated.

Thanks in advance.


texts:
I have the Webform module version  8.x-5.0-beta9, and when I try to uninstall the module Drush asks me to uninstall the webform_demo_application_evaluation module, first. When I try
drush pm-uninstall webform_demo_application_evaluation, it throws an error.

  PHP Fatal error: Call to a member function getColumns() on boolean in
  /var/www-drupal/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php on
  line 227
  Drush command terminated abnormally due to an unrecoverable error.
  Error: Call to a member function getColumns() on boolean in /var/www-drupal/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php, line 227

How do I resolve this issue? Do I need to install the development snapshot?


texts: How can I create a custom module that can be reinstalled without throwing an error?

texts:
I'm creating a custom module based off of Bootstrap Paragraphs, with a bunch of configuration files for custom paragraph types.
The configuration includes a bunch of field.storage. files, which AFAICT result in tables being created in the underlying MySQL data store for the respective fields.

The module is under active development, and I often need to reinstall it to pick up new changes.
Whenever I uninstall it and install it again, I get the error

  Uncaught PHP Exception Drupal\Core\Entity\EntityStorageException: "'field_config' entity with ID 'paragraph.custom_component.custom_component_field' already exists." at /var/www/html/core/lib/Drupal/Core/Entity/EntityStorageBase.php line 425, referer: http://localhost:2345/admin/modules.

My best interpretation of this error is that the MySQL store already contains this table, so it can't be created.
Sure enough, when I access MySQL, the tables are there, even after module uninstallation.
Elsewhere, I've seen people say that in Drupal 8 uninstalling a module should cause all traces of the module to be removed, but that doesn't seem to be the case for me.

How can I set up my component so that it will delete the fields from the store when I uninstall it? Is there a better approach I should consider?

What I've tried

Overriding hook_uninstall() in the module file and adding the following code

\Drupal::configFactory()
  ->getEditable('field.storage.custom_component.custom_component_field')
  ->delete();

Renaming the config/install directory to config/optional
Purging configuration using the "Purge Configuration" tab available from the Easy Install module


texts:
I have create a hook to alter page funcionality. It's posible invoke javascript function in hook.
          I test this function but i had this error -->  Call to undefined function alert()

      function catalogo_preprocess_node(&$vars)
      {
        alert("hello");
      }


texts: Edit tab available to anonymous user on some but not all pages?

texts:
On a Drupal 6 site that I've inherited, there is a custom content type for staff profiles.  Editing should be limited to two user roles "content creator" and "careers."  This has worked fine for the past 2+ years, but a few weeks ago we noticed that some, but not all, of the individual staff page/nodes are editable buy anonymous users (anyone!).

I've looked at the permissions for this content type as well as for all our user roles-- nothing indicates that this should be possible at all.

The only way I've been able to "fix" this is by recreating the nodes 1-by-1 and deleting the "broken" ones.

I'm particularly curious as to why this only affects some nodes-- I have so far been unable to detect any sort of pattern that connects them.

Any ideas where I should be looking to diagnose this?


texts: Getting different results for admin versus non-admin user on view when there is a relationship

texts:
I have a view that shows the two newest articles with specific taxonomy rules. We got a new requirement to now exclude articles that are linked via entity reference.

So I added the relationship for referencing entities. With just the relationship in place and no filters added, non-admin users only see articles that are related (the relationship is not set to required).

When I add the filter that node ID of the related (referencing) articles should be NULL, non-admin users see nothing, but admin users see the results as they should be.

What can explain the discrepancy and what can fix it?

Drupal 7


texts: drush "The drush command 'self-update' could not be found."

texts:
I'm trying to figure out why many drush commands aren't working.

drush theme list also reports:

  The drush command 'theme list' could not be found.  Run drush
  cache-clear drush to clear the commandfile cache if you have
  installed new extensions.

I'm mildly certain I installed drush via brew install drush.

Any tips?


texts: Aggregate uploaded files for simplified download

texts:
I have a content type that users are uploading a lot of files into, and the client would like to be able to download all of the attached files with a single click. It seems that a server-side compression of all the files would be a good solution, something like Stephen.Colson is trying to do here stephen.colson's sandbox.

I haven't found anything appropriate, though. Is anyone aware of a good solution for aggregating file downloads?


texts:
I want to convert the XML structure below into a PHP array.

<BillingApplyRq>
    <FatoryId>xxxxxx</FatoryId>
    <TotalNum>2</TotalNum>
    <Records>
        <Record>
            <ReturnMsgNo>1</ReturnMsgNo>
            <ReturnMsg></ReturnMsg>
            <TradeSeq>00001</TradeSeq>
        </Record>
        <Record>
        <ReturnMsgNo>1</ReturnMsgNo>
        <ReturnMsg></ReturnMsg>
        <TradeSeq>00002</TradeSeq>
        </Record>
    </Records>
</BillingApplyRq>

Does anyone know how to do that?


texts: Using taxonomies with Field Collection in Drupal 7

texts:
How do you create a taxonomy listing when the field is being used in a field_collection field type?

I'm working on modifying the Article content type for a newspaper website; specifically, I've added two field collections: one is a byline, with two fields ("author" [taxonomy] and "position" [text]; e.g. "Ændrew Rininsland, Production Editor") and another is an image, with three fields plus the image ("caption" [text], "author" [taxonomy], "organization" [text]).
Both of these are set to have unlimited values, such that each story can have multiple bylines and multiple photos, each with its own caption and photo credit.

What I'm wanting to do now is use the "author" taxonomy term to create a listing of each story each author/photographer has contributed to. Simply going to the term's taxonomy page doesn't work; that only lists nodes with attached taxonomy terms, not fields (such as a field_collection). See this issue.


texts: How to disable the page title output of main content?

texts:
I want to output the page title in the 'title' block and not with the main content output. I'm using the Bootstrap theme for Drupal 8.

I've enabled the title block and placed it in its own region but now I've got two page titles being displayed.

I've spent two days and have tried everything to disable the title that is output with   {{ page.content }} in the page.html.twig template.

I do not want to hide it via CSS.

Can the page.content title be disabled?


texts:
I am running into a problem with url alias in my drupal 7 installation:

I have a drupal 7 installation which uses a purchased theme. This theme has a portfolio section (in its demo installation with dummy data). I updated the demo installation and changed all sections are required by my project - everything works out fine.

Now the portfolio section has a url called http://<my_drupal_site>/portfolio/4 I need it to be http://<my_drupal_site>/branch-locator. Things I have tried/noticed so far:

I checked the node table, the url_alias table, the admin > content section as well as admin > search > url_alias there is nothing related to portfolio/4. When I open the corresponding block it does not have any body/code in it (I believe that is because it is a block that is part of the theme). When I open the view, I still am not able to find anything where portfolio/4 is mentioned.
The only place where I found portfolio/4 was in menu_router table which had an entry for the same. I updated this record to branch-locator and everything worked fine for a few minutes. Then it showed me a 404 error. When I went back to the menu_router table I found that portfolio/4 was back again in place of branch-locator. (I read somewhere that menu_router table gets cleaned and recreated somehow - not sure how)

So my question is, how can I have portfolio/4 get rendered as branch-locator? Since this is a custom theme I know it will be hard for anyone to give an exact answer how to solve this, but any pointers will be VERY much appreciated!!

P.S - I am not sure what tags to add..If you feel this question can be better tagged, please do so :)


texts: Can You Have An Exposed Filter In One Page Of A View But Not On Another?

texts:
I have a View with two Pages. On the first Page I want to have an Exposed filter for User ID. On the other I want to use a Contextual Filter to dynamically filter a single UID.

Is it possible to do this on one View...

ie. have the Exposed Filter on the first Page Display and the Contextual on the other?

Or do I need to create two similar views to accomplish this?

It seems like I can override the -display- of the Exposed filter but not whether it is applied to the SQL Query.


texts: Single on/off checkbox default value not work

texts:
I have a boolean user profile field which is single on/off checkbox, says 'field_user_flag'. Its On value is 1 and Off value is 0. But I could not set #default_value = 1 from hook_form_alter to save "1" into its table field_data_field_user_flag and field_revision_field_user_flag.

When it is 0 and unchecked in user/*/edit, I would like to set it to 1 and checked. Thus, I did it in my hook_form_alter as below.

$form['field_user_flag']['#default_value'] = 1;
$form['field_user_flag']['#attributes'] = array('checked' => 'checked');

But, it did not work. I created the field in account settings (admin/config/people/accounts/fields/) without using Profile 2 module.


texts:
I have created some pages by writting custom module using hook_menu; those pages were hard-coded in content type template files before. But now, i miss some node functionality, template elements like social blocks (service links), comments etc.

Could module somehow register the page as part of content type (mimic itself as node of content type), or could i inject the page from module inside content type ?

Thanks for your clues!


texts: Error non-numeric value encountered when edit type content

texts:
When I edit a type content published I receive the following error:

THe fields in type content is:

Maybe a problem in the php version?
Drupal version: 7.75
PHP Version 7.1.24


texts: How do I disable the Update manager module?

texts: Is it possible to disable The Update manager module without uninstalling it?


texts:
I want to run a migration import but it only imported for me first 100 items (I didn't use --limit option!).

when running drush migrate-status I get this result:

Group: my_migrate       Total  Imported  Unprocessed  Status  Last imported
MIGRATION_CLASS_NAME     2197   100       2097         Idle    2015-10-01 12:37:31

when I try again with migrate-import it won't import any new item :

Processed 0 (0 created, 0 updated, 0 failed, 0 ignored) in 0.3 sec (0/min) - done with 'MIGRATION_CLASS_NAME'

(I rolled back migration and import again, and the same results : only 100 items!)

this is the class :

class MIGRATION_CLASS_NAME extends BaseMigration {
  public function __construct($arguments) {
    parent::__construct($arguments);
    $this->description = t('From content type to Taxonomy terms');

    $this->map = new MigrateSQLMap($this->machineName,
        array('nid' => array(
                'type' => 'int',
                'not null' => TRUE,
                'description' => 'node ID.'
                )
            ),
            MigrateDestinationTerm::getKeySchema(),
            $this->sourceConnection

    );

    // Create query
    $query = Database::getConnection('default', $this->sourceConnection)
            ->select(MIGRATION_DATABASE_NAME.'.node', 'n')
            ->fields('n')
            ->condition('n.type', 'TYPE');

    $query->leftJoin('field_data_meta_description', 'md', '(md.entity_id = n.nid AND md.bundle = n.type)');
    $query->addField('md', 'meta_description_metatags_quick');

    $query->leftJoin('field_data_field_slide_beschreibung', 'b', '(b.entity_id = n.nid)');
    $query->addField('b', 'field_slide_beschreibung_value');

    $query->leftJoin('field_data_field_slide_motiv', 'i', '(i.entity_id = n.nid AND i.bundle = n.type)');
    $query->addField('i', 'field_slide_motiv_fid');

    $query->leftJoin('field_data_field_ref_tb_to_tax_teilgebiet', 't', '(t.entity_id = n.nid AND t.bundle = n.type)');
    $query->addField('t', 'field_ref_tb_to_tax_teilgebiet_tid');

    $query->leftJoin('field_data_field_ref_tb_to_bundes_jahr', 'l', '(l.entity_id = n.nid AND l.bundle = n.type)');
    $query->addField('l', 'field_ref_tb_to_bundes_jahr_tid');

    $this->source = new MigrateSourceSQL($query, array(), NULL,
  array('map_joinable' => FALSE)); // I tried also without "map_joinable" option.
    $this->destination = new MigrateDestinationTerm('TERM');

    //Make the mapping here
    ...

  }

}

Has anyone get like this strange import before, or if you have any idea why it won't import.
Thanks in advance.


texts:
I have installed ECK module in my website. Using it I have created a "report eck" entity in which I have different bundles like section, notes, etc., each containing different fields.
I have my content type "Report" in which I have referred "report eck" entity using entity reference field.
Now, in my nice template, I need to get various values including the bundle type, in which I am facing lots of trouble. My bundle type is coming up as following when I am doing kint() on my reference field, but I am not able to get this bundle type and many other values, please guide.

Also, it seems to be a protected values, so I navigated to "Available Methods" tabs and found method 'getEntityKey()' which seems to be useful, but how can I use it in twig template??


texts: Add content link not shown for custom content if not granted permission to create basic page or article

texts:
Hi all and first of all thanks for reading!!

I written a module that creates a custom content type and manages its permissions.

All works well for authenticated user whom i grant permissions to create and edit that custom content type, the only thing doesn't work is the "add content" link in menu navigation.

The authenticated user see the navigation menu and, if i copy and paste the link, is able to create custom content, but the link "add content" is not shown unless i grant permission also to create basic page or article page.
This is very confusing me.
Someone could help?

Many thanks.

Best regards.


texts: Using Drupal 6's form ahah to have one dropdown field update the values of a second dropdown field

texts:
I am working on a pair of form fields the directly effect one another. Specifically the problem I am dealing with is that we have thousands of groups users can join on this website that I have been working on. We are creating some administrative analytics forms for the site. Part of those forms is filtering by group.

The problem is that most of the people don't know the name of a group off the top of their heads, only what it starts with. So instead of using auto-complete we came up with two dropdowns. The first contains the options A through Z, letters of the alphabet which the group names begin with. The second dropdown contains all of the groups beginning with the selected letter.

The concept is simple enough and we were able to implement the AJAX pretty easy with jQuery. But this causes validation errors. After some research I found that this has to do with Drupal form caching. The solution is to use the ahah functions.

The problem with that is that all the instructions I have found so far deal with ahah actions for the specified field updating itself, not another field. So I am trying to figure out how to get the list of letters to update the group list using ahah and registering the new values with the form cache.

One solution I found was to simply load all the values on the page in a hidden dropdown and then just load up those in the set in the visible one as needed. But that creates a bunch of problems because the client uses almost exclusively IE and we have seen IE choke when given huge lists like that. Especially with the lists stored in JavaScript. So we need a light-weight solution.

Any thoughts? Ideas?


texts: Drupal 7 : I want "Access Denied on Node but Title listing in view"

texts:
I used content access for restricting content of particular content type.

Anonymous user can't see Node and get Access Denied But want to listing of those restricted node's title to Anonymous user.
I searched and found premium content module but not found way to use it.

What I want,When Anonymous go:
On node == Access Denied,
On View (listing Title) == can see Title.

kindly help me for premium content OR any other Solution.


texts:
Still getting my head around Drupal 8 after using Drupal 7 for so long. I want to override (alter) the node delete action. Now in Drupal 7 I would have used  node_delete_confirm_submit() and hook_node_delete() or similar such as using hook_form_alter and changing the submit function.

In Drupal 8 this has partly changed. I can still use hook_node_delete(), but there is no node_delete_confirm_submit() which was deprecated in favor of \Drupal\Core\Form\ConfirmFormBase. Rather than try and create a hack I would like to learn the proper way I should be doing this.

I have tried to use ConfirmFormBase. I have a src/Form/DeleteXXXConfirm.php file.

namespace Drupal\XXX\Form;

use Drupal\Core\Form\ConfirmFormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;

class DeleteXXXConfirm extends ConfirmFormBase {

   ... code here for confirm and delete ...

}

Since I want to override node/nid/delete, I assumed the routing file would look something like this.

XXX.delete:
  path: '/node/{id}/delete'
  defaults:
    _form: '\Drupal\XXX\Form\DeleteXXXConfirm'
    _title: 'Confirm Deletion'
  requirements:
    _permission: 'administer site configuration'
    id: ^\d+$

This doesn't appear to work, do I need a Controller? Or am I totally barking up the wrong tree? I am obviously misunderstanding something. Can anyone point me in the right direction?


texts: How to create a cronjob to update all nodes

texts:
I have a content type that has a computed field that needs to be updated constantly.
So I need to create a cronjob to update all nodes of a certain type (example 'page'), so that the code is executed from the computed field and its value updated.

thx


texts: Update the existing content having custom field as GUID

texts:
I want to update the contents view feeds. I have set the custom field as GUID in Node Mapping. So when importing it via csv in feeds it makes the unique field as guid and sets the guid in field value.

But if I add a content manually by node/add/content_type and the update it via feeds module it creates a new content. It means GUID for the manually created node is not set.

Is there any way to do it?


texts: How can I specify where an image is uploaded

texts: I have a slideshow block that does a slideshow for a news stories that take two images.  An image for the page and a teaser image for the slideshow.  but the image never shows up in the slideshow.  The image url is sites/default/files/styles/mt_slideshow/public   but the actual location of the image after its uploaded is sites/default/files.   so is there a way to force the image to be uploded where this site is looking, or change where the site looks to where the image  is uploaded?