texts: How can I provide an optional link to a Forum from a node (D7)?

texts:
I have custom node types 'foo' or 'bar', and each node should have its own associated forum you can easily navigate to from that node. I was hoping to eventually use the rules module to generate the forum upon 'foo' or 'bar' creation.

To both 'foo' and 'bar' I've added a custom Term reference field which is validated against the Forum taxonomy, and I have not marked the custom field as required. But when trying to save any of these content types, it's making this forum reference required. Why?

Possibly related - when I add this custom field to a pre-existing content type and then view a node of that type, I get the following error:

  Notice: Undefined property: stdClass::$forum_tid in forum_node_view() (line 271 of modules/forum/forum.module).

And if I try to edit, I get the following errors:

  Notice: Undefined index: und in advanced_forum_type_is_in_forum() (line 1038 of sites/all/modules/advanced_forum/advanced_forum.module).
  Warning: Invalid argument supplied for foreach() in advanced_forum_type_is_in_forum() (line 1038 of sites/all/modules/advanced_forum/advanced_forum.module).

(Yes, I'm also using Advanced Forums, but I think this is more fundamentally a base Drupal 7 Forum module issue.)

This topic (which is marked as a duplicate of this) is as close as I could come to finding a similar error, but seems to imply that I'm trying to save a forum node (as opposed to 'foo' or 'bar') without linking it to a forum term (forum or container). Which makes some sense as when I do provide a valid value to the custom Term reference field, the 'foo' or 'bar node will show up as a thread in the associated forum and the breadcrumb on node 'foo' or 'bar' acts like a forum node breadcrumb. However, I really don't want my 'foo' node to act like a forum node.

So I'm guessing that trying to link to a forum from an arbitrary node using a Term reference custom field is a Bad Idea. How can I do this without hardcoding a URL?


texts: What is the suitable file permission for 'files'?

texts:
I have written this small bash script to rebuild D6.22 file permissions:

#!/bin/bash
cd /path/to/drupal

chown -R bob:www-data .

find . -type d -exec chmod u=rwx,g=rx,o= {} \;
find . -type f -exec chmod u=rw,g=r,o= {} \;

cd /path/to/drupal/sites

find . -type d -name files -exec chmod ug=rwx,o= '{}' \;
find . -name files -type d -exec find '{}' -type f \; | while read FILE; do chm$
find . -name files -type d -exec find '{}' -type d \; | while read DIR; do chmo$

chmod -R 777 /path/to/drupal/sites/default/files  #bad idea??
chmod -R 755 /path/to/drupal/tmp

echo "Permissioin rebuild is done!"

Of course prior to executing the script 'bob' should have been added to www-data group using

  usermod -G www-data bob

I know that a security-aware admininstrator should avoid giving 777 permission to web server, however when I assign 755 to files, users can not upload image/avatars and I get a warning that says sites/default/files/pictures/picture is not writable.

So what alternative permission do you use for 'files' (and works)?

Thanks


texts: hook_menu_local_tasks_alter for specific tab

texts:
I've tried with my custom module to implement hook_menu_local_tasks_alter, but I'm not sure how can I edit specific tab.

Here's my example code:

<?php
    function my_module_menu_local_tasks_alter(&$data, $router_item, $root_path) {

        $data['tabs']['0']['output']['0']['#access'] = FALSE;

        //krumo($data);

    }

With this code I can hide the first tab, but that does on all pages.

When I'm using hook_form_alter and with krumo(form_id) I can see what form is and I'm using switch statement to edit specific form.
Is it possible to do this or something similar with tabs?

I'm not using CSS in this case, because I like to change the name of the tabs on specific pages too.


texts:
Drush for Drupal 6 had a plugin that allowed you to delete a view. That plugin's functionality was mostly rolled into drush for Drupal 7.

I have a view that can't be edited through the UI, and I was hoping the drush could solve the problem.


texts:
Since drush 9 (drupal 8.4 requirement), alias @sites does not seem to be implemented anymore (or yet ?).

$ drush @sites cr
The alias @sites could not be found.

Is this a way to get the same behavior that does not consist of typing my 300 alias in a config file ?


texts:
This issue hints it's possible to clone Option sets https://www.drupal.org/project/commerce_option/issues/1319618

  To reproduce:

  On page admin/commerce/products/option-sets Click 'clone' on any
  product option set. New option set appears as [original option set
  name] (cloned) Selecting 'Manage Fields' shows no fields and selecting
  'Manage Display' shows no fields added.

But there is no Clone button anywhere to be found under admin/commerce/products/option-sets following that instruction.

Does it require any additional module?


texts: How can I eliminate duplicate Drupal nodes in a View when one CT references the other?

texts:
Drupal 7 with relevant Modules: Views & Entity Reference

I have a view that simply shows the "Teaser" display type of two different Content Type records, we'll say they are Article and Page. This is built into a Views Page.

My Article CT has some simple fields that are shown.

My Page CT has a few fields, but also an Entity Reference field (unlimited entries). The Entity Reference field points to other Article nodes.

My View then, as expected, shows each record's Teaser display and of course when a Page record references another Article record, that Article's teaser is shown as part of the Page teaser.

This is great. The problem is, I do not want to show duplicate Article teasers. That means, if a Page references an Article, I don't want to show that same Article teaser as an individual listing.

Think of it like this, I have these Articles:

Article 1
Article 2
Article 3

And I have these Pages:

Page 4
Page 5
Page 6

Page 4 points -> at Article 1 and Article 2

Page 6 points -> at Article 2

TL;DR

Right now the view would show something like:

Article 1
Article 2
Page 4

Article 1
Article 2

Page 5
Page 6

Article 2

Article 3

What I want is this:

Page 4

Article 1
Article 2

Page 5
Page 6

Article 2

Article 3

Here's a Diagram:
http://i.stack.imgur.com/2joEr.jpg


texts:
I can't find anywhere documentation on how to create a sub-module inside a module in Drupal 8. I have created a custom module for translations I am trying to enable as sub-module.

In the main module, can I simply create a sub_modules folder and place my sub-module, including the submodule.info.yml file and the translations folder? I'm guessing I have to add something into my mainmodule.info.yml file but I have not found anything to help me.


texts: Migrating a site with a module that doesn't have a version for latest core version

texts:
I'm working on migrating a site from Drupal 7 to Drupal 8. All content and other things are migrated successfully excepts a module (the Field collection module) that is available for Drupal 7, but not for Drupal 8.

Please give guidelines if have any experience with it.


texts: Drupal Views: Add Views signature to all SQL queries adding view name to Inner Join

texts:
When I preview my view, I get an error and notice that the view signature in the query was added twice. The one that's an issue is:

':default' AS view_name

Here is the full query.

SELECT DISTINCT taxonomy_term_data.tid AS 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, 'video_categories:block' AS view_name
FROM {taxonomy_term_data} taxonomy_term_data
INNER JOIN {node} node_taxonomy_term_data ON (SELECT nodeINNER.nid AS nidINNER, ':default' AS view_name
FROM {node} nodeINNER
LEFT JOIN {taxonomy_index} taxonomy_indexINNER ON nodeINNER.nid = taxonomy_indexINNER.nid
LEFT JOIN {taxonomy_term_data} taxonomy_term_data_nodeINNER ON taxonomy_indexINNER.tid = taxonomy_term_data_nodeINNER.tid
WHERE (( (taxonomy_term_data_nodeINNER.tid = taxonomy_term_data.tid ) ))
ORDER BY nodeINNER.nid DESC
LIMIT 1 OFFSET 0) = node_taxonomy_term_data.nid
LEFT JOIN {taxonomy_vocabulary} taxonomy_vocabulary ON taxonomy_term_data.vid = taxonomy_vocabulary.vid
WHERE (( (taxonomy_vocabulary.machine_name IN  ('video_category')) ))

The error I get is:

SQLSTATE[21000]: Cardinality violation: 1241 Operand should contain 2 column(s)

Which makes sense since I am not expecting the second parameter to be in there for view_name. Why does it do this and how do I stop this feature from adding the view_name to the inner join on my query?

When I uncheck this box, the query works as expected, however, I use the signature in my reporting to quickly identify issues, slow queries etc.


texts: How do I properly render a private file URI with l()?

texts:
If given a private file with a uri of private://Screenshot from 2015-12-07 15-52-42_0.png. How might I use l() to properly render the link?

When rendered as follows I see https://server/drupal-private-file-system/Screenshot%20from%202015-12-07%2015-52-42_0.png instead of system/.... in the URL.


texts: Google Analytics Events Tracking Module not working out of the box

texts:
I was super excited to learn about the google_analytics_et module. I downloaded it and then uploaded to my staging site and enabled the modules like that mentioned. I then clicked around and notice that nothing happens like the documentation states. So I went to the internet to search for some answers. Nothing that helps me.

I am hoping that someone has some information. I wanted to add event tracking and the module seems to have promise. Is there a trick to getting it to work. Do I need to add javascript to the site, example module to make it work?

Is there a better way? Not being a developer is making it harder to figure out.

Thank you in advance.


texts: Allow CSS styling in node filtered HTML view?

texts:
I'm working through my first major Drupal 7 implementation.  My users need to create nested HTML ordered lists, with the various styling in Roman, numeric and alpha formats as listed at http://www.w3.org/TR/html401/struct/lists.html#type-values . The current project is taking place on a node of content type "book page."

This install is using CKeditor, which properly shows the various format types in edit mode.

In node view mode, though, the styles disappear, reverting to 1,2,3 format.  I found in the Filtered HTML settings the statement "... and CSS are always stripped."  Since CKeditor applies style commands to create the formatting method, it seems that Drupal filters them out.

Is there a method to allow styling in node view?  I just discovered http://drupal.org/project/css_injector but can't yet determine if it will do what I need.

Found this discussion which appears to be related.  http://drupal.org/node/259527


texts: How to set the first option as the selected in the SELECT form via hook_form_alter

texts:
I have created a Views with an exposed filter and I tried to use hook_form_alter to convert it to a select list. Now, I need to set the default value as the first option whatever output in the select list. I DONT'T need to have '-Any-' as the default value which usually do. I wonder how can I achieve this. The page keep showing the below message when first visit the page not until one of the option is selected and applied.

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

Here the code in my template.php. Hope you can help me out. Thanks!

if($form_id == 'views_exposed_form' && $form['#id']=='views-exposed-form-news-page') {

     //Query
     $query = db_select('node', 'n');
     $query->fields('n', array('title'));
     $query->condition('n.type', 'news');
     $query->orderby('n.title', 'ASC');
     $result = $query->execute();

     // Get Select options
     $options = array();

     foreach( $result as $node ){
       $options[$node->title] = $node->title;
     }

    // Alter the form
        $form['title_1'] = array(
         '#type' => 'select',
         //'#default_value' => ??
         '#options' => $options,
         '#title' => t('Filter By'),
    );
 }


texts: Lable of radio button does not have `for` attribute in custom form

texts:
I have created a custom form and showing the radio buttons as below.
 $organization_options = array(
      'ABC' => t('ABC'),
      'PQR' => t('PQR')
      'Other' => t('Other'),
    );

$form['organization_type'] = array(
      '#type' => 'radios',
      '#title' => t('Organization Type'),
      '#options' => $organization_options,
      '#required' => TRUE,
      '#default_value' => $options['ABC'],
    );

After printing this radio button in custom twig file {{ form.organization_type }}. I get the HTML as below.
     <input data-drupal-selector="edit-organization-type-abc" data-msg-required="ABC is required." type="radio" id="edit-organization-type-abc" name="organization_type" value="ABC" checked="checked" class="form-radio form-check-input">
      <label>
        ABC
      </label>

I want to add for attribute to above label, so that when user click on the ABC label the respective radio button gets checked.
The expected output:-
      <label for="edit-organization-type-abc">
        ABC
      </label>


texts: How can I get a custom number of posts on the front page without views?

texts: I need to have 16 nodes on the front page. Drupal only allows 1-10, 15, 20, etc. I'm using views now but it breaks the AJAX of the rate module.


texts: I've installed FullCalendar in my Drupal 7 installation and can display it on a page but can't figure how to add events to the calendar display dates. I realize FullCalendar is a view but when I add fields to the view, even date fields, it doesn't display anything.


texts: D7 - Print node taxonomy terms including custom term field as CSS Class

texts:
I have a list of possible taxonomy terms (vocab is called Categories) that can be referenced on a given node. For this particular vocabulary, I have a custom field called field_icon_class. The intention here is to make use of CSS Sprites, so when the terms for the page are rendered, they hopefully get printed out with the field as the CSS Class for the individual taxonomy term.

I've tried numerous ways to get these to render the way I would like to no avail. I've tried:

taxonomy_term_load_multiple($node->field_categories);

along with a combination of other iterative statements which weren't successful. Ideally, I would like for each taxonomy term for that node to render along the following lines:

[taxonomy term name]

Any ideas how this can be accomplished, or any module exists to do so? Much thanks!


texts:
so I am trying to create a view via Drupal 8 Structure->Views, and I am setting up this view to display certain shops in certain areas, I would like titles above each type of location of shops, so I would like u.s.a stores to have a title, and canada stores to have a title, is this possible in the view creator? for example:

Or should I create separate views, then sort in the twig files, example stores - can, stores - usa

Please let me know, thanks!


texts: In "Status report" it just outputs the string "version", which causes problems when querying Drupal version

texts:
When I go to "Status report" menu, only the string "version" is getting printed, which can cause problems with some modules like Webform.
I have Drupal 6.22, but in the "Status report", Webform writes "Webform requires at least version 6.16 of Drupal core.", which means the problem above can be a possible reason.
How can I fix that?

Here are some screenshots:

EDIT

The file system.module contains

define('VERSION', '6.22');

on line 11, which is correct, BUT the return value of this function was bool(false) (after checking it with a var_dump()), which means a failure (like when this was defined earlier or sg similar). After that, I put the following line BEFORE the above mentioned define function:

var_dump(defined('VERSION'));die();

and it gave back bool(true), which means this constant has already been defined!
I still don't know where, why and how...

There's a function with the name _drupal_bootstrap_full() (in /includes/common.inc, line 2673), in which module_load_all() function is called. The "VERSION" constant is defined after calling this function (and its value is "version" then), but knowing that doesn't make an advance.


texts: Does securelogin module needs to have a certificate?

texts:
securelogin seems to be a must to protect against spying login/password.

However it is not clear (to me) whether it requires a SSL Certificate.
I couldn't find this info neither in its module page nor anywhere else  :
http://drupal.org/project/securelogin
(is it too obvious that it does not need to say ?).
Thanks


texts: How do I print out a specific node to my page?

texts:
I'd just like to print out the body of a specific node (no title or other fields).  Am I doing this right?

echo node_load(127)->body['und'][0]['value']

I can't seem to find the answer in any of the Drupal docs.


texts:
I am trying to set cache with in my custom created cache table which is created with below code:

function custom_activity_dashboard_schema() {
  $schema = array();
  $schema['activity_dashboard_cache'] = drupal_get_schema_unprocessed('system', 'cache');
  return $schema;
}

function custom_activity_dashboard_update_7021(){
  $schema = custom_activity_dashboard_schema();
  if(!db_table_exists('activity_dashboard_cache')) {
    db_create_table('activity_dashboard_cache', $schema['activity_dashboard_cache']);
  }
}

Table created looks like screenshot :

Just added simplly this code to test if cache entry get created or not :

   $cache_time = '+10 minutes';
   $expire = strtotime($cache_time);

  $t_revisions = total_revisions();

  // set cache
  cache_set("total_revisions", $t_revisions, 'activity_dashboard_cache', $expire);

  // get and print cache value
  $cache = cache_get("total_revisions",'activity_dashboard_cache');
  echo $cache->data;

with above code there is no entry in database table when I run query to see :

But when I print value by cache get it prints value that was cached on my page.

I am not able to figure out what I am doing wrong and why cacnot I see entires in database table but the value after cache get is printed.

Please suggest what I am doing worng.

With same code I can see entires in database table on my loacl environment.

UPDATE :

We are using redis and entity_cache for full site.

Thanks!


texts: In Views 2, display only one value and leave blank all other values

texts:
I have a view that displays all nodes of a content type but I'm trying to display 1 value of a multi-value field and keep the rest of the values of the same field as blank. For example:

One field has 2 values: Yes and No. I'd like to display both nodes in my block in a table but for the column with the Yes/No field, I'd like to show "Yes" but leave blank if value is "No". Can this be done? Thanks


texts: Why are default values in a checkboxes $form not displayed?

texts:
I'm having a drupal form (7.x) of type checkboxes.

I have an array of values for my checkboxes.

$options = array(
    'uid'         => 'UID',
    'name'        => 'Name',
    'mail'        => 'E-mail',
    'created'     => 'Created',
    'edit_node'   => 'Edit',
    'cancel_node' => 'Cancel',
);

I have an array of default selected values.

$defaults = array(
    'uid'         => 'UID',
    'name'        => 'Name',
);

And now I try to make the default values selected by default, like this:

$form['dynamic_user_fields'] = array(
    '#type' => 'checkboxes',
    '#title' => t("Dynamic User Fields"),
    '#options' => $options,
    '#default_value' => $defaults,
    '#description' => t("Select the fields to display in the view."),
);

But this is not working, all checkboxes are unchecked by default. Where is my mistake?

What is not working so far: I've seen this related question but the answers do not work.

What I've tried:

(1) using numeric keys does not work.

'#default_value' => array(1, 2),

(2) using array keys does not work.

'#default_value' => array('uid', 'name'),

(3) using array structure does not work.

'#default_value' => array('uid' => 'UID', 'name' => 'Name')

Any ideas?

References

This is the full code I'm Using: views_handler_filter_dynamic_fields.inc#l317
This is a demo site: drupal-7/dynamic-user-fields
Related issue: #1245838 Default fields should be checked initially

I stepped up to maintain this module but the code base is a migrated D6 module.


texts: Is there a way to set a session variable but not save them in the sessions table?

texts:
I wanted to save a huge array in a $_SESSION variable. If I understand it correctly, Drupal saves the entire $_SESSION into the sessions table. But when the $_SESSION variable gets to around 3mb, MySQL throws an error.

I don't want to increase max_allowed_packet size, and I don't really need Drupal to save the array variable in the sessions table.

So, is there a way to set a $_SESSION variable that can be excluded from being saved into the sessions table?


texts: Running drush entity:updates claimed successful but not changing anything

texts:
I am working on a project with custom entity type. My module works fine in my local environment. But when I deployed to my staging site, things are strange.

For instance, I tried to change my entity definition and then run the drush command:

drush entity:updates -y

The command gave me positive response:

The following updates are pending:

dharmasun_payment entity type :
The Field 1 field needs to be installed.
The Field 2 field needs to be installed.

 // Do you wish to run all pending updates?: yes.

 Finished performing updates

Except the database was not changed at all. So when I re-run the command, it gives me the exact same output.

The staging site might have some different module installed than my development environment. But I cannot make breaking change on the staging platform (or my workmates would be mad).

My questions:

How do I begin to debug this? Is there anyway I can get better log messages with the drush entity:update command?
Or is there any alternative way to update entity definition and make changes to database?

Thanks.


texts: How can I capture JavaScript value for use on tpl.php

texts:
I have a custom module, in a javascript file that is located in the js folder of the module, I captured a value from a previously written function using an if statement. Ex: if($numb==6) show this img else show this img.

I need to access this value/var so I can display a particular image on my tpl.php when it loads.

How can I accomplish this in drupal7?


texts: Is it possible to disable taxonomy hierarchy?

texts:
The site I am building uses fields (plus a custom module) to provide a richer set of relationships between taxonomy terms than the built-in hierarchy allows.

I want to remove/disable the built-in hierarchy. What I mean is that when a user is creating or editing a term, I do not want them to see the "Relations" section, and when they are viewing a list of terms in a taxonomy, I want the drag-and-drop functionality to only work for ordering, not indenting.

I know I can do this with another module using hook_form_alter() or the like, but is there an easier and quicker way to "turn off" this functionality in Drupal 8? I have a vague memory of (maybe in an earlier Drupal, or somewhere else) being able to specify, when you create a taxonomy, if you want it to be hierarchical or not, but I cannot find such a thing here.


texts: What is the purpose of key_value_expire table?

texts:
In Drupal8, what purpose does the key_value_expire table data serve?  Can that be excluded from a database backup?

I ask because, during development, I backup the database using "drush sql-dump --ordered-dump" and exclude tables like "cache*", but after making a few minor content changes in a node/page (did not create a revision) and re-dumping the database, git diff is saying that all of the data in the key_value_expire table changed.

key_value_expire is one of the larger tables in Drupal, in terms of # of rows of data, so it will balloon the storage requirements for Git if the data in this table changes completely for every minor change on the site.

Also, is there a detailed explanation of the functionality/purpose of each Drupal table?

Thank you very much in advance.


texts: views_embed_view fails with contextual filters?

texts:
I have a view with 2 contextual filters, each is set to display all results if not present. This is tested on the Views edit screen using the Preview Contextual Filters. Both contextual filters filter taxonomy term Ids.

With none set it gives loads of results; with '152' it returns three results; with '152/366' it returns one result. These are the expected results.

However in my Drupal 7 code I have tried the following, but none of the ones with filters work:

print views_embed_view('my_view','default'); // ✔ all shown

print views_embed_view('my_view','default',152); // ✘ nothing
print views_embed_view('my_view','default','152'); // ✘ nothing
print views_embed_view('my_view','default',array(152)); // ✘ nothing
print views_embed_view('my_view','default',array('152')); // ✘ nothing
print views_embed_view('my_view','default',152,366); // ✘ nothing
print views_embed_view('my_view','default','152','366'); // ✘ nothing
print views_embed_view('my_view','default',array(152,366)); // ✘ nothing
print views_embed_view('my_view','default',array('152','366')); // ✘ nothing
print views_embed_view('my_view','default','152/366'); // ✘ nothing

Also, all the ones that use array for the contextual filter argument generate an error: "html_entity_decode() expects parameter 1 to be string, array given"

I feel like I'm missing something obvious here...


texts: Filter nodes that have a field date that is not in the future

texts:
I have a view setup to list nodes that have "public date" date field that are in the past.
To do that, the filter is doing a Content: Field Public Date <= today.
"today" if the site is set to UTC timezone, in views that comes out as:
DATE_FORMAT('2020-12-10T00:00:00', '%Y-%m-%d')

Except that means here in EST, nodes would be listed 5 hours earlier than intended.
If I set the site timezone to America/New_York (which it should be), then "today" in the views query comes out as:
DATE_FORMAT('2020-12-09T19:00:00', '%Y-%m-%d')

Except that (as of this writing) would be yesterday at 7 PM EST.
What we want is for nodes to not be in the listing until their public date is met in EST. So if a node has a public date of tomorrow (December 11th 2020) and today is December 10th 2020, then that node should not be listed until December 11th, midnight.
I don't work with date fields as filters like this often, is this the way to typically do it? Is this expected behavior?


texts: Unable to implement photo slider in theme template

texts:
I downloaded a theme from here and I chose this theme because I wanted to builder a slider photo gallery as shown in the screen shot here.

However, I am unable to achieve the desired effect because I am new at Drupal 7.

I have tried the following steps for implementing the photo gallery. Please help me out by pointing my mistake.

1- Identify block regions. These are as follows:

2- Make a content type with Image type as the field as follows:

3- Then I placed it inside the Slide show block provided by the template as shown in the figure.

4- I even made a view and placed it inside the same Slide show block provided by the template but I am not getting the slider that I want.The previous screen shot shows the view as well.

At best, I get a picture on the front page when I choose it as 'published to front page'.

So, does this mean I cannot implement a photo slider this way? And my only option then is to use a contributed module for a photo slider?

If the latter is true then what use is the template other than a basic mark up for html and css?

Lastly, is the solution to my problem that I use a contributed photo slider module and then place it in one of the pre-defined blocks provided by the theme?

Appreciate your help on this.


texts: 'Content Type' link not available for new content type

texts:
I have created a new content type (I can see in Content type list), but this is not available on "content >> Add Content".

Checked most parameters on creating the content type. No success.


texts:
Some products are delivered on a pallet and customers need to pay a deposit for those.

1 to 26 products go on 1 pallet. I need a rule that adds 1 pallet to the shopping card when the amount of that product is between 1 and 26.

For every 26 products more added to the shopping card there has to be added 1 pallet to the shopping card.

I created a rule that works fine when 1 to 26 products are added. But when customers add ore then 26 products to there card it does not work.

This is the rule I currently have:

{ "rules_sn_pallet_siniat_statiegeld_1_26" : {
    "LABEL" : "SN Pallet Siniat statiegeld 1-26",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "TAGS" : [ "pallet" ],
    "REQUIRES" : [
      "commerce_rules_extra",
      "commerce_conditions",
      "commerce_order",
      "commerce_cart"
    ],
    "ON" : { "commerce_cart_product_add" : [] },
    "IF" : [
      { "commerce_rules_extra_rules_condition_has_term" : {
          "line_item" : [ "commerce-order:commerce-line-items:0" ],
          "field_name" : "field_soort_pallet",
          "term_id" : "122"
        }
      },
      { "AND" : [
          { "commerce_conditions_compare_total_product_type_quantity" : {
              "commerce_order" : [ "commerce_order" ],
              "product_type" : "product",
              "exclude" : 0,
              "operator" : "=",
              "value" : "1"
            }
          }
        ]
      },
      { "AND" : [
          { "commerce_order_compare_total_product_quantity" : {
              "commerce_order" : [ "commerce_order" ],
              "operator" : "\u003C=",
              "value" : "26"
            }
          }
        ]
      }
    ],
    "DO" : [
      { "commerce_cart_product_add_by_sku" : {
          "USING" : {
            "user" : [ "commerce-order:owner" ],
            "sku" : "100",
            "quantity" : "1",
            "combine" : 1
          },
          "PROVIDE" : { "product_add_line_item" : { "product_add_line_item" : "Productfactuurregel toegevoegd" } }
        }
      }
    ]
  }
}


texts: Checking for changed fields - Identifying an empty array & Field Type

texts:
This is probably a simple question, but I am not finding it right away. I have a mostly working function to check for changed fields in a form. Here is the snippet checking for change:

// Check the number of values for each field, or if they are populated at all.
$old_field_count = (isset($old_field[LANGUAGE_NONE]) ? count($old_field[LANGUAGE_NONE]) : 0);
$new_field_count = (isset($new_field[LANGUAGE_NONE]) ? count($new_field[LANGUAGE_NONE]) : 0);

The problem I am a having is when I submit the form, empty text fields always respond as changed. The $old_field_count is not set, so comes up as 0. The $new_field_count is 1, because for some reason it is an empty array.

old count 0
new count 1 ... (Array, 1 element)
    0 (Array, 1 element)
        value (String, 0 characters )

There has to be an easy way to say "If ($new_field_count = "An empty Array") {$new_field_count = 0;}"

Edit: I found my answer in part. I tried If (empty($new_field_count[0])) {$new_field_count = 0;} but that just breaks any empty field that isn't a text field. So now I am thinking I have to additionally identify if it is a text field.


texts: How to set a node reference programmatically?

texts:
I'm creating a new node and attempting to the values of the fields programmatically. I cannot seem to figure out how to set a value for a node reference field, the widget type is autocomplete and it is set to unlimited values.

Here is my code to create the new node and an entity metadata wrapper

// Create the communication node and set the current user as the author
$new_comm = entity_create('node', array('type' => 'comm', 'uid' => $uid));
// create a wrapper for the new communication
$nc_wrapper = entity_metadata_wrapper('node', $new_comm);
// then I set some other field values via the $nc_wrapper

I cannot seem to set the value for the node reference field field_comm_relationship. I have tried all manner of setting the value including the following ($oc_wrapper wraps a different node type that also has a node reference):

I tried inserting it straight from the $oc_wrapper

$nc_wrapper->field_comm_relationship = $oc_wrapper->field_call_site_ref->value();

I tried using the set method

$nc_wrapper->field_comm_relationship->set($oc_wrapper->field_call_site_ref->value());

I tried both of the previous while accessing the actual nid value

$nc_wrapper->field_comm_relationship->set($oc_wrapper->field_call_site_ref->value()->nid);

and

$nc_wrapper->field_comm_relationship = $oc_wrapper->field_call_site_ref->value()->nid;

I tried to make the input an array

$site_nid = ['und' => [ 0 => ['nid' => (int) $oc_wrapper->field_call_site_ref->value()->nid]]];
$nc_wrapper->field_comm_relationship = $site_nid;

I tried using the node_load function instead of EMW

$node = node_load('node', $nc_wrapper->nid->value());
$site_nid = $oc_wrapper->field_call_site_ref->value()->nid;
$node->field_comm_relationship['und'][0]['nid'] = $site_nid;
node_save($node);

As suggested I do call save() later in my code, but it's not making it there because it hits a fatal error. For instance if I run this code

$nc_wrapper->field_comm_relationship = (int) $oc_wrapper->field_call_site_ref->value()->nid;

I get this error

EntityMetadataWrapperException: Invalid data value given.
Be sure it matches the required data type and format.
Value at node()->field_comm_relationship: 713511. in EntityMetadataWrapper->set()
(line 122 of /vagrant/sites/all/modules/contrib/entity/includes/entity.wrapper.inc)


texts:
I am using Drupal 7 on a CentOS 6.5 box. I am trying to debug some code which produces the following error:

  User error: ImageMagick error 1: convert: no decode delegate for this
  image format  /tmp/thesis-163.OBJ.xml' @ constitute.c/ReadImage/503.
  convert: missing an image  filename
  jpg:/tmp/thesis-163.OBJ.PREVIEW.jpg' @
  convert.c/ConvertImageCommand/2800.  in _imagemagick_convert_exec()
  (line 519 of
  /var/www/html/sites/all/modules/imagemagick/imagemagick.module).

I can see that the problem is caused by the fact that ImageMagick is trying to make jpg out of a xml file. What the error is about, isn't really the issue. The issue is that, when I insert a dsm statement to check what is going and run the program again, the error goes away. If I comment out the dsm statement and run the program again the error returns. I have never seen this type of behaviour before and can't explain it.

Unfortunately, I can't reproduce this behavior with a small snippet of code otherwise I would post it here.

Can someone explain why this is happening so that I can fix it?


texts:
I'm using drupal commerce and I added a new product (and product display).
I can see it in the listing, but when a user click on the product page, it's saying : permission denied.
All the other products works fine, it's only the last one which doesn't.

I tried to rebuild the permissions but that doesn't changed anything. How can I check what is "denying" the page ?


texts: I want to override page.tpl.php to work for all pages or custom urls

texts: If i override page.tpl.php to page--front.tpl.php which is working for only front page of site. But i want that overrided .tpl file should work for other urls as well. how can i create ? is there any other filename suggestion which i can use ?


texts: Point dev URL to the default folder of a multisite

texts:
In a multisite set up, the default domain www.domain.com point to the 'sites/default' folder.
I want a temporary subdomain point to the default site for development.
In the sites.php files I have:
$sites['dev.domain.com'] = 'default'; // this line can be removed due to the default behavior (see comment below)
$sites['sub1.domain.com'] = 'sub1.domain.com';
$sites['sub2.domain.com'] = 'sub2.domain.com';
$sites['sub3.domain.com'] = 'sub3.domain.com';
Pointing to the 'default' folder is not working for some reason?
What is wrong?


texts:
I am using the Field Group module on my user registration form.

Is there any option to add a help text (description) to the whole group, which has 7 input fields?

I want the users to be able to see some description text below the FieldGroup heading.


texts: Broken live site after upgrade although upgrading locally and stage was no problem

texts:
I have just upgraded a site from Drupal 8.7 to 8.8, and I now have a broken site.

Pages on the site (mainly admin pages) are now giving the following error:

  Drupal\Component\Plugin\Exception\PluginNotFoundException: The "entity:path_alias" plugin does not exist. Valid plugin IDs for Drupal\Core\TypedData\TypedDataManager are: entity_revision, entity_revision:block, entity_revision:block_content, entity_revision:block_content:basic, entity_revision:block_content:paragraph_in_block_display, entity_revision:block_content_type ...

(I've truncated it because it goes on at some length about the entity types available)

Clearly something has gone wrong during the upgrade process. I've run all the module updates via composer, and database upgrades, and imported the config that was exported from a development instance of the site that has successfully been upgraded.

drush updb tells me that all the database updates have been done.
drush cim tells me that my config has been imported correctly.
drush en pathauto, path_alias tells me that those modules are already installed.
drush cr clears the cache, but does not resolve the issue.

I'm aware that the issue is due to the Pathauto / path_alias changes that occurred between D8.7 and D8.8, and I'm aware that I've probably missed a step during the upgrade process. That doesn't matter right now; what matters is how to fix it now that I'm in this situation. Any help appreciated.


texts: New site appearing in folder structure after first hit on homepage?

texts:
This one has me scratching my head.  I'm new to Drupal and am trying to restore a backup of a Drupal 7 site to a 3rd party hosting provider (hostgator as it happens.)

I purchased a business account and domain name to experiment with, and via their interface installed Drupal 7 in the public_html/myaccount subfolder.

I then restored the backup to that same folder.  Beneath myaccount is the typical drupal file structure-- includes, scripts, sites etc.

Beneath the sites folder were subfolders all and default, exactly as restored from the backup and a typical Drupal structure.  But that has changed.

When I browse to www.myhostedsite.com/myaccount I get an unstyled version of my site along with messages on the page that say things like:
Undefined index: highlighted in include() (line 126 of /home4/xyz/public_html/myaccount/modules/system/page.tpl.php).

...and to my surprise, under the sites folder there's now a new folder with the name of the old site, with js and css subfolders beneath it.

How did that appear, and would anyone know what I may be doing wrong?  I've noodled with .htaccess and settings.php values but am not sure I know what to look for in either location (though I did set the database connection correctly in settings.php, I'm pretty sure.)


texts:
I am using Drupal panopoly. For a node type, I am able to display the content of the node and some profile information about the author. I used Contexts for this.
However now, I want to display the link to author's personal contact form. The link to the personal contact form shows up on the View profile page. I need to add a direct link to the Contact Form from the node display page. How do I do this?


texts: How to conditionally attach a stylesheet to a page, preventing anonymous users from getting a cached version?

texts:
I'd like to create a module capable of overriding some of the theme's css (for any theme). Think of small things like hiding the image, changing font sizes and colors, etc.

My initial thought was to toggle this using a session variable:

/**
 * Implements hook_library_info_build().
 */
function my_module_library_info_build() {
  $libraries = [];
  $libraries['override'] = [
    'version' => '1.0',
    'css' => [
      'base' => [
        'override.css' => [],
      ],
    ],
  ];
  return $libraries;
}

/**
 * Implements hook_preprocess_HOOK().
 */
function my_module_preprocess_page(&$variables) {
  if ($_SESSION['override']['enabled']) {
    $variables['#attached']['library'][] = 'my_module/override';
  }
}

This works very well for logged in users, but for anonymous users it only caches the first version of the page (using the status of $_SESSION['override']['enabled'] at that time). So some pages show the regular lay-out, and some only show the overridden version.

I realized that I probably have to add a cache tag, so I tried adding

$variables['page']['#cache']['tags'][] = 'override:' . $_SESSION['override']['enabled'];

Assuming this would allow 2 versions of the page to be cached, either for override enabled or disabled. But that does not work either.

What needs to be done to allow multiple versions of the same page to be cached and served, depending on a $_SESSION variable?


texts: views 3: select only one value from a multivalue field

texts:
I have a content type which has a multivalue image field. I need to create a view that displays a list of nodes of that type but displays only one value of that multifield, not all of them.

I need to get something like this:

node title
first image

node title
first image

etc

Any ideas? Thanks, M.


texts: drupal 7: my hook module make my site slow?

texts:
I create my own hooks module, in a simple frame (to test it) to change  in exposed filter of view to 'All' , but when I enable this module, it's work fine but make my site slow .. and just when I disable it , my site back to fast, what is my mistake?

myhooks.info

name = my hooks module
description = hooks website module.
package = myhooks
core = 7.x

myhooks.module

function myhooks_form_views_exposed_form_alter(&$form, $form_state, $form_id) {
  if($form_id == 'views_exposed_form') {
    $form['name_list']['#options']['All'] = 'All';
  }
}


texts: How can I add my field of his type of material to be used in the rule

texts:
I need to compare two different entities in the field after the update term.
Event: "After updating existing term"
One field is in the drupal commerce product, the other in a term. With the help of "entity has a field" do not get to add because you do not see the entitie of the product. What can be done to solve the problem?


texts:
I am trying to upgrade to Drupal 9, but I have two modules that aren't compatible. I patched both the modules to make them compatible.
However, I can't upgrade to Drupal 9. When I do, it tells me those modules don't meet the requirements, which of course is true, since they need to be patched.
How can I upgrade to Drupal 9 if those modules initially don't meet the requirements?


texts: Redirect to a specific page when user update their profile

texts:
Is there any way to redirect the user after save their profile information.

I would like to redirect them to a specific page.

To be clear, here is the Flow:

User go in his profile
He change his password information
The user click on Save Button
The information is save and I want to redirect him on a specific page (node/xxx)


texts: Add a new colum with a button to field collection

texts:
I'm trying to add a button or a link (< a href=''>< /a> or a < button>< /button>) in a new column in my field collection. For the moment i have 3 fields added by the administration of my field collection. I searched for add a button by the administration but we can't. what the best tips to add a button in a new column of my field collection ?

Do i need to "foreach" all element of my field collection and add a new element with the HOOK_form_alter ?

Here an example with the actual view (i cut the "delete line button" here so there aren't on the picture):

And now what i wanna create :

The "button" can be a link and after with css i style him.

PS : the button appear on edit content form

Thanks !


texts: How to I change the blogger's name button from all lower case to proper case in Omega 3.1 subtheme?

texts: I want firstname lastname's blog to be Firstname Lastname's blog


texts: Combine 2 contextual filters - taxonomy term ID from url and NID

texts: Is it possible to get taxonomy term from url and node id at the same time from current node? I need to get taxonomy term from current node to pull some date from referenced nodes that have parent taxonomy of current node term. So far ok. But moreover I need to be able to get to current node's fields. Using another conextual filter to get NID was not helpful.


texts:
I hear the buzz words, "continuous integration", "drush" and "jenkins" often. Thus, sparking my interest.

How are drush and jenkins used together for continuous integration?

Also, why would you want to use drush and jenkins together?


texts: Is there a firm or preliminary decision on which modules will leave Core for 8?

texts: I seem to recall I've seen a more than one discussion about breaking out certain less than maintained modules from Core. They would presumably be moved to contrib instead. Currently I can't find any information on this topic.


texts:
I am trying to get user data by UUID in my custom module and I don't know how to join on users_field_data table to get user fields (email, username, etc.).

My request for the users table works but I don't know how to join.

$query = \Drupal::entityQuery('user')
          ->condition('uuid', $uuid)
          ->execute();
$result = User::loadMultiple($query);
dpm($result);

How can I execute a join with the users table?


texts: How can I find out what's denying permission to access a path?

texts: user/uid/edit is giving permission denied where uid = the current user's uid. The permissions all look correct. Is there any way to find out what exactly is denying the permission?


texts: All WYSIWYG Editors do not show up on site

texts:
I have installed the CKEditor module, but my editing block doesn't show up properly:

I've followed all suggestions listed here:
the WYSIWYG editor doesn't show up, drupal 7

In previous websites I've done, once installed, I never had problems like this.  The "Full HTML" or "Filtered HTML" dropdown is gone, and the editor, though looks to be a WYSIWYG editor, isn't CKEditor, and as such, doesn't show the options that I've chosen in CKEditor Configuration pages.

Here's an example of another site I've used it on, where it works properly:

EDIT
I have now tried the CKEditor module alone, and have tried each WYSIWYG editors (uninstalling other modules each time so they're independent).  Even after selecting which module to use for text (via the instructions on the link above), the WYSIWYG editor will not change from what you see above.  This includes 1) only showing limited options that I can't change, 2) not allowing my to change between Full & Filtered HTML & other options.

Thanks in advance for any help.


texts:
I just got a project from a friend:
D6, 6.34, 3 languages.
Theme: Sharp Sales (via Fusion via Topnotch)
So quite an ancient project and I first installed a local copy, but I can't login - it keeps on forwarding me to the live server.
I deleted the rewrites in .htacces, deleted cache, watchdog, access_log tables and I searched for redirects in the database, but it seems to come from the theme somehow:

INSERT INTO `cache` VALUES ('theme_registry:tnt_sharpsales_6',
...
:\"skinr_preprocess\";}}s:23:\"link_formatter_absolute\";a:8:{s:9:\"arguments\";a:1:{s:7:\"element\";N;}s:4:\"file\";s:14:\"link.theme.inc\";s:4:\"type\";s:6:\"module\";s:10:\"theme path\";s:22

and I found sth in the template.php as well:

* @param $options
 *   An associative array that contains the following other arrays and values
 *     @param $attributes
 *       An associative array of HTML attributes to apply to the anchor tag.
 *     @param $query
 *       A query string to append to the link.
 *     @param $fragment
 *       A fragment identifier (named anchor) to append to the link.
 *     @param $absolute
 *       Whether to force the output to be an absolute link (beginning with     http:).
 *       Useful for links that will be displayed outside the site, such as     in an RSS
 *       feed.
 *     @param $html
 *       Whether the title is HTML or not (plain text)
 * @return
 *   an HTML string containing a link to the given path.
 */
function tnt_sharpsales_6_themesettings_link($prefix, $suffix, $text,         $path, $options) {
  return $prefix . (($text) ? l($text, $path, $options) : '') . $suffix;
}

So I installed a fresh D6 and copied the theme over, but I can't find a setting there for absolut links.
Anybody any idea how I could get rid of the absolut links?


texts: Form always visible even when radiobutton value is changed (form api)

texts:
i'm having an issue with the property #states visible on a form.

I want to hide it when form mercuriale's value is 1.

$isMercuriale = db_query('SELECT isMercuriale FROM groupes_catalogues WHERE id = ' . $idCatalogue)->fetchField();

  $form['mercuriale'] = array(
    '#type' => 'radios',
    '#title' => t('Type de catalogue'),
    '#default_value' => $isMercuriale,
    '#options' => array(
      '0' => t('Classique'),
      '1' => t('Mercuriale'),
    ),
  );

  /* Secteurs */
  $listeSecteurs = db_query('SELECT tid, name AS nom FROM taxonomy_term_data WHERE vid = 7 ORDER BY nom');
  $header = array(
    'nom' => t('Secteur'),
    //'reduc' => t('Réduction (%)'),
    //'option' => t('Statut'),
  );

  $options = array();
  foreach($listeSecteurs as $secteur)
  {
    $options[$secteur->tid] = createFieldsCatalogue('secteurs', $secteur->tid, $secteur->nom, $idCatalogue);
  }
  $form['secteurs'] = array(
    '#type' => 'tableselect',
    '#header' => $header,
    '#options' => $options,
    '#default_value' => $uid,
    '#states' => array(
      'visible' => array(
        ':input[name="mercuriale"]' => array('value' => 0),
      ),
    ),
  );

What am I missing ?
Thank you.


texts: Using path aliases how to identify node IDs from database and based on these IDs how to publish them?

texts:
I have a content type called article. For this content type, I unchecked the "Published" checkbox under the publishing options tab.

I have 30000 nodes I changed to unpublished. Among those, I want to publish 900 records. I have the node URLs.

Using the path aliases, how to get the node IDs? Once I have the node IDs, how can I publish those nodes?


texts: Copy values from taxonomy term field to new text field in content-type

texts:
I have a content-type with a certain taxonomy term field that allows multiple values.

I don't need this field to be a taxonomy term field anymore, but just a simple text field. So, I want to "transform" the nature of the field.

I do know it is not possible and that I have to create a new text field and copy the values of my first field into my second through a custom php script.

But I hardly think that I'm going to need some help from you guys for the SQL query that will be a bit complex.

I need to recover all the term's names for each piece of content
and, if there are several of them, concatenate them with a comma (for example),
and then copy the result in the new text field before deleting the old taxonomy field.

The truth is I have no idea how to proceed. Can I run the query directly in PhpMyAdmin? Or in a PHP file? Do I need to use a simple SQL query or an EntityFieldQuery class? I'm not very familiar with this kind of stuff.

Thanks in advance for any clue...


texts: IMCE file browser doesn't list the files in the Directory path that are uploaded by FTP

texts:
I installed IMCE and Filefield_sources modules to browse the files on the server. my website is on the localhost yet. the directory path of User-1 which is assigned to the administrator is set to <root>/temp_files but when I click on the browse file link in the add new content page it only displays files the are uploaded via IMCE file browser not the files I uploaded in the  Directory path. why ?

UPDATE:

my OS is Windows so I guest it is not permission related.


texts: Creating a filter programatically with views_get_view

texts:
I have a lot of views and I want to add a filter to just one of them. This view is called soccer_news_feed and I want it to check out my custom field: field_data_field_is_score and display if it's not 1.

So in a hook_update_n I have this code:

$view = views_get_view("soccer_news_feed");

$view->add_item(
  $view->current_display,
  'filter',
  'field_data_field_is_score',
  'field_is_score_value',
  array('operator' => '<>','value' => array('value' => 1))
);

So I thought maybe this work but I get this error when I run updb:

PHP Fatal error:  Call to a member function get_option() on a non-object in /var/www/public/sites/all/modules/contrib/views/includes/view.inc on line 2450

I'm very lost on this.


texts: Drush: difference between pm-update pm-updatecode

texts: What's the difference between pm-update and pm-updatecode? I reviewed this in the Drush documentation, but they sound the same.


texts: how to show 2 content fields when page load in drupal 7?

texts: I am using drupal 7 and I have created a content type and give the ability to this content type, User can show this content type and create node..Here I am using field collection with 2 fields textarea and image upload with multiple option..So basically its show one group or textarea and image. but I need to show 4 groups in first time..Then user click on other item then it create new group.


texts:
So I'm trying to get the import-html module to import files every time there is a cron run. However, I was hoping someone could help me understand what the format of file_list, profile_id, and source_siteroot is supposed to be. Below is my interpretation of file_list and source_siteroot

function cronmonitor_cron() {
  if(variable_get('cronmonitor_enable',0)){
    $file_list = ".";
    $context = array();
    $context['profile_id'] = drush_get_option(array('profile-id'), import_html_current_profile_id());
    $context['source_siteroot'] = "sites/default/files/old-sites/.";
    import_html_import_files($file_list, $context);
  }
}

but whenever I run cron, I get

invalid argument supplied for foreach() import_html_process.inc:52

This in turn is the line

foreach ($file_list as $list_index => $rel_path) {

Which definitely means there is something from with $file_list, right? What should its structure be?
The site says it is
"an  array of simple file paths, probably selected from the file_list form.
 *   Relative to the import context settings."
But it'd help if someone gave me an actual example as the words go over my head right now.


texts:
I tried to manage drupal modules with the --package_handler=git_drupalorg which needed me to add the --gitinfofile option. Using drush dl this works but if I try to update my modules with drush up the version information is the same as of the drush dl version.
Is there a fix for this or a guide which explains how to use drush with the git version control system.
I am using the drush 6.2.0 version.


texts:
I am using bootstrap sub-theme as default theme.  I created a views slideshow block. In the tpl file, I added this:

<div class="test-region">
 <?php print render($page['test']); ?>
</div>

I placed the slideshow block into the above region.I can see my slideshow on my site. I added the below css to make the image slideshows 100% full width but it is not working. When I refresh my page, I can see the image slideshows in full width for 1 sec but then images go back to original sizes.

.views-slideshow-cycle-main-frame-row-item .field-content img {
    min-height: 500px;
    width: 100%;
}

Do you know why images show in full width for a sec then go back to original sizes?


texts:
I need to create a custom form with a vendor dropdown ("Vendor A", "Vendor B") and a list box with multiple options belongs to selected vendor. Once a user select Vendor from dropdown, list box will be populated options related to this vendor. To do it in drupal 8, i created taxonomy vocabulary "vendors" and "vendorA_options", "vendorB_options" vocabulary to save vendor related options. Vendors will be max 5-8.

Is this the right way to do this in drupal 8 or i should add custom tables for it?

Thanks in advance.


texts: How to hide empty fields on user accounts display?

texts:
Let's say a profile2 has 3 fields.

Weight:
Height:
Length:

The user only inputs 45 kg and 160 cm, BUT for length he inputs nothing.

Now the display is like this:

Weight:45kg
Height:160cm
Length:Select

How can I hide the field that had no input like this:

Weight:45kg
Height:160cm

Since the user didn't select any value for length, and it's not a required field. I don't want it displayed on the user profile.

I know this can be done with Views and no results behavior, but I need this for user profile display.

Here is a live example:

http://vuxi.com/users/nitap


texts: How to create an entity reference view that contextually filters based upon current user ID

texts:
I'm looking to create a entity reference view that filters based upon a field I've placed on the user profile.

I have two content types (Speakers, and Blog Authors) (Speakers will also be blog authors) that I want to as an available list of authors on a Blog content type, so on creation, the speaker can choose the author profile to link the particular blog to, but filtered by only those listed on a particular user's user account.

I've placed an entity reference field on the user account that is a link from a specific user to a specific piece of content of either the Speakers or Blog authors content type (called blog_author_link).

I'm looking to create a view that filters the entity reference field on the blog content type based upon which field is selected in a users profile.

I have a view that successfully lists both content types, but when I attempted to add a relationship from that user account link (blog_author_link), and contextually filter based upon Content:nid and set it to pull from the logged in user's id, it doesnt seem to work.  (Yes, There are users that have that attribute assigned, and I've passed those arguments and the filter results in no output).  I tried to do a uid, but I dont think that is available on the entity reference view type.  I'm a bit over my head.

Any Ideas?

EDIT:
Ok, so It seems based upon when I start passing random arguments into the preview's contextual filter that it is looking doing exactly what I'm telling it to do, filter based upon the NID, when I need to filter based on the UID,  but there is no contextual filter for the UID under Entity Reference Views type...  Any one have any idea what I'm talking about?


texts: Google+ button for sharing an article (just like TweetMeme) available?

texts:
I need a button to share the current node to Google+?
Is there a module to implement it?

I already have a standalone one (TweetMeme for twitter and another one for facebook )


texts: Add upload/processing status bar/throbber

texts:
I am new to Drupal/web development and I have been trying to create a module to add files upload menu. Once the files are uploaded, they undergo processing and a message is displayed upon completion of the process. Everything works well but I would like to add a processing progress bar/throbber from the tile Submit button is selected to when the final output is displayed. I am clueless on how to implement this. Any help is appreciated
Here's part of the code I used:
//Before this part of the code, there is function to create Menu ($items[])
function g_p_proc_form($form, &$form_state, $values) {
    $form['#attributes']['enctype'] = 'multipart/form-data';
    $form['filter'] = array (
        "#type" => "fieldset",
        "#title" => t("File Process <BR> "),
        "#collapsible" => TRUE,
    );
  // without this attribute, upload may fail on submit
    $form['#attributes']['enctype'] = 'multipart/form-data';
    $form['filter']['file'] = array(
        // '#title' => t('File processing'),
        '#type'  => 'file',
        '#name' => 'files[]',
        '#description' => t('Select Submit to start processing the file'),
        '#type'  => 'file'),
        '#upload_location' => 'public://',
        '#attributes' => array('multiple' => 'multiple'),
    );

    $form['filter']['submit_upload'] = array(
        '#type'  =>  'submit',
        '#value' =>  t('Submit'),

    );

    // drupal_set_message(t("in fn"));

    return $form;
}

function g_p_proc_form_submit($form, &$form_state) {
    try{
        $number_file = count($_FILES['files']['name']);
        $f_name = array();
        for ($i=0; $i<$number_file;$i++)
        {
            $file = file_save_upload($i, array('file_validate_extensions' => array('pdf PDF')), 'public://', FILE_EXISTS_REPLACE);
            $f_name[] = $_FILES['files']['name'][$i]; //[]
        }
            }catch (Exception $error){
        echo 'Exception: ',  $error->getMessage(), "\n";
    }
    $n_f = count($f_name);
    drupal_set_message(t('Number of files: !n_f', array('!number_f'=>$n_f)));
    $fn_name = 'g_p';
    $fn_call = $fn_name($f_name);
function g_p($f_name=array()){
    $curr_l = getcwd();
    chdir('My file processing PHP script location ');
    $n_f = count($f_name);
    $shell_command = shell_exec("file_processing_php_script_name.php");
    //header("Location: "Current file processing module menu site"); //Commented out
    drupal_set_message($shell_command);
    chdir($curr_l);
}

As it can be seen from the code, I process the files upon upload and display the output message after processing. I would like to add a throbber/processing-progress bar from the time Submit is selected to the time the output is displayed, after the files are processed. How can I achieve this? Again, please understand that I am new to web development/Drupal and am not very proficient in terms/commands used in them.


texts:
I've installed Drupal 8 in a minimal installation; I've enabled CKeditor and created a text-format called "Full". I've also created a role named as "Administrator" and gave it all permissions available whatsoever; After that, I've attached my user "Admin" to that role "Administrator" and associated it with my newly created text-format ("Full"). I than decided I'm good to keep on:

After I did all of this I went to my content type and clicked to edit it's body field... When I went in to the edit screen I didn't see any place to attach the new text format I created to it, so where is the right place to set the field for other text-format rather than the default "plain text"?


texts: dblog not working, page shows a 500 Internal server error

texts:
My problem starts in a contact form with an upload box, it does everything right and sends the email, except that, on upload it shows:

  Warning: strtr() [function.strtr]: The second argument is not an array in syslog_watchdog() (line 105 of syslog/syslog.module)

So I found this post to resolve my problem above, but it just showed me another problem, a problem with dblog, the page shows me a 500 error, I can't access it.

I couldn't find any help to solve this matter so if anyone knows some way to figure out what is causing this, I would appreciate it.


texts: How can I export webform analysis data to excel sheet?

texts:
Screenshot:

Problem:
I want to export all Analysis datas to excel sheet.

I am using drupal 7.53 and webform 7.x-4.14.


texts:
I have two blocks on our Drupal 8 front page: one shows a list of events upcoming; the other a list of events past. The blocks are generated from views filtering nodes whose event dates are after and before today's date respectively (using an 'event date' field, not the date authored).  The granularity of the event dates is to an hour. The filter is set to compare to 'now'.

But ... the lists are rarely up to date, usually several days out in fact. With 'future' events having event dates of days recently passed.   So I'm not looking at caching as the source of the problem (rightly or wrongly) as we have cacheing configured in hours not days.

What can I do to ensure that the lists are correct each day?


texts: Create a zip file from a list of selected files and make the zipped file downloadable in Drupal 8

texts:
How to create zip file programatically based on the files selected in Drupal 8? Is there any class already existing in Drupal 8?

As per below answer I'm using following code to generate zip file:

$file = \Drupal\file\Entity\File::load($fileId);
$fileUri = \Drupal::service('file_system')->realpath($file->getFileUri());

$zip = \Drupal::service('plugin.manager.archiver')->getInstance(['filepath' => '/foo/bar.zip']);
$zip->add($fileUri);

The bar.zip file above should exist in the referenced path above: /foo/bar.zip.
Also how do I flatten the the zip file folder structure so that the file sites/default/files/myimage.png is myimage.png?


texts: Views load the whole entity even though they only need 3 fields

texts:
I am using Views to fetch the 3 fields of a specific entity. However, this leads to the view to make a full load of the entity and all the images included in it, even though they are not displayed. This leads to loading 20 images per entity instead of 1!.
How can I hook into the process and modify this. I tried almost all view's and entity's hooks but nothing seems to have an effect. Any ideas?


texts: How to use tags for filtering images to be displayed using views?

texts:
I'm pretty new to Drupal (version 7). I'm trying to create multiple image galleries. I've created a content type called "Images" and use a view to display it like a gallery.

However, I wonder if there is some way to "tag" the images so that they go to different views. Ex.: I have an image tagged so that it will only appear in the "events view" and not the "projects view".


texts:
Drupal uses t() in various places. I was wondering if there was a way to hook into this function. Basically, if Drupal calls:

t("some string");

I wanted to modify this string and add "BOOM" at the end. I was hoping it would be as easy as this

function mymodule_t($string)
{
   return $string.'BOOM';
}

But no luck... any ideas on how to get this right?


texts: Override Another module's Template file using my Custom Module (Drupal 7)

texts:
I'm willing to change the user-profile-item.tpl.php template provided by the user module.

I've created a new template file. Now my  question is:

Where do I put the new template user-profile-item.tpl.php template
file? I've created a custom module, should I place it right in the
custom module's directory?
Do I need anything to do so that Drupal
picks up my template file instead of the default template file?

PS I got this link did not understand. Sorry I'm a newbie :(

EDIT:

I solved this using preprocessors, I figured out that I can use preprocessors easily without changing template file. I wrote following preprocessor in my module to achieve what I was looking for.

function MYMODULE_preprocess_user_profile(&$vars){
//    dsm($vars); // prints nice debugging information
    $vars['user_profile']['charity_link'] = array(
    '#markup' => l('Add Charity!', 'my/custom/link' . arg(1)),
    '#weight' => 10
    );
}


texts:
I'm looking to a way to make a call to a PHP function in my Drupal 6 module, and return the result asynchronously to the page.

I'm familiar with jQuery AJAX, but I don't understand how to post to a function using it. Does anyone have experience on doing this?


texts: What is difference in the referencing entity options while adding a relationship in a views?

texts:
I have entity reference field field_patient_reference.
While adding a relationship in views I get two options :
What is the difference between the two options below:

  Entity Reference: Referencing entity A bridge to the Content
  entity that is referencing Content via field_patient_reference

  and

  Entity Reference: Referenced Entity A bridge to the Content
  entity that is referenced via field_patient_reference


texts: Authenticated users can't view the front page

texts:
I set node/4 as the front page on the Site Information screen.

This works for anonymous users, but authenticated users cannot access the front page (node/4).  Even if they manually type www.site.com, they are redirected to www.site.com/user/4.

Please help me out.


texts:
I'm simply trying to implement the tabs widget on a particular page.

I have both jquery_update and jquery_plugins modules enabled.
If I go to Administration > Reports > Status report Under jQuery Update, I see jQuery 1.10.2 and jQuery UI 1.10.2 are both green and showing as loaded.
If I type jQuery.fn.jquery into the console I see "1.10.2"

But the bad news is

If I try to use jQuery("#tabs").tabs();  I get an Uncaught TypeError: undefined is not a function error
If I enter any of the following "jQuery.fn.ui","jQuery.ui", "$.fn.ui", "$.ui" into the console:  I get undefined
Having this in my template.php:

:

 function my_theme_preprocess_page(&$vars){
   drupal_add_library('jquery_plugin', 'tabs.min.js');
 }

does nothing.

And finally, checking the heading of the rendered page, I see a call to Google CDN to the minified version of jQuery 1.10.2, but don't see any similar call to grab the jQuery UI library.

Working with Drupal and jQuery is such a nightmare, what else can I check, do, change, to get this working?


texts: Security Review - Untrusted users are allowed to input dangerous HTML tags

texts:
I am getting the following error in my security review:
Untrusted users are allowed to input dangerous HTML tags.

Is this because in my text formats I've got the following:
Plain text  All roles may use this format

Should I disable  anonymous users from being able to access plain text?

Also, it is saying:
It is recommended you remove the following tags from roles accessible by untrusted users.

img

Should I remove the img tag from authenticated users???? Does this mean that authenticated users will not be able to uploaded images to their site at all?


texts: Using views to display content based on taxonomy terms?

texts:
I have created a faculty profile system on our university departments site. Every faculty member is tagged with terms regarding an area of expertise (either in teaching or in research).
What I need is to create a view that takes the areas of expertise from a specific faculty members page, and displays the other faculty members that also work within those areas. (but only those areas)

What I have done  so far is a view that wants to show ALL the terms on EVERY faculty content type, but I need to have the view filtered somehow based on the specific page that is being viewed. Here is what I have:

http://sustainable.unt.edu/irene-klaver

Here is an example of what I need: http://sustainability.asu.edu/people/persbio.php?pid=188

The faculty nodes are a custom content type (CCK). The view uses Imagecache/Imagefield to use the thumbnails. The terms have their own vocabulary in Taxonomy, specifically for this purpose. I am using Drupal 6.

I have been told by a few that this might not be able to happen with Drupal, and that I have to create some custom php code in my node-faculty.tpl.php file. Since the ASU site aboves developer doesn't use Drupal, they couldn't really help me out much. I find it hard to believe that someone hasn't needed a function that is similar to this before... If anyone can at least point me in the right direction, I would greatly appreciate it!

Thanks!


texts: How to display an image in a Views RSS feed

texts:
I am trying to display an image in a Views RSS feed.

I have added the following fields to my View: field_image,
field_title, field_twitter (These fields come from my node).
I then set all fields to "Exclude from display".
I then create a new field in Views called "RSS Content".
I then place tokens for all the fields (from step 1) into "RSS Content".
Finally, I go to "Views >> Show >> Settings". In the drop down menu for "Description field", I select "RSS Content".

When I look at my RSS feed, the image field is displayed like this:

    <description>
&lt;img src=&quot;http://example.com/sites/files/nodes/content/images/intro/two-hearts-1312984-1280x960_0.jpg&quot; /&gt;
</description>

How do I get the image to display properly, instead of the image tags being escaped?


texts: Get select options for an entityreference field using another field as a contextual filter?

texts:
I have a Course Offerings vocabulary where each taxonomy term is an educational course.
Users have a multivalued My Courses Entity Reference field referring to the terms of the courses they're enrolled in.
I have a custom content type (Entityform) with two more Entity Reference fields: a Course field and a Student field. The user must first select a course (a Course Offerings taxonomy term), and then select a student (a user).

Here's the kicker: I need to filter the Student select list options based on what the user selected in the Course field.

The Course field select options are generated by a view that returns the current user's My Courses field courses. After the user selects one of their courses, the Student field select options should be generated by a view that uses the course they chose as a contextual filter to return a list of only the users enrolled in that course.

I know how to build the view once I have the contextual filters, but I'm stumped as to how to pass the Course term to the view as a contextual filter. Is this possible?

EDIT FOR CLARIFICATION:

Both the Course and Student fields are Entity Reference fields.
Both use select-list widgets whose options are populated with views Entity Reference displays.
The Course field comes before the Student field on the eform. The intention is that the person filling out the form will first choose the course. Then they'll choose the student from a list of students enrolled in the course they just selected.


texts: How to change the variation title in the add to cart block in Drupal Commerce 1?

texts:
I'm building a store in D7 and Commerce 1. My product variations have a Size attribute - these are displayed in the Add to Cart block as a list of radio options.

I would like the option labels to include the price of that variation, e.g.

Small - $10
Medium - $15
Large - $20

These labels should be generated automatically from the price.

I figure this could be achieved with a simple function, but I haven't been able to find one. Any suggestions welcomed!


texts: How to check node authorship info in views

texts:
I want to show users their published articles in a block. Those articles have their author name set in by Admin manually while the articles are created by Admin on behalf of the users.

In views I don't find any field in Node to compare authorship of the node with logged in user.

I've found a related article: http://drupal.org/node/228959
but no idea about how to look for following point in the article:

Go to 'Arguments' and select "User: UID is Author" and set the default
value to 'Return Page not found'.

I don't see "User: UID is Author". I only see "User:UID".


texts: I keep a lot of unused elements that I don't bother to delete such as blocks, content types, views, taxonomies etc. Is there any speed benefit of deleting these unused elements? If so which ones?


texts: Lightbox2 with CCK fields, duplicate images in articles

texts:
I'm having some trouble with Lightbox2 for Drupal 7, or rather I don't know how to configure it properly. In my desperate search for a tool that will handle inserting scaled image thumbnails with links to original images into random places of article text I came over Lightbox2 that does pretty much what I need. I've created a field_image for my article type, then went to Manage Display, discovered a helluva lot of Lightbox Formats available for field_image and happily set it to Medium -> Original (that was what I needed all the way long). I proceeded with creating an article, adding a picture to it and writing something like this in article body:

Much text here

Even more text here.

I've got what I wanted and there was a pic sitting between the two paragraphs of text. But there also was the same pic right under the article text. I tried to counter it by setting field_image Format in Manage Display to "Hidden". It hid the bottom pic, yes. But with "Hidden" setting active my further uploaded images are no longer processed by Drupal to make medium-sized previews of them (Drupal must think I don't need them because I set his precious field_image to "Hidden"). Setting it to something meaningful every time I want to add an image to an article and then turn it off to prevent additional images from showing seems too great a pain. How does one handle that?


texts: Reducing file size of original images on server (browser crashing)

texts:
Problem

I don't want to limit my users photo size on upload, I'd prefer to compress once it's been uploaded incase they don't know how to compress images. I've implemented the first suggestion from this question:

How can I reduce the file sizes of the original versions of uploaded image files?

However sometimes when I click to upload a photo the browser locks. I can't find a pattern but it didn't happen before. Is there something wrong with my code, some sort of memory issue I might be unaware of?

(Otherwise the crop and scale works correctly.)

Set-Up

I've got a custom module and I'm hooking into the four forms on my site where people can upload photos. Here's an example of one of the forms:

  function resizeimage_form_alter(&$form, &$form_state, $form_id) {
  //select the correct form
    if ($form_id == 'profile2_edit_school_form') {
     //check that the form has been edited
      if(array_key_exists('values', $form_state)){
       //if it's been edited, check if the profile banner has been edited
        if(array_key_exists(0 , $form_state['values']['profile_school']['field_school_banner']['und'])) {
        //if it has, call the resize function
          array_unshift($form['#submit'], 'resizeimage_scaleandcrop');
        }
      }
    }
  }

  function resizeimage_scaleandcrop($form, $form_state) {
    //grab the image fid
    $imagefid = $form_state['values']['profile_school']['field_school_banner']['und']['0']['fid'];
    //use it to load the file object
    $imageobject = file_load($imagefid);
    //use the filepath to load the image
    $imagefilepath = $imageobject->uri;
    //load the image
    $image = image_load($imagefilepath);
    image_scale_and_crop($image, 700, 200);
    image_save($image);
  }


texts: How to create a page on which users can upload files?

texts:
Maybe it's a question of logic. I'm new to Drupal.

Drupal 7: I want to have a page 'upload' which should be displayed in the main menu, on that page users should be able to upload files (pdf etc), which afterwards will be listed on a second page 'downloads'.

I created a content type 'uploads' with all the fields I need (title, description, file, tags). How do I get that content type inside a static page? Until now I can only access that uploading process when I hit 'add new content' on the home page.


texts: how to add to cart button in drupal 8 commerce?

texts: I am using zircon theme for my commerce site need to add cart and checkout pages to my site,how to create an add to cart button in drupal8 for product display which goes to cart page.


texts: How do I attach a CAPTCHA when adding the contact form to a node?

texts:
I am embedding the Drupal contact page in a node. I added the following code in template.php.

function sakura_preprocess_node(&$variables) {
  $node  = $variables['node'];
  if (!empty($node)) {
    $variables['template_files'][] = "node-" . $node->nid;
  }
}

Then, I created the node-24.tpl.php template file (for the node where I add the contact form).

require_once drupal_get_path('module', 'contact') .'/contact.pages.inc';

//no need to maintain two version of node.tpl.php
include "node-page.tpl.php";

function local_contact_page() {
  $form = contact_mail_page();
  // override default values here if you want
  // next one will select a different category
  //$form['cid']['#default_value'] = 0;
  $form['submit']['#value'] = 'Отправить';
  unset($form['copy'], $form['subject']);
  dpm($form);
  return($form);
}

function local_contact_page_submit($form_id, $form_values) {
  return(contact_mail_page_submit($form_id, $form_values));
}

function local_contact_page_validate($form, $form_state) {
  return(contact_mail_page_validate($form, $form_state));
}

print drupal_get_form('local_contact_page');

drupal_set_message($form_id);

I also enabled the CAPTCHA module with the math method. On /contact it shows the CAPTCHA, but it doesn't show it on the contact form I embebbed in the node.

How can I make the CAPTCHA appear on the node page with the contact form?


texts:
I am using the webforms module and created a new webform.
Now my problem is... after I have created a specific content type, I would like to diplay this webform...

Imagine: Create a new event with title, start, end und location.

After this, Visitors should see the webform below:

webform contains attend=yes/no, name, email and a submit button that sends an email.

How can I achieve that?

Thanks!


texts: How to create dependent dropdown in drupal 7 content type?

texts:
I have created a 2 custome content type in drupal 7 one is tourname and another one is location. Once I added a tour name in tour content type like tour1,tour2 and so on. In location content type I added location1, location 2 and so on for each tour name. Now I created third content type name it as details in that I need two drop down one is list of tour I have added and another one is list of location I have inserted. Whenever i changed the tour drop down value, the second drop down value will get automatically updated  based on the tour name.

Thanks in advance.


texts: Avoiding entity-type errors on module installation

texts:
I created a logger service that uses a config entity for configuration: https://drupal.org/project/dblog_persistent

Unfortunately, it appears that this module is not installable on a new site, because Drupal attempts to instantiate the logger service before actually installing the config entity type it depends on - the result is a PluginNotFoundException.

There has to be some way to prevent services from being instantiated until the module is installed, or not?

This is the class and constructor definition:

<?php

namespace Drupal\dblog_persistent\Logger;

use Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException;
use Drupal\Component\Utility\Unicode;
use Drupal\Core\Config\Entity\ConfigEntityStorage;
use Drupal\Core\Database\Connection;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Logger\LogMessageParserInterface;
use Drupal\dblog\Logger\DbLog;
use Drupal\dblog_persistent\DbLogPersistentStorageInterface;

/**
 * Class DbLogPersistent
 *
 * @package Drupal\dblog_persistent\Logger
 */
class DbLogPersistent extends DbLog {

  /**
   * @var \Drupal\Core\Config\Entity\ConfigEntityStorageInterface
   */
  protected $channelStorage;

  /**
   * @var \Drupal\dblog_persistent\DbLogPersistentStorageInterface
   */
  private $storage;

  /**
   * @var \Drupal\dblog_persistent\Entity\ChannelInterface[]
   */
  private $channels;

  public function __construct(Connection $connection,
                              LogMessageParserInterface $parser,
                              EntityTypeManagerInterface $manager,
                              DbLogPersistentStorageInterface $storage) {
    parent::__construct($connection, $parser);
    // The following causes an error on installation:
    $this->channelStorage = $manager->getStorage('dblog_persistent_channel');
    $this->storage = $storage;
  }

And the service definition:

services:
  dblog_persistent.storage:
    class: Drupal\dblog_persistent\DbLogPersistentStorage
    arguments:
      - '@database'
  logger.dblog_persistent:
    class: Drupal\dblog_persistent\Logger\DbLogPersistent
    arguments:
      - '@database'
      - '@logger.log_message_parser'
      - '@entity_type.manager'
      - '@dblog_persistent.storage'
    tags:
      - { name: logger }

As a hack, I could surround every function in the logger with ifs that ensure it doesn't run unless installation is complete, but that's pretty dirty. Is there at least some kind of null entity storage that the constructor could fall back on, to minimize the amount of defensive programming?


texts: Custom Gallery images showing in one column

texts:
In Drupal 7, I have created a custom gallery, but all images are showing in only one column.

I have Bootstrap theme for Drupal. I'm using the modules Views (Bootstrap), Colorbox, Multiupload Imagefield Widget, Multiupload Filefield Widget (both for multiimage uploads).

Steps I took:

I created a new content type Gallery
Added an image field to the content type and selected multiload (to enable upload of several images at once)
Removed body field as I only need images.
Image display has been set to Colorbox (I previously created different image styles - preview, full, etc.)
In Views, I created a new page Galleries, which contains all galleries that I have on the site. I had no problems putting those Galleries in a 4 column layout. So basically this is a Albums view.

My problem is that when I click on Album name, a new page (of content type Gallery) opens. It contains all the images of the particular album. However, all the images are shown in only one column.

I have tried to change the layout with panels and display suite, but as Images are considered as one field, the end result stays the same. Is there any way I could change the steps I took and do this differently, so I could have the Gallery with listed Albums as I have now, and then when I click on albums the images are shown in 3 or 4 column layout?

Thanks


texts: Login box on one site to log you into another site too

texts:
My client has a drupal 6 site. This is used with there clients to project manage projects. We are building a new main website for our client using drupal (6/7 yet to be decided). They wish to have a login box on the home page of there new website that will log you into the project manage site. So something like:

Go to main website
Enter user name and password for project site
Website changes to project site with user logged in.

Would this be possible? The user would not have a login on the main site.

Both sites would be running on the same machine. Part of me is thinking that maybe multi-site could be my answer.


texts: Varnish is working but X-Drupal cache is missed

texts:
I have configured varnish on a Digital Ocean server and installed Drupal varnish module. I have confirmed that varnish is running  but once i do a test on my site using blazemeter.com the server CPU goes at 100% during the test duration ( 20 minutes)

root@gtdev:~#  curl -SLIXGET http://46.101.217.71/
HTTP/1.1 200 OK
Server: nginx
Date: Wed, 11 May 2016 09:57:53 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Vary: Accept-Encoding
X-Drupal-Cache: MISS
X-Content-Type-Options: nosniff
Content-Language: ar
X-Generator: Drupal 7 (http://drupal.org)
Cache-Control: public, max-age=21600
Expires: Sun, 19 Nov 1978 05:00:00 GMT
Vary: Accept-Encoding
Etag: "1462960672-1"
Last-Modified: Wed, 11 May 2016 09:57:52 GMT
X-Varnish: 373674512
Age: 0
Via: 1.1 varnish

Drupal Varnish Module Configuratoin:

$conf['cache_backends'][] = 'sites/all/modules/varnish/varnish.cache.inc';
$conf['cache_class_cache_page'] = 'VarnishCache';
$conf['page_cache_invoke_hooks'] = false;
$conf['reverse_proxy'] = true;
$conf['cache'] = 1;
$conf['cache_lifetime'] = 0;
$conf['page_cache_maximum_age'] = 21600;
$conf['reverse_proxy_header'] = 'HTTP_X_FORWARDED_FOR';
$conf['reverse_proxy_addresses'] = array('127.0.0.1');
$conf['omit_vary_cookie'] = true;

isvarnishworking.com says that it is working as "Sort Of". So if its working then why the CPU is on 100% usage any idea ?


texts:
Does someone know an alternative to the Jcarousel module?

I'm using it, but there is too much CSS to write. Is there some alternative more flexible to have a simple slider?


texts: How to replace an unfiltered Search API results view with custom text?

texts:
Setting: using the search_api_views module, I have created a view with an exposed fulltext search filter. In addition, I have lots of facets for the corresponding search index in a separate block (via the search_api_facetapi module). Searching and filtering works well.

Question: When no facet item is selected and no fulltext search is used, then all indexed nodes are shown in the view as search results. How can I replace this full nodes list with a custom text (e.g., “Enter a search term or select a facet item to filter our products.”)? In other words: how can I hide the results list if and only if no search filter (facet or fulltext) is applied?


texts: How to create reviews for user comments?

texts:
I want use user review for my content. For example they can send their comment in my content and review in comment ( with fivestar field ).

Five star and other module not work in drupal 8.


texts: How can I merge a development site with a production one on an earlier core version?

texts:
I work for a small company that currently has a Drupal 6 site setup and working well on a live Azure server. However, we need to migrate to D8 (should have done it years ago!) and are wondering how to manage this.

We have gotten so far as working out how to migrate the current config and content to D8 through use of the migrate tools, migrate plus and migrate manifest modules. But we're now wondering how to combine this with a database merge from our D8 dev DB to the live D6 DB.

It would obviously be a disaster if users were suddenly unable to login anymore, or if their content suddenly disappeared. So we're looking for the safest, but ideally fastest and most-integrated solution, i.e. if we could go from D6 prod straight to D8 prod using the D8 dev data, that would be ideal. I imagine this would be impossible though, and that a D6 to D8 migration would have to be performed on the live site before anything else.


texts:
I have done:

$term = Term::create([
  'name' => 'title',
  'vid' => 'myvocab',
])->save();

It works.

But I don't seem to be able to set the parent term.

I have tried:

$term->parent = array($parent_tid);
$term->save();

It gives an error:

  InvalidArgumentException: Value is not a valid entity. in Drupal\Core\Entity\Plugin\DataType\EntityReference->setValue() (line 106 of /core/lib/Drupal/Core/Entity/Plugin/DataType/EntityReference.php).

I have also tried:

$term->parents = array($parent_tid);
$term->save();

It gives no error, but also does nothing.

In my code $term could be a new term or an existing term I've loaded, which is why I set the parent and then save it. But I can't get it to work.

Documentation for D8 is sparse. I've dug around the code in the taxonomy module, and it looks like parent is an entity reference field that accepts multiple values, but I can't work out how to set it. It looks like setting parent to array($id) should work, but I think the magic setter is breaking. Any help?


texts: How can I use PHP code in a webform field?

texts:
I have to store location information of users, so I have installed the smart IP module, which provides users country information using user's IP. by using this module, I have to use PHP code into some field to print the country information.

but I don't see any field which can support PHP code as default value.


texts: How to recover drupal password in localhost?

texts:
I have a complete Drupal website on localhost. I forgot the password and username for my account. I found the username in the database, but the password is hashed.

I can't send emails from localhost, so recovering the password using the email is not possible.

How can I recover the password?


texts: How to format views table using open outreach theme

texts:
The Views preview of my table looks like this.

Using Open Outreach it appears like this.

Neither are exactly what I'd like to see. How can I change the displayed table format (on my site) without fooling with php and CSS? I'm new to Drupal. I really don't want to get into CSS and php.


texts: Make PDF,XLSX,DOCX,PPTX output for drupal REST server

texts:
When I tried to configure drupal service admin/structure/services/list/MyServiceName/server, I only see the following response content types.

Is it possible to provide pdf, docx, pptx, xlsx etc. as response format?


texts: Include specific stylesheet for specific language?

texts:
I have the following stylesheets:

stylesheets[all][] = AAA.css
stylesheets[all][] = BBB.css
stylesheets[all][] = CCC.css
stylesheets[all][] = chinese.css

AAA, BBB and CCC are fine. They should show for all languages. But I need english.css to ONLY show if the language code of the current page being viewed is:

cn-zh
tw-zh

The language code is retrieved from the i18n module:

$language = i18n_language();
$languageCode = $language->language;

How can I include this stylesheet for this case?


texts:
Can anyone recommend a Google OAuth solution for D8?

I've done some looking, the only real viable solution that I can find is the OneAll Social Login module. This would potentially work for us, but we don't necessarily need something with 35+ login options. There seem to be other modules out there, but either seem to be confined to D6/D7 or have very low usage stats.

I'll explain what we are attempting to do. We have a dashboard that our customers login to, they can then launch into their various services from there. We'd just like to provide the option to login & associate a Google account with your existing D8 account to streamline the process.

EDIT: @drastik provided links to the Social API Stack module and it works without any issue. This is exactly what we wanted.


texts: In the People list, change from time span display to date display

texts: This is Drupal 7: when I am logged in as administrator and I click "People" to check the registered users, the default Drupal display is the "Member for", which displays a time span. For example: "2 min 10 sec" or "23 hours 24 min" or even "6 days 22 hours". How can I change that display to a "Member since" display that would show the date and time the user actually registered? Thanks!


texts: Retrieveing config for a custom ctools content type

texts:
I've created a custom ctools content type to make a custom pane for my node/%nid panel. The content type has an edit form with some configuration options for the pane, that I would like to access from a function call from a custom module.

I haven't been able to find where this information is stored in the DB, or how I might be able to access it with some of the ctools functions.

For more context, the form has a toggle between public and private users. And I would like to know when submitting an unrelated form on the page, if that block is set for public or private use, and wanted to get the information directly from what I chose when configuring the pane.


texts: Thoughts on customizing the user profile page?

texts:
I'm looking to really transform the user profile page for my drupal 7 site and community into something enganging and interative. Perhaps a friends block, list of social media links like fb, linked in, etc as well as to be able to see new posts and comments that that user has contributed to the site.

Certainly we can do better than the default drupal page these days!

What modules do you recommend to start putting together a recipe for a quality and informative user profile experience?

Also, does you have any links for tutorials that would be good resources? Perhaps even a cool profile page you have done as an example.


texts: How do I make an internal link with CKEditor?

texts:
I am using Drupal 8.

Using the standard WYSIWYG editor, when I click on the link button, I only get the option to add a url. I would have thought there would be some capabilities to look up existing pages.

Is there some way to create an internal link?


texts:
So we define the function with this hook...

/**
 * Implements hook_preprocess_bean().
 */
function MODULE_preprocess_bean(&$variables) {

  // Attach css...

  return $variables;
}

What can this be attached to please?

$variables['SOMETHING']['#attached']['css'][] = drupal_get_path('module', 'MODULE') . '/MODULE.css';


texts:
Im using Drupal 7.41 and Omega3 sub theme and Ckeditor. I have added a sentence in the style of heading (h1)  at the top of my Home Page content, it shows in Ckeditor using the source button (showing markups) with H1 tags around the heading, and shows in the style of H1 normally in Ckeditor. When I save and close off the edit, it just appears as normal text, and as P tags when I view via Firefox (View Source) , the H1 markup is not showing, when I go back into Ckeditor, I can see its in the style of H1 and when I click Source button,  i can see it has the H1 tags around it. When I View Source on Firefox, it shows as P tags. I have flushed Cache, and checked but it still shows as P tags.

Basically, its showing correctly in Ckeditor (with/without clicking Source button), the markup is not getting wiped, but its just not showing when I view the webs page when I come out of Ckeditor (either logged in or not). Can anyone help?


texts:
I have a content type with a field allowing to select public or private.

I am using the Pathauto module for generating path aliases using this field, using /[node:field_evt_diffusion]/[node:title] as pattern. I am using the CAS  module to casify the /private/* path.

Is it possible to create two path aliases for the same node?


texts: How to create View with Full Content and Teaser

texts:
Can I create a View of nodes which has 'Full Content' for one node and 'Teaser' for the others ?

My page consists of a node containing full content followed by summary nodes which link to their pages.

I have a workaround but it not ideal:

I selected 'Teaser' Show:Content | Teaser in the View for all my nodes and increased 'Summary or Trimmed length' to 60000. That way, nodes with summary will show up and nodes without summary will display 60000 chars from body.