texts: Commerce: How to save user data (in the order date) when delete it

texts:
Hi all for one of my client site I use Drupal Commerce.

Now: when an user make an order his/her uid and email are stored in the order's tables (I don't know which one, but this is not important) and this is ok.

When the user (or the administrator) delete his/her account all orders related to this user lost account information so in commerce there are orders without uid and email, and this is not good: How to know which is the client that have bought the order XYZ ?

How can I resolve this problem ? Is there the possibility to not delete this information. Other commerce suite like Prestashop op Magento do not have this problem.

M.


texts: Ajax error on dependent dropdown. Drupal 7

texts:
I am trying to get the following dependent dropdown to work, however I constantly get the following error. So far could not figure out what the problem is. I was wondering if anyone has had a similar problem and might have the solution for it.

  An AJAX HTTP error occurred. HTTP Result Code: 200 Debugging
  information follows. Path: /?q=system/ajax StatusText: OK
  ResponseText: stringstring(1) "2" array[ {"command":"settings",
  "settings":{"basePath":"\u002F", "pathPrefix":"",
  "ajaxPageState":{"theme":"bartik",
  "theme_token":"Ghiw-ikiaoP9ioC23jfb6h1vvIuA4G_nb3NBGO0mfEA"},
  "overlay":{"paths":{"admin":"node\u002F*\u002Fwebform\u000Anode\u002F*\u002Fwebform\u002F*\u000Anode\u002F*\u002Fwebform-results\u000Anode\u002F*\u002Fwebform-results\u002F*\u000Anode\u002F*\u002Fsubmission\u002F*\u000Anode\u002F*\u002Fedit\u000Anode\u002F*\u002Fdelete\u000Anode\u002F*\u002Frevisions\u000Anode\u002F*\u002Frevisions\u002F*\u002Frevert\u000Anode\u002F*\u002Frevisions\u002F*\u002Fdelete\u000Anode\u002Fadd\u000Anode\u002Fadd\u002F*\u000Aoverlay\u002Fdismiss-message\u000Auser\u002F*\u002Fshortcuts\u000Aadmin\u000Aadmin\u002F*\u000Abatch\u000Ataxonomy\u002Fterm\u002F*\u002Fedit\u000Auser\u002F*\u002Fcancel\u000Auser\u002F*\u002Fedit\u000Auser\u002F*\u002Fedit\u002F*",
  "non_admin":"admin\u002Fstructure\u002Fblock\u002Fdemo\u002F*\u000Aadmin\u002Freports\u002Fstatus\u002Fphp"},
  "pathPrefixes":[  ], "ajaxCallback":"overlay-ajax"}}, "merge":true},
  {"command":"insert", "method":null, "selector":null, "data":"\u003Cdiv
  id=\u0022second-select-box-replace\u0022\u003E\u003Cdiv
  class=\u0022form-item form-type-select
  form-item-second-select-box\u0022\u003E\u000A  \u003Clabel
  for=\u0022edit-second-select-box--2\u0022\u003EChoose
  \u003C\u002Flabel\u003E\u000A \u003Cselect
  id=\u0022edit-second-select-box--2\u0022
  name=\u0022second_select_box\u0022
  class=\u0022form-select\u0022\u003E\u003Coption
  value=\u00227\u0022\u003ECountries\u003C\u002Foption\u003E\u003Coption
  value=\u00223\u0022\u003EUniverse\u003C\u002Foption\u003E\u003C\u002Fselect\u003E\u000A\u003C\u002Fdiv\u003E\u000A\u003C\u002Fdiv\u003E",
  "settings":null}, {"command":"insert", "method":"prepend",
  "selector":null, "data":"", "settings":null} ]

Here is the code:

function form_new_term_step_two($form, &$form_state){

    $first_options = _step2_first_options_select_box();

    $selected = isset($form_state['values']['first_select_box']) ? $form_state['values']['first_select_box'] : key($first_options);
    //var_dump($selected);

    $form['first_select_box']= array(
        '#type' => 'select',
        '#title' => 'How do you categorize the term ?',
        '#options' => $first_options,
        '#default_value' => $selected,
        '#ajax' => array(
            'callback' => 'ajax_step2_select_callback',
            'wrapper' => 'second-select-box-replace',
        ),

    );

    $form['second_select_box'] = array(
    '#type' => 'select',
    '#title' => 'Choose',
    '#prefix' => '
',
    '#suffix' => '
',
    '#options' => _ajax_example_get_second_dropdown_options($selected),
    '#default_value' => isset($form_state['values']['second_select_box']) ? $form_state['values']['second_select_box'] : '',
  );

    return $form;
}

/*
 * All the Submit and Callback fucntions
 */
function ajax_step2_select_callback($form, $form_state){

    return $form['second_select_box'];

}

function _ajax_example_get_second_dropdown_options($selected= Null){

    $results =  taxonomy_get_term_by_name($selected);
    $tid = array();
    foreach ($results as $objs){

        $tid = $objs->tid;

           }

    $terms = taxonomy_get_children($tid);

    foreach ($terms as $term){

        $options[$term->tid] = $term->name;

    }

    return $options;
}


texts: View: display nodes based on user selected preference

texts:
I'm struggling with a view, principally the contextual filter.

As shown in the picture below (trying to make it clear):

My users can select in which products they are interested (through taxonomy, checkboxes). So they can receive information on the commercial offers when they log in.

My user B is a professional. He created a node for his company B (he's the author), and the company B is selling the products (selected also through taxonomy, checkboxes).
My user B create a commercial offer (= content type, node). This commercial offer is linked (through a field term reference) to his company B. In this way, there is a link between the commercial offer and the product.

The idea is to have a view which display only the commercial offer for the user interested in the product flower.

I created the view, displaying the commercial offer, but I cannot find the right contextual filters.

Thanks for your help.


texts: Cannot find image properties when uploading

texts:
I'm building an LXC based on an existing and working well website. I've checked that all settings where the same.
However, when I want to save a content after having uploaded an image on my LXC, I get the following error:

  PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer
  value.

I have thoroughly searched the web all the day to read every close topic but none gave me a suitable answer.

The fact is when the Field SQL Storage module try to get the properties of my image; it is unable to find its parameters, so the width and height properties are empty and the SQL query is crashing.

Why Drupal can't read my image properties and store them in database?


texts: Why does the Configuration Management module warn not to use in production?

texts:
In the Configurations Management module, right before you click the Import button, it warns:

  Importing configurations will write your configurations directly to the activestore. DO NOT USE THIS ON A PRODUCTION SITE!

Should I heed this warning? If so, why? What's the point of this module if it shouldn't be used in production?!


texts: viewElements Fails To Fire in Custom Field Formatter

texts:
Using the code, below, in my_module in the path my_module/src/Plugin/Field/FieldFormatter/DateRangeSpecialFormatter.php the format appears both in the Views field dialog and the content type manage display dialog, but having selected the format, clearing cache and either loading the page or reloading the view preview, viewElements() does not fire.

The formatter is a clone of a datetime_range formatter.

namespace Drupal\my_module\Plugin\Field\FieldFormatter;

use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\datetime\Plugin\Field\FieldFormatter\DateTimeCustomFormatter;
use Drupal\datetime_range\DateTimeRangeTrait;

/**
 * Plugin implementation of the Special daterange formatter.
 *
 * @FieldFormatter(
 *   id = "daterange_special",
 *   label = @Translation("Special date range formatter"),
 *   field_types = {
 *     "daterange",
 *   }
 * )
 */
class DateRangeSpecialFormatter extends DateTimeCustomFormatter {

  use DateTimeRangeTrait;

  /**
   * {@inheritdoc}
   */
  public static function defaultSettings() {
    return [
        'separator' => '|',
      ] + parent::defaultSettings();
  }

  /**
   * {@inheritdoc}
   */
  public function settingsSummary() {
    $summary = [];
    $summary[] = $this->t('Special daterange formatter.');
    return $summary;
  }

  /**
   * {@inheritdoc}
   */
  public function viewElements(FieldItemListInterface $items, $langcode) {
    $elements = [];
    $separator = $this->getSetting('separator');

    foreach ($items as $delta => $item) {
      if (!empty($item->start_date) && !empty($item->end_date)) {
        /** @var \Drupal\Core\Datetime\DrupalDateTime $start_date */
        $start_date = $item->start_date;
        /** @var \Drupal\Core\Datetime\DrupalDateTime $end_date */
        $end_date = $item->end_date;

        if ($start_date->getTimestamp() !== $end_date->getTimestamp()) {
          $elements[$delta] = [
            'start_date' => $this->buildDate($start_date),
            'separator' => ['#plain_text' => ' ' . $separator . ' '],
            'end_date' => $this->buildDate($end_date),
          ];
        }
        else {
          $elements[$delta] = $this->buildDate($start_date);
        }
      }
    }

    return $elements;
  }

  /**
   * {@inheritdoc}
   */
  public function settingsForm(array $form, FormStateInterface $form_state) {
    $form = parent::settingsForm($form, $form_state);

    $form['date_format'] = [
      '#type' => 'textfield',
      '#title' => $this->t('Date format'),
      '#description' => $this->t('See the documentation for PHP date formats.'),
      '#default_value' => $this->getSetting('date_format'),
    ];

    return $form;
  }

}


texts: Adding conditional css to view or display type

texts:
Hi i have created a view that displays recently viewed items. This displays the 'teaser' display mode of a custom content type. This content type has a field 'favorite'.

What i want is to add a css class to the outer div (on the teaser div or de col-... generated by the view). But only if it is a 'favorite'.

I have created the view in the Drupal backend I could probably do in a custom module. I just want to check if it is possible without any programming.


texts: Best way to create a Facebook Follow button on nodes

texts:
I have some nodes with information about a political candidate. Some of the candidates have a Facebook profile, which I link to using an URL-field.

But they also want a follow button directly on the page. I was thinking of typing in their handle to a text field and create a field formatter to render the code for the actual button.

Is this the best way to do it?


texts:
I can't seem to get my markers to come up in the Gmap module - I've changed permissions, I've checked the gmap_markers.js file, etc.

The map itself comes up, but I can't get any markers to appear.

What could cause this?

Could it be permission settings on my /default/files directory?


texts: How to add a region to display only on a specified page?

texts:
So, I have a region, which should only display on a specific page. Is there a way to have a page-checking condition in the page template to only display the region on the specified page, or do I need to create a page specific .tpl file which should have the region in it?

The issue I'm having is that region is being added to pages without content in them. This is evident, because the CSS border property for the region is being applied despite their being no content in it.
. You can see in the images that there is border applied to the element, which shouldn't be loaded into the page.
Here is the relevant excerpt from my page.tpl

    <?php print render($page['navigation']); ?>

  <?php if(drupal_is_front_page()) {unset($page['content']['system_main']['default_message']);} ?>

        <?php if ($logo): ?>
          <a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home" class="header__logo" id="logo"><img src="<?php print $logo; ?>" alt="<?php print t('Home'); ?>" class="header__logo-image" />
        <?php endif; ?>

        <?php print render($page['header']); ?>

      <?php print render($page['hero']); ?>

        <?php print render($page['highlighted']); ?>
        <?php print $breadcrumb; ?>

        <?php print render($title_prefix); ?>
        <?php if ($title && !drupal_is_front_page()): ?>

<?php print $title; ?>

        <?php endif; ?>
        <?php print render($title_suffix); ?>

        <?php print $messages; ?>
        <?php print render($tabs); ?>
        <?php print render($page['help']); ?>
        <?php if ($action_links): ?>

<?php print render($action_links); ?>

        <?php endif; ?>
        <?php print render($page['content']); ?>

          <?php print render($page['blog_sidebar']); ?>

          <?php print $feed_icons; ?>


texts:
I've been troubleshooting a memcache issue on our Drupal 7 site and in the process the front end CSS broke, meaning all content was unstyled.
The Chrome console has a message:

The resource from “/sites/all/themes/mbm/css/style.scss?qktcrf” was
blocked due to MIME type (“application/octet-stream”) mismatch
(X-Content-Type-Options: nosniff).

Should Drupal be using a .scss file on the front end?
If not, how would I determine where the breakdown of the .scss being converted to a .css file occurs?
Help appreciated.
Steve


texts: How to make user profiles editable by site administrators

texts: For a site I'm building, Profile2 is not an option because it doesn't play with Pathauto. As an alternative, I want to extend the regular user profiles with a mugshot and a bio text field. I don't want the profile owners to have exclusive editing rights over those two extra fields; site administrators should be able to enter the profiles and edit the image and the text as required. Out of the box, this isn't workable because an administrator would need to override the user's password to make any changes to a profile, thus effectively issuing a new password for every change made. Is there a way to give administrators regular editing access to the profiles?


texts:
today i was adding the workflow module to my site and as i was not clear i used a trigger in it. using this trigger I blocked the current user to view the page and now if i login from my admin user it just tell me that The username webmaster has not been activated or is blocked.
please guide me what to do to restore my old position.


texts: How to programmatically add/modify a rule?

texts:
Hello,
I have the Rules module. I tried to programmatically create or modify a rule but it doesn't work. What I tried so far : I created the
MY_MODULE.rules_defaults.inc file and wrote this code :

function MY_MODULE_default_rules_configuration() {
$configs = array();
$rule = { "rules_name" : {
  "LABEL" : "rules ",
  "PLUGIN" : "reaction rule",
  "OWNER" : "rules",
  "REQUIRES" : [ "rules", "mimemail", "uc_cart" ],
  "ON" : { "uc_checkout_complete" : [] },
  "DO" : [
    { "component_rules_commerce_order_status_pending" : { "order" : [ "site:current-cart-order" ] } },
    { "mimemail" : {
        "key" : "[site:name]",
        "to" : "mail@mail.com",
        "subject" : "[site:name]",
        "body" : "Random text",
        "language" : [ "" ]
      }
    }
  ]
}
}
 $configs['rules_name'] = rules_import($rule);
  return $configs;
}

Yet it doesn't work.
I also tried with MY_MODULE_default_rules_configuration_alter() but to no avail.


texts: How can I add context (or distinguish between contexts) to translations with t()?

texts:
I have made a custom address handler for the Addressfield module which uses the word "state" (for the geographic state/province).  However, I'm also using the Revisioning module, which uses the word "State" to describe the state of a piece of content.

Unfortunately, to translate this into Japanese, I need two different words for "State"; how can I get two different strings to appear on the translate interface screen?

(I know I could just re-write "State" in revisioning to something like "Revisioning state" but I'd like to know if there's a way to handle this without altering the strings.)


texts:
I'm struggling theming the taxonomy-term page and since i'm not really getting anywhere, i now embedded two blocks (created with views) in my taxonomy-term.tpl.php. Now, that views is showing everything the way I want it, I don't want the term page itself output its data.
That's why I'm trying codes like

<?php hide($content); ?>

But that won't do the trick. How can I just show the Blocks from Views instead of the content taxonomy provides itself?

Thanks!


texts: What is the equivalent of setting $base_url to serve a site from a different URL?

texts:
I have a drupal 9 installation that is served from let's say http://www.example.com.
How can I make it serve from http://example.com/something?
The code is in /web
I tried adding in htaccess this, with no luck, I get a 404 when visiting http://example.com/something:
RewriteEngine on
RewriteRule ^/?something/(.*)$ /$1 [QSA,END]

In drupal 7 I would do it with base_url if I remember correctly.
It drives me crazy!!!! Any ideas?


texts: How to get the part of URI and pass it to as a argument?

texts:
I can access current path using method \Drupal::request()->getRequestUri(); as shown below.

    function bartik_preprocess_node(&$variables) {
        $variables['current_path'] = \Drupal::request()->getRequestUri();
    }

Now, this is giving me path, /drupal8101/user/1 if I am on the user1 profile page. (Complete path of site:http://localhost:8888/drupal8101/user/1), which is working right.

So, if I want to put any argument in the twig file, it is fulfilling only for /drupal8101/user/1, that is understood.

    {% if current_path == '/drupal8101/user/1'%}
       .............
    {% endif %}

In above case it is working fine, But what can I do to get that condition worked for all users like /drupal8101/user/*.

In short, I want following kind of thing,

    {% if current_path == '/drupal8101/user/*'%}
       .............
    {% endif %}


texts:
I am trying to setup a filefield using imce to allow the user to upload files however I am having problems setting it up trying to get a unique folder for each node.

So for example I have set the imce directory path to

php: return $user->name.'/'.date('Y-m-d-H-i');

Which will upload files to user/2015-06-12-13-15.

However when the I click use the file browser if I don't upload the file within the same minute as when I clicked use the file browser, IMCE throws an error saying the directory doesn't exist as I imagine the date change throws off the upload.

I don't want to restrict users creating one node an hour so does anyone know of another way of generating random file paths for each node?


texts: How is the module Userpoints Donation intended to work?

texts:
I enabled the Userpoints Donation module (part of Userpoints Contrib). Then I put a check in the settings for the type of material - (Choose which content types should show a donate points link).

What's next? Nothing has changed. It says "Only the checked content types will show a donate points link". But no reference appeared.


texts:
I`m using Drupal 7 and i have added some extra fields in People > Account Settings.

What I`m trying to accomplish is to give logged in user link ( in sidebar block ) to export those fields into .pdf

I created a view with all user fields and i found module called Views Data Export

But unfortunately it does not support PDF. Is there any other way/module to do this?


texts: How can i create theme's block width should be configured from dynamically

texts:
I want to develop a drupal theme, where

  The theme should be develop in a way that the number of the columns of
  the theme and the width of the columns can be configured from the
  Admin area.

Can anyone guide me how to approach in theme development ?


texts: Form API + AJAX - Form doubles itself on submit

texts:
I've been looking for an answer to this for hours now.

A) No matter what I do, the form will always be visible again after submit. How can I stop the from from displaying after a successful submit?

B) If there are validation errors, the form will attach to the existing form, resulting in 2,3,4,5,.. forms on the page. How to stop that?

This is the code:

function agals_support_form($form, &$form_state) {
$form['wrapper'] = array("#markup" => "

");

$form['name'] = array(
  '#type' => 'textfield',
  '#title' => t('Name'),
  '#default_value' => '',
  '#maxlength' => '128',
  '#required' => TRUE,
);

$form['submit'] = array(
  '#type' => 'submit',
  '#value' => t('submit'),
  '#ajax' => array(
    'callback' => 'agals_support_form_ajax_handler',
    'effect' => 'fade',
    'wrapper' => 'status',
  ),
);

if(isset($form_state['values']['name'])) { //output
  $form['form_output'] = array(
    '#prefix' => '
',
    '#suffix' => '
',
    '#markup' => t('You entered @value', array('@value' => $form_state['values']['name'])),
  );
} } return $form; }

function agals_support_form_submit(&$form, &$form_state) {
  watchdog('agals_support', 'submitted');
  drupal_set_message('Form submitted');
  $form_state['rebuild'] = TRUE;
}

function agals_support_form_validate(&$form, &$form_state) {
  watchdog('agals_support', 'validation');
  if (empty($form_state['values']['name'])) {
    watchdog('agals_support', 'name missing');
    form_set_error('name', t('Please enter your name.'));
  }
}

function agals_support_form_ajax_handler(&$form, &$form_state) {
  watchdog('agals_support', 'ajax_handler');
  return $form;
}


texts:
I have a field group that contain sub field group with almost 30 fields
also I have a checkbox field that I want ajaxly show hide field group accoridng   checking event of it.

I have no problem with ajaxly show hide a field according to checking.but I have no idea how I can perform with  fieldgroup.
Any idea?


texts: Use external class in drupal 8 module with file name and class name

texts:
I have created a module in drupal 8 .
I need to use a class which is in external file .

File name : drupal.php

Class name : class newman{...}

In drupal.php ( have many classes ):

<?php
namespace Drupal\mymodulename\lib;
class newman{
   public function new(){
       $dp = 'TEST';
       return $dp;
   }
}
?>

In my controller :

<?php
namespace Drupal\mymodulename\Controller;

use Drupal\Core\Controller\ControllerBase;
use Drupal\mymodulename\lib\drupal;

class mmController extends ControllerBase {
    public function man() {
          $this->man=new newman();
          $build['test'] = [
                            '#markup' => $man->new(),
                           ];
    }
}

Error: Class 'Drupal\mymodulename\Controller\newman' not found in Drupal...

How can I fix it ?


texts: How to show nodes grouped by entity reference?

texts:
Im working on a Drupal 8 module that bring nodes with entity references, my array at this moment is showing this:
 Array
(
    [0] => Array
        (
            [title] => New Issue
            [id] => 6
            [Category] => 2
           )

    [1] => Array
        (
            [title] => New Product Deleted
            [id] => 7
            [Category] => 1
            )

    [2] => Array
        (
            [title] => A new issue added
            [id] => 8
            [Category] => 2
            )

)

As far you can see i have issues, inside this i have categories, at this moment im showing by issue, but i would like to show by category, example:
Category 2
 - New Issue : ID 6
 - A new issue Added: ID 8
category 1
 - New Product Deleted: ID 7

How can i handle this based on that array, already my vector is like this:
$nids = \Drupal::entityQuery('node')
            ->condition('status', 1)
            ->condition('type', 'issues')
            ->execute();
            $getIssues = [];
            $nodes = \Drupal\node\Entity\Node::loadMultiple($nids);
 foreach ($nodes as $node) {
  $getIssues[] = [
                    'title' => $getProducto->getTitle(),
                    'id' => $getProducto->id(),
               ];
  $getCategories[] = [
                'Category' => $getCategory, <-- Getting this from the entity
           ];
 }

Any help will be appreciated.


texts:
I have a problem to find a right module in drupal to do something that should be simple.

I need my web content out into two columns. Entering a node should have title and description in the center column, and then a right column with related documents. It should be the same type of content.

In a previous work had solved with "views", the result:
http://www.imasmallorca.net/ca/unprograma/335

The problem to do with "views" it was not working the bread crumbs, nor the search. Neither the menu worked properly (not marked as an asset corresponding point)

Now, I'm working with "panels" to avoid this problem. It allows me to create columns, and embed a view with eg documents. The problem is that if I use a "panel page" does not appear in the search, and if I create a "panel node" I can pass arguments to the view in the right pane.

The question is: Is this right module? Should look for another module? is there another proper way to do this in Drupal?

Excuse my language, I'm Spanish :)

Thank you very much for your help, in another post I have been very useful.


texts: New User Registration take long time (more than 60 seconds)

texts:
New user registration take too much time in my drupal 6 website. When we perform Add user in administrator section, it is working normally, within one or two second we can add users. But when we are trying to Create new account, it takes long time.

I have enabled CCK, Content Profile,Token,CAPTCHA,Views Modules.

How does debug it ?.


texts: I have a page with many child pages. And I have a task: there's needed to change parent for all of this child pages. I can move single page using "node hierarchy > Parent > Enter the title of the parent node." and write wanted node title there, but I can't use it for many pages. Is there solution for this problem? I tried to google it, but find nothing.


texts: Charts, how to format a date/time from external table on X-axis in Views

texts:
I am using the Data Module to bring in some data from an external database.

Have configured a View to display a Chart (using the Charts Module) of the columns  I require and it works great, except that I can not seem to alter the display of the X-Axis labels, which are showing the format in the database column (epoch date/Unix timestamp). I would like to display label like dd/mm/Y on the X-Axis but can not figure out how.

Can anyone point me in the right direction?

BTW, I have flagged the Database Column as a Date type in the Data UI, even created an exposed filter to display the chart on date ranges, just that the Chart labels are Unix timestamp.

regards
Darryl


texts:
I am trying to create a module that supplies a custom menu block, that changes based on what organic group you are looking at. I'm confused by the documentation, so I thought I'd ask here. I saw an answer for Drupal 7, but I'm using Drupal 6.

og_menu doesn't work for me because I don't want group admins to change it. I just want the default to be dynamic based on some logic of my own.

Specifically, should I supply a custom block from my module? If so, how do I render the list of links I create, or should be supplying a custom menu? What hook do I use?


texts: How to remove Page cached by boost message in view source

texts:
I installed Boost and the page cached by boost will have a line of message at the bottom of view-source.

<!-- Page cached by Boost @ 2014-11-08 14:04:46, expires @ 2014-11-09 14:04:46, lifetime 1 day -->

How to remove the above line?


texts:
As i am still developing some basic php skills:

I want to theme the title of my views-block slightly (just color and fontweight)

I have created a views-view--my-view--block-1.tpl.php and pasted the code of the 'display output' under the theme information of my view.

However i am stuck here as i cant seem to find anything that looks like a block title variable.

I have looked in my block.tpl.php but dont know what code to use here.

Help appreciated,


texts:
I have made a subtheme of zen and started making some changes to it's SASS files.
However now I have some layouts that aren't working as I expected, so I went to the chrome devtools, but that only tells me what CSS file the particular thing is in.

What I want is what SASS file it is in. Now, when I read the config.rb file it says it has some support for FireSass, but that plugin has been removed by the author, so no luck there.

I do have the environment set to :development and the firesass = true, therefore the sass_options :debug_info => true.

So I go to the root in the theme file /sites/all/themes/mytheme and run compass watch, but there are never any source maps.


texts: Subtract one field from another (Quiz, Getting difference between revisions)

texts:
I am using the evaluation quiz module. Users fill out the question and (not using the score that is calculated by the quix module) they are given a score by giving each of their answers points which are then totaled.

I'm wondering is there an easy way to subtract one revision of the users answer from another revision to get the difference.

I have no problem getting the results from each revision but just dont know how to subtract the second to latest revision from the latest revision.


texts: Can I add a "edit node" link as field in a node?

texts:
I need to have the "edit node" link as a field so that I can manage its display.

Can I do this?

Update:
I created the field but the token code is printed instead of its value.
The code you see in the capture is printed: http://misite.com/node/%5Bnode%3Anid%5D/edit

Capture:


texts:
in D8 (multilanguage site, with two languages) i wanna send email for registration, etc by user preference of language of user (People -> Edit people -> Language Settings)

I've enabled all modules for translations and translations are saved correctly (see the attachment).

I followed this guide: https://www.valuebound.com/resources/blog/how-to-send-mail-programmatically-drupal-8
but not work for me.

The language code passed for the email is correct but the email is always send in default language (in my case, english).


texts: How to Apply Panelizer on already created nodes of a particular node type?

texts:
I've got a content type Article
with created nodes of that content type

Then I decided I want to use Panelizer, but i discovered I have to manually modify each node to apply panelizer

-I enabled the "Node template" display in the Pages admin (admin/structure/pages).
 - I have tried Display Suite, but I want to use Panelizer

Its like the node will have its own Panelizer isolated from global Panelizer settings.


texts: Where is the Profile2 field data hiding?

texts:
I created a couple of different profile types in Profile2. I then register new accounts through /admin/people/add user (my-profile-type). All of my custom fields show up, and I enter the data accordingly. However, when I go back to the user's profile to edit it, the data isn't there.

Am I missing something obvious? Another post here said there was a button in the admin that gives access to the profile2 fields - but I don't see anything like that?


texts: Getting the pretty value of a Select field in Node twig template

texts:
I would like to get the pretty value from a field in my content.

Here is the structure of the select box field when I add a content :

00|Ground
01|Apartment
02|House / Cottage
03|Business premises
06|Attachments

In my node--content-type.html.twig, when I call the field with :

content.field_*machine_name*.value

It display the key of the selection (00, 01, 02,...). I would like to have Apartment, House / Cottage, ....

When I call just this :

content.field_*machine_name*

It display the pretty value but wrapped in a div that I don't want.


texts:
I know that Display Suite change its features due to limitation of PHP script within DS in Drupal 8.

What I want is customize the uploaded file which display something like this:

Code File: sample_file.zip

Into:

Download Code

In which, Download Code is a link the same with the original output as sample_file.zip.

I created a token field in Display Suite and put the following code to no avail:

Download Code

The output of this is a plain text:

Download Code

Instead of Download Code.

So, how can I link the downloadable File as shown in the image below into something like Download Code with the original link of the file?


texts: How do I prevent delimiters in a URL from being URL encoded?

texts:
I need to know how to get a +-delimited string to be appended to the end of the URL path without the + character being URL encoded.

Why: I'm trying to pass arguments to a View. I'm working on a custom module to conditionally route webform confirmations to a View. The view will take multiple arguments, returning all nodes matching the arguments (currently trying to do this with Views 3.0).

I've done proof-of-concept tests on the view that demonstrate that for a view with a path of, say, cbos/name1+name2 it will produce the desired result (i.e., displays nodes name1 and name2). So I know that this can be done from the Views side. (I'm pretty certain at this point Views has nothing to do with it, I just need to make clear why I need to do this.)

The problem is on the custom module / webform side.

I'm creating the URL path using the following code:

while ($cbo_short_name = db_fetch_array($result)) {
if ($count > 0) $delim = '+';
$cbo_short_names_arg .= $delim.$cbo_short_name['cbo_short_name'];
$count = $count + 1;
}
$redirecturl = "cbos/".$cbo_short_names_arg;
$node->webform['confirmation'] = drupal_urlencode($redirecturl); // ... have also tried setting this via the form settings page using tokens

... where $cbo_short_name is an array of short names (usually initials) for organizations. (There's usually only 1, but in about 15% of cases there will be 2 or 3 short names. The visitor has to be shown all of them. Hence, the View)

What this should do is produce a URL path of the form given above; what's happening is that '+' is getting URL encoded as %2B (e.g. cbos/name1%2Bname2), which breaks the Views argument string -- only the first result is returned.

If I could somehow force '+' to be passed intact, without URL encoding, this would work. But I'm at a loss for how to do that.

What I've tried so far:

Setting the confirmation URL on the form settings page (preferred,
since I don't have to hard code it).
Setting the redirect URL
programmatically (what you see above).

Both work to set a value, but in both cases the delimiters are URL encoded in the resulting URL path.


texts: How do I open up a YAML Form in a bootstrap modal window

texts:
I have a form made in the YAML Form module and I would like it to open up in a bootstrap modal window.

Can I just put the Bootstrap html into my page.hmtl.twig file and print out the form somehow?

This would be sufficient for my purposes as I want to form to be accessible from all pages on the website.

If this is not the Drupal way could someone please point me in the right direction


texts: What version of Drush is compatible with Drupal 6 / PHP 5.2

texts:
Just installed drush on a system using PHP 5.2.  However, when I run drush, a message is displayed saying Your command line PHP installation is too old. Drush requires atleast PHP 5.3.0. To suppress this check, set the environment variable
DRUSH_NO_MIN_PHP=1.  Since I am using Drupal 6 I need to use PHP 5.2. Could someone please tell me which version of Drush is compatible with Drupal6 / PHP5.2.


texts:
How can I display Profile2 fields in a view that has a content type as filter?

Later edit(example):

I have a view which displays a content-type X. I have a profile Y with different fields. I would like to be able to add fields from profile Y to the view which already has fields from content-type X.


texts:
hello I encounter difficulties to display a date in the correct format in a view.

I souhaire display my dates like this 2009-07-19T03:00:00+01:00

I created a new format here / admin / config / regional / date-time / formats
here that Y-m-d\TH:i:sP

Then I created a new type of date and selected my new format.
When I go to my view, I select my new date format but the field shows a different format 2016-03-17+01:00 +01:00

So I have a time zone more and I miss the hour, minutes and seconds.
Do you have a solution ?


texts: Use value of mail field into field username

texts:
I've tried to login by email address. So i've to remove username field from user_register_form and use value of mail field into value of name field by adding custom form validation in hook_form_alter(). But i couldn't make this work as i except. I'm getting error message "You must enter a username." Is any help from your side?

This is my code:

function test_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == "user_register_form") {
    $form['account']['name']['#access'] = FALSE;
    $form['account']['name']['#required'] = FALSE;
    $form['actions']['submit']['#value'] = t('Register');
    $form['actions']['submit']['#attributes'] = array('class' => array('btn-success'));
    $form['#validate'][] = 'test_user_register_validate';
  }
}

function test_user_register_validate($form, &$form_state) {
  $form_state['values']['name'] = isset($form_state['values']['mail']) ? $form_state['values']['mail'] : '' ;
 }

Answer:
I got the solutions by just adding below code instead of '$form['#validate'][] = 'test_user_register_validate';'

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


texts: Have all internal links in drupal leave out subdirectory where docroot resides

texts:
I've successfully followed some instructions online to get our plain url to direct to the content found in a subfolder (drupaldev) so that when you enter any url for that site even without the subdirectory name, it serves the correct page. However, I cannot figure out how to remove the internal links on the site that reference the '/drupaldev/' subdirectory.

This is what my .htaccess file includes:

RewriteRule ^$ drupaldev/index.php [L]
RewriteCond %{DOCUMENT_ROOT}/drupaldev%{REQUEST_URI} -f
RewriteRule .* drupaldev/$0 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* drupaldev/index.php?q=$0 [QSA]

And this is what my settings.php file contains:

$base_url = 'http://www.bluewaterfederal.com';

As you can see, if you mouse over any of the links within the site, they all mention drupaldev, but if you take that same url and remove the "drupaldev" from it, it works fine...


texts:
I'm trying to figure out the best way to handle different forms per bundle.
I current do something like:

class MyEntityForm extends ContentEntityForm {

  public function buildForm($form, $form_state) {

    $bundle = $this->entity->getType();

    switch ($bundle) {
      case 'bundle_a' :
        $form = BundleFormA::buildFormA($form,$form_state);
        break;
      case 'bundle_b' :
        $form = BundleFormB::buildFormB($form,$form_state);
        break;
    }

This works but I get errors with non-static $this which makes sense, but $this is available as far as I can tell.  Either way, I feel like I'm on the wrong path, so any help would be appreciated.


texts: Complex View with Contextual Filter and Relationships

texts:
I have a View of taxonomy terms. I use the Relationship: Content using Categoria Secciones to show, with Aggregation, the listing of the category terms, and next to it, the number of products in that category. That works perfectly. But this is the part where I am stuck: I want to add a contextual filter of Fabricante, so I can filter by another Taxonomy. I have previously, in other ocassions, used contextual filter with a Content View, but not in a Taxonomy View. I have tried to add another Relationship in my Taxonomy View: Content using Fabricante and use this relationship in a contextual filter of type Has taxonomy Term id but it doesn't work.

In summary, I want a listing of taxonomy related to a product (which works) and add the contextual filter of another taxonomy which is assigned to the same product (this is where I am stuck).

Here, if it is of help, the SQL, with the correct TID of the additional taxonomy term, which is 32619. The listing is empty, even if the product is assigned to that taxonomy term.

    SELECT taxonomy_term_data.tid AS tid, taxonomy_term_data_taxonomy_term_hierarchy.tid AS    taxonomy_term_data_taxonomy_term_hierarchy_tid, taxonomy_term_data.name AS taxonomy_term_data_name, taxonomy_term_data.vid AS taxonomy_term_data_vid, taxonomy_vocabulary.machine_name AS taxonomy_vocabulary_machine_name, field_fabricante_taxonomy_term_data.nid AS field_fabricante_taxonomy_term_data_nid, MIN(taxonomy_term_data.tid) AS tid_1, 'taxonomy_term' AS field_data_field_imagen_categoria_taxonomy_term_entity_type, COUNT(DISTINCT field_taxonomia_taxonomy_term_data.nid) AS field_taxonomia_taxonomy_term_data_nid
    FROM
    {taxonomy_term_data} taxonomy_term_data
   LEFT JOIN {taxonomy_term_hierarchy} taxonomy_term_hierarchy ON     taxonomy_term_data.tid = taxonomy_term_hierarchy.tid
    LEFT JOIN {taxonomy_term_data} taxonomy_term_data_taxonomy_term_hierarchy ON taxonomy_term_hierarchy.parent =    taxonomy_term_data_taxonomy_term_hierarchy.tid
    LEFT JOIN {field_data_field_taxonomia} field_data_field_taxonomia ON taxonomy_term_data.tid = field_data_field_taxonomia.field_taxonomia_tid AND (field_data_field_taxonomia.entity_type = 'node' AND field_data_field_taxonomia.deleted = '0')
   LEFT JOIN {node} field_taxonomia_taxonomy_term_data ON field_data_field_taxonomia.entity_id = field_taxonomia_taxonomy_term_data.nid
   LEFT JOIN {field_data_field_fabricante} field_data_field_fabricante ON taxonomy_term_data.tid = field_data_field_fabricante.field_fabricante_tid AND (field_data_field_fabricante.entity_type = 'node' AND field_data_field_fabricante.deleted = '0')
   LEFT JOIN {node} field_fabricante_taxonomy_term_data ON field_data_field_fabricante.entity_id = field_fabricante_taxonomy_term_data.nid
   LEFT JOIN {taxonomy_vocabulary} taxonomy_vocabulary ON taxonomy_term_data.vid = taxonomy_vocabulary.vid
INNER JOIN {taxonomy_index} field_fabricante_taxonomy_term_data__taxonomy_index ON field_fabricante_taxonomy_term_data.nid = field_fabricante_taxonomy_term_data__taxonomy_index.nid
   LEFT JOIN {field_data_field_imagen_categoria} field_data_field_imagen_categoria ON taxonomy_term_data.tid = field_data_field_imagen_categoria.entity_id AND (field_data_field_imagen_categoria.entity_type = 'taxonomy_term' AND field_data_field_imagen_categoria.deleted = '0')
WHERE (( (field_fabricante_taxonomy_term_data__taxonomy_index.tid = '32619') )AND(( (taxonomy_vocabulary.machine_name IN  ('secciones')) )))
GROUP BY tid, taxonomy_term_data_taxonomy_term_hierarchy_tid, taxonomy_term_data_name, taxonomy_term_data_vid, taxonomy_vocabulary_machine_name, field_data_field_imagen_categoria_taxonomy_term_entity_type, field_fabricante_taxonomy_term_data_nid


texts: How to block temporarily comments from specific IP address?

texts:
Can we block specific IP address for a period of time and block posting comments from that IP address for this period of time?
Only posting comments, not viewing pages.


texts:
I am trying to use Colorbox with Drupal 8 (within a VM) but the images are not showing up in an overlay. I have followed the instructions and installed the module and the colorbox javascript library into the libraries folder.

In Drupal's status report screen, it says that the colorbox library is installed.

When I examine the page with the images I would like to display, I can see that none of the Colorbox libraries are loaded. I suspect that I need to add a entry in MYTHEME.libraries.yml to load the Colorbox Javascript. Can someone show me what that entry would look like (if indeed I need that to get Colorbox working).

If that is not the issue, then what am I missing?

I noticed that if I use drush to install the Colorbox-plugin it works. But once I reboot the VM, it doesn't work anymore. So this would indicate to me that some setting is being lost, which leads me to think its the libraries.yml file that needs to be updated.

NOTE

I should add that this is a custom theme that I am developing. My theme is not using any custom JavaScript files, so that should not be the issue. I tested colorbox with the default Bartik theme and it works. I have no idea why when my theme is selected that the colorbox javascipt files are not loaded into the page.


texts: Is there a way to show the Google Analytics panel inside a drupal site?

texts:
I'm using the Google Analytics module to track the visits.

Is there a way to show the Google Analytics panel inside the Drupal site?


texts:
Within a block I have configured under the "Visibility settings" and "Show block on specific pages" I have put in PHP code that determines where this block is displayed within a page or not via a returned true or false.
I have it working correctly but then I added additional restrictions within the PHP but I must have put in a syntax error that caused the site to go down saying "Temporarily Unavailable".

I need to be able to change the PHP code back to the working version but I don't know what drupal table the block PHP code is stored.  Please tell me what drupal table the block php visibilities settings is stored at.


texts: Use created year as condition in Entity Query

texts:
I'm performing an entity query that searches for nodes of my custom content type called 'news'. I want to perform the query in a way that only produces the 'news' nodes that have a Authored Date that fits within a specific date . Here is an attempt I made below.
'

$year = 2018-02;
$query = \Drupal::entityQuery('node')
  ->condition('type', 'news')
  ->condition('created', [date('Y-M','created'), $year], '=')
  ->range(0, 10);


texts: Insert/create user in database using login form

texts:
I know its dump question, using login form and insert user in database.

Actually, I have an API that includes users of company/organization and these users already have registered on other applications. So, using such API I can get user info using username and password.

Of course, we need to logged in users directly (without registration) who already have account on other applications.

For logging in, I need to, first, insert the user info in data (before insertion, I can fetch username and password from API) so user can get in the site as logged in user.

After fetching from API, how to create user in the database with
username and password field only?
It should be done without email info.


texts: Welcome email body not changing to reflect account settings

texts:
I'm in /admin/config/people/accounts and have changed the text that new users will be sent when signing up accounts, but the body of the messages remain the same, although the subject line is changing, so I know it's having some account. I have cleared the cache many times ;).

I'm using Mailsystem and HTMLmail as well as Profile2... not sure if they would affect these emails.

The password reset email does work, but not the account creation Welcome message.

I have confirmed that user_mail_register_no_approval_required_body is set correctly in the variables table in the database, but that call is never being made.

I'm looking through user.module and user.admin.inc trying to determine how this is all supposed to work. Even changing the hardcoded message in _user_mail_text() (user.module line 2589) hasn't had an affect.

I have a functioning hook_mail in my module so I added the correct key from user.module to that (register_no_approval_required_body) with no luck.


texts: Image files aren't recognized when changing a html file to page.tpl.php

texts:
I want to create a drupal theme base on a static web template. after googleing I've found out that I should set up a .info file and also put my header in the html.tpl.php and body in page.tpl.php and so on.
I change index.html file into page.tpl.php, but the image in the site aren't recognized by drupal(although the index.html worked correctly).
It seem to me that drupal should show the page exactly same as static version because I have't added any code into the page ( in order to change the static version into the dynamic one ).
if so, how can I find the problem.
Thanks

HTML:

    <script type="text/javascript" src="js/modernizr.js"></script>
    <script type="text/javascript" src="js/jquery-1.8.2.min.js"></script>
    <script type="text/javascript" src="js/rgpars-custom.js"></script>

=====>

.info file:

    scripts[] = js/modernizr.js
    scripts[] = js/jquery-1.8.2.min.js
    scripts[] = js/rgpars-custom.js

html.tpl.php file :

    <head profile="<?php print $grddl_profile; ?>">
      <?php print $head; ?>
      <title><?php print $head_title; ?></title>
      <?php print $styles; ?>
      <?php print $scripts; ?>
    </head>


texts: Missing Schema on custom field only during PHPUnit Test

texts:
I have a custom field setup that I created similar to this tutorial. I exported all my fields on my node to a test module and enable it during my PHPUnit test.

I run my test with the following command:

php ./core/scripts/run-tests.sh --verbose --php /usr/local/bin/php --url http://nginx --class "Drupal\my_module\Tests\ExpenseTest"

And I get the following error:

The test did not complete due to a fatal error.
Exception Uncaught e ConfigSchemaCheck   95 Drupal\Core\Config\Development\Conf
Drupal\Core\Config\Schema\SchemaIncompleteException: Schema errors for
core.entity_form_display.paragraph.my_field.default with the
following errors:
core.entity_form_display.paragraph.my_field.default:content.field_city_state.settings.size
missing schema,
core.entity_form_display.paragraph.my_field.default:content.field_city_state.settings.autocomplete_route_name
missing schema,
core.entity_form_display.paragraph.my_field.default:content.field_city_state.settings.placeholder
missing schema in
Drupal\Core\Config\Development\ConfigSchemaChecker-&gt;onConfigSave() (line
95 of

This is part of my core.entity_form_display.paragraph.my_field.default.yml file:

field_city_state:
weight: 2
settings:
  size: '60'
  autocomplete_route_name: my_module.city_autocomplete
  placeholder: ''
third_party_settings: {  }
type: city_state_default
region: content

If I remove the settings it doesn't give me the error (Although I am not testing that field yet).

This is my module's Field Type Class:

<?php

namespace Drupal\my_module\Plugin\Field\FieldType;

use Drupal\Core\Field\FieldItemBase;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\Core\TypedData\DataDefinition;
use Drupal\Core\Field\FieldItemInterface;

/**
 * Plugin implementation of the 'city_state' field type.
 *
 * @FieldType(
 *   id = "city_state",
 *   label = @Translation("City/State"),
 *   description = @Translation("An entity field containing city/state"),
 *   category = @Translation("Address"),
 *   default_widget = "city_state_default",
 *   default_formatter = "city_state_default"
 * )
 */
class CityStateItem extends FieldItemBase implements FieldItemInterface {

  /**
   * {@inheritdoc}
   */
  public static function schema(FieldStorageDefinitionInterface $field_definition) {
    return [
      'columns' => [
        'state_code' => [
          'type' => 'varchar',
          'length' => 2,
        ],
        'city' => [
          'type' => 'varchar',
          'length' => 255,
        ],
      ],
    ];
  }

  /**
   * {@inheritdoc}
   */
  public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
    $properties['state_code'] = DataDefinition::create('string')->setLabel(t('State Code'));
    $properties['city'] = DataDefinition::create('string')->setLabel(t('City'));

    return $properties;
  }

  /**
   * {@inheritdoc}
   */
  public function isEmpty() {
    $value = $this->state_code;
    return $value === NULL || $value === '';
  }

  /**
   * Get city string.
   *
   * @return string
   *   Returns city name.
   */
  public function getCity() {
    return $this->city;
  }

  /**
   * Get state code string.
   *
   * @return string
   *   Returns the state code.
   */
  public function getStateCode() {
    return $this->state_code;
  }

}

This is my module's schema file:

city_state:
  type: mapping
  label: 'City/State settings'
  mapping:
    state_code:
      type: string
      label: 'State Code'
    city:
      type: string
      label: 'City'

Don't understand why I am getting this error and only during Testing. (No issues when running config import on dev and staging).


texts: Add custom attribute to an external JS script

texts:
It's not really clear how to add custom attributes when adding an external JS script to the page.

Currently I have this code:

drupal_add_js('https://code.jquery.com/jquery-3.4.1.js', array('type' => 'external'));

How can I add an integrity attribute to the rendered script tag?

The rendered script should look like this:

<script src="https://code.jquery.com/jquery-3.4.1.js" integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU="></script>

I know this post exists, but I'm not able to use that solution since the source is loaded externally and I will not be able to check on the source.


texts: How to fetch the completed goal as an entity with the Rules module?

texts:
Followup question for the question about "How to access fields from a goal when creating a node with Rules?".

I'm trying to create a rule that finds and uses the fields of the goal that triggered the goal completed event. They can be fetched if you know the goal id (as shown in the answer to the previous question). But creating individual rules for each goal is not viable because there are quite a few of them and I'd like administrators to be able to easily add them without having to write new rules.

So how can I create a rule without specifying a Rules Condition to check the id of the goal that was completed?


texts:
I want to change the 'Create' label for a specific Content type.
I made a new content type called 'Bid Offer':

I want to show this to the users as 'Make Bid Offer' instead of 'Create Bid Offer'

Any help appreciated


texts:
So being relatively new to Drupal development (I have experience programming in other Content Management Systems and writing bespoke functions in PHP/MySQL) I noticed something interesting...

I realised after some development that the custom modules I had installed by uploading to /modules/ should actually have been uploaded in /sites/all/modules/ to avoid being overwritten on a Drupal update.

So I swiftly deleted the modules via FTP, cleared the cache, reuploaded in the correct directory, cleared the cache and continued where I left off.

What I found interesting was that all of the settings I applied to these modules had been remembered.

So my question is, why did this happen?
Do modules have access to the DB and store variables there?

And so, if you want to truly remove a module and all its attachments from Drupal, how do you go about this (If it is just a case of storing in DB, then obviously you could delete through phpMyAdmin...but are there any other things to look for that could be left behind)?

Beginning to develop for drupal, it's good to know what is "under the hood" and that's why I ask this question.

Thanks so much for your time,
Scott


texts: How do I get Views PDF to Download a file?

texts:
I am using views-pdf to create a 'ticket' for people. Buy a ticket and they need to keep the ticket on their phone. I am using views-pdf to generate the ticket and would like to automatically trigger the download.

At the moment I have the following, which is not working:

function yhivepasses_views_pre_render(&$view) {
 if ($view->name != YOGAHIVE_PASSES_VIEW_NAME || $view->current_display != YOGAHIVE_PASSES_VIEW_DISPLAY) {
 return;
  }

//'Content-Disposition' => $disposition . '; filename="' . mime_header_encode($name) . '"',
  drupal_add_http_header('Content-Disposition', 'attachment; filename="yogahivepasses.pdf"');
}


texts: Form API: Autocomplete Field in Chrome and Safari

texts:
I'm working on a custom webform component to essentially look up entity properties in an autocomplete field.
All works perfectly in Firefox, but I'm just seeing an plain old textfield in Chrome and Safari. Nothing is printed to the console, and nothing is printed to watchdog.
This is what the field looks like on Chrome/Safari:

This is what is looks like in Firefox:

I'm wondering if this has something to do with my code, so I've extracted the relevant snippets below:
Form Definition:
  $ac_field_id = drupal_html_id('field_autocomplete');
  $element['field_autocomplete'] = array(
    '#type' => 'textfield',
    '#title' => $component['name'],
    '#description' => t($component['extra']['description']),
    '#default_value' => $value['field_autocomplete'],
    '#required' => $component['required'],
    '#autocomplete_path' => 'entity-auto-comp/' . $field_entity_type .
                                '/' . $field_entity_prop . '/' . $field_number_of_items_to_return .
                                '/' . $search_type . '/autocomplete',
    '#attributes' => array(
      'data-entity-auto-id' => $ac_field_id,
    ),
  );

How Autocomplete Path is being Handled:
 /**
  * Implements hook_menu() - this provides a URL route for our
  * entity data source
  */
 function entity_auto_comp_menu() {
    $items['entity-auto-comp/%/%/%/%/autocomplete'] = array(
      'page callback' => 'entity_auto_comp_autocomplete',
      'page arguments' => array(1, 2, 3, 4),
      'access arguments' => array('view published content'),
      'type' => MENU_CALLBACK,
    );
    return $items;
}

/**
 * Implements hook_autocomplete() - which allows us to return data
 * to the form field as JSON.
 */
function entity_auto_comp_autocomplete($entity_type, $entity_prop, $max_results = 5, $search_type = 'STARTS_WITH', $string = '') {

  //Get all relevant entity IDs
  $efq = new EntityFieldQuery();
  $efq->entityCondition('entity_type', $entity_type, '=');
  $efq->propertyCondition($entity_prop, $string, $search_type);
  $efq->range(0, $max_results);
  $efq_result = $efq->execute();
  $efq_keys = array_keys($efq_result[$entity_type]);

  //Load entities from database
  $entities = entity_load($entity_type, $efq_keys, false);

  $prop_values = array();
  foreach($entities as $entity){
    $prop_values[$entity->$entity_prop] = $entity->$entity_prop;
  }

  //If we couldn't find anything, say so
  if(count($prop_values) == 0){
    $prop_values[""] = "No results were found...";
  }

  drupal_json_output($prop_values);

}

Some JS I'm using to detect changes and populate a hidden form field:
(function ($) {
    Drupal.behaviors.ol_webform_manage_map_default = {
        attach:function (context, settings) {

          //Get the autocomplete field as a jQuery object
          var $autocomplete_field = jQuery('input[data-entity-auto-id="'+Drupal.settings['ac_field_id']+'"]', context);
          var $autocomplete_value = jQuery('#'+Drupal.settings['ac_field_id'], context);

          //Event listener for option selection
          $autocomplete_field.bind('autocompleteSelect', function(event) {
            $autocomplete_value.val(jQuery(this).val());
          });

        }
    };
})(jQuery);

I'm stumped. So I would appreciate any help you can provide!
Thanks,
Strainy
Update
Scratch that. Nothing to do with browsers. It's got something to do with how I'm handling permissions at either the form field level or the autocomplete path. Realised that I can only use autocomplete if I'm logged in!


texts: How to filter a view based for the current user based the value of custom fields in his profile and fields in the list of items viewed

texts:
I'd like to implement Views that conditionally show or hide item listings of content nodes to the current User based on:
(1) value(s) in the current User's profile and
(2) value(s) in the profile of the author of each item and
(3) value(s) in each content node itself.

A good example would be a classified ad system that enabled advertisers to specify that a given ad be shown only to users whose profiles meet a set of specific criteria.

For example:
A Drupal site with User Accounts with custom fields to capture each user's age, height, and hair, and a Content Type for advertisements with the same fields.

The challenge is how to construct a View that supports a use case like the following:
Users who will look at the View:
= David is a bald, 6.5 foot, 70 yr old.
= Edward is a blond, 5'5", 18 year old.
= Fred is a brown-haired, 5'11", 30 year old.
Ads that can be displayed in the View as follows:
= "Miracle Grow Hair Spray" posted by Abby to be shown only to bald people.
= "NuEar Hearing Aids" posted by Betty to be shown only to people over age 65.
= "Big and Tall Shop" posted by Carol only to be shown to people over 6 feet tall.

In summary, I'm trying to filter tablular View of nodes based on attributes of the content nodes, the authors of the node, and the current user who is looking at the View.
The standard Views filter UI supports filters based on attributes of each node in the table, but does not appear to permit any use of information about the current user other than his login state.

Any advice and references to doing the filtering at the granularity of each node would be greatly appreciated!


texts: Load fields from a node which reference an entity

texts:
I have a node with a entity reference field (more precisely a product reference). How do I access the fields of the referenced entity from the node?

(I’m trying to do it through a code field in the Display Suite, so I have access to the $entity object, not sure if that helps)

To explain better I would like to be able to do something like these tokens:

[node:field-products:0:field-flow-rate]
[node:field-products:1:field-flow-rate]
[node:field-products:2:field-flow-rate]

but with PHP, so I can cycle through the index.


texts:
I get the following error:

  Strict warning: Only variables should be passed by reference in include() (line 18 of /home/sites/dev/theparce/sites/all/themes/parce/block--block--3.tpl.php).

This is the block code which is causing that error.

if ($user_gallery) {
  print render(node_show($user_gallery));  // Line 18
  print drupal_render ($user_gallery_edit);

}
else {
  print drupal_render($user_gallery_new);
}

Why do I get that error, even if I get all printed as expected?


texts:
What's the sanest way to present a Ctools modal to the user while bypassing the normal AJAX workflow? For example, how could I show a completely JavaScript-generated "Are you sure you want to log out?" confirmation prompt to the user in a Ctools modal after the user clicks the "log out" link?

I know I can probably fake a box which would get the same styling as the Ctools modal, but I'd rather avoid silly hacks if not strictly necessary.


texts: How do I fetch the ID of the current entity?

texts:
I am using an entityform as rendered entity reference field of an eck entity as 'landing page'

I need the form submission to include the title of the landing page.
My solution is to add an entityform field and make rules copy paste the landing page title into the field, when submitted.

The Rules trigger is 'After saving a new entityform submission'.

Now I need to somehow fetch the entity ID of the landing page, but how to get the ID from the current entity?

I tried to create a rules component that uses php to get the entity ID of the current entity (landing page) as follows:

{ "rules_get_node_from_current_path" : {
    "LABEL" : "Get landingpage from current path",
    "PLUGIN" : "rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "php", "rules" ],
    "USES VARIABLES" : { "current_landing_page" : {
        "label" : "Current landing page",
        "type" : "domain",
        "parameter" : false
      }
    },
    "DO" : [
      { "variable_add" : {
          "USING" : {
            "type" : "text",
            "value" : {
              "select" : "site:current-page:path",
              "php" : { "code" : "list($id, $vid, $bundle) = entity_extract_ids($entity_type, $entity);\r\nprint $id;" }
            }
          },
          "PROVIDE" : { "variable_added" : { "nid_txt" : "NID txt" } }
        }
      },
      { "data_convert" : {
          "USING" : { "type" : "integer", "value" : [ "nid-txt" ] },
          "PROVIDE" : { "conversion_result" : { "nid" : "NID" } }
        }
      },
      { "entity_fetch" : {
          "USING" : { "type" : "domain", "id" : [ "nid" ] },
          "PROVIDE" : { "entity_fetched" : { "landing_page" : "Landing page" } }
        }
      },
      { "drupal_message" : { "message" : "Current landing page title: [current-landing-page:title]" } }
    ],
    "PROVIDES VARIABLES" : [ "current_landing_page" ]
  }
}

..but that gives me the following errors:

  Notice: Undefined variable: entity in eval() (line 1 of
  /home/cdt/public_html/sites/all/modules/rules/modules/php.eval.inc(146)
  : eval()'d code).

  Notice: Undefined index: entity keys in entity_extract_ids() (line
  7874 of /home/cdt/public_html/includes/common.inc).


texts: Difference between views-to-content-type attaching modules

texts:
For D7, there are a number of good options for attaching a view to a node, including

EVA
Viewfield
View reference

Is EVA a superset of the functionality of the other options? What exactly is the difference between them?


texts: Organic Groups - Include nodes as part if it on group creation

texts:
I'm looking for at way to make some nodes, eg. "About us", part of the Organic Group.

/
/about-us*
/more-general-stuff

When I create the OG I want the nodes marked with * to be part of the group.

/my-group
/my-group/about-us
/my-group/another-page-for-the-group

/my-group/about-us is a copy of /about-us, and if you edit /about-us it also updates /my-group/about-us.

/my-group/about-us could contain blocks specific for the group.

So when I tried to use views to create a page on /%/about-us, I'm not able to put blocks on that "page".

Any ideas is welcome.


texts: Using custom functions in Views template files = not good practice?

texts:
I have a field in my View that outputs a YouTube URL (eg. http://www.youtube.com/watch?v=rF1X12PE6PY)

I want to output just the ID part (ie. rF1X12PE6PY)

So I made a module with a function that takes the full URL and returns just the ID. Then in my views-views-fields.tpl.php template I call the function:

<?php print youtube_id_get($fields['url']->content); ?>

Now this works fine, but something tells me it's not good Drupal practice?

Will this screw up Views performance/caching? Should I create a custom Views filter instead (still learning about such things)?


texts: Is it necessary to clear site caches after putting site into maintenance mode?

texts:
I enabled maintenance mode on a Drupal 7 site; however, when I checked the homepage as an anonymous user, I noticed that the original homepage was still being displayed rather than the maintenance page. It was only after clearing the site's caches that the maintenance page was displayed. Anonymous page caching is enabled on the site.

I am wondering if it is necessary to clear the site cache's for maintenance mode be be effective or is it sufficient to just enable maintenance mode in the admin UI? My main objective to be able to safely run database updates, which should be run whilst the site is in maintenance mode. The actual display of the maintenance page is not really important.


texts: How to make custom content type as product in ubercart drupal 7?

texts: I want to make custom content types as ubercart products in drupal 7


texts: What is the difference between path and theme path in theme registry?

texts:
I'm trying to alter the theme registry:

function comment_simplify_theme_registry_alter(&$theme_registry) {
  $module_path = drupal_get_path('module', 'comment_simplify') . '/tpl';
  $theme_registry['comment']['template'] = $module_path . '/comment';
  $theme_registry['comment']['theme path'] = $module_path;
  $theme_registry['comment_wrapper']['template'] = $module_path . '/comment-wrapper';
  $theme_registry['comment_wrapper']['theme path'] = $module_path;
}

Now this is what I have in theme registry:

comment_wrapper
  template: sites/all/modules/comment_simplify/tpl/comment-...
  path: themes/bartik/templates
  type: theme_engine
  theme path: sites/all/modules/comment_simplify/tpl
  render element: content

I want to know what the difference between path and theme path is.


texts: Target single block with amended theme function?

texts:
I have amended theme_user_list so that the user picture is printed out just before the username. I would like to use this function only on the Who's online block. Is there anyway I can make this block be the only target for my amended function? Thanks.

function MY-THEME_user_list($variables) {
  $users = $variables['users'];
  $title = $variables['title'];
  $items = array();

  if (!empty($users)) {
    foreach ($users as $user) {

      // $items[] = theme('username', array('account' => $user));

      $picture = theme_get_setting('toggle_comment_user_picture') ? theme('user_picture', array('account' => $user)) : '';
      $username = theme('username', array('account' => $user));
      $items[] = $picture . $username;
    }

  }
  return theme('item_list', array('items' => $items, 'title' => $title));
}


texts:
I'm working on a Drupal 7 site that lists hotels at the moment. To make it fair on the hotels who have signed up the listing page needs to be in a random order on each visit. You can click through to view a hotel's details details on a separate page. I need the site to "remember" the order the hotels were in so that when you go back to the listings they're in the same order and so the next/previous buttons work on the hotel details page.

I'm currently listing the hotels in a view so I'm a bit stumped as to how I can get this to work.

Thanks.


texts: Views rewrite output for image url add divs

texts:
So in views , I had created a block display with this fields:

image field : imagecache URL (exclude from display)
image field :    imagecache for resized image (exclude from display)
image field :    data (description) (exclude from display)
global field : rewrite the output with

            [field_galerie_image_vdl_fid_1]

Stripped out all wrapper elements like  , and using a field template with:

<?php if (!empty($title)): ?>

<?php print $title; ?>

<?php endif; ?>
<?php foreach ($rows as $id => $row): ?>
  <div class="<?php print $classes[$id]; ?> chocolat-parent" data-chocolat-title="set title">
    <?php print $row; ?>

<?php endforeach; ?>

but in result I get:

           http://caucadis.vmdev/sites/all/media/imagecache/galleryformatter_slide/galerie_images_vdl/2016/22/people-q-c-640-480-4_0.jpg

So what do I missed ?

thanks


texts: How to get Users Email address in an Rest Export View for auth users

texts:
i build a Rest export view for autocompletion of an textfield. The input should autocomplete email addresses of all logged in users. As admin thats possible, but not as authenticated user, the email addresses get stripped from the result on field access level.

The use case is a share form between users on the same platform ( contact form is not suitable ).

I know this is a security measurement but this platform is for logged in users only and all users are from the same company.

I could hack around the core functions but i wanted to ask if there is a better way to do this?

Greetings,

yobottehg


texts: Node reference field options supplied by Views 3 work in preview, not in content

texts:
I am trying to associate a node with a product type in Drupal Commerce. It is like choosing a t-shirt color, but instead they are choosing a node they published as a product attribute.
 I'm using Views to filter for only nodes published by current user, then I click the check box "Enable this field to function as an attribute field on Add to Cart forms" while editing this field type.

When I view this product display, the node reference selection box is there, but there are no selections aside from "-none-".

I have flushed the cache, multiple times; I run the cron tasks. I've done everything I thought I could do.

What am I missing?


texts:
We use Drupal's tabledrag component in one of our interfaces and we've got this requirement we don't know how to solve.

Basically, we have a tree structure with elements of 2 types - let's call them A and B.

An element of type A can be moved to any location in the tree (we use weight and parent-child relationships).
An element of type B is always a child of an A, and cannot be moved to another A. It is locked under it's parent A. However, it can be sorted with sibling As.

So for a tree like:

A1
\- A2
 - B1
 - A3
   \- B2
    - A4
    - B3
    - B4

We can move A3 up to be a child of A2, and all it's children (B2..B4) will move along (like normal).
However, B1 can only be moved up and down (in regards to A2 and A3), as we can change it's weight, but cannot change it's parent: it's locked under A1.

I have searched for a while, but have not found any examples of this. Is this even possible with Drupal's core tabledrag ?


texts:
I have a form that uses ajax submit "method", the ajax submit handler returns ajax response with complete form(the form has ajax wrapper outside of itself so no issue there) and it is not working for anonymous users. I am using dynamic_page_cache only at this point.

I am displaying this form via field formatter that I have on an entity(imagine comment form) and I am using lazy builder.

The thing is that the form works for anonymous users if there are multiple forms like this on a single page(imagine taxonomy term page listing entities) but it is not working when there is only one form(entity page..imagine node/1). By not working I mean the form will submit but not with ajax but traditionally via normal post method.

I have checked the form structure, wrapper, drupalSettings.ajax entries, JS errors, watchdog..everything, but I just cannot figure out why the form does not utilize ajax but will submit as normal form instead. I have compared loaded JS with anonymous and logged in user, nothing significant there. The only thing that I have found that differs is missing form_token input in the form compared to logged-in user but I have checked the FormBuilder and this is on purpose + when I'm listing multiple entities with this form the ajax works just fine without it.

And so since there are no errors anywhere I have nothing to grab on to for debugging.

So my question is how could/should I try to debug this issue?

This question is a follow-up from Does caching has to be manually disabled for ajaxified forms?


texts: How to get custom role ID from Drupal UI?

texts: Really simple, where I can I look up the custom roles and their role id's?


texts: How do I create a php page that has access to the Drupal API?

texts:
I would like to create a PHP page that executes Drupal API functions.

The page would be inside my Drupal 7 website, perhaps the theme directory, but I'm not sure where it should reside.

I would like this page to run a query to the database using the Drupal's database abstraction layer. Once the query is retrieved, I would like to run some other D7 API functions and finally print out a page.

The page should not be one of the default Drupal templates, but a new page, that simply has one single  within it.

How can I achieve this?

EDIT: The correct way to do this is to implement hook_menu() inside a module. I'm trying to do this, but my approach doesn't work. This is what I'm doing:

the profileBox.info file

name = PB
description = "Creates a callback to returnuid.tpl.php"
package = SDNN
core = 7.x
files[] = profileBox.module

the profileBox.module file is installed and has the following code:

function profileBox_menu() {
  $items['returnunid'] = array(
    'title'=>'Example'
    'description'=>'examples'
    'page callback' => 'profileBoxGetit',
    'access callback'=>TRUE,
  );

  return $items;
}

function profileBoxGetit() {
  $stringit = "the string output";

  return $stringit;
}

I created a returnuid.tpl.php file with some html code in it - just to test (not functional code)
I then pointed my browser to [root]/?q=returnuid
I expected to get the content of the $stringit variable, but I instead got an "access denied" error

This module actually messes up the Administration menu, which dissapears when the module is installed.

What am I doing wrong?


texts: How do I add a view mode to a simple custom entity?

texts:
I have created a super-simple drupal 8 custom entity.  We now need a custom view mode for this entity.  What do I need to add to my definition to make my entity appear as an option on the 'Add View Mode' page: /admin/structure/display-modes/view/add ?

My super-simple entity definition is

 * @ContentEntityType(
 *   id = "schedulecal",
 *   label = @Translation("ScheduleCalendar"),
 *   base_table = "scheduler_entity_calendars",
 *   entity_keys = {
 *     "id" = "id",
 *     "uuid" = "uuid",
 *   },
 * )

I can't find this info anywhere in doc.


texts:
I am maintaining a site on drupal 6. I have installed a birthday module which can send mails to users on their bday. But it doesnt do so. None of the other cron related tasks are done, though cron runs daily, and I do get a notification on mail . I tried to install a new module called ultimate cron (6.x-1.7), this could solve my problem earlier when I last installed it. But on re-installation this also doesnt work. None of the triggered rules that should be fired on cron run are fired.

On site config -> cron it lists all the processes, but they are in starting state. And on background process page , it shows first task with 0 progress n none other are being processed.
I have tried to install latest version of ultimate cron modules, but that gives some error saying "Unknown field: start stamp".
Please help me with this.


texts: How to limit the amount of User Points users get?

texts:
I've a content type 'Content' with the field 'Value' (an integer) and a flag called 'Publish Content and grant points to user'. Every time a Content is flagged with this flag, I'd like to grant the Content's author some User Points, equal to the value in the 'Value' field, but with a maximum of 5.

I've got a question about the 'maximum 5' condition. I made 2 seperate rules with an extra condition 'Data comparison': one with [flagged-node:field-value is lower than 6] and another with [flagged-node:field-value is greater than 5]. (Note that I can choose "field-value" here!) Isn't it possible to do this in just 1 single rule?

Note: I also have a problem with the 'Value' field. See: Grant user User Points equal to value of certain field.


texts:
I'm encountering a very weird problem where my database settings look like this in database.inc:openConnection()

array(1) {
  ["default"]=>
  array(6) {
    ["driver"]=>
    string(1) "A"
    ["database"]=>
    string(1) "A"
    ["username"]=>
    string(1) "A"
    ["password"]=>
    string(1) "A"
    ["host"]=>
    string(1) "A"
    ["port"]=>
    string(1) "A"
  }
}

It's after I moved the site to a new host with Ubuntu 14.04, so PHP and MySQL are now on a different version.

Another related strange thing is that drush sql-connect is not returning anything.

The result of global $databases; var_dump($databases); looks normal.


texts: How to override confirmation messages when saving or updating content in Drupal 8?

texts:
I've got a few taxonomy vocabularies, but the confirmation message on save/update is generic - Created new term %term. or Updated term %term..
Those messages come from \Drupal\taxonomy\TermForm.
Usage of that class is defined in \Drupal\taxonomy\Entity\Term class annotation.

I would like to have custom confirmation messages specific to each vocabulary.

What's the best way to accomplish that? Ideally I'd like to have separate form handler classes for each vocabulary.


texts: EntityMetadataWrapperException when updating Open Atrium

texts:
I've taken over management of a site using Open Atrium on the Pantheon hosting platform. The upstream repository was originally set incorrectly to Drupal 7 instead of Open Atrium. What this means is that if I want to be able to push any Open Atrium updates, I need to migrate the current site over to a fresh Open Atrium install.

I have a local install using the latest version of Open Atrium for Pantheon. I've been trying to import my current production database, then run update.php, following Open Atrium best practices for updates (including drush registry-rebuild). I keep getting the following exception thrown:

EntityMetadataWrapperException: Unknown data property bootstrap_tour_step_reference. in EntityStructureWrapper->getPropertyInfo() (line 335 of /Applications/MAMP/htdocs/site/profiles/openatrium/modules/contrib/entity/includes/entity.wrapper.inc).

I've found references to this error and Organic Groups (here and here), and looked into Open Atrium issues containing this exception message, but nothing seems relevant.

Do I need to look into manually running hook_schema, or hook_schema_alter on the current production site before importing that database into the fresh Open Atrium install?

Edit: After learning a bit more about drush rr, it looks like the registry-rebuild isn't completing. Any tips for trouble-shooting registry-rebuild fails? Seems like registry-rebuild itself is kind of a last-ditch method, so I'm at a loss!


texts: Classification: {{ content.field_classification.value }} not displaying

texts:
Hoping someone can assist me please.

I am trying to display the value of a custom field in a bootstrap sub theme

I have created my node--testtype.html.twig template and that seems to work.

I'm trying to just show the content of one field, the machine name is field_classification.

When I use
Classification: {{ content.field_classification.value }}
 the Classification displays as expected, but the value of my field_classification doesn't.

Can anyone see what I am doing wrong please as thought I d copied the correct code from what I have read?


texts: CSS-tags added using Display suite on products disappears

texts:
Using Display Suite to format output of entity product from Drupal Commerce. HTML- and CSS-tags added by "Expert" formatting tend to disappear when products are viewed using display-nodes. In this case its a image-field with n-number of images that I'm trying to display in a horizontal row instead of stack them vertical. I'm using fancybox as display widget and want to change the behaivor with "float: left; position: relative;". Drupal 7.

The dialog for entering the extra tags are displayed both in product-type view and node-type view when administer fields. It does not matter if I do the formatting at product-type-level or node-type.

When adding the same formatting with a non commerce node-type it works as I suppose it should.

Are there a better way to accomplish horizontal rows with thumnails and displaying full size-pictures using fanzybox when presenting commerce products?

I have been using lightbox2, but it seems to be a bug when combining it with Drupal Commerce.


texts:
Entity Translation exposes a checkbox on fields, entitled:

  Users may translate all occurrences of this field

When dealing with a Field Collection field, which of the following should I check the box for?

Only the field collection field
Only the child fields
Both the field collection field, and its child fields


texts: How to clear unused files from the database and the filesystem?

texts:
I would like to have a script that runs on cron, to delete all files that are not currently being used. I noticed that the file_usage table and the hard drive are getting filed with them.

Is there a way to do so?


texts: How to force users to re-authenticate on specific pages?

texts:
Is there any possibility to Re-Authenticate user especially on specific pages like we see in some websites?

Background: for some of the websites like banking sites, when you are initiated fund transfer it will ask you to re-authenticate your account. Main moto is here, user will be logged in a long back ago using "Remember me", so for visiting few pages I want to re-authenticate user.


texts: How to programmatically delete all values in custom CCK field for a given node?

texts:
I'm on Drupal 6, and I have a multiple value CCK field. I need a PHP function to delete all the values in that field so I can later repopulate it. I am currently doing this:

if (isset($node->field_received_email[0]['value'])) {
  foreach($node->field_received_email as $key => $value) {
    $node->field_received_email[$key]['value'] = NULL;
  }
}

However, sometimes when I later repopulate it, I get Drupal dblog errors like:

  Duplicate entry '16026-133' for key 'PRIMARY'
  query: INSERT INTO content_field_received_email (vid, nid, delta,
  field_received_email_value) VALUES (16026, 15888, 133,
  'whatever@email.com')

It appears that the primary key is remaining, and so when I go to write data again to the field it gives the duplicate primary key error.

Any suggestions on how to really delete all the values and keys from a multiple value CCK field in a given node so I can later re-write them?

Thanks a lot!


texts:
When I implement bartik_links__system_main_menu($variables) in my template.php file, there is nothing different in the main menu than the previous one. I've changed some of the markup in this function; I checked it in the theme developer, and the function that is responsible for the main menu is still theme_links() rather than bartik_links__system_main_menu($variables).

Why?


texts: How programatically choose between multiple shipping methods commerce_shipping?

texts:
I'm using Commerce Shipping Postal Code Weight to configure weight based shipping very happily. However, I have cases where I need to use flat rate shipping for certain items. The issue is that I don't know how to resolve the conflict between the shipping services. The particular case I have is that the weight-based shipping charge is less, and I don't want to show that to the customers.

So, how do I set up the conditions, where different shipping services are called?


texts: defining relationships between terms in a taxonomy

texts:
Is there a module which allows you to define a relationship between some terms in a taxonomy? Specifically, being adjacent? The taxonomy is flat.
So that Auckland has Northland and Waikato as neighbours (the use case would be to build a view of events in nearby regions)

My searching can't have used the right names for this - I'm not finding anything :-)


texts: How to find the values that have changed in a form submission?

texts: How can I tell what values have changed in a validate hook of a form submission?


texts: Print the main menu in overridden node page

texts:
In development site. I am using sitemap page so i need to print the all main menu and submenu in that page. I am using this code, but it is not working.

$main_menu = menu_navigation_links('menu-main-page');
echo '<pre>main menu';print_r($main_menu);

How can I achieve it?


texts: How to add a second search path for subdomain, using sphinx

texts:
Just wondering if anyone has had any success in implementing a second search path, for a subdomain, using sphinx search module in Drupal?

Any best practice advice, is much obliged!


texts: Redirect to the registration page of the main domain

texts:
I have a master site at http://www.abc.com and a subsite at http://www.abc.com/xyz.

I want to redirect a user to the registration page of the main domain, whenever a user tries to register on the sub-domain.
As they are different Drupal setups, how do I redirect a user?


texts: How to use hook_user_login and hook_user_logout to output content to the page

texts:
I came across this post: execute a php code after a user login and I implemented the accepted solution. In my implementation, however, I'm trying to output content to the page. This simply doesn't show up. My module name is "alert", and here's the code:

alert.module

<?php

function alert_user_login(&$edit, $account) {
  for ($i=0; $i < 1000; $i++) {
    echo 'hi<br>';
  }
}

alert.install

<?php

function alert_install() {
  // Set the module weight so it can override other modules.
  db_query("UPDATE {system} SET weight = 99 WHERE name = 'alert'");
}

function alert_uninstall() {
  // Remove the module from the system table
  db_query("DELETE FROM {system} WHERE name = 'alert'");
}

alert.info

; $Id$
name = Alert
description = Present dialogs or perform redirects based on certain events
core = 7.x

I'm implementing this in my theme's template.php file. Should this work?


texts:
I'm creating a website and I want to display a widget from another website inside a block.

In the widget description, I have this information:

  Paste this code at the top of your website code, with the other JS
  includes. If you are already loading jQuery, please remove it from the
  code below and only load the widgets.js

  Paste the following code where you want your widget to appear on your
  website, note that the widget is 100% width, so you will need to
  contain it.

How do I include this first code inside the header (or footer)?


texts: Is there a Drupal module to add a Creative Commons license to entities?

texts: I am looking for a module (beyond the Media Gallery module) that allows content creators to licence the content they create by means of the Drupal WCMS under one of the Creative Commons licenses. Is there a module for this?


texts:
I am trying to alter the title of my nodes to prevent URLS appearing in any title. This is the code I am using.

function mytemplate_preprocess_node(&$variables) {
  $node = $variables['node '];
  $variables['title'] = cleaner(check_plain($node->title));
}

cleaner() removes URLs from nodes. The above works perfectly on teasers, but not on full view or when the title is displayed in a list with other articles inside a block.

How can I make sure that the URL disappear whenever the concerned node's title is listed?


texts: Text format field missing for minimal installation

texts:
I installed minimal version of latest stable Drupal 8. It does not include any HTML text formats so I had to add my own custom Full HTML text format next to default Plain Text.

It also doesn't include any content types, so I had to create my own Basic page content type with Body field.

When adding/editing content under body field it doesn't show the Text format field drop-down and I cannot select neither out of two formats, it just loads up some default CKEditor.

Also with minimal installation it doesn't include Administrator role. So I did create my own custom Administrator role and gave it all permissions, including under Filter, but still no effect, even though I'm user/1.

How do I get Text format working/displaying on Minimal installation?


texts:
I have a Drupal site and I am unsure of how the files directory works.

It seems at the moment all files uploaded to the site go to the files directory. If I create a new node and upload fish.png which goes to the files directory another user also uploading a file called fish.png will overwrite my file.

Have I missed something here???


texts:
In Drupal 7 some menu items, even though they exist in menu_links db table, do not appear in the menu. I wonder if it has something to do with cache, but I have disabled the cache and cleared it.

If I add a menu item that goes for instance to <front>, it appears in the menu, but if I add a menu item for a certain node, it does not appear. I can't find the logical reason for it.


texts: How to substr_replace a "$" in front of price tags using VBO

texts:
I'm using Views Bulk Operations to update details on a bunch of products (more than 1300 of them.)  I am trying to insert a "$" in front of the #### price tag, and I receive an error of:

  Parsing Error in script: syntax error, unexpected '"$"' (T_CONSTANT_ENCAPSED_STRING)

Here is the PHP code I'm trying to execute. Can anyone tell me if I have typed something wrong here? I'm pretty new to this... thanks all!

$entity->field_my_field_name[LANGUAGE_NONE][0]['value'] = substr_replace($entity->field_my_field_name[LANGUAGE_NONE][0]['value'], '$', 0, 0);
entity_save('node', $entity);


texts: Views: displaying a field from a vocabulary based on the name

texts:
The following seems simple to me but i can't get it done in views:

A taxonomy vocabulary has two relevant fields: Name and Image. In the nodetype associated with this vocabulary i use Name as the linking field (i can not set the field up to directly use the image) but in the node view i want to show Image instead of Name. In my case Panels handles the display of my nodes.
I turned to views and tried two alternatives with a taxonomyterm view and a content pane display:

Add both vocabulary fields and rewrite the output from the Name field to use the Image field. If i put the Image field first i can see a replacement pattern that seems to match the Image field, but the result is crap. I think a real link between the node and the tax-terms is missing;
I added a contextual filter with Taxonomy Term: Name but get stuck because the value is not in the URL. Everything i tried in options like "Provide default value" and "Specify Validation Criteria" fails. Also, using the Argument Input option in Pane Settings, picking Name from the node list under "from context" seems to do nothing.
When i enter a valid Name value in Views Preview it returns the corresponding Image, exactly like i want. But someway that value isn't read when the view is run for real.

Any clues? Thanx in advance!

Kind regards,
Cas


texts: Drupal 7 Draggable Views in different order when logged in

texts:
My site is : www.terrafirmasouth.co.uk
I have draggable views set up for projects, I have a menu option called 'Sort Projects', certain users can access this to rearrange projects, if they have a role called 'publisher' .
I have given the Publisher role access to 'Sort Draggable Views' in People/Permissions (but not for anonymous users). When they are logged in, they can rearrange projects under a Sort Projects menu item (path is 'sort-projects'), and the order seems fine, then when they log out the order just reverts back to what it was before the update. When they log back in again, the order to retained from the previous update.  When I log in as administrator and do the same thing i.e. change order of a project,  the order is fine , and when I log out.

Is there some other permission I need to set for anonymous users so they see they updated order? Also, on the Sort Projects screen, it doesnt show 'updated successfully or saved' in green  at the top which I would normally expect, i dont get any message, other than the spinning circle at the top, then it finishes as normal. Any ideas?


texts: Sort content in a view by taxonomy term and use terms as headlines in drupal 8

texts:
Say I have a content type books and a taxonomy vocabolary book categorys i.e.

book categorys:
 - Novel
 - Short Story

Now, what I would like to display in a view is:

Novel

Novel 1
Novel 2

Short Story

Short Story 1
Short Story 2

I sure can make one block for each taxonomy term and filter by term, but I also create regulary new ones so that is not an good option.


texts: in drupal 7, views_get_view('VIEWNAME') get a error?

texts:
I want to embed a view in the tpl.php, so I am using the views_get_view('VIEWNAME') function.Here is what I am doing the tpl.php.

<?php
   $view = views_get_view('MapView');
   print $view->preview('default');
?>

"MapView" is the view's name, I am not sure the argument in the views_get_view is the machine name or human readable name, in fact in my example is using the human readable name, because I can't find the machine name in the drupal view configuration

anyway, I get a error saying "Fatal error: Call to a member function preview() on a non-object", seems like I didn't fetch the view in the correct ?

any idea ?


texts: How to convert a timestamp field into a date field?

texts: Is there a way to convert the data of a timestamp field into a regular date field in Drupal 8? preferably without coding or making a new module.


texts:
I have a module as defined:

parent
    child1
    child2
    ... parent module files

These modules install and operate correctly.  My question is regarding drush.  I want child1 to have the drush commands.  But when I declare them in child1 drush does not recognize them.  However, when I declare them in parent, drush finds the commands and I can use them.

Looking through the drush topic docs-configuration file to see what that might afford me, I could find nothing to tell drush to look at child-module folders.

And the drush documentation is.... lacking.

Is it possible to define drush commands in child1 or must they be defined in parent?


texts:
Using Drupal 7 and trying to store registration information into my own database.

I have a hook_form_submit() function that should be submitting the information into my own database table.

what it looks like:

 /**
 * Implementation of hook_form_submit().
 */
 function loanpieuser_database_form_submit($form, &$form_state){
    // Array of information to save into drupal user's table
    $edit = array(
                  'f_name' => $form_state['values']['f_name'],
                  'l_name' => $form_state['values']['l_name'],
                  'second_email' => $form_state['values']['second_email'],
                  );

    user_save(drupal_anonymous_user(), $edit);

    // Set custom DB
    db_set_active('loanpie');

    $dateFormatter = DateTime::createFromFormat('Y-m-d', $form_state['values']['dob']);
    $dob = $dateFormatter->format('Y-m-d');

    $nid = db_insert('loanpie_user')
     ->fields(array(
                    'ssn' => $form_state['values']['ssn'],
                    'dob' => $dob,
                    ))
     ->execute();

    // Change back to Drupal DB
    db_set_active();
 }

I do this and go back to check my database but no new column has been added.

Does Drupal require information about my external db tables or should it just be told that I want to insert x information into it? I have the credentials added in settings.php.

Is something wrong in this hook_form_submit function or would it be a database connection issue? I've tried to alter this function a million times.