texts: sites/simpletest permissions are set to 777, but still "permission denied" error

texts:
I am running a WebTestBase test and getting the following warnings:

But the files and folders within sites/simpletest are set to 777. Drupal does already write within this folder during the test execution. What is the problem here?


texts: should I use str_replace() or is there a better drupal way for that?

texts:
Some background info:
I'm Building a D7 module that also sends out a message to users of the site.
I want the site maintainers to be able to define the message by using 'tokens' like this:

$string = "hello :username, there is a new node called :nodenodename_with_a_link on the :website"; // defined in the GUI

I could use str_replace to replace those 'tokens' like so:

$find = array(':username', ':nodenodename_with_a_link', ':website');
$replace = array($username, $node, $sitename); // generated form the db
$newstring = str_replace($find, $replace, $string);

But I'm wondering if this is also the correct way to go in Drupal (7)?


texts: Drush site install without dropping/recreating database

texts:
I am from Ukraine, so sorry for my bad English...
Please help me to fix a problem. I'm trying to install Drupal with Drush on shared hosting.

I use the command drush site-install. On localhost everything worked correctly, but on the  hosting I get an error: Access denied for user 'bigferwn_t'@'localhost' to database 'bigferwn_t'.

Command string is 100% correct. The problem lies with permissions. When Drush runs the site-install command it DROPs the RECREATEs the db. So if the db user does not have that permission (like in many hosting provider) we get the error access denied.

So I created a db in hosting account manually and want to install drupal using the database that I just created. I don't want to drop and recreate this db. I simply want use the existing database.

There are issues discussing the same problem https://www.drupal.org/node/1105514.

In the site-install command there is no option to "NOT CREATE OR DROP DB" or if there is I can't find it.

I tried to use the patch from https://www.drupal.org/files/issues/drush-script-options.patch which was proposed in the issue above, but it is old and for a different version of drush.


texts: How to formatting line breaks in custom module's email body containing translatable plain text?

texts:
with my custom module I try to prepare an email body containing hard coded plain text. The text should be translatable and formatted with line breaks for a nicer output.
The text is prepared in my controller as following (for example):
$mail_body_plain['textpart'] = t('And much more...') . '\r\n';

php code sniffer gives me the warning:

Do not concatenate strings to translatable strings, they should be part of the t() argument and you should use placeholders

In my opinion every unnecessary format should be avoided to get parsed by t() function, to keep the Drupal translation database cleaner. But it seems, that my approach violates Drupal's coding standards.
What is here the right solution?
Thanks in advance


texts: Language paths per country- how to redirect users to their respective language's path on login?

texts:
I have a website that is available in both English and Japanese.

English is the default language and has a path prefix of "en".

Japanese has a path prefix of "ja".

Users can log in from the front page via a block.

If a user whose account is set to Japanese lands on the English front page and logs in, he/she will be taken to /en/mylogindestination instead of /ja/logindestination.

How can I redirect users with Japanese-language acconts to /ja/mylogindestination (and users with English-language accounts to /en/mylogindestination)?

I already have a number of login-related fixes in Rules so if this can be done in Rules that would be a plus, but a custom module is also ok.


texts:
I have create one form in .tpl file with simple html form tag.
In action attribute of this form element i passed a url like 'action=savequestion'. Now in my .module file, inside hook_menu(), I am defining menu with the above url mentioned in action.

$items['savequestion'] = array(......); //like this

But when i am submitting that form defined in tpl file, It is not calling this menu item and page not found comes.

any one have idea about this? Thank you.


texts: How to use a field other than node id or term id as contextual filter?

texts:
I have a content type "Person" which has a field called "state". On the node page of any "person", I want to display other nodes of "Person" which has the same value for the "state" field.
For e.g. If a we are on a person node who is from New York, the view block placed on this node should display other persons from New York.

I know how this could be done if it were node id, or term id : using contextual filters and getting content id from URL, etc. However, I'm not sure how do I get this from other text field like "state".

Any pointers would be appreciated.


texts: How to properly use contextual filter on group content fields

texts:
On my homepage, I created a view for group contents with relationship on "Group content" and "Group". I want to create a contextual filter that when I search on the exposed filter, results will be displayed on new page.

I have an exposed filter of "Category" and "Region" and without contextual filter the result displays on the same page.

I tried filtering with field "Name" as "Display a summary", and I get this:

But when I manually click on any item and check its URL, i'm getting this:

http://localhost:8888/drupal-8.2.3/home/Mozilla%20123?field_trade_type_job_target_id=All&field_region_business_target_id=All

And I can't search to other items anymore since I am on a filter specific path, in the example above, /Mozilla%20123?

I tried another field name, "Category" and I get this, since the 3 given examples are in the same category:

18 is a taxonomy path. When I manually click the content, I am directed to:

http://localhost:8888/drupal-8.2.3/home/18?field_trade_type_job_target_id=All&field_region_business_target_id=All

with this content:

This image supposed to be what I want to achieve in the first place when I click search on the exposed filter in the homepage.

Any help is greatly appreciated. Thanks!


texts:
I have created a view from an entityform that I've set up in D7/views 3.8.  There is a request date field in my entityform. The field type is date. i have set the format to be m/d/Y.

I added a date filter in the view that is not working.  After typing in the date several times, I literally copied the date from the view results and pasted it into the filter box, to be sure there were no typos and the filter still returns no results.

So I put in 10/02/2014 and nothing is returned

Does anyone one know what could be happening here?

Update: Here is what I "think" I know.  I changed the filter to "contains", [just for testing].  I then entered '10' quick apply, it returned all rows that had a 10, did the same for '01' and '2014', all return rows.  So I assume, even though I change the date format m/d/Y, it is not that way in the db or the view, so my search for '10/01/2014' is not working because that exact string is not in the date field.

How can I confirm/check and then fix?  My users need to search using m/d/Y format in the filter box.

Update2: so after thinking about the above update, I was able to successfully run a query using this format in the filter box '2014-10-01'.  I went back to be sure I had added the m/d/Y format. It is there and is being pulled into my entityform correctly, so why is it not going to the db this way?

How can I fix?


texts:
In Drupal 7 I'm trying to hide a node from a listing view based on whether the current user has a certain role and the node references a child term of a specific taxonomy term.

For example I have a node with content type 'job' and I want users with the role 'Store Manager' to be able to see all jobs except those that have a taxonomy term with the parent 'Manager'.


texts: Writing to a specific or new element in a multi-value custom field

texts:
We're trying to key track of software license keys issued to a specific user in Drupal 7.  We've created a custom user field called "field_key" with unlimited values.  We'd like to add a new element to field_key every time a new license is issued, and save the new key into the new element.

As expected, the following code saves our new key into the first element of the array every time, overwriting the original:

$edit['field_key'][LANGUAGE_NONE][0]['value'] = $key_save;
user_save($account, $edit);

If we remove the index value, changing [0] to [], what I thought should happen was that the index would be incremented and we'd write to the next element.

$edit['field_key'][LANGUAGE_NONE][]['value'] = $key_save;
user_save($account, $edit);

That ends up behaving exactly like the first example using [0], overwriting the original.

If I force the index (delta) value, using [1], for example, the result is the same. This occurs even if I create a new empty element in the user GUI.  I can add additional elements and populate them in the GUI.  If I do this and have, say, 5 keys listed in the user GUI, the next time we run the code using [], [0] or [5], the result is that all of the original elements are deleted, the field is reduced to a single element, with the new value overwriting the original.

I obviously have the command syntax wrong here.  Any tips?


texts:
I'm trying to add a site with Aigir and i'm getting this warning:

Warning in features rebuild of permessi. No module defines permission "create article content".

Warning in features rebuild of permessi. No module defines permission "create slides content".

Warning in features rebuild of permessi. No module defines permission "delete any article content".

Warning in features rebuild of permessi. No module defines permission "delete any slides content".

Warning in features rebuild of permessi. No module defines permission "delete own article content".

Warning in features rebuild of permessi. No module defines permission "delete own slides content".

Warning in features rebuild of permessi. No module defines permission "delete terms in tags".

Warning in features rebuild of permessi. No module defines permission "edit any article content".

Warning in features rebuild of permessi. No module defines permission "edit any slides content".

Warning in features rebuild of permessi. No module defines permission "edit own article content".

Warning in features rebuild of permessi. No module defines permission "edit own slides content".

Warning in features rebuild of permessi. No module defines permission "edit terms in tags".

all permissions are exported with features & features_roles_permissions.
the problem is on the new created site this permissions are not set for any of the roles set in the module.
any idea?
thanks


texts: Filter data using exposed filter using country in drupal 7?

texts:
I want to filter all views data through IP address (or country) on the front page.

How can I work with exposed filter module? Is there any other method to filter data using selection box (Countries)?


texts: how to display the list of corresponding users by using user reference module

texts:
I have 3 user role that

Senior->users(senior1,senior2)

Sub_Senior->users(subsenior1,subsenior2)

junior->users(j1,j2,j3,j4)

the user subsenior1 is belonging to senior2 , user subsenior2 is belonging to senior1.

the users j1,j2 belonging to subsenior1 and users j3,j4 belonging to subsenior2 referenced by using user reference fields

but i am not able to list the corresponding users in views page like when i click the senior1 user it will list the corresponding subsenior2 user(corresponding all referenced users).

I'm extremely new to drupal any one help me ..

thanks in advance..


texts: CSS not applied on install, but loaded properly

texts:
I have installed Drupal 8, but the default CSS is not applied (see http://ec2-54-187-215-79.us-west-2.compute.amazonaws.com/user/1 for example).

Chrome's 'inspect' functionality reveals that the CSS is loaded properly from http://ec2-54-187-215-79.us-west-2.compute.amazonaws.com/sites/default/files/css/css_4w6DyMZOD_Fu1oxqpACBFcOPDgVYtgOuayu9S6-8btc.css?0

What is causing this issue? How can I solve it?


texts: How to make a panel page the default local task

texts: I've got a custom module providing local tasks like entity/%/edit and I'm trying to get entity/% to show up as the default local task. entity/% is defined as a Panel Page using the panels module. How do I do this? Whenever I change the menu type to "local task" or "menu tab" (or "default menu tab") the local tasks disappear from the display. This is in Drupal 7.14 with ctools 7/x-1/0


texts: How to achieve triggered redirect after log in so that administration interface will be available on the redirected url?

texts:
I would like to ask for an advice. Recently, I was developing a conference site with Drupal 7. The site is hosted at domain1.com. However, the conference is covered by another organization and they require that conference page will be accessible from their own domain something like.: organization.com/conference2014 Fortunately, Drupal has base_url parameter and the site is accessible from organization.com/conference2014 domain. BUt, my problem is when I want to access administration interface of Drupal through organization.com/conference2014?q=user/login I get redirected to organization.com site which is administrated by the organization admin. Moreover, when I access again organization.com/conference2014 - it still asks me for the password.

I got adviced to introduce trigger after the user successfully logs in to the site organization.com/conference2014. It does redirect me but the administration interface/overlays is not there. Any ideas how to tackle this problem?

Martin


texts: How do I add an help text icon next to a custom form element label?

texts:
I'm trying to add an information icon next to a custom form label. When users hover the cursor over that icon, it should display the label description.
I know '#attributes' => array('title' => t("text description")) would show the help text when hovering the cursor over the text area. In my case, it should be added to the icon next to the field label.


texts: I need to get the taxonomy from the $content array to print in the node template.  How can I do it? I tried with $content['taxonomy']. Where can I get a guide with all params in $content array?


texts: What is a field_base compared to a field_instance? Is field base what is created with field_create_field()?


texts: How to save and load configuration data of type sequence

texts:
I have a theme "basic_theme". I want to add some settings to this theme, in particular config menu_search_fields is a sequence of data, each entry has 3 informations (field, weight and uuid).
I'm pretty sure the schema is correct because I almost copied from core\modules\image\config\schema\image.schema.yml
basic_theme.settings:
  type: theme_settings
  label: Basic theme settings
  mapping:
    menu_search_fields:
      type: sequence
      label: Menu search fields
      sequence:
        type: mapping
        mapping:
          field:
            type: string
          weight:
            type: float
          uuid:
            type: string

Inside theme-settings.php I have some fields to map to those data, for example field "field" is:
$i = 0; // for this example only one entry
$form['menu_search']['fields']['wrapper'][$i]['field-wrapper'][
    "menu_search_fields.$i.field"
] = [
    '#type' => 'textfield',
    '#title' => t('Field'),
    '#default_value' => theme_get_setting(
        "menu_search_fields.$i.field"
    ),
];

I used as a key "menu_search_fields.$i.field" but i doesn't work.
How can I correctly map the fields with sequence entries?


texts: How do I do a regex query in reverse in entity query?

texts: I have a config entity with a row of regex strings, and I want to query which one of them matches a provided string; this stackoverflow question (https://stackoverflow.com/questions/12044628/searching-mysql-database-by-a-regex-match-in-reverse) describes how this could be done in mysql. What's the best way to do this using entity query?


texts: Need example : D7 + XPath parser to import (mediawiki) XML - xpath parser settings?

texts:
I've installed XPath/Feeds/D7, but I don't know how to configure XPath parser settings.

Maybe someone can help me to set it right.

I just want to inject <title> and <text xml:space="preserve"> to my node.

I need help to configure my XPath Parser settings : admin/structure/feeds/edit/my_import/settings/FeedsXPathParserXML

I've the following XML structure :

<mediawiki xmlns="http://www.mediawiki.org/xml/export-0.3/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mediawiki.org/xml/export-0.3/ http://www.mediawiki.org/xml/export-0.3.xsd" version="0.3" xml:lang="fr">
  <siteinfo>
    <sitename>Site Name</sitename>
    <base>http://domain.net/index.php/StartPage</base>
    <generator>MediaWiki 1.15.5-1~bpo50+1</generator>
    <case>first-letter</case>
    <namespaces>
      <namespace key="-2">Media</namespace>
      <namespace key="-1">Special</namespace>
      <namespace key="0" />
      <namespace key="1">Chat</namespace>
      <namespace key="2">user</namespace>
      <namespace key="3">Chat user</namespace>
      <namespace key="4">domain.net</namespace>
      <namespace key="5">Chat domain.net</namespace>
      <namespace key="6">files</namespace>
      <namespace key="7">Chat files</namespace>
      <namespace key="8">MediaWiki</namespace>
      <namespace key="9">Chat MediaWiki</namespace>
      <namespace key="10">Model</namespace>
      <namespace key="11">Chat model</namespace>
      <namespace key="12">help</namespace>
      <namespace key="13">Chat help</namespace>
      <namespace key="14">category</namespace>
      <namespace key="15">Chat category</namespace>
    </namespaces>
  </siteinfo>
  <page>
    <title>Drush</title>
    <id>579</id>
    <revision>
      <id>1637</id>
      <timestamp>2012-05-25T14:51:51Z</timestamp>
      <contributor>
        <username>admin</username>
        <id>1</id>
      </contributor>
      <comment>/* Install Drupal with Drush */</comment>
      <text xml:space="preserve">Drush is a command line utility.

=Install Drupal with Drush=
To install drupal with drush :
 drush site-install standard --db-url=mysql://username:pass@localhost/databasename

[[category:Drupal]]</text>
    </revision>
  </page>
  <page>
    <title>Memcache</title>
    <id>586</id>
    <revision>
      <id>1287</id>
      <timestamp>2012-02-12T17:43:32Z</timestamp>
      <contributor>
        <username>admin</username>
        <id>1</id>
      </contributor>
      <comment>Do it under Debian</comment>
      <text xml:space="preserve">=Install=
==Debian==
===Memcache Server===
To install :
 aptitude install memcached

Read and change ''/etc/memcached.conf''.
===PHP5 / PECL===
Install memcache PECL :
 php5-memcache
or
 pecl install memcache

Restart Apache.

===Drupal===
* InstallMemcache module in Drupal.
* Change ''settings.php'' :
&lt;source lang=&quot;php&quot;&gt;
$conf['cache_backends'][] = 'sites/all/modules/memcache/memcache.inc';
$conf['cache_default_class'] = 'MemCacheDrupal';
$conf['memcache_key_prefix'] = 'site_prefix';
&lt;/source&gt;

Read : http://drupal.org/node/1131458

[[category:Linux]]

[[category:Drupal]]</text>
    </revision>
  </page>
</mediawiki>

Optional task : How can I convert "=" to <h1>, "==" to <h2>, space before start of line to <pre>, [[category:xyz]] to Tags, etc ... ?


texts:
The search engine crawler, like Googlebot, doesn't index any data, which is set to be visible only particular user, right?

For example, let's say I have fields named field_A & field_B on user's fields, and also a permission named permission_X.

The field_A is set as "View own value for field" for user who has permission_X with Field Permissions module.
The field_B is set to be hidden on "Manage display", but is output through contextual filter set as "User id = User ID from logged in user" in Views.

If they're set so, do field_A & field_B still possibility to be indexed by Goolgebot?

I'm building development site with D7 now. And, I wonder if there will be a risk that the data, whose is visibility restricted, will be exposed through snippet or cached page in search result after I run the product site.

I'm afraid that this may be a very basic question but couldn't find any answer for it. Thank you in advance.


texts:
I have created a wishlist in which those nodes are showing which are flagged,
Wishlist working fine

The next task is to create favorite groups. That is, the user must be able to create groups of favorites, being able to edit a name, for example “summer recipes”, and assign recipes to the group.

What i have tried so far i have created a another content type "Create Group" which is automatically get flagged on creation by Using hook_node_presave().

Now flagged nodes(Groups) are also showing in wishlist then i have added draggable views into the existing wishlist view for grouping content by drag and drop by changing order.

But after changing order ,the changed order is not shaving into database,i think its a module issue which is not compactible with views relation.

Is there any alternative like is it possible to add custom select list in group content type which will show list of flagged node per user .


texts: Only show first entity reference in views

texts:
In my situation :
I have 2 content types content type A and B
In content type B add entity reference field of content type A
In views, I want to display some values of content type A,but I also want to show some values of the first content Type B which has entity reference field to content type A.
How can i show only its first value ?

edit:
Content Type B has an entity reference field to Content Type A.
In the view I list all of the nodes of Content Type A.
But I also want to show some field of the first node that is referenced in Content Type B.

For example:
Content Type A has fields: title and logo.
Content Type B has fields: body and entity reference to Content Type A.
Multiple entities of Content Type B can be referenced to an entity of Content Type A.

What I want to show is:
Content Type A - Title
Content Type A - Logo
Content Type B[0] - Body

Thanks in advance!


texts:
I got a custom form in a block, wich is available on my homepage.
After e while the form action changes to action="/cron.php" instead of action="/nl".
I can't figure out where this fault is comming from.

My Drupal Website got standard block caching enabled. If i clear the cache, the form is back to normal. After a while it goes back to "/cron.php" and i have to clear the cache again.

  <form action="/nl" method="post" id="dms-locator-filter-form" accept-charset="UTF-8">
  to
  <form action="/cron.php" method="post" id="dms-locator-filter-form" accept-charset="UTF-8">

Annyone an idea where this fault/strange behaviour could come from?


texts: Does an ajax callback work within a Views style plugin?

texts:
My module has a custom Views style plugin. In the style settings form, I want to implement an ajax callback, such as described here: https://www.drupal.org/docs/8/api/javascript-api/ajax-forms

However, I haven't had any luck. I can get a spinning effect, but nothing happens afterward. Here's an example of what I've tried:

use Drupal\Core\Ajax\AjaxResponse;
use Drupal\Core\Ajax\HtmlCommand;

  public function TestCallback(array $form, FormStateInterface $form_state) {
    $ajax_response = new AjaxResponse();
    $text = 'Text to see if this is working';
    $ajax_response->addCommand(new HtmlCommand('#foo', $text));

    return $ajax_response;
  }

  /**
   * {@inheritdoc}
   */
  public function buildOptionsForm(&$form, FormStateInterface $form_state) {
    parent::buildOptionsForm($form, $form_state);

    $form['test'] = [
      '#title' => t('TEST!'),
      '#type' => 'select',
      '#options' => [
        '' => t('None'),
        'foo' => t('Bar'),
      ],
      '#ajax' => [
        'event' => 'change',
        'callback' => '::TestCallback',
    // having the line below uncommented seems to help
    //'url' => views_ui_build_form_url($form_state),
      ],
      '#prefix' => '

',
      '#default_value' => '',
    ];
  }

If I uncomment the commented 'url', I get this error:

Uncaught TypeError: Cannot read property 'settings' of undefined
at resetSize (<anonymous>:34:32)
at later (debounce.js?v=8.6.3:20)

If I keep it commented, I get:

Failed to load resource: the server responded with a status of 500 ()
/admin/structure/views/ajax/display/view_name/page_1/style_options?
_wrapper_format=drupal_ajax&ajax_form=1&_wrapper_format=drupal_ajax:1
Uncaught Drupal.AjaxError
ajax.js?v=8.6.3:500

What's missing and/or incorrect?


texts: Limit the reviews on "Product" content type

texts:
I want to limit the users' review of my "Product" content type to only one, and I tried to implement a code from this link in Drupal 7 as a simple module named "review_limit." I saw this module in my module list and installed it without an error.

This is my code:

function review_limit_form_alter($form_id, &$form) {
    // If the form is a "product_review" node form
    if ($form_id == 'product_review_node_form') {
        // Add an extra validation function //
        $form['#validate'][] = 'review_limit_user_node_limit';
    }
}

// Validation function
function review_limit_user_node_limit($node) {
    // Get our logged in user's details
    global $user;
    $result = db_query("SELECT n.uid, n.nid
    FROM {field_data_field_product_review_pr}
    Inner Join {node} n ON field_data_field_product_review_pr.entity_id = :nid
    Inner Join {users} ON n.uid = :uid", array(':nid' => $node->nid,':uid' => $user->uid))->fetchfield();
    //if founded referenced field from the logged user, drupal show error message
    if ($result) {
        // Throw error
        //drupal_set_message('You have already submitted a review of this item.', 'error');
        form_error($element['title'], t('You have already submitted a review of this item.'));
        die;
    }
}

and i have prepare a template named product--review.tpl.php, page--node--add--product_review.tpl.php and call it from my template.php using

function bartik_theme() {
  return array(
    'product-review_node_form' => array(
      'arguments' => array(
          'form' => NULL,
      ),
      'template' => 'product_review-node-form',
      'render element' => 'form',
    ),
  );
}

This module does not work, every user is still can to create a product review node as much as they want.
Did I miss anything? Can anyone help me to solve this problem?


texts: Unknown column when trying to use JSON_EXTRACT in where clause

texts:
This query is working directly in Mysql:

SELECT entity_id FROM node__field_json WHERE
JSON_EXTRACT(field_json_value, "$.mpk") = '014005'

I cannot make it working in Drupal:
$query = 'SELECT entity_id FROM node__field_json WHERE JSON_EXTRACT(field_json_value, "$.mpk") = :symbol';
$result = $this->database->query($query, [':symbol' => '014005'])->execute();

An error:

SQLSTATE[42S22]: Column not found: 1054 Unknown column '$.mpk' in
'where clause': SELECT entity_id FROM node__field_json WHERE
JSON_EXTRACT(field     _json_value, "$.mpk") = :symbol; Array
(
  [:symbol] => 014005                                                                                > )


texts: unset the timezone and group in the profile form

texts:
The version of Drupal is 7.x

Hi,  I need unset the timezone the user_profile_form and the timezone doesn't remove the page.  I tried with this code:

function mymodule_form_alter(&$form, &$form_state, $form_id){
if($form_id == 'user_profile_form')
 { unset($form['account']['timezone']);
}

What is my error?.

Also, I have a group in the profile named:  group_my_information.  How can I remove it with unset?  I tried this code:

unset($form['group_my_information']);

What is my error?

Thanks for your help.


texts: View calc and multiple field collection lines

texts:
I came here because I have a problem with view calc module and several lines in my field collection. So first the result of my view look like this :

All this fields are in the same content type, and I put sum calculation on each fields. But it's seems the value of the field is multiplied by the count of lines in my field collections. So for the first sum(Montant HT) the calcul done is :

8600 + 51600 + (3101.26 * 5) + 2962.99 + (42000 * 3)

For the column paid sum I don't know how the sum is calculated I doesn't understand.

I tried to use distinct but it didn't work, so how can I found the right sum for all my column ??

Thanks


texts: How to drop tables shown as Missing in Schema Report

texts:
During development/testing after using Backup and Migrate Restore in conjuction with Schema, Schema will show Extra tables no longer referenced in the database, used by modulesetc, and no longer required.

How can these tables be removed with a module or within drupal with api/php? Can a form be created to specify select tables to drop?


texts: Why can't i get simple form theming to work?

texts:
I've got this implementation of hook_theme in a theme :

function uncoated_theme($existing, $type, $theme, $path) {

  return array(
    'uncoated_user_register_form' => array(
      'render element' => 'element',
    ),
  );

}

Furthermore, I've got the following function:

function uncoated_form_user_register_form_alter(&$form, &$form_state, $form_id) {
  $form['#theme'] = array('uncoated_user_register_form');
}

function theme_uncoated_user_register_form($element) {
  return '

";
}

However, the function theme_uncoated_user_register_form is never invoked. I've also tried to replace $form['#theme'] with $form['#theme_wrapper'] to see if I could at least wrap the form in additional markup; but that does not work either.

I can't really see what I'm doing wrong? Drupal seems to be totally ignoring the theme function I'm trying to run the form through.


texts: How to set end date relative to start date in date range field

texts:
Is it possible to set the end date relative to the selected start date in a D8 date range field?
I have a date range field that I use to specify an accounting period. The end date should now be put to one year minus one day from the selected start date. For example, the start date 2016-07-01 will give the end date 2017-06-30.
How is this possible?


texts: How to remove chosen comma between taxonomy

texts: How can I remove comma from theese ingrediens and let them float left? I am using chosen for my taxonomyes


texts: How to target profile2 fields in a template

texts:
I'm theming the display of user profile information managed by profile2 using a custom template, user-profile.tpl.php. I want to hide specific profile2 fields, and also check the value of others. However, looking at the $user_profile, field values are nested deeply in a profile, under the $pid, so I'm not sure how to cleanly target these in a template. So, my questions:

What is the best way to render a single profile2 field when working in a template?
What is the best way to hide a given profile2 field?

It's easy to hide a profile, or the title for a profile:

hide($user_profile['profile_main']);
$user_profile['profile_main']['#title'] = NULL;

But I'm not sure how to work with individual profile2 fields.

Note: based on http://drupal.org/node/1300460 (unanswered)


texts: Why is @? used when referring router.request_context?

texts:
In core.services.yml we have:

calls:
  - [setContext, ['@?router.request_context']]

But router.request_context is also defined in core.services.yml (and it depends on request_stack alone which doesn't depend on anything) so I can't see how could this become an invalid reference.

So why is @? used here?


texts: Change 'error' class in clientside validation module

texts: I am working on drupal 7 clientside validation module.On validation which displays error messages with 'error' class which is same as  drupal's system error message's class.But I want seperate theming for clientside validation so I want to change the class 'error' to 'newerror' without hacking the module.I searched everything in web but most suggestions for altering error messages.I dont want to change systems error class.Any suggestions?


texts:
In D7 I'm trying to determine the best way to periodically check if e-mail is working. I'm looking for a way to create a workflow that, say, on cron would check the day of the month, if it's the day that has been configured in the module as the test day, send an e-mail. Check the return value on the e-mail function. If the e-mail failed, write the error to the logs and/or send it to another service, like Slack, to alert the team.

Is there a module that comes close to doing this, or can something be cobbled together with actions and rules, etc? Thanks!


texts: How to use Open Atrium 2 for document managment

texts:
In the past I have used Open Atrium 1 as an intranet site making use of the document management system.

I can't work out how to do something similar in OA2. From the documentation I have found:

  News section - for document management, wikis, or articles

So I have created a News section. It looks like I can create a Document Page and add attachments to it. Do I no longer have the options to create files and folders. Just document pages and attachments?


texts: Trying to add profile2 fields to user/edit page

texts:
I am trying to show the profile2 fields in my user edit page, but I can't figure out how for the life of me. I read that they should autmomatically show up but it's not happening..

I have added the following in my template.php:

function mytheme_theme($existing, $type, $theme, $path){

        $hooks['user_profile_form']    = array(
        'render element'       => 'form',
        'template'             => 'user-profile-form',
        'path'                 => drupal_get_path('theme','mytheme').'/templates');

    return $hooks;
}

function mytheme_preprocess_user_profile_form(&$variables) {
    global $user;
    $variables['form'] = drupal_render($variables['form']['account']);
    //???
    $profile2 = mytheme_profile_form();
}

function mytheme_form_user_profile_form_alter(&$form, &$form_state){
    global $user;
    $mainprofile = profile2_load_by_user($user->uid, 'main');
    $profile = profile2_load_by_user($user->uid, 'basic_information');

    //Example field
    $form['profile_basic_information']['field_field_1']['und']['#id'] = 'school-district';
    $form['profile_basic_information']['field_field_1']['und']['#attributes']['data-placeholder'] = "Choose your Field1";
    $form['profile_basic_information']['field_field_1']['und']['#attributes']['class'] = "input-xlarge";
    $form['profile_basic_information']['field_field_1']['und']['#default_value'] = !empty($profile) && isset($profile->field_field_1['und']) ? $profile->field_field_1['und'][0]['value'] : '';

}

function mytheme_form_user_profile_form_submit(&$form, &$form_state){
    //TODO
}

I also have user-profile-form.tpl which right now consists just of echo $form;

But the fields I am adding to the form are not being added.. I'm not sure that the form_alter is affecting the output (it is running, though).


texts:
is there any method/module that allow removing module folder when uninstalling the module
or delete the files via dashboard


texts: How to call a function on node submit in drupal 7

texts:
I have created content type programmatically.. I don't want to display its node data in a block. Now I want to fetch data and save fetched data in a variable.
How can I do it ?

Or else how can I call a function on node submit ?

here is my code :

function default_content_form_alter(&$form, &$form_state, $form_id) {
    debug($form_id);exit;

    switch($form_id) {
        case 'name_of_the_form':
            $form['#submit'][] = 'test_form_submit';
        break;
    }
}


texts: Datepicker dropdown defaults to January 1940

texts:
In a custom form, I have this date field:

$form['contact_information']['birthdate'] = array(
    '#type' => 'date',
    '#title' => t('Birthdate'),
    '#required' => TRUE,
);

When I click on the field, the calendar dropdowns default to Jan 1940:

I have added some Javascript to set the date automatically to today's date by default, so the calendar grid itself is correct, but the dropdowns are wrong.

jQuery(function ($) {
    Date.prototype.toDateInputValue = (function() {
        var local = new Date(this);
        local.setMinutes(this.getMinutes() - this.getTimezoneOffset());
        return local.toJSON().slice(0,10);
    });

    $(document).ready(function() {
        $('[data-drupal-selector="edit-birthdate"]').val(new Date().toDateInputValue());
    });
});

(taken from here)

When I click the left arrow besides the dropdown, the dropdowns change (as expected) to last month, December 2016. It is just the initial dropdown values in this UI element that are wrong.

Is there a way to fix this, or do I need to open a ticket?


texts: How to know where to place a block in the body of my page

texts:
I am new to drupal7 and I am trying to create blocks and new content on the body in drupal7 using css and php. Can you help with directions please.
 Thank you


texts: I need to use my theme path in a jQuery script for a D8 theme I'm building. I know this is available as drupalSettings.path.baseURL (followed by the path to my theme) but how do you make this variable available to javascript? Lots of D7 info out there, not much D8.


texts: How to measure time taken for a Feeds processing (benchmarking)?

texts: Is there a way to measure time taken for a Feeds processing (benchmarking)? e.g. nodes / minute, time taken for last import. Similar to the statistics in Migrate UI?


texts: How Can I display values of variables in a "PHP contextual filter code" to debug my code?

texts:
I have to use PHP code in contextual filter code in a "Arguments/Contextual Filters" of a view:

global $user;
$uid=$user->uid;

$pid=db_query("select pid from profile where uid='$uid';")->fetchField();

$equipo=db_query("select field_equipo_proyecto_target_id from field_data_field_equipo_proyecto where entity_id='$uid';")->fetchField();

$num_equipo=db_query("select field_num_equipo_proyecto_value from field_data_field_num_equipo_proyecto where entity_id='$equipo';")->fetchField();;

printf("%02d",intval($num_equipo));
return sprintf("%02d",intval($num_equipo));

I think I have some error because I can´t get a correct value. I would like to know how display variables such as $num_equipo, etc to debug my code easier.


texts:
Search cron on my sites takes about 2-3 minutes, no matter how frequent I run it.
I was under the impression only new nodes added since the last run get added to the index. Apparently it's working differently?

Would a SOLR search index update be quicker?


texts: How to style a custom theme setting form

texts:
I have a set of custom theme settings defined in my theme.

They are fully integrated into my theme and appear on the theme's setting page but they are not styled. I use the seven admin theme.

I would like to style the forms on the admin pages; similarly to how other core modules like color, logo etc are styled.

How does one go about this?

Ideally, I would group my settings, place them in a div and give the entire group a title and help.


texts: Calling form validation function from new button

texts:
I've attached a Process button on the node edit form. But on clicking it - in it's validation function form_set_error is not working.

In my form_alter I've this code:

$form['buttons']['process'] = array(
            '#type' => 'submit',
            '#value' => 'Process',
            '#validate' => array('disavow_process_validate'),
        );

        $form['#validate'][] = 'disavow_validate';

So on pressing "Process" button validator function disavow_process_validate is called with $form and &$form_state. But form_set_error and assigning values in the $form_state are not working as working in the normal validation function disavow_validate

What could be the problem?


texts: I cannot figure out why revisions have stopped working. I have double checked my configuration, and all the correct modules are installed. The checkbox in the content type is checked, the checkbox when I edit content is checked, but no revision is available. It doesn't seem to go to the database, although it once did. I do have the body text replaced with a paragraph, but that shouldn't effect revisions. I have no idea what I'm missing.


texts: How can I modify the Quick Edit Module to have a better UX for end-users?

texts:
For a current project I'm working on we're trying to leverage the "In Place Editor" functionality provided by the Quick Edit module.

Our main goals are to:

Have a module that allows us to perform Create Update and Delete options in-line on only fields that needs the functionality.
Make it so that there is a single visible button which says "Edit" on some content that is always used to enter the "In Place Editing" mode.

Instead, the Quick Edit module provides us with:

Quickedit on any and all fields that are editable by the user.

This works really well for site and content adminstrators, but, our target audience is the end-user of the site.

A contextual link (a pencil icon by default) which you must first click. This link then shows a menu for options "Quick Edit", "Edit", "Delete" (and any others that have been placed by modules hooking into the Contextual module).

Clicking "Quick Edit" then simply enables the ability to edit in line. At which point, you still have to click on a field within the context in order to get the field to appear as an editable form input (and it's not immediately obvious that's an available option).

What is the best way to go about achieving a slightly more stream-lined, end-user oriented, in place editing system in drupal 8?

tl;dr

Drupal gives me this:

I'd like this instead:


texts: Where to put Commerce Kickstart translation po file?

texts:
After installing a blank Commerce Kickstart site, I'd like install another language as default for the site.

I can see the language .po file to download -> here

Where should I put the .po files and how can I enable the new language as default?


texts:
I have a Master view & numerous child views for the same content type. The Master View has all nodes from the content type. The content gets copied to the child view from the master view basis of specific requirements by the user. I want to have the functionality to remove specific content from the child views. I do not want to delete it as the content would be reused for others from the Master View.

Is there any module to achieve this?

I am not developer.


texts: How to exclude views fields from display when a node is flagged

texts:
We use the flag module to mark items that will have delays in shipping so that the customer knows that those items will be delayed before adding them to cart. In drupal 7, we excluded our "add to cart" button and "more info" button from display and used a global custom text to rewrite them with the following text displaying them inside a btn-bar div class.

[flagged][add_to_cart_form] More info

We then use the following css to hide the add to cart, and more info elements when the flag is present in the button bar.

.btn-bar.pre-order .atc,
.btn-bar.pre-order .moreinfo{
  display: none;
}

In Drupal 8, the functionality of this still works correctly (updating the replacement patterns of course), but there is apparently a security issue with rewriting forms, so the add to cart button won't render properly when being rewritten in a global custom text.

So my question is what is the "simplest" way to hide those 2 fields when that particular node is flagged? Can this be accomplished by adding some code to my custom theme for the view in question?


texts: How can I set a variable in the body of a node?

texts:
In Drupal 7 I've created a node of type basic page.
Then in Body field I've inserted some markup mixed with php code.
Then this was saved in PHP text format.
In the above mentioned markup I have variable I'd like to output to html.
I tried some preprocess functions but that didn't give me any result.
How can I set the variable?


texts:
I have created a view that displays titles of contents created by authenticated users. I have used pagination to display specified number of items per page. Besides this I want a "show all" link that when clicked displays all contents on single page I have enabled the views pager "more" link but this link redirects back to the same page besides displaying all the remaining contents.

How can I show a "show all" link in my pager?


texts: Do wildcards not work with Menu Local Task?

texts:
I am getting an offset error , Undefined offset: 4 in _menu_translate()

 $items['admin/content/import-dashboard/new'] = array(
    'title' => 'Import Dashboard',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('import_dashboard_new_content',"article"),
    'access arguments' => array('Import Dashboard Permission'),
    'type' => MENU_LOCAL_TASK | MENU_NORMAL_ITEM,
    'expanded' => TRUE,
  );
    $items['admin/content/import-dashboard/new/%'] = array(
    'title' => 'Import Dashboard',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('import_dashboard_new_content',4),
    'access arguments' => array('Import Dashboard Permission'),
    'type' => MENU_LOCAL_TASK | MENU_NORMAL_ITEM,
    'expanded' => TRUE,
  );

I simply want to default new to article, and also use wildcards to support other arguments.

I'm pretty flexible in my approach, so feel free to throw a few suggestions if it could be done better.

Can someone quickly suggest where I made my rookie mistake?

Indeed, changing to Menu Callback works when using the wildcard.

$items['admin/content/import-dashboard/new/%'] = array(
    'title' => 'Import Dashboard',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('import_dashboard_new_content',4),
    'access arguments' => array('Import Dashboard Permission'),
    'type' => MENU_CALLBACK,
    'expanded' => TRUE,
  );

Would still like to know why it fails when it a MENU_LOCAL_TASK or MENU_NORMAL_ITEM


texts: How to make taxonomy term checkbox display multicolumn?

texts:
I have about 20 items for checkbox. Drupal default checkbox is too long down. How to make it in to column like this?

[ ] list1  [ ] list4  [ ] list7  [ ] list10
[ ] list2  [ ] list5  [ ] list8  [ ] list11
[ ] list3  [ ] list6  [ ] list9  [ ] list12


texts: ESIs with Varnish 2.1.5 for Anonymous Users

texts:
We're trying to configure our sites running D7 to use ESIs with Varnish 2.1.5, and having a hard time figuring this out.

We have a file /test.php that is being included in the template via esi so it appears on all pages of our site. The call to the file is through (in the template)

<esi:include src="/test.php" />

Relevant vcl conf is:

sub vcl_fetch {
...
  // enable esi
  esi;
  // if url is test.php, set ttl to 15 s
  if (req.url == "/test.php") {
    unset beresp.http.set-cookie;
    set beresp.ttl = 15s;
  }
}

The text from test.php appears when users are logged in, but does not appear when they are logged out -- which is what we're after. This is without the ESI module as that is for authenticated users.


texts: When I look at the devel query logs of my website I see that views takes up most of the loading time. Anonymous loads of my page are much faster compared to registered loads but how come? Isn't views loaded the same way for every user?


texts: How to get content language abbreviation ("en" instead of "English") in a View?

texts: Im trying to get the content language abbreviation in a view, when I select "content: Language" field then it shows me "English" but I need to get its abbreviation "en", I though there was an option in the view field but there isn't.


texts: Create custom links for private message in OG group

texts:
I am using the module private messages to let users send messages to groups and other users. I would like to create a link where the recipient info is automatically filled with the Group title on the new message page.

Did any one try to work with private messaging groups and create the autocomplete links  ?


texts: How can I inject a different service in an existing one, i.e. exchange one already injected service by an own one?

texts:
The basic authentication provider service uses the user.auth service:

basic_auth.authentication.basic_auth:
    class: Drupal\basic_auth\Authentication\Provider\BasicAuth
    arguments: ['@config.factory', '@user.auth', '@flood', '@entity.manager']
    tags:
      - { name: authentication_provider, provider_id: 'basic_auth', priority: 100 }

I wrote an own service my-user.auth (extending UserAuthInterface) and want my service to be injected into the basic authentication provider instead of the user.auth. How can I do this?


texts: Pass custom variable from template.php to *.tpl.php

texts:
template.php > THEMENAME_field_CONTENT_TYPE(&$variables)
I am trying to check each field as it passes through...

if( $variables['element']['#field_name'] == 'field_I_am_looking_for' )
{
    if( $variables['element'][0]['#title'] == 'value_I_am_looking_for' )
    $variables['newVariableName'] = 'NewVariableValue';
}

or for Booleans...

$variables['newVariableName'] = True;

But in *.tpl.php file, when I do this...

<?php if( isset( $content['isIcebreaker'] ) ): ?>

It's What You're Looking For!

<?php endif; ?>

...Nothing happens.

Specific Details...
The custom content type is called 'Netrunner Card' and all cards have 0 or more 'subtypes'. The subtypes field is a taxonomy_reference field. One of those subtypes is 'Icebreaker' and I'm trying to set $variables['isIcebreaker'] = True; whenever a card has the subtype of 'Icebreaker' and then test against that in node--netrunner-card--full.tpl.php.

Basically, in regular-speak, when a card has 'Icebreaker' as one of its subtypes, I want to add in some custom div's and other content in the node--netrunner-card--full.tpl.php for those cards. But the custom variable isn't making it over. I'm uncertain as to what I'm doing wrong.

SIDE NOTE If there is a better way to do what I am trying to do, I would appreciate those answers as well. However, regardless, I would still love to know the appropriate, Drupal Best Practices way of passing custom variables from template.php to a *.tpl.php file.

CODE VIEW
I have split off my template.php and included the new file as sort of an extended template.php. Here are posts of both my template.php and my tpl file.

template_netrunner_card.php

node--netrunner-card--full.tpl.php

ANSWER: I used the preprocess_node function like so...


texts: how to get all options values of simple hierarchical select in drupal $form?

texts:
i have writed this code to unset empty terms :

    function shs_selective_form_alter(&$form, &$form_state, $form_id) {

  if ($form_id == 'views_exposed_form' && $form['#id'] == 'views-exposed-form-projet-immobilier-page-1') {
    foreach ($form['field_r_t_tid']['#options'] as $tid => $term_name) {
      if (is_numeric($tid)) {
        $result_count = db_select('taxonomy_index', 'ti')
        ->fields('ti')
        ->condition('ti.tid', $tid, '=')
        ->execute()
        ->rowCount();

        // Removing the option for tags with no-content
        if (!$result_count) {
          unset($form['field_r_t_tid']['#options'][$tid]);
        }
      }
    }

  }
}

but is not worked, he show me this error : Undefined index : #options ...
how can i resolve this error?


texts: How to hide a field of a content type except when editing?

texts: I'm using Drupal 7 and have a custom content type that I've given authenticated users the ability to add and edit. Instead of giving them the ability to delete nodes, I've added a Boolean checkbox titled "Delete?" to the content type that they can check when editing the node. This prevents them from deleting a node without any administrative review. Is there anyway to hide this checkbox when they're adding a new node?


texts: How to use drop tables on target when via drush sql-sync?

texts:
I'm using the following command::

drush sql-sync @prod @dev

As I experienced, it does not drop tables on target (@dev) machine.

Is there a way, while syncing this way, to drop tables on target, so databases match completely? Or I must manually first drop tables on target?


texts: How do I delete custom entity instances?

texts:
I've create a custom entity content with Drupal console,

 drupal generate:entity:content

Now I want delete (remove) it completely, how can I achieve it with drupal console or drush ?

my drupal version is 8.1.8 and my drupal console is 1.0 beta 5

update
I have serveral Entity in my module and I want to only remove one Content type, uninstalling module cause all Entity Database table dropped.

I know I can looking for entity table in database remove it and all related file manually I looking for a method with Drupal console or Drush


texts: Programmatically load webform edit page by SID

texts:
I am trying to load an edit form like (drupal 7) : node/6/submission/72/edit into a custom page where I run the drupal_render_form

but I am not sure is this the same as node load form? can some one provide references on how to load webform submission edit page into a body of page.

thank you!


texts: How to display the alt below images in Panels?

texts:
I have a drupal site which sells variety of products.
I set a content type for my product and use panel for the layout.
Basically, the text is on left, and images on right
Is there anyway So I can Display the alt text below images because they are very valuable keywords for SEO and customer.
I can't find the any tokens of node field to import into panel.

Can anyone help me with this? Thank you very much.


texts: Display referenced content type on specific pages

texts:
I have several basic Pages. I also have a content type of Quick Link. The Quick Links just have an image and a title. The site administrator should be able to specify which pages have which Quick Links displayed on them.

I thought this would be straightforward. I added a Node Reference on Page which points to Quick View as check boxes. I then created a (block) View which filtered for Quick Link content type. In the View I added a Contextual Filter for Content: Quick Link. I added the block to my region but nothing appeared on the front end :(.

I also tried the same but using a relationship in the View, and probably every other combination of configurations, but either nothing shows on any page or every Quick Link shows for every page.

I am new to Drupal so I apologise if I'm missing something really simple. I've searched around for the last two days but can't seem to find the same situation explained.

Thanks in advance.


texts:
I want to use this code in Drupal 8.

if (isset($_SESSION['loop'])) {
     $loop = $_SESSION['loop'];
} else {
     $loop = 0;
}
for ($count = 0; $count <= $loop; $count++) {
     $_SESSION['code'][$loop] = $code;
     $_SESSION['price'][$loop] = $price;
     $_SESSION['loop'] = $loop + 1;
}

This code worked correctly, but in Drupal 8 we should use this code.

// Setting a value.
$tempstore = Drupal::service('user.private_tempstore')->get('mymodule_name');
$tempstore->set('my_variable_name', $some_data);

// Getting a value.
$tempstore = Drupal::service('user.private_tempstore')->get('mymodule_name');
$some_data = $tempstore->get('my_variable_name');

I don't know how to change my code to use this service's API. How do I convert my code to use the user.private_tempstore service?


texts: How to add custom query to comment entity

texts:
I have comment thread field attached into a node. I would like to have a search function by keyword.

I used hook_query_TAG_alter() to add database condition according to my needs.

Here's my current code:-

if ($query->getMetaData('base_table') == 'comment') {
  $query->leftJoin('comment__comment_body', 'ccb', 'c.cid = ccb.entity_id');

  $or = db_or();
  $or->condition('ccb.comment_body_value', "%$keyword%", 'LIKE');
  $query->condition($or);
}

The above code is working, but I also would like to get the parent comment to be able to determine where the comment results coming from.

I'm trying to add the comment_field_data table where the thread is stored. However, I'm not sure on how to get the parent comment according to the thread name in the results or if it's possible that way.

Here's a sample comment with replies:-

Comment Parent with no replies
Comment Parent with replies
  - This is a test reply
  - This is a test comment
  - This is a test

If I searched on a keyword "reply", then the result should be like below:-

Comment Parent with replies
  - This is a test reply

Should I just create a custom field widget to have full control with the query?

Any recommendations is greatly appreciated. Thanks!


texts: Move Drupal Profile2 field from one profile type to another

texts:
Use Case:

I have Profile2 module installed and enabled.

I have a Profile type called 'Main Profile' and it has a field (e.g. City) and different users have already entered value for the field.

I need to move this Profile2 field from one profile type ( Main Profile) to another new profile type (Career Profile).

After moving, the data initially entered by users for this field should be still present, without re-entering again.


texts:
Here is my situation,

I have a view-1 which will list the node titles based on Content: Taxonomy term CONTEXTUAL FILTERS
View-2 which will list all the taxonomy terms (of a vocabulary) with node count.

Now how do I print the view-1 as a custom field within view-2.

The reason I am trying to do this is, I am trying to construct a UI which will display the nodes on click on taxonomy terms with count.

I tried using below code to print view-1 as a custom PHP field on view-2, but it did not work for me.

    print views_embed_view('view-1','block_1', $row->tid);

$row->tid is the term ID argument I am trying to pass


texts:
I am trying to add DISTINCT to a view, and for example I chose the default content view.

I expect that it would add DISTINCT(id), but the query does not change at all. Why is it not added?

Update:

Trying to do another basic View that shows one node type in a REST display. It uses the Entity plugin and no fields. I tried to set DISTINCT, but look at the query:

SELECT DISTINCT date_recur__node__field_event_date.field_event_date_value AS date_recur__node__field_event_date_field_event_date_value, node_field_data.nid AS nid
FROM
{node_field_data} node_field_data
LEFT JOIN {date_recur__node__field_event_date} date_recur__node__field_event_date ON node_field_data.nid = date_recur__node__field_event_date.entity_id
WHERE (node_field_data.status = '1') AND (node_field_data.type IN ('event'))
ORDER BY date_recur__node__field_event_date_field_event_date_value ASC
LIMIT 10 OFFSET 0

This obviously doesn't work. I am not even setting the date value anywhere in the query, how is this getting in there?


texts: Drupal SimpleNews with I18N and anonymous user

texts:
I am implementing simplenews on a new Drupal website.
Most users, if not all, will not be connected (registered).

I eventually managed to allow anonymous user to register to the newsletter (simple permission settings).

However, is there a simple way (that is, without altering the module code) to register email of users and their current 'locale' AND only send the newsletter of a given language to those who subscribed to it.

I.E. : A french user should not get an english newsletter and vice-versa.

I already made the newsletter translatable via "Content translation".

Thank you.


texts:
I seem to be having an issue with the auto generated Thumbnail of a you tube video that shows in a block as a teaser on my frontpage.

When viewing the front page using Firefox the thumbnails are shown. But when viewing on IE11 I just get the alternative text description without the thumbnail.

I am using Drupal 7


texts: How to exclude multiple nodes based on their ID in taxonomy term view?

texts:
In taxonomy term view I want to exclude multiple nodes based on their id.

I tried to add a new CONTEXTUAL FILTER so I can handle multiple values in my Content: ID but the problem here is that it overwrites the url taxonomy/term/%/edit.

Also I have tried to add Content: ID filter in my FILTER CRITERIA but I cannot add multple values in "Not equal" field.

How can I solve that?


texts: Drupal hide form items completely with states

texts:
I try to hide a whole date/image/taxonomy block on my node form dependent on a checkbox.
If use the following for my title field it works perfectly. The title field is hidden/visible dependant on the test_box checked value.

function interceptor_box_listener(&$form, &$form_state) {
  $form['test_box'] = array(
    '#title' => t('You want to choose a title?'),
    '#type' => 'checkbox',
  );
  $states_array = array(
    'visible' => array(
      'input[name="test_box"]' => array('checked' => TRUE),
    ),
  );
  $form['title']['#states'] = $states_array;
  return $form;
}

The point is that I have more complex fields I need to toggle and I'm not able to address them correctly. If I try to adress the following fielditem, nothing happens at all.

Plakat

<input type="hidden" value="109" name="field_plakat[und][0][fid]">

It tried the following:

$form['field_plakat[und][0][fid]']['#states'] = $states_array;

Is there any possibility to just pass an id to drupal but stay with the states system? Of course I'd be able to use plain javascript here, but I really like to stay strictly on the module side.


texts: How can I use drupal_static() to save an element in an associative array?

texts:
I'm making repeated calls to a few related object instances, and I need to cache them in memory.

If I have an array of objects, like:

array('object_a' => $obj_a, 'object_b' => $obj_b);

I want to do something like:

$obj_a = getmyobj('object_a');

Where the object is created if it doesn't exist in memory already.


texts: How do I get rid of the node title on a specific view mode?

texts:
I'm using Drupal 7 with Omega subtheme and Display Suite module.

I have a content type and the nodes are displayed as default (Full Content). But I have two or three nodes of this content type which must be displayed in slightly different way (just a few fields hidden, some others perhaps).

So using Display Suite I've created a new view mode for these specific nodes and on the content edit page I've selected new view mode rather than Default.

Now the problem with this new mode is that node's title is rendered twice, once as the page title and second as the node title. This is different from the Default/Full Content mode, which seems to just have a page title and no node title.

How to get a rid of the node title on the new view mode so it's the same as the way Default/Full Content displays are shown (without using Views)?

Maybe there's some way to clone the Full Content view mode and then just edit that clone. So the new view mode also only shows a page title not the node title?


texts:
I am creating a menu item using the following code.

$item = array(
'link_path' => 'node/custom',
'link_title' => 'Custom Title 001',
'menu_name' => 'menu-custom-menu', // Menu machine name, for example: main-menu
'weight' => 0,
'plid' => 0, // Parent menu item, 0 if menu item is on top level
'module' => 'menu',
);
menu_link_save($item);

I can see the entries is menu_links table, but can not see this menu item under the menu at 'admin/structure/menu/manage/menu-custom-menu'. What is wrong with my code?

Please note this path('node/custom' actually doesn't exist in Drupal System.


texts:
"Primary Tabs" is coming up as one of our top pages in Google and it takes users to the log in page. I'm not sure what "Primary Tabs" means. Can someone point me in the right direction?

I created a sitemap using XMLSiteMap module. Initially had allowed the menu items to be captured in the site map. I have since removed menu items, recreated and resubmitted the sitemap to Google and asked Google to re-crawl the home page but it still shows.

Our home page is set to the highest priority, followed by certain custom pages and content types.

https://fosterclub.com/sitemap.xml

Is "Primary Tabs" a Drupal thing or a Google thing and if it's a Drupal thing, where might this be coming from?

Google last cached our homepage today.

Edit: here is what is in the view/edit/etc. tabs, but Google wouldn't have access to these.


texts: Couldn't display body field on a view with Search Api

texts:
I have a view that I set it up with Search Api and Facet Api, I couldn't display the body field of indexed nodes.

I tried to add it to the Search Api index fields but it still the same result.


texts: Sharing fields and their data between a user profile and a content type?

texts:
I have a content type called "Profile". This is a standalone content type and may or may not be associated with an actual user on the site.

I thus need to find a way of sharing profile fields between the Drupal user and the new custom content type. In other words, if you edit the "home address" field on the Drupal user's profile page, that field (and its data) should show up on the Profile page associated with the user via EntityReference or Relation or whatever.

Is this at all possible? I know you can reuse fields across content types, but in my understanding, it doesn't share their data (Such that you can use field_something on content type A and again on content type B, but data from A will never show up on B and vice-versa).

Thanks!

(Addendum: My fallback is to just put all of the fields on the new Profile content type, keeping the actual default Drupal user profile relatively sparse. Moreover, I'm curious whether this is at all possible.)


texts: After Module updates got "Warning: require_once() "

texts:
I am using Drupal -7 and my website is on cloud(not local host).
This is NOT a multi site and using Omegasubtheme.

I have just updated workbench Moderation module from 1.3 to 1.4 and have also added Workbench Media module(7.x-1.1) to my dev. site.
After running update script, I got bunch of errors on my site. So, I again moved Worbench Moderation Module from 1.4 to 1.3.

Devel Generate and Devel Node Access Modules were enabled in my site and I made those module disabled.

After that, I got these errors so I made them enabled again.
I found this thread but, this is for database.inc for memory allocation error message in database.inc.

Devel Module

Can anyone help me how to get rid of these errors?

Errors which I got on front page:

  Warning: require_once() [function.require-once]: Unable to allocate
  memory for pool. in _registry_check_code() (line 3177 of
  /docroot/includes/bootstrap.inc).
      Warning: require_once() [function.require-once]: Unable to allocate memory for pool. in _registry_check_code() (line 3177 of
  /docroot/includes/bootstrap.inc).

Errors on available updates module page:

Warning: require_once() [function.require-once]: Unable to allocate memory for pool. in menu_execute_active_handler() (line 515

  of /docroot/includes/menu.inc).
      Warning: require_once() [function.require-once]: Unable to allocate memory for pool. in module_load_include() (line 330 of
  /docroot/includes/module.inc).


texts: What is going on with this exposed operator on my view of files?

texts:
What I did:

Edited a View of Files
Added File:usage:entity ID as a filter
Exposed the filter
Exposed the operator
Selected an option and applied it.

I see these weird empty boxes appear below the Entity ID filter, but only in preview mode. When I save the view and use the filter on the actual view page, the boxes below the entity ID list don't appear.

Has anyone else seen this? What causes it?


texts: User login through JSON request returning HTML instead of JSON

texts:
I am using Drupal 8.6.4

http://example.org/user/login?_format=json

When I try to submit a post request, it returns HTML page instead of JSON response.

I am sending headers:

  Content-Type: application/json

and data as:

 { "name": "admin" , "pass": "admin" }

What am I missing?


texts: How to configure edit permissions for Panel panes?

texts:
Is there a way to configure edit (not view) permissions for a Panels 'pane'?

I would like to add a pane for 'custom content', for example above and below a view, so that the content manager role that I've setup can edit that part of the page. Seems really simple (and essential), but haven't found anything like this.


texts: CKeditor not working for users only in forums

texts:
I Installed CKeditor in drupal 7, and all works fine, except in the forums. If I enter as an administrator, there CKeditor works just fine (in the administrator overlay) but if I log as a standard user CKeditor works in all areas but the forums, where I get the following error: TypeError: $(...).get(...) is undefined as in the following line of code: $("#node-form").get(0).setAttribute('action', '/?q=node/add/forum/0&29e0_name=0a'+v+'8f52a260a1342d3127_form');

I'm out of ideas and the solutions offered here are usually for CK editor not working in general, but here the frustration is that it only doesn't work in the forums section and only for standard users.

thanks in advance


texts: Jquery loading Ajax only works on first node in view unless clicking any other node first

texts:
I have a view of nodes. Each node has a table and a div. I would like to click a link to show an extra row in that node's table along with loading content via ajax into the div. Later the click should hide the extra row and div.

The code I have works correctly if the first node I click on is anything other than the first node in the list. If I click the first node in the list, none of the links in the other nodes will work. It's as if clicking the link in the first node of the list disables jquery from there on. Here's the code:

     Drupal.behaviors.ajaxview = function(context) {
  $('a.morelink:not(.ajaxview-processed)', context)
  .addClass('ajaxview-processed').each(function(){
    $(this).click(function(e){
        e.preventDefault();
$index = $('a.morelink').index($(this));
if ($('.xtrarow').eq($index).is(":hidden"))
 {
   $('.xtrarow').eq($index).show();
      var target = $('.col2').eq($index)
      var nrefcount = $(".mynrefcount").eq($index).val();
      var nid = $(".mynid").eq($index).val();
      var placeholder = '0';
       if(nrefcount == placeholder)
{var toLoad = Drupal.settings.basePath + 'content/no-replies';}
else
{var toLoad = Drupal.settings.basePath + 'replies/' + nid;}
            xhr = $.ajax({
        url: toLoad,
        success: function(data) {
          $(target).html($('.audioforumtable', data));
          Drupal.attachBehaviors(context);      }
      });
} else {
       $('.xtrarow').eq($('a.morelink').index($(this))).hide();
       }
     });
  });

What am I doing wrong?


texts:
I am following the Nodejs integration documentation to set up Chatroom, but am a little confused.

In step 2, do we cd to the folder of nodejs installation, or the drupal nodejs module?

Also, what is the server.js file?


texts:
The following code creates navigation links for a Twitter Bootstrap carousel. The script runs perfectly when saved on my local machine as well as hosted as its own document. When placed into a Drupal page, however, the javascript is modified. I understand that Drupal requires a special Javascript structure. Is that the case with my code below? Any suggestions would be helpful. Thanks!

--- You can see how Drupal closes tags on Line 10

Original Code - working:

$(document).ready(function() {
    $('#headerCarousel.carousel[id]').each(function() {
        var html = '

';
        for(var i = 0; i != $(this).find('.item').size(); i ++) {
            html += '
'  + $(item).attr('data-title') + '
';
        }
        html += '

';
        $('.btn-navbar').after(html);
        $('.carousel-control.left[href="#' + $(this).attr('id') + '"]').hide();

    }).bind('slid', function(e) {
        var nav = $('.nav-collapse[data-target="' + $(this).attr('id') + '"] ul');
        var index = $(this).find('.item.active').index();
        var item = nav.find('li').get(index);
        nav.find('li.active').removeClass('active');
        $(item).addClass('active');

        if(index == 0) {
           $('.carousel-control.left[href="#' + $(this).attr('id') + '"]').fadeOut();
        } else {
           $('.carousel-control.left[href="#' + $(this).attr('id') + '"]').fadeIn();
        }
        if(index == nav.find('li').size() - 1) {
           $('.carousel-control.right[href="#' + $(this).attr('id') + '"]').fadeOut();
        } else {
           $('.carousel-control.right[href="#' + $(this).attr('id') + '"]').fadeIn();
        }
    });

   $('.bootstrap .nav a').bind('click', function(e) {
       var index = $(this).parent().index();
       var carousel = $('#' + $(this).closest('.nav-collapse').attr('data-target'));
       carousel.carousel(index);
       e.preventDefault();
   });
});

Generated code after placing in Drupal - broken:

$(document).ready(function() {
    $('#headerCarousel.carousel[id]').each(function() {
        var html = '

';
        for(var i = 0; i != $(this).find('.item').size(); i ++) {
            var item = $(this).find('.item').get(i);
            html += '
'  + $(item).attr('data-title') + '

';
        }
        $('.btn-navbar').after(html);
        $('.carousel-control.left[href="#' + $(this).attr('id') + '"]').hide();

    }).bind('slid', function(e) {
        var nav = $('.nav-collapse[data-target="' + $(this).attr('id') + '"] ul');
        var index = $(this).find('.item.active').index();
        var item = nav.find('li').get(index);
        nav.find('li.active').removeClass('active');
        $(item).addClass('active');

        if(index == 0) {
           $('.carousel-control.left[href="#' + $(this).attr('id') + '"]').fadeOut();
        } else {
           $('.carousel-control.left[href="#' + $(this).attr('id') + '"]').fadeIn();
        }
        if(index == nav.find('li').size() - 1) {
           $('.carousel-control.right[href="#' + $(this).attr('id') + '"]').fadeOut();
        } else {
           $('.carousel-control.right[href="#' + $(this).attr('id') + '"]').fadeIn();
        }
    });

   $('.bootstrap .nav a').bind('click', function(e) {
       var index = $(this).parent().index();
       var carousel = $('#' + $(this).closest('.nav-collapse').attr('data-target'));
       carousel.carousel(index);
       e.preventDefault();
   });
});


texts: How to show difference between views page and views block

texts: I have created a view page, to this same page I will add a block by clicking on add button. So whatever changes I will do in the block is affecting the view page also. So how can I configure this, so that my block changes should apply only to block and not to page.


texts: Image field in content type not displaying the image

texts:
Created a content type called Gallery and added the image style for that. The images are to be displayed in the page--front.tpl.php

I have fetched the images using this,

                        <?php
                        $nid=11;
                        $node = node_load($nid);
                        $imgcount = count($node->field_img['und']);
                        for ($i = 0; $i < $imgcount; $i++) {
                        $image_uri = $node->field_img['und'][$i]['uri'];
                        // url
                        $masthead_raw = image_style_url('gallery-thumb', $image_uri);
                        ?>
                            <img src="<?php print $masthead_raw; ?>">

                     <?php } ?>

.

The image is not displaying.Please guide me.


texts: Within my themes page.tpl.php file it has a reference to a lot of variables like $head and $local_styles. What file are they stored in?

texts:
Within my themes page.tpl.php file it has a reference to a lot of variables like $head and $local_styles.
What file are this variables stored at so that I can looked at what each of these variables represent?
John


texts: How to select, add, limit or level select hierarchical taxonomy terms as field widget values?

texts:
To sort and "tag" content hierarchically Drupal has/had the great ability to build hierarchical term trees like: car > toyota > combi, car > ford > lector, etc. which could be added to content in different ways.

There are 3 modules, I know of which provided field widgets for the ability to hierarchical select, add, limit or level select taxonomy terms as field values in Drupal 7 to add these terms of a certain level to content and with some limitations for Drupal 8. Hierarchical Select, Simple Hierarchical Select and Clientside Simple Hierarchical Select.

Looking at the project pages of each module, it seems, the user has been left allone on a dead end when it comes to complex hierarchical term usage in post Drupal 7 days. HS development has been stopped. SHS further development has been stopped too, and CSHS has too many bugs and limitations (I am not able to add new terms on any level in a field widget form).

How do users use complex hierarchical term lists for field form values nowadays? Does the concept of terms stopped gaining enough interest to call out for contrib solutions or do I do not see the options, I knew I was able to do such things back in the days with Hirarchical Select? Are there work arounds or completely different approaches how to reach the same goals without hierarchical terms?


texts: Is this acceptable for passing data from a module to a template?

texts:
I'm attempting to pass some data from a block module into a template. I've found that I can make up a render array property and then access it in the template. Here is an example of my code:

class MyBlock extends BlockBase {
      return [
        '#firstname' => 'John',
        '#lastname' => 'Doe',
      ];
    }

I can access this data in the twig templeate by using:

{{ elements.myblock.content['#firstname'] }}
{{ elements.myblock.content['#lastname'] }}

Is this an acceptable means for passing data into a template? All the other examples I've found have the render arrays being picked up by a hook_theme function and then getting passed to the template. The method I show above seems simpler and I'm wondering if there is something problematic with doing it this way.

Thanks!


texts: Setting up a development environment for drupal site

texts: I have a production site at example.com (with a subdomain multi-install) and I have been meaning to setup a development environment at beta.example.com (also having all of the multi-sites). I would like these machines to be as identical to each other as possible so the push from the development machine to the production machine goes very smoothly. Is it possible to have the sites folders named the same on the development machine as they are named on the production machine? That is, they do not have beta in the file name. Does this involve hostname rewriting? Can apache even do that?


texts: How do Install and use packages from Packagist?

texts:
I would like to install use kamermans/guzzle-oauth2-subscriber in my Drupal 8 build.

I ran composer require kamermans/guzzle-oauth2-subscriber which put the package in mysite/vendor/kamermans.

The module is installed on mysite/docroot/modules/custom/scheduleapi.

The example code from Kamerman uses the following lines.

use kamermans\OAuth2\GrantType\AuthorizationCode;
use kamermans\OAuth2\GrantType\RefreshToken;

Clearly my module knows nothing about kamermans.

How do I access files and libraries that Composer puts into the vendor directory?


texts: Unable to print menu links using menu_navigation_links

texts:
I'm using a custom template and attempting to customize the output of specific menu items. However when I attempt to output each link in the menu specified it outputs nothing. menu-it is the machine name of the menu.

<?php $menu = menu_navigation_links('menu-it', 1);
    foreach($menu as $item){
        print $item;
    }
?>


texts: Images within content of page but not separate fields

texts:
I would like to create a basic page within Drupal 7 that would consist of some images mixed with HTML. I would use CSS to position the images within the HTML content, sort of like a magazine or newspaper article.

I would like for the end user to be able to edit/replace these images along with the HTML yet the image field did not seem to give me flexibility to place the image within the HTML content.

I could upload the images via FTP directly to the ../sites/default/files directory and manually reference the images ...

<img src="../sites/default/files/image-name.png" />

but that would not allow the end users to manage the images from with Drupal, plus I would need to give them FTP access to the filesystem which I would like to avoid.

Any suggestions on how to work around this?


texts: Account Settings: "Access Denied" on emails translation

texts:
I'm having issues for accessing the "Email Notifications" from user configuration in Brazilian Portuguese. All Developer Portal "User Email Notifications" are being sended in this language.
Picture of the Email that it's sended for a user that registered in the Developer Portal:

I don't know why but when i try to access the Portuguese translation endpoint, where this text should be presented (admin/config/people/accounts/translate/pt/edit), the portal just return a "Access Denied".

Even with the site being configurated with "Brazilian Portuguese" as the main language, the "Emails" field in "User Account" configuration keep appearing in English, rather than Portuguese.

Someone have any clues about how and why this is happening?


texts: How to get BundleKey in EntityManager after getting storage of entity?

texts:
I want to get bundleKey of any entity type after is loading from

$node = \Drupal::entityManager()->getStorage('node');

After getStorage I am getting bundleKey Value as "type", but how to render that, as it is saying that is a protected value.
Tried to fetch like:

-> $node->get('bundleKey')->Value();
-> $node->getField('bundleKey')->getValue();
-> $node->bundleKey;

All above methods i tried to fetch Values but still no luck.

Anyone Knows how to fetch bundleKey.


texts:
I've two content-types "Book" & "Review". I want users of role reviewers to add reviews to any book they desire.

How I did it?:

I've added entity-reference to Book from Review with (auto-complete) widget. This just allows reviewers to add review node and select book from auto-complete. Who does that way? I'm not satisfied with it.

How I want it:

I've a page for every book /book-details/title-of-the-book, where I want to provide a link/button which says Add Review and then it should show them the fields of Review content-type and reviewer fills it and submits. His review is submitted. and the same page shows list of all reviews for that book.

How to achieve this in drupal-7?


texts: Where do I fetch myself complete definition for a bundle?

texts:
I can fetch entity-type definition...

$entityType = \Drupal::entityTypeManager()
  ->getDefinition($this->entityType);

and I can fetch myself some of the bundle specific information...

if ($bundleName !== null) {
    $bundleConfig = $entityType->getBundleConfigDependency($bundleName);
    $config = HelperConfiguration::instance($bundleConfig["name"]);
    $configValues = $config->getConfigValue();
}

$configValues carries properties like description, preview_mode, display_submitted, even langcode, but what I cannot find, is how to find translatability status for a bundle.

On /admin/config/regional/content-language I can wonderfully manipulate translatability bulk-wise, from entity-coarseness, up to specific fields.

So, while there is an isTranslatable() method on EntityTypeInterface (and also onFieldDefinitionInterface), where is the bundle equivalent? Where is the rest of bundle's metadata hidden?


texts: Is there a drupal 7 equivalent to the Country Ban module?

texts:
I'm wondering if anyone has a Drupal specific solution for blocking entire countries from accessing your server. My company only does business in the US so there's no point in having other countries accessing my site.

For Drupal 6, there is the Country Ban module.  Is there a Drupal 7 was to do this?


texts:
When upgrading from Devel 8.x-2.x to Devel 8.x-4.x in a composer based build, how do I handle the Kint module being removed per Remove Kint module and create a kint dumper plugin in devel?
The service container can't be created because the Kint class is missing. I'll add the class path to Kint when I blow up the build again. :) Thank you.


texts:
I want to create a script file that I can call using a form on submit. For example I can use:

action="action.php?uid=1&method=deleteuser"

This would trigger the script to result in the function deleteuser in file action.php deleting uid 1. However, when I tried to create this file and put it in the home scripts folder it couldn't call basic drupal commands such as db_query. Where and how can I generate such a script file so that I can access drupals core functions?


texts: How should I insert a row into a database table created by another module?

texts:
I'm attempting to insert a row into a table created by another module. This module was enabled in a previous hook_update_N(); I want to insert a row into the table with another hook_update_N() or the same one. Using two hook_update_N() works when the updates are ran at different times but if both updates are ran at once the second update fails because the table does not yet exist. I have tried using sleep() but that seems problematic.

/**
 * Enable commerce fees
 */
function mymodule_update_7004($node) {
  module_enable(array('commerce_fees'));
}

/**
 * create compliance fee
 */
function mymodule_update_7005($node) {
  // wait for commerce_fee table to be created
  sleep(10);
  if (db_table_exists('commerce_fees') == TRUE) {
      db_insert('commerce_fees')
    ->fields(array(
      'name' => 'non_compliance_fee',
      'title' => 'Non-compliance Fee',
      'display_title' => 'Refundable Non-compliance Fee',
      'description' => '',
    ))
    ->execute();

    // Clear the necessary caches and rebuild the menu items.
    commerce_fees_reset();
    entity_defaults_rebuild();
    menu_rebuild();
  }

  else {
    drupal_set_message('table commerce_fees does not exist');
  }
}


texts: Entity translation: views with and without language fallback

texts:
I need views with entity language fallback and others without.

if "Enable language fallback" is activated, is there a way to disable this for a specific view

Thanks
Rainer


texts:
At the moment, I have this in my template.php

drupal_add_css('https://fonts.googleapis.com/css?family=Short+Stack',array('type' => 'external'));

I now have the .woff is the theme's folder. What's the proper way to add it?


texts: In view, add a sample no global "link" field foreach row

texts:
I created a view from the user interface. This view shows some content of a type of node.
For each node displayed, I want add a field "mylink custom" in this view for show a generated link.

I generate the link from a custom module, I want change the link according to the node displayed by the (row) view and some current user parameters.

How can I do that ?

I add a "Global : Custom text" default field in the user interface, but this field is global ! When I want get his value from a prerender hook view, I get only the global value for all nodes displayed in my view. But I want set a different value of my "custom link field" for each row of my view.

I didn't add a new field in my node structure because I want just display a generated text when the user go to the view page. I don't want save this value in each node because this text change each time an user go to the view page.

Thanks for help =)


texts:
I need to change the login URL from /user to /my-url

I found this module: Rename Admin Paths module. But I think this could be done in other way. Plus, this module has some conflicts with multilingual sites.


texts: Could not determine database connection parameters. Pass --db-url option when site-install

texts:
i am writing drush script to install drupal site

 $build_make_file = ($build_src = drush_get_option('build-src', FALSE)) ? $build_src : '../builds/build-drupal-core.make ';
    $dest .= ($build_dest = drush_get_option('build-dest', FALSE)) ? $build_dest : 'test';
    $options = array();
    $options['debug'] = drush_get_option('debug', FALSE);
    $options['no-core'] = drush_get_option('no-core', FALSE);
    ($contr_dest = drush_get_option('contrib-destination', FALSE)) ? $options['contrib-destination'] = $contr_dest : '' ;
    $status = drush_invoke_process('@none', 'make', array($build_make_file, $dest), $options);
    drush_print('Site Download '.(($status) ? "SUCCESS" : "FAILURE" ));

    // go to install directory before we do anything else
    drush_op('chdir', $dest);

    $dbHost="localhost";
    $dbName="drupal_test_db";
    $dbUser="test_user";
    $dbPassword="xxxxxx";
    $dbPort ="3306";
    $status = drush_invoke_process('@self',
                                   'si',
                                   array(
                                          'db-url' => 'mysql://'.$dbUser.':'.$dbPassword.'@'.$dbHost.':' . $dbPort . '/'.$dbName,
                                          'account-pass' => $AdminPassword,
                                      )
                                  );
    drush_print('Site Install - ' . (($status) ? 'SUCCESS' : 'FAILURE'));

The site download part works where it downloads the make file. The second part running 'site-install' returns an error:

Could not determine database connection parameters. Pass --db-url option

How to call 'site-install' command from the drush script correctly? I would appreciate much of your help. Thank you


texts: Is there a good way to inspect objects whose type is derived from the EntityDrupalWrapper class?

texts:
I'm sure this question applies to other complex object types, but EntityDrupalWrapper is the one I'm currently working with. This is the type of object returned by entity_metadata_wrapper() (and probably others).

When using code like the following:

$order_wrapper = entity_metadata_wrapper('commerce_order', $order_object);
dpm($order_wrapper);

the output from Devel is none too helpful:

It doesn't show what you'd expect to see for a call to dpm() with, for example, a stdClass object.

A similar call to dvm() does print the object, but in a manner I'm not familiar with, and it's not very readable.

I've tried debug() and it produces a PHP user notice that looks something like this:

Incidentally the HTML output contained in that warning is the same output that dvm() prints to the screen.

How can I inspect these types of objects (preferably with Krumo), so I can see what properties are available? Or am I stuck using dvm()?


texts: Having an entity registration for an organic group

texts:
I have a website where we organise yearly events of 2 - 3 different types. To register users to the event, I'm currently using the entity registration module. (Tell me if you think this is not a good choice) I think I also want an organic group for every event, since every event should have it's own private forum, its own organisation wiki and image gallery. (If you think I don't need a separate organic group for that, see below, I'd appreciate your alternative suggestion!) For that reason, I created a new content type called "Event" which is a group type and has a registration field.

Some users might be really stupid, so I want the event registration to automatically trigger a group membership request, otherwise people will end up complaining "I registered for the event but I still can't access the event forum". How can I do that? (Maybe with rules? If yes, how?)

If you're thinking "Oh no, you're doing it all wrong!", I'd be happy to hear suggestions! Maybe there is a really clever way of doing it without having to resort to organic groups. The feature wishlist is: An event overview page, an event forum visible for all participants and staff, a staff forum visible only for staff (which will have a separate registration form), a staff wiki, an overview over the personal schedule and an image gallery for the event.


texts:
I'm migrating an old site to Drupal (using migrate module), and I've managed directly in code all old urls to redirect to new Drupal urls using redirect module, for example:

www.mysite.com/UserProfile.php?user=5

Redirects to:

www.mysite.com/it/community/peoples/mr-max

This works very fine on my dev environment with apache, but doesn't works on live environment with nginx.

At first try with old url, I received a blank page with the message "No input file specified."

So I've changed virtual host conf from:

location ~ \.php$ {
  #fastcgi_split_path_info ^(.+\.php)(/.+)$;
  #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
  include fastcgi_params;
  fastcgi_param SCRIPT_FILENAME $request_filename;
  fastcgi_pass php-fpm;
}

to:

location ~ \.php$ {
  #fastcgi_split_path_info ^(.+\.php)(/.+)$;
  #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
  include fastcgi_params;
  fastcgi_param SCRIPT_FILENAME index.php;
  fastcgi_pass php-fpm;
}

RESULT: no more "No input file specified." blank page, but redirect doesn't works and my front page is shown for all old urls.

Here's other settings from my virtual host, if can help:

location ~ \..*/.*\.php$ {
  return 403;
}
location ~ ^/sites/.*/private/ {
  return 403;
}
location ~ (^|/)\. {
  return 403;
}
location / {
  try_files $uri @drupal;
}
location @drupal {
  # For D7 and above:
  # Clean URLs are handled in drupal_environment_initialize().
  rewrite ^ /index.php;
}
location ~ \.php$ {
  #fastcgi_split_path_info ^(.+\.php)(/.+)$;
  #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
  include fastcgi_params;
  fastcgi_param SCRIPT_FILENAME index.php;
  fastcgi_pass php-fpm;
}

What kind of setting I have to change/add to the above conf to make redirect working correctly?


texts:
I have the standard Main Menu, Management Menu, User Menu, etc., plus a bunch of custom menus. They are consistently shown in the same strange order (not in the order created, not alpha, not alpha by machine name) when shown in /admin/structure/menu/manage/. I can't determine a logic for the order.

I use Footer sitemap to place links in the footer and the various menus show up in this same order. I can find no way to change the weight of entire menus or reorder them. The database table I found was sorted alphabetically by machine name and not in the order I see at /admin/structure/menu/manage/. Any way to control this order?


texts: default value imagefield -> get from field collection item

texts:
I've got a contenttype "gallery" with an imagefield "thumbnail", used in listviews oder teaserviews. This contenttype also has a field collection with "image", "title" and "description". So what would be great now, if there's no value set for the "thumbnail" field, the default value should be the value from the first field-collection image.

any chance to realize this? Thanks for your help

EDIT:

i tried this:

That's not a solution

function channelportal_gallery_node_presave($node) {

    $galleryimage = field_get_items('node', $node, 'field_gallery_and_caption');
    $firstimageID = $galleryimage[0]['value'];

    $item = field_collection_item_load($firstimageID);
    dpm($node->field_thumbnail);

    $node->field_thumbnail = field_get_items('field_collection_item', $item, 'field_gallery_image');
    dpm($node->field_thumbnail);
}

But nothing is stored, to the field, even if the first dpm gives back an empty array and the second one containing the values it should contain. But after all, nothing is stored to the field and it's empty again...

Thanks for your answer Chad Payne


texts:
Security Update for drupal

All other updates are being done smoothly thorugh drush

I have a multi site installation if drupal so i worried to remove the sites folder and update that the general way.

I get this error when updating through drush commons module:

The commons directory could not be found within the modules directory at /var/www/drupal/., perhaps the project  [error]
is enabled but has been deleted from disk.

Please help.


texts:
I am on a Drupal 7 website and I have a webform with multiple fields, one field is a selectbox with :

1-10 employees
10-20 employees
20-30 empolyees
...

Another one is an open textfield Postcode.

Webform offers the possibility to choose the recipients (e-mail TO) based on a component but not on multiple components.

For example, I want the mail to be sent to john@doe.com if employees = 1-10 and Postcode = 75000 etc.. And one more thing, I want my client to be able to change and contribute these rules. So a solution with Webform Rules will be too difficult for them in my opinion. I hope to find a solution within the webform e-mail interface.

Have you any idea how is it possible to do that without building a new complete custom form and keep the power of Webform ?

Thanks.


texts: EntityQuery for taxonomy term of specific bundle

texts:
I would like to build a query for all taxonomy terms of a specific bundle.

$terms = \Drupal::entityQuery('taxonomy_term')
  ->condition('type','mail_template')
  ->execute();

This returns an error 'type' not found.

How do I query taxonomy terms of a specific bundle (specific vocabulary)?


texts: Validation error on term-reference field when ajax'd option is submitted?

texts:
I get the error "Illegal choice" when I submit a form with a multi-select option that was freshly created via ajax.  Workflow is like this:

User loads node edit form
User needs to select a non-existant job title (job titles are drupal taxonomy terms)
User presses my custom ajax button that (1)takes their new title, (2) adds their new title as a drupal term, (3) updates the form in the browser, (4) selects the new title

When I submit the form, drupal doesn't seem to see that the new title has a corresponding (therefore valid) TID and errors out in the validation.

I tried creating custom validation on the title element, but despite passing that validation, drupal still does its own check, which fails.

Anyone know how to work around this?


texts: How to create a new custom content type record when a user registers

texts:
My client's Drupal 7 website has a custom content type which is currently being used as a user profile. Now we need to incorporate this custom content type with the Drupal registration process. That is to create a user profile(a new record in custom content type) when a user registers. The User profile content type has many fields which asks for personal details and there are many views that are based on this content type. Therefore, I need to have this content type as it is but to incorporate this somehow with the Drupal registration process.

Is this doable?