texts: MySQL 5.1 to MySQL 5.6 update causes php-cgi error: PDO issue?

texts:
I recently performed a MySQL upgrade on Windows Server 2008R2, moving from MySQL 5.1 to MySQL 5.6.22 (Community Edition). The server is currently using PHP 5.3.0.

Things went just fine for all my WordPress installs (no problems on cutover); however, all my Drupal 7 sites are now generating 500 errors (coming from php-cgi.exe via php5ts.dll from what I can tell).

To address concerns about the broad nature of the question, this is the specific Windows event log message:

  Faulting application name: php-cgi.exe, version: 5.3.0.0, time stamp: 0x4a492a25
  Faulting module name: php5ts.dll, version: 5.3.0.0, time stamp: 0x4a4929bb
  Exception code: 0xc0000005
  Fault offset: 0x0015e1b0
  Faulting process id: 0x7bb4
  Faulting application start time: 0x01d01fa8dec6e9a6
  Faulting application path: C:\PHP\php-cgi.exe
  Faulting module path: C:\PHP\php5ts.dll
  Report Id: 2e661541-8b9c-11e4-a303-001b210e0a6a

I've checked database credentials, time zone defaults, and haven't changed IIS settings, folder permissions, or anything of that nature.

The one difference that stands out is that Drupal uses PDO for access, and I'm wondering if there is a potential issue there with the version being used, since all these sites worked fine with MySQL 5.1.

PDO seems to be showing version 5.0.5-dev (rev 1.3.2.27).

I can't locate anything that leads to identification, troubleshooting or resolution.

(I'm off to try to replicate with just a simple PDO test.)

Has anybody encountered this and/or have documentation that might help isolate/resolve things?

NOTE: The closest I've come is to somebody using PDO drivers for MSSQL (not MySQL) where there was a faulty Drupal layer on top of PDO. Details here - http://forums.iis.net/t/1181446.aspx?PHP+5+3+8+Problems

UPDATE:

Not PDO...

The following example (with real values) works fine.

$dsn = 'mysql:host=localhost;dbname=DBNAME';
$username = 'USER';
$password = 'PASS';
$options = array();

$dbh = new PDO($dsn, $username, $password, $options);

if ($dbh) {

    $stmt = $dbh->query('SELECT * FROM MYTABLE LIMIT 1');
    $results = $stmt->fetchAll(PDO::FETCH_ASSOC);

    print_r($results);

}
else {
    echo 'Failed.';
}

UPDATE 2:

I have double checked any options set by the prior install of MySQL 5.1 that might not have been carried over. I realize more things are auto-set and defaults might have changed, which could be part of the issue.

The other issue that might come into play is changing the server collation default from utf8 to utf8mb4 ... It looks like Drupal 7 should support this (discussion, in the framework of Drupal 8 goes back to 2011 - https://www.drupal.org/node/1314214). The tables continue to show ut8 collation, so data should be unaffected.

MySQL 5.6 does introduce explicit_defaults_for_timestamp but I haven't been able to find anything implying it should be an issue either (setting 0/1 results in the same error).


texts: Why settings.php does not redirect to homepage so it betrays that the file is in that exact location even if moved by security reasons?

texts:
I have checked that www.example.com/sites/default/settings.php is reachable via web browser, even if it returns an empty page. What is more strange, in Drupal org webpage, http://www.drupal.org/sites/default/settings.php , it gives a 500 internal server error. Shouldn't the access be prohibited to that folder, or even a redirection made?

This is different to the question Why is settings.php in the web folder? , though somehow it completes it.


texts: How to use form API to edit sub form that is added to user_register_form

texts:
I need to alter a Redhen Contact form when it is attached to the user registration form.  More generically, I need to alter a sub form.  The form is added to user_register_form() via hook_form_FORM_ID_alter() in rendhen_contact.module:1029.  (I don't think this is specific to Redhen's implementation; I'm just providing this as a reference point.)

The first issue I encountered was that the hook implementation in redhen_contact.module hadn't occurred when my hook was called.  In a custom module, I used hook_module_implements_alter() to resolve that (see screenshot at bottom for kpr()).  With that I'm still unable to alter, for example, the #title attribute of field_agency_interest.  Even if I do $form['redhen_contact]['form']['field_agency_interest']['und']['#title'] or ...['und'][0]['title'] it doesn't change.

I tried using $form['#after_build'][] = 'module_callback_name' but I can't edit the sub form elements.

How can I alter a sub form added to a form?


texts: Cannot display date_field in a content view

texts:
Without succes i am trying to display a date_field in a content view (so no fields view).
I rather dont want a fields view as i dont want to theme the whole view.
The view is displaying other fields such as image_field etc.

I have checked the:/types/manage/mycontenttype/display settings for default as for teaser.
But in both settings they are set to default (so no hidden)

The normal display of the node itself displays the date fine.
With a fields display i can render the date_field as well.

Does somebody has any thought why the date_field is not displaying in a content view?

D7


texts:
I have a structure as follows:

Taxonomy -
Academic Programs
Occupation Classifications
Academic Programs has a term reference field to Occupation Classifications

Nodes -
Academic Homepages (has reference to Academic Programs)
Occupation Details (has reference to Occupation Classifications)

I'm trying to build a block view that will pull information from the Occupation Classifications taxonomy and the Occupation Details node. The block will display on Academic Homepages nodes.

The block is pulling in information from the Occupation Classifications taxonomy, but I can't get it to display fields from the Occupation Details node that have the same term reference to the Occupation Classification.

Here's how I have it configured currently, and I'd appreciate your help in getting fields from the Occupation Details node as part of this view.

Contextual Filters:
Content: Nid (default from URL)

Relationships:
Field: Academic Program
(Academic Program): Taxonomy term: SOC Code


texts:
Hi I'm Drupal beginner.

I'm trying to make a view which shows most commented content today, this week, this month, total in Drupal 6.

I only found the total comment count field.

Please help me.


texts: How do you get Taxonomy ID (TID) from a term name via PHP?

texts:
Yes, I googled. I searched. No one has a concise answer to this basic question. Everyone seems to be looking for TID to Term name, but not the other way around. And linking to the Drupal API doesnt help neither. A PHP example would seal the deal.

We just need a simple PHP example of how to convert a Term Name to a TID.

I have the following, but it does not work:

$tid = _taxonomy_get_tid_from_term($row->field_term_name);

print $tid;


texts: How to change the HTML of the commerce shipping service form on checkout pages?

texts:
Right now, the HTML of the commerce shipping service consists  by input buttons, where you select the desired method.
I'd like to is to have it in the form of a select, and - more importantly - have no default shipping method selcted.
How to do it?


texts: Views Search is displaying no results behavior by default

texts:
I've created a Drupal 7 Views Search page. It works overall. However, when there are no returned results I want it to display a message such as 'your search returned 0 results. try something else.' So I put that message in an unfiltered text area using 'advanced > no results behavior' but now it's showing that message by default before someone has even entered their search terms.

I want the search page to only show that message once they've entered a search term in the 'search: search terms' exposed filter criteria and it actually returns no results. I don't want it to display right when they get to the page.

Anyone know how to keep that from happening?


texts: How do I display last five nodes, with the latest at the bottom using views?

texts:
I am creating a view which lists node titles for a specific node type. I want to display the 5 latest nodes with the latest at the bottom of the list.

If I sort using the post date criteria in an ascending manner, then the earliest 5 posts are shown. If I use descending, then the latest 5 are shown, but the the latest is at the top.


texts: hide "Submitted by ADMIN on THU, xx/xx/xxxx - 00:00" in a view

texts:
I created a view listing a type of content.

This list shows the title of the content, publication information, images, link...
I would like to get ride of the publishing information but I don't find the wright parameteres.
Thank's to any of you who could help


texts: Are there any module options or techniques to authenticate through OpenAM on Drupal 8?

texts: I see that there is an OpenAM module for Drupal 7, but I do not see one for 8. Is there an option for this?


texts: Is there another module to auto refresh a page besides Views Auto-Refresh?

texts: I am currently using the Auto-Refresh module to build an page that stays up-to-date, without needing to be reloaded.  However, this module will not cooperate with Features.  Is there another module or method I can use the build a page with auto-refreshing content?


texts:
Using Drupal 7 with custom zen subtheme.  I created a footer block to hold standard copyright information.  But this block is left aligned, how do I center my footer block?

UPDATE

Below is the HTML for my footer.  What CSS selector should I use to identify my footer block?

 &copy; Copyright 2011 example.com


texts: how to catch when node is being promoted?

texts:
I would like to take some action when node is being promoted. I tried using node_validate or node_presave but none of them is working.

What is the quickest way to do this?

thanks


texts: Views Ajax Pager not working when loading view with ajax

texts:
I have a page with a view that has a pager with ajax.
the pager is working fine when the page first run.

the page has a button that loads the next page using ajax, the view is loaded fine but the ajax pager is not working properly, just links without ajax (open pages directly).

how to make ajax pager work when loading a view via ajax, I'm using Drupal 7.28 with views 3.8

p.s. I think ajax view events needs to be rebinded to the pager links after loading the view through ajax, but I can't figure out how to achive that.


texts: Add #ajax event to a custom composite element

texts:
I have created a custom composite element for Webform (6.0) that has a date field and a select field. The idea is when a user picks a date, an API call is made that returns available time slots to make a booking.
I am familiar with how this is normally done in FormBase forms and inspecting form_state to inform build values, but I am stuck here.
class WebformTourAvailabilityComposite extends WebformCompositeBase {

  /**
   * {@inheritdoc}
   */
  public static function getCompositeElements(array $element) {
    $date_format_entity = DateFormat::load('html_date');
    $date_format = $date_format_entity->getPattern();

    $elements = [];

    $elements['tour_date'] = [
      '#type' => 'date',
      '#title' => t("Tour Date"),
      '#date_date_format' => $date_format,
      '#date_year_range' => '0:15',
      '#attributes' => [
        'min' => '[webform_submission:created:html_date]',
        'onkeydown' => 'return false'
      ],
      #'#datepicker' => TRUE,
      '#datepicker_button' => TRUE,
      '#date_label_position' => 'invisible',
      '#required' => TRUE,
      '#ajax' => [
        'callback' => 'mymodule_get_date_options',
        'wrapper' => 'available-times'
      ]
    ];

    $elements['tour_time'] = [
      '#type' => 'select',
      '#title' => t('Tour time'),
      '#prefix' => '
',
      '#suffix' => '
',
      #'#options' => [],
    ];

    return $elements;
  }

}

in mymodule.module:
function mymodule_webform_submission_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state) {
  $selected = $form_state->getValues();

  if (isset($selected["select_appointment"]["tour_date"])) {
    $response = \Drupal::httpClient()->get('https://nestiolistings.com/api/v2/appointments/group/123/available-times');
    $options = json_decode($response->getBody()->getContents(), TRUE);
    #$form["elements"]["step_1"]["select_appointment"]["tour_time"]["#options"] = $options['data'];
    $form["elements"]["step_1"]["select_appointment"]["#webform_composite_elements"]["tour_time"]["#options"] = $options['data'];
  }
}

function mymodule_get_date_options(&$form, \Drupal\Core\Form\FormStateInterface $form_state) {
  return $form;
}

Which method I should override or use in the Webform ecosystem, or if this needs to be a composite at all and I can do this some other way?


texts: How to find the right data selector in Rules Components?

texts:
In Drupal 7, I have set up a rule to automatically close blog comments after two weeks. That works well.

Now, I am trying to have a block displayed on the blog entries when comments are closed. For this, I am using the Rules block visibility module.

I have set up the rule component as per the strict instructions of the module's "readme.txt" file. Without any condition, the export of the component gives this:

{ "rules_set_comments_closed_blocks_after_blog_entry" : {
    "LABEL" : "Display Comments Closed block on blog entries",
    "PLUGIN" : "rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "USES VARIABLES" : {
      "module" : { "label" : "Module", "type" : "text" },
      "delta" : { "label" : "Delta", "type" : "text" },
      "result" : { "label" : "Result", "type" : "boolean", "parameter" : false }
    },
    "DO" : [ { "data_set" : { "data" : [ "result" ], "value" : "1" } } ],
    "PROVIDES VARIABLES" : [ "result" ]
  }
}

The problem I have is with the condition. I cannot find the right data selector in the Data Compare section.

If, on the other hand, I create a rule to display a system message on the site when comments are closed, I do find the data selector item "node:comment" and comparing its value to "NOT 2" (meaning not open) makes the message display only on blog entries with closed comments.

The above exported component works, but on all blog entries whether the comments are closed or not. I just need to add the condition to differentiate nodes with closed comments from those with open comments.

I have tried "entity" has field, entity is of type, etc. But, in components, the list of data selector is still very limited. In fact they are limited to site or current user items.

How can I expand the list of data selectors so that I find my "node:comment" (or similar) selector?

Any help on this is greatly appreciated. :)


texts: Views block for content that is older than current node created date

texts:
How should I go about creating a view that only shows content that is older than the current node's creation date? I've created the argument using 'Content: created date' but I struggle to pass this over to the filter criteria.

To be honest, I'm not even sure this is the correct way to do it.


texts: What's the usual practice for providing several CMS-editable content in pages, particularly the home page?

texts:
I need to create a home page with several content areas containing text and images (e.g. welcome text, welcome image on a different section of the same page, a second welcome text on a different section of the same page, a third text content area, etc). All of these, of course, is in the same page as some other regions and blocks.

My googling led me to these options:

Create a content type for each of those content. I think this option is a bit overkill since the content type will only be used for one instance of the content type. Doing this will also require creating a block specifying the particular instance of the content type.
Create a system settings page using hook_admin a make each of the content sections a system variable. This also sounds incorrect since those content aren't really system variables. This method also isn't applicable since there is no sense of authorship and doesn't work with the workflow modules.

So what's the usual practice for doing this?


texts: How do I disable or completely remove the save configuration button in module's admin page?

texts:
If my question is not broad enough, please tell me and I'll give more detail. I didn't know how to ask the question. Yeah, this is my question...

I am using drupal 7. I have a module and I would like to make a configuration form to my module in admin page. I have given the path and created the forms but there is just one problem. The "Save Configuration" button that comes by default.

What I am trying to do is to add information to the database. I have one submit button for that. I also showed the current rows in my database table with table select in the configuration page. I have another button to delete the selected elements from the database also. So that means I don't need the "Save configuration" button in my case. How can I disable or completely remove the "Save Configuration" button? Thanks.


texts: Views, add field value as class to list element

texts:
I have a content field called Featured which is an list integer checkbox.

When using Views to display a list of this content, I would like to add a css class to the item wrapper when that value is 1 like so:

<li class="views-row views-row-1 views-row-odd views-row-first featured">

I suspect editing the views row template would be one option, although I do not know how to achieve this, and since this is the only change I need to make, is there an easier way?


texts:
I have a scenario where payments should be made to different targets based on some conditions. I was considering multi-store approach but I felt it might be a overkill considering that we only need payment targets and not complete store management.

Is there any simpler way of achieving this?


texts:
From Drupal 8 beta 6 (released today), I have this error :

  Error message UnexpectedValueException: Untrusted Host "localhost" in
  Symfony\Component\HttpFoundation\Request->getHost() (line 1221 of
  core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Request.php).

I use this local url to call my site: http://theming.dev

Inside my setting file, I have:

     $settings['trusted_host_patterns'] = array(
        'theming\.dev$',
     );

Note, this error is displayed only when I uncomment this lines:

 if (file_exists(__DIR__ . '/settings.local.php')) {
   include __DIR__ . '/settings.local.php';
 }

What is the problem please ? Thanks.


texts: How to find out if a default image is used in content?

texts:
I have an Administration View for my content. I want to filter if a default image is used or if there is an already uploaded one.

I don't find a reference for this to use it as field and/or filter in views.

I tried the relationship for Content:Image, but this reveals nothing like "has default image" or something alike.

Any ideas?

EDIT:
I now have a workaround for this. I added a field for the image as a mini-thumbnail, so a visual control if the default image is used is possible. The fields are in a table, so reverse sorting of the images reveals that all default-images come after custom images...


texts: Should I define all my variables in the module.settings.yml file?

texts:
With the new Configuration Management System we can create a module.settings.yml file with all the variables that we will use in our module.

Now just to made a test I delete all the content inside my module.settings.yml file (leaving the file empty), I reinstalled the module and it works, so I deleted my module.settings.yml file and I reinstalled my module one more time and, the module works, I can set the variables (the configuration is created) and I can use the variables, even I can export the configuration.

In this scenario I see that you don't need to define your variables even the file is not needed (or maybe I missing something). So, should I define all my variables in the module.settings.yml file?


texts: Bug remove file button in webform multi upload file

texts:
Module: Webform 8.x-5.5
Context: Multi file upload webform

Bug:  When I'm removing a file from the uploaded list, the label of all the file disapear...

But, when I upload an other file, they all comes back, exept the removed one.

Someone get an idea to fix it?


texts: Send a context from a panel page to a view integrated in it?

texts:
I'm struggling trying to figure out how to do the following :

I have 3 different views displaying content filtered by different features (content-type, custom boolean field, etc.).
I want to create 3 panel-pages in which I'll integrate those 3 views. Each of those panel-page will only be displaying the content authored by one different member beetween three specific (named AGS, MM, admin).
Thus I wanted to set up a contextual filter in my view which would be the content author ID. Author wasn't available so I chose User : Authmap ID (?). Then, in my panel-page, at Variants > Panel > Contexts I've tried to send a User context by selecting "AGS". I also checked "Send Arguments" in the view settings at Variants > Panel > Content.

... But it's not working !   :(
I'd also love to send other context to my views (boolean, etc). But let's first try to make this thing working out...

Anyone's enlightenment will be greatly appreciated !
Thks.

[CONFIG : Drupal 7.4 - and most recent Views and Panels]


texts: How to set (import) oembed's ctools exportable settings as defaults for the module programmatically?

texts:
Oembed provides defaults for some providers (e.g. youtube, twitter etc) out of the box. It also provides the ability to export each provider's settings through the UI. I have added a new URL pattern ("scheme") on youtube's settings on /admin/config/media/oembed/provider/list/youtube/edit and have also exported these, it looks like that:

$provider = new stdClass();
$provider->disabled = FALSE; /* Edit this to true to make a default provider disabled initially */
$provider->name = 'youtube';
$provider->title = 'YouTube';
$provider->endpoint = 'http://www.youtube.com/oembed';
$provider->scheme = 'http://*.youtube.com/watch*
  http://*.youtube.com/v/*
  https://*.youtube.com/watch*
  https://*.youtube.com/v/*
  http://youtu.be/*
  http://*.youtube.com/user/*
  http://*.youtube.com/*#*/*
  http://m.youtube.com/watch*
  http://m.youtube.com/index*
  http://*.youtube.com/profile*
  http://*.youtube.com/view_play_list*
  http://*.youtube.com/playlist*
  my_addition_here';

The problem is that no feature is picking up oembed's settings. This only works with custom providers I have created myself, not default ones already provided by the module.
This seems to be related to the problem: https://www.drupal.org/node/1543894. I have tried the patch ie adding

'api' => array(
  'owner' => 'oembedcore',
  'api' => 'oembedcore',
  'minimum_version' => 1,
  'current_version' => 1,
),

to _oembedcore_provider_schema_1() or even by altering the schema with a hook and also

/**
 * Implements hook_ctools_plugin_api().
 */
function mymodule_ctools_plugin_api($module = NULL, $api = NULL) {
  if ($module == "oembedcore" && $api == "oembedcore") {
    return array("version" => "1");
  }
}

according to https://www.drupal.org/node/1543894#comment-8981081 but this doesn't seem to make features aware of oembed's settings.

Another related issue, https://www.drupal.org/node/1330140 suggests this addition:

function my_module_schema_alter(&$schema) {
  $schema['oembedcore_preset']['export']['api'] = array(
    'owner' => 'oembedcore',
    'api' => 'oembedcore',
    'minimum_version' => 1,
    'current_version' => 1,
  );
}

but that doesn't seem to have any effect really.

There's also a hook that's supposed to alter a provider's attributes used by oembedembedly, 'hook_oembedprovider_alter':

function oembedembedly_oembedprovider_alter(&$providers) {
  foreach ($providers as $host => $patterns) {
    if (strpos($host, '*') === 0) {
      $new_host = drupal_substr($host, 1);
      if (!empty($providers[$new_host])) {
        $providers[$new_host] = array_merge($providers[$new_host], $patterns);
      }
      else {
        $providers[$new_host] = $patterns;
      }
      unset($providers[$host]);
    }
  }
}

but that doesn't seem to work either when I apply it in my own module.

How can I pursuade oembed module to pick up my exported overriden settings for one of its default 'providers'?


texts:
I am currently moving a website from Drupal. The information I need to transfer is divided to many DB tables and connected through entity_id (That is my understanding, I have no experience in Drupal).

E.g. I have 2 MySQL tables:
users — contains uids, passwords and emails
field_revision_field_user_profile_phone — contains phone numbers and entity_ids

I believe there should be a table that matches uids and entity_ids, that will let me build a MySQL query to join them, but I can't find it.

How do I join those tables?


texts:
The D7 core function drupal_http_request uses the stream_socket_client() php function. For many serious web hosters, sockets and stream_sockets functions are a security bad practice and most of them disable these functions.

Why the D7 developpers don't make drupal_http_request rely on cURL functions ?
Is there any alternative ?
Thanks,
J.


texts: Recommend a theme function to modify the 'Submitted by' line for a node?

texts:
I would like to theme the 'submitted' by date without editing the node.tpl.php file. In other words, in the template.php file.

I know this has been answered thousands of times before, but for the life of me I cannot find a good solution when searching.

Can someone suggest a theme function that uses format_date() or other means to manipulate this however I see fit? Specifically, I simply need to say Submitted by: admin 2012/10/10 but I would like something to keep in my toolbox as this problem comes up on every single project I do.


texts: How do I delete config entities from hook_install, when the module containing that hook is enabled via config?

texts:
I'm trying to delete some config entities in an install hook. These entities do not exist in the config sync folder, they're excluded using the config_exclude_modules approach in settings.php. So deleting them from the config sync folder isn't an option, it needs to be done by running some code.
Contrived example:
function module_install() {
  $entities = [
    'foo' => ['bar', 'baz'],
    // ...
  ];

  foreach ($entities as $type => $ids) {
    $storage = \Drupal::entityTypeManager()->getStorage($type);
    $storage->delete($storage->loadMultiple($ids));
  }
}

This works fine on its own; if I drush en module, the entities are deleted as expected.
This module does not exist upstream, so as part of the commit core.extension.yml is updated to enable the module. When everything's pushed, running drush cim upstream installs the module as expected, and the install hook is run.
But, as part of the same cim, all of the config entities I just deleted are recreated. I guess this kind of makes sense; the target state was calculated before the module was installed, and the import process is dutifully making sure the result will match that initial calculation when it finishes? Maybe?
This is annoying, though, as being able to delete these entities in an install hook would be extremely useful for a particular project. Alternatives like running a command against all of the remote sites will be difficult to organise, and using the natural CM flow already in place would save a lot of pain.
Is there a way to make this work?


texts: can i register using same email id for a 3 different profile types

texts:
This project is related to add social service work details into my website.
I used profile2 module to create a 3 profile types and its create successfully.
we have 3 profile types,
1) Single User
2) Comapny
3) NGO

Can i register on above 3 profile types using same email Id because if single user is chairman of company and they wants to register as comany using same email id so it is possible.
same like if single user is chairman of NGO and also they wants to register NGO using same email Id then it is possible or not.

How i can manage this situation.please help me


texts: How would I use DATEDIFF(), NOW(), and BETWEEN in a db_delete() query?

texts:
Is the something like the following possible?

db_delete('note_dates')
    ->condition("DATEDIFF('start', NOW()) BETWEEN 0 AND 30")
    ->execute();


texts: Properly export text format and editor settings

texts:
I'm trying to export the CKeditor settings and restricted_html settings but it's partially imported in the end.

I'm exporting the editor.editor.restricted_html.yml and the filter.format.restricted_html.yml files but I'm not getting the correct settings for enabled filters upon installation, but I'm getting the styles dropdown config for example. This results in an empty styles dropdown in the editor for the end user.

What am I missing?


texts: Add a JS app in Acquia root domain folder

texts:
I have a decoupled app, both backend and frontend parts, and I want to add them to Acquia cloud. Right now the js app is placed in a subfolder in drupal's docroot folder.
What I need is to have the JS app in the domain's root folder and have Drupal instance in a subdomain or subfolder. Is this possible? Thanks.


texts: Pre-defined color picking in the node admin in Drupal 7

texts:
I want the user to select one of the predefined color for one my Article fields.

I am unable to find a suitable way for the user to do so though. What I want is that there is a color picker of selected colors and user is able to pick on.

Any idea ?

Thanks


texts: When I change theme, I can't see my sidebars

texts:
I am a total n00b, just trying to set up my first site.

I got something nice with the Bartik theme, then realized that I wanted drop-down menus on the main menu, so decided to try another theme.

I tried both Corolla and Martinelli, but when I set them as default theme I can't see my sidebars or footers.

The are still set up as they were for Bartik and if I switch back to that then I see them again.

Obviously, this is just some stupid n00b thing, like not knowing to rebuild the front page or something. Can anyone tell me what I am doing wrong? Thanks.


texts: How do I disable the "Add to cart" button when a user has already a product in the cart?

texts:
I need to sell a node on my website and I'm using the Ubercart and Paypal Express Checkout modules. It works: I can buy a node by clicking on the Add to cart button on the product page and Checkout with Paypal in the shopping cart page.
I grant a role when the product has bought.
Now, when I return to the product page, I see again the Add to cart button, even if I bought the node.

How can I prevent this?


texts: How to docreate a function to do if conditions dependign on content type name

texts:
{% if logged_in == false %}

Heading

some text.

something here

    <buttonLearn
    more</button>

{% else %}

 {% endif %}

Hi Folks, in the code example above I have tried do doing some twig foo. It works greate if th user is looged out.

But what if I like to seperate contnet types by machine name?

So for example you have two names lets say article and block

How to make shure that the field is visible on block but not on artivle for logged out users? in short what is the required functioon to get false or true bi a string containing the content type machine name to do something like

 {% if logged_in == false || somefunction= 'content_type_machine_name' %}

Is that possible?


texts: I have a context that is fired when it is on a node page. I wish to pass the nid of the node being viewed, into a view to display on the page. Is this possible? How would you go about doing this?


texts: How to edit the template of a node teaser that is sent in a newsletter email?

texts:
I have a content type for my newsletter, it has an entity reference field that displays the latest articles of my site in a teaser format.

I tried to edit the teaser display in my node.tpl.php like this:

<?php if ($teaser): ?>
    <!-- teaser template HTML here -->
  <?php else: ?>
    <!-- regular node view template HTML here -->
  <?php endif; ?>

in the website all is correct, what i put inside the if, is working but just in the website, but when i send the newsletter, the email arrives with something very different (something like a standard format), could you please tell me were can i edit the way my newsletter send the emails?


texts: How to create a view of existing blocks?

texts:
My aim is to make a Views grid of existing blocks in Drupal 7 (Might be possible without any additional code\module in Drupal 8).

I've tried to make a Content based View and filter it via Block ID's, but when I came to filter this View, I found no such option.

I've tried to check the "Relationships" option to see if I can add a relationship to Blocks but no such option was available there either.

Therefore, I wonder if a View of existing block is even an option naturally.


texts: Set value for start/end date field labels in hook_form_alter

texts:
how can I replace the labels of start/end date for a date field via form_alter? the code below only works for the fieldset. The "to" needs to be removed.

$form['field_my_dates']['und']['0']['#title'] = t('My new title');

Code below not working neither, please help me to figure out how to do it! I forgot to mention that I'm using the popup widget for the date field.

function mywebform_date_combo_process_alter(&$element, &$form_state, &$context) {
    if ($element['#field_name'] == 'field_my_dates') {
        $element['value']['#date_title'] = 'From';
        $element['value2']['#date_title'] = 'To';
        $element['value2']['#title'] = t('');
    }
}

function mywebform_date_part_label_date($vars) {
    if ('field_my_dates' == $vars['element']['#field']['field_name']) {
        return t($vars['element']['#date_title']);
    } else {return t('Date');}
}


texts: Programmatically set URL Alias when creating node in form plugin

texts:
I'm currently importing data from a database to create nodes based on them. My node save code looks like this

$node = \Drupal\node\Entity\Node::create([
        'type'                 => 'issue',
        'title'                => $title,
        'body'                 => $body,
        'field_issue_category' => $term,
        'field_issue_type'     => 'publication',
        'field_pub_id'         => [
            'target_id'           => $publication_id,
        ],
        'field_issue_group' => $group_id,
        'field_date'        => $date,
    ]);
$node->save();

I also want to create a url alias based on the title of this node, which I create like this,

$nid       = $node->id();
$title     = preg_replace("/[\s_]/", "-", $title);
$path      = \Drupal::service('path.alias_storage')->save('/node/'.$nid, '/mypath/'.$title);

This successfully create a url alias that shows up in the URL aliases list in the URL alias config. However it doesn't show up in the URL alias field on the node edit page.

This creates a problem. One, the user can't see what the actual alias is.
Also I have a block plugin that puts every node of that type in a list on a page. It also displays the url to that node. I'd like the url displayed to be the alias like '/mypath/title' but Drupal only seems to know about the '/node/nid' path.

Is there a proper way to programmatically set a nodes url alias so that it still appears in the url alias field?


texts: Is there any way to take a preexisting field with content, and generate taxonomy from it?

texts:
I have a content type called 'classes' in the content type is a text field called 'instructor'. I also have a separate content type called 'instructor profile'. The two content types 'classes' and 'instructor profile' are not tied to together in anyway unfortunately (not setup by me).

I would like to tag the existing 'instructor profile' content type with their 'classes'. So for example, if you are looking at the instructor profile, you can see what classes he/she teaches. The easiest way to do this would be take the existing 'instructor' text field under 'classes' and generate the vocabulary so I can match those up with "instructor profile' under a view later on by tagging the Instructor's profile with the right vocabulary.

However, I can't seem to find a module that will take an preexisting field and generate terms from it (or convert that field into a free-tagging taxonomy term). Any idea?


texts: How to display my block on search results page only if nothing found?

texts: I want to place a webform block to make user able to inform about their special queries if no search results appeared.


texts:
Is there a way to cache drupal private images in client browser? I have a website with private profile images that are used many times and I want to cache them even for a very few time.
How can I do that?

Thanks


texts: How can I display seveal menus with different classes

texts:
I have the "joy" to upgrade a Drupal 6 site to Durpal 8. In my Drupal 8 site I have three different menus, which each display different types of nodes. I want to display them in the region of the sidebar_first, but each of them should have a different background colour. E.g. menu A is red, Menu B is blue and so on. This colour should be in the background if the menu is collapsed and expanded.

I tried it this way:

        {% if page.sidebar_first|render %}
            <div class="sidebar_first">
                <aside id="sidebar-first" class="column sidebar first">
                    {{ page.sidebar_first }}
                </aside>
                <aside id="sidebar-first-person" class="column sidebar first">
                    {{ menu-person }}
                </aside>
                <aside id="sidebar-first-kinder" class="column sidebar first">
                    {{ menu-kinder }}
                </aside>
                <aside id="sidebar-first-kunst" class="column sidebar first">
                    {{ menu-kunst }}
                </aside>
                <!-- /#sidebar-first -->
            </div>
        {% endif %}

But instead of displaying the menu I get a 0. So my guess is that I have to  fill the twig placeholder with values somewhere first. Which would be the approach for this? Write a module? Including other Twig templates?

Here you can see the old Drupal 6 site, which I try to rebuild with Drupal 8.
http://claudiazeppenfeld.de/kunst/fadenerzaehlungen-fuer-porzellan

In Drupal 6 I achieved this with Blocks and Context. I am not sure to solve that in Drupal 8.


texts: jQuery not functioning in Chrome regardless of core/custom code

texts:
For whatever reason jQuery is refusing to function in Chrome for us.  It works in all other browsers.  This is the case regardless of the theme, page (aka: core admin pages like blocks have no jquery like drag), custom jquery, or core jquery.

In the firebug console $ correctly returns function() and the javascript is present in the html.  Its basically like Chrome is just ignoring it.  There have been no changes to core files and thus you would imagine at least the core admin pages would be functioning properly.

Scratching my head on this one here, any suggestions are appreciated.


texts: Changing a user password through phpMyAdmin

texts:
Hopefully this should be a quickly resolvable query:

If I only have phpMyAdmin as a means of changing a password - e.g. say I can't login and need to change the Admin password (and Drush is equally not available etc) should I be able to reset a user's password using the following query:

UPDATE drupal_users SET pass = SHA2( 'the_password', 256 ) WHERE uid = 20

where the drupal tables are prefixed with "drupal_"

I have tried the above query in order to change the password for a user, but when using the password specified in the above sql statement I am still unable to login.  This makes me think I am missing something here.

Anyone got any ideas how to change a drupal 7 user password via PhpMyAdmin using SQL?


texts: How to display the node title in different region 2 using theme method in drupal 7

texts:
I want to display the breadcrumb and page title in my main content area.

For breadcrumb I used theme('breadcrumb', array('breadcrumb' => $breadcrumb));

What should I use for page title?
I have tried theme('pagetitle',  array('title' => $title_text)), but it is not working.

Also that how can I use the built in theme styles of paragraph tags or heading tags...
e.g. I used the following for generating a table in built in theme style

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


texts: Problem file to import not found or unreadable ../../variables/_colors.scss

texts:
I'm currently using Omega 4 with Sass, compass, breakpoint, singularity.

When I run the command drush omega-guard, I have the error below.
Any body know what could be the problem.

It's like there is a problem with globbing.

I'am on Ubuntu 14.04

Thanks a lot

error sass/layouts/header/header.layout.scss (Line 1 of sass/variables/**/*: File to import not found or unreadable: ../../variables/_colors.scss.
    Load paths:
      /var/www/vhosts/nexera.linuxlocal.com/sites/all/themes/nexera/sass
      /home/beach/.rvm/gems/ruby-2.1.2/gems/compass-0.12.6/frameworks/blueprint/stylesheets
      /home/beach/.rvm/gems/ruby-2.1.2/gems/compass-0.12.6/frameworks/compass/stylesheets
      /home/beach/.rvm/gems/ruby-2.1.2/gems/compass-normalize-1.5/stylesheets
      /home/beach/.rvm/gems/ruby-2.1.2/gems/compass-rgbapng-0.2.1/lib/stylesheets
      /home/beach/.rvm/gems/ruby-2.1.2/gems/breakpoint-2.0.7/stylesheets
      /home/beach/.rvm/gems/ruby-2.1.2/gems/singularitygs-1.1.2/stylesheets
      /home/beach/.rvm/gems/ruby-2.1.2/gems/compass-blend-modes-0.0.2/stylesheets
      /home/beach/.rvm/gems/ruby-2.1.2/gems/color-schemer-0.2.8/stylesheets
      /home/beach/.rvm/gems/ruby-2.1.2/gems/toolkit-1.3.8/stylesheets
      /home/beach/.rvm/gems/ruby-2.1.2/gems/susy-1.0.9/sass
      /var/www/vhosts/nexera.linuxlocal.com/sites/all/themes/nexera/sass
      Compass::SpriteImporter
      Sass::Globbing::Importer)


texts:
I have a calendar in Drupal 7, and I want to link this calendar with other nodes.

How do I do this? Which module should I use?

I am using Drupal 7.


texts:
I need to override the UserController to to change logout redirection, I try thiscode below  to test my new controller but my display test inside doesn't work. :

namespace Drupal\my_module\Controller;

use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\DependencyInjection\ContainerInterface;

class MyModuleUserController extends ControllerBase {

  /**
  * Constructs a MyModuleUserController object.
  *
  */
  public function __construct() {}

  /**
  * {@inheritdoc}
  */
  public static function create(ContainerInterface $container) {
    return new static();
  }

  /**
  * Logs the current user out.
  *
  * @return \Symfony\Component\HttpFoundation\RedirectResponse
  *   A redirection to home page.
  */
  public function logout() {
    user_logout();
    echo "
";
    echo "
test controller
";
    exit(0) //@TODO delete this test
    return $this->redirect('user.login');
  }
}

Path : my_module/src/Controller/UserControler/MyModuleUserController.php


texts:
Hi I want to know if there's a way to unpublish content(nodes) automatically based on a field date previously created.

I want that task to be automatically based on the current date.

Example:

The user already has a content with that field called "Deadline" filled with 20/01/2015 so, for now that content should be passed to unpublished.

If I can do it through some hook let me know to insert in my costume module, thx so much

Edit: I can't use the Rules module because whenever I try to add some condition to one Rule one error just pop up, and I can't continue, and I'm not gonna do a CLEAN installation .....


texts:
Hello fellow Drupal expert,

I'm in search of wisdom. Some said i can find it in here :)

Okay so here's my issue. We got an intranet and we'd like to have some privacy (if you know what i mean). We're using IMCE and a module called private_file_download_permission (so we can map our existing roles to folders). But nothing is working, we can set private folders (and control their access) but every file we upload (through IMCE)is being corrupted.

Let me explain cause i've found some interesting things. First, if i download my file through FTP it work well. But if i go through the website it is corrupted. So I looked around and find that when i open my file with a text editor there's 2 empty lines added to it and if i delete them the file goes back to normal. But remember this happen only when the file is put on a private folder (works fine on public ones).

Have you some idea of what kind of sorcery is going on ?

Sorry for my english, and thank you for your answer;
Rémi


texts: Access EntityEmbedFilter process function in a preprocessor

texts:
I'm getting the value of a wysiwyg field in a preprocessor then passing it to Twig in a #markup render array. Everything works as expected with the exception of embedded images. I've modified the list of XSS allowed tags to allow the drupal-entity tag. However, it seems that this is being passed to Twig after the EntityEmbedFilter has opened and closed.

I'd like to use EntityEmbedFilter process function to process the value of my field prior to passing it to Twig. However, when trying to instantiate an instance of EntityEmbedFilter with the new keyword, I get an an error because the constructor requires a configuration array.


texts: How to allow users to check a checkbox to make a view their default view

texts:
Situation:

A view with nodes, which has views displays 'Thumbnail list' and 'Compact list'.

The users can select one of the display types in a menu, that has both options under 'Articles' parent menu item.

Parent 1, 2 and 3 are views.

How can I allow users to set their personal default view display (thumbnails or compact) for each Parent? With other words:
There should be a checkbox on the thumbnail list and compact list pages, that says "use this as my default list view for this parent"


texts: Remove drupal parameters from form submitted via GET

texts: I have form which is submitted via GET method. The problem is that after submit the URL looks very bad, with lots of parameters like form_build_id & form_token. How can I get rid of them? Thanks


texts:
There seems to be a problem when I check if the node is served by ajax or not, I use this function :

function mytheme_preprocess_node(&$variables) {
    if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
        $variables['is_ajax'] = true;
    }else{
        $variables['is_ajax'] = false;
    }
}

The same code works great with preprocess_page or preprocess_html

Is there a way to make it work? or eventually get the page/html variable in the node preprocess ?

Thank you !


texts: Showing/Hiding Content-Type Fields Based On User

texts:
I have a content-type that has many fields for different translations. How do I set it up in a way that it shows the translation field based on user selection only. I mean user selects his/her language, then only that content-field appears on the post.

Appreciated...


texts: Generate fields in content from other content values?

texts:
I want to generate fields in a content from the values of other content.

Specifically,  I have a list of "players" stored as a content type, and a separate content type called "Events". Events list the rank of each player that participated. On the "player" content, I'd like to be able to display the players wins by searching all the "events" content. Is this possible?

Also, in Views, is it possible to generate a list of all the events a player has won, as well as how many?


texts: Create a drop down list of notifications with an unread item count that resets or hides on click

texts:
I've used the message module to create a notifications system on my site. It works fantastically, however the final task I would like to complete has been less pioneered via contributed modules. This is the creation of a drop down menu item that lists unread notifications. It requires several characteristics.

1. Drop down functionality. Options I have investigated:

A) Menu views. Will allow immediate attachment of an item count badge via menu badges module. Would require addition of custom drop down javascript in theme and one additional module compared to option B.

B) Quick tabs accordion. Don't set a default tab and it behaves exactly like a drop down menu toggle. No additional modules or javascript necessary.

2. A badge that counts the # of unread items in the views list attaches it to the link that activates the drop down. Menu badge provides this for option A and link badge(required by menu badge so it's installation is a given) MAY provide this for option B but I don't know how to go about doing so.

3. Removing/resetting the badge after the drop down is viewed. Rules link may be the solution to this by marking the messages in the list as read + some css that hides the badge after click until it can be updated on next page load. May be possible to use views auto refresh module to do this through ajax, but it seems like this single feature would be a little too module heavy at that point.

I want to achieve this in the most lightweight manner possible, but I'm unsure how to proceed.

Re-written for clarification.


texts: How to hide "Counter" and "Date" on certain page/node?

texts:
How do I hide the "Count content views" of a certain page/node?

I want to hide the numbers of reads along with the date the page was updated without effecting other pages on the site.


texts: Trying to get an "About the author" view to work on a multi user blog (contextual filters)

texts:
I'm working on a Drupal 7 install sub-theming zen. I have a blog and I want to have an "About the author" view on each blog post. I've created a custom post type (Profile) for this, but I'm not sure how to make my view aware of the user who has created each post to show the Profile depending on the post author. I know this used to be done with the view arguments but that's part of Contextual Filters in Drupal 7, but I still don't know what filter I should have there, or if I should add any fields in the Profiles so that the filters can tell which profile belongs to which author.

Any help will be most welcomed!


texts: How do I append a view to the node body in custom module?

texts:
In Drupal 7, we could do the following within a hook_node_view:

$node->content['nodehierarchy_children'] = array(
  '#theme' => 'nodehierarchy_children_embed',
  '#nodehierarchy_view' => $node->nh_children_view,
  '#nodehierarchy_view_display' => @$node->nh_children_view_display,
  '#nodehierarchy_view_args' => $arguments,
);

Then in the hook_theme:

function nodehierarchy_views_theme() {
  return array(
    'nodehierarchy_children_embed' => array(
      'render element' => 'element',
    ),
  );
}

Finally we have the theme function:

function theme_nodehierarchy_children_embed($variables) {
  $element = $variables['element'];
  $display = $element['#nodehierarchy_view_display'];
  $arguments = $element['#nodehierarchy_view_args'];
  return $view->execute_display($display, $arguments);
}

How do I accomplish the above in Drupal 8? I'd like the implementation to be Drupal 9 compatible, so ideally I don't want to use depreciated functions etc.

I mean should I attempt to somehow override node.html.twig and provide it with a render array using something similar to:

$view = views::getView($node->nh_children_view)
$build['nodehierarchy_children_embed'] = $view->buildRenderable($display,$arguments);

I think if someone could provide the functions and general methodology, I could fill in the coding portion.


texts: How to get only the first value of a field in a Views template

texts: I'm using Views 3.0 and I'm trying to access a field which allows users to upload 3 photos. When I type print $fields['field_productshots']->content; it displays all 3 product photos. Is there a way to limit it to just the first image?


texts: Some drupal database operations won't complete

texts:
On a development server (and it's sister staging server), I'm not sure how I got myself into this situation. When running drush updatedb I get this error below.

$ drush updatedb
The following updates are pending:

redirect module :
  7101 -   Add status field.
  7102 -   Disable redirects that could cause infinite loops.

webform module :
  7322 -   Add index on {webform_submitted_data}.data.

Do you wish to run all pending updates? (y/n): y
Cannot add field redirect.status: field already exists.                                       [error]
Performed update: redirect_update_7101                                                        [ok]
Cannot add index data to table webform_submitted_data: index already exists.                  [error]
Performed update: webform_update_7322                                                         [ok]
Finished performing updates.

I occasionally dump the production server database onto dev and stage to have an updated copy.

Is there a way I can push through this?


texts: Commerce Attribute price is not updating in cart

texts:
I am using commerce price attributes module then I am facing problem , price is updated on the product display node but not in my cart...also, there is no line item for the added price attribute.

Example :

In above images ,regular licence   is showing price $2.00 and School licence is showing price  $10.00.
i select school licence then click on add to cart button but price is show $2.00 in cart.


texts: Putting multiple Add to cart links / buttons on a page

texts:
I'm writing a series of blog posts on my eCommerce site. For example, "10 easy breakfasts for the busy mom/dad". Under each "breakfast idea", I want to put a small block like "Items you'll need". This "items you'll need" will have links to products in our shopping site.

The idea is that if someone likes a blog post or one of the "receipes", they can immediately click on the products below and add them to cart. I don't want them to be taken away from the page they are reading though, because that would be annoying.

They will need some indication that the product was added to cart, so maybe a green tick or "Added!" label will need to show up.

When you get to bottom of the blog post, there should be a block "Products you have in your cart" so that they review and can choose to check out if they want.

I've found these articles & modules:

Creating Drupal Commerce add to cart links
,

Commerce Add to Cart Ajax,

Custom Add to Cart Link

But I'm not sure which is the way to go considering my requirements:

Curated product links / thumbnails in blocks
Clicking sends ajax signal to cart to add product
There is an indication that the product was added "Added!" or a tick or border highlight.
If the same product is on multiple blocks in the page, when I click one block, it should update on all the blocks.
Ajax stuff should be robust on mobile devices

I've never done this before, Drupal ajax & custom cart stuff, so I wanted to ask your advice on what to consider before moving ahead. I want to do it in the simplest and most robust way possible. If I can avoid custom code and sandbox code, that would be ideal. Thanks.


texts: unset the path for the library used by FullCalendar

texts: I am using FullCalendar module to display some events. I had to modify the design of the calendar and the only solution was to alter the way javascript of fullcalendar displays events and so . Now i do not want that at an update of the fullcalendar, all the changes i have made to dissapear.My question is how can i unset the path of the current fullcalendar library and set the path to my own customized library ?


texts: Display twitter tweets for own account in drupal 6

texts:
Suppose My twitter account is drupaltest so I want to display all the mentions of #drupaltest or @drupaltest on the Drupal 6 website. Looking at the twitter module http://drupal.org/project/twitter but that one is a little confusing. So let me know whats the best way to post tweets for your accounts on the Drupal 6 website? I am not looking for any reverse functionality of posting on twitter through my website, just want to display those tweets.

Thanks.


texts: How to translate the Home link when using Path Breadcrumb?

texts:
I am  using the i18n module in my site. When using the Path Breadcrumb module, I can manage the Home link text in Path Breadcrumbs settings, via admin/structure/path-breadcrumbs/settings

But there is nothing related to this within the page "Translate interface". Therefor it allways shows in the same language for all of my site languages.

How can I also translate this Home link?


texts: Get term value from user field and set that value to new field

texts:
How to get term from user field and set that to the field in node?
When user is creating node I need to get term and set it to the node field.

I have field_term_reference in user fields and in node I have field_book_reference field. I need to get term from field_term_reference and set that term to the field_book_reference.

Both fields has autocomplete widget.

Here is my current non-working code:

function set_value_node_presave($node) {
global $user;
$user = user_load($user->uid);
$term = field_get_items($user, $account, 'field_term_reference');

$node->field_book_reference[$node->language][0]['value'] = $node->$term;

}

SOLVED Here is working code:

function set_value_node_presave($node) {
global $user;
$user = user_load($user->uid);
// Get field from user
$term = field_get_items('user', $user, 'field_term_reference');

$node->field_book_reference[$node->language][0]['tid'] = $term[0]['tid'];

}


texts: Use datefield year as condition in Entity Query

texts:
I'm performing an entity query that searches for nodes of my custom content type called 'news'.
The content type has a date field called 'field_date'. I want to be able to perform the query in a way that only produces the 'news' nodes that have a 'field_date' that fits within a specified year. Here is an attempt I made below.

$year = 2015;
$query = \Drupal::entityQuery('node')
  ->sort('field_date', 'DESC')
  ->condition('type', 'news')
  ->condition('field_date', [date('Y','field_date'), $year], '=')
  ->range(0, 10);

In the code above I'm attempting to only grab the year from the 'field_date' datefield and compare that to $year, 2015 in this case. However I receive SQL errors like:

  Invalid parameter number: number of bound variables does not match
  number of tokens

I'm guessing part of it is date('Y','field_date') doesn't know what 'field_date' is but I'm not sure how to go about it.

How do I make a year comparison on a datefield in a entityquery condition?


texts: Render the User creation form on another page

texts:
I have a Views page and I want to insert the user creation form as found in /admin/people/create into the Views page header. I know people frown upon the PHP filter, but I just need to output the user registration form, which is at most 2 lines of php code vs having to make a module just for that. Unless there is a better way?

I know drupal_get_form() has been replaced from the form builder in Drupal 8, and the Drupal 8 equivalent of drupal_get_form() is, for example, $form = \Drupal::formBuilder()->getForm(Drupal\user\Form\UserLoginForm::class);.

But how do I get the form name or ID? How do I put it in that example? Do I just inspect the form and grab the form ID?

I tried the following code, but I nothing gets returned. What could I be missing?

$form = \Drupal::formBuilder()->getForm(Drupal\user\Form\user_register_form::class);
drupal_render($form);


texts: Possible to call a function after user sets their password for the first time after using their one-time login link?

texts:
I have a Drupal 8 site and I need to dynamically redirect the user after they set their password for the first time after using their one-time login link.

I cannot figure out any way to hook into the workflow for this condition. Is it possible?


texts: How to hide the "Add comment" link in the teaser?

texts:
I don't want the Add comment link displayed in the teaser. But the comment form should be displayed along with the content of the node which forms a part of a page.

Edit:  I don't have access to the php code. I want to do it through the admin console. Is there a way I can uncheck "Add comment" from appearing in the teaser and instead appear in the full content node which forms a part of a page?


texts: Why does this rule not appear in the UI and how can I clone it?

texts:
I need to clone and modify the following rule:

commerce_checkout_order_email

However, it does not appear in the UI.

I have checked the following paths with no success:

admin/config/workflow/rules
admin/commerce/config/checkout/rules

I'm obviously missing something but I can't figure it out.

This rule is defined in this file along with 4 other rules, all of which do appear in the UI

sites/all/modules/commerce/modules/checkout/commerce_checkout.rules_defaults.inc

The thing is this rule DOES get executed properly.

Any ideas will be greatly appreciated.

By the way, I have doubled checked on TWO different drupal installations, one of which is a default commerce_kickstart distribution and the rule doesn't appear either.  It won't show up in the UI nor in the database.


texts: Fire Autocomplete after input reaches 4 characters

texts:
I am searching for a way, to fire the autocomplete event after 4 characters are in the input-field. What I am doing now is:

if(strlen($string) > 3) {

in my "page callback", but this is not the way I want it to work. Because now, the event is fireing, but only returns matches after 4 characters.
Is there a way to start the autocomplete only after the input?


texts: Is it possible to have a single date exposed filter with date range?

texts: In my existing exposed filter, I have two field (Start and End Date) filter, Is it possible to create as one field?


texts: How to make one field automatically have the date-time of the last change of another field

texts:
I need to make one field have the date-time of the last change of another field in a drupal 7 content type.  I tried using a computed field but the calculation is complex and I am having trouble.  Is there an easier way to make one field reflect the date of the last change of one other field?
thanks


texts: Commerce 2: Is it 'really' necessary to setup product attributes before adding a simple product?

texts:
Following along with the documentation at http://docs.drupalcommerce.org/v2/product/index.html#

Slightly puzzled by the following

  "Setup product attributes - Before creating products, you need to
  create some attributes... "

Is it really necessary to setup some product attributes? What about a simple product for which a the body field is all that is needed to describe the item?

Be interested to know whether there may be some other reason for why product attributes should be created or whether the documentation ought to be clarified?


texts:
I am running a Drupal 7 website with "Cache pages for anonymous users" and "Cache blocks" enabled. Both "Minimum cache lifetime" and "Expiration of cached pages" are set to 1 day.

When I update a node, for example, edit a picture, and visit that page as an anonymous user, the new picture isn't being displayed. When I manually clear the cache the page is displayed as it should be. It's like the cache isn't cleared after the node is updated.

Extract of the API:

modules/node/node.pages.inc

function node_form_submit($form, &$form_state) {
  $node = node_form_submit_build_node($form, $form_state);
  $insert = empty($node->nid);
  node_save($node);

  // Do stuff...

  // Clear the page and block caches.
  cache_clear_all();
}

Notice that the function cache_clear_all is called after the node is saved, regardless if the node needs to be inserted or updated.

Further inspection of the API reveals the following:

modules/node/node.module

function node_save($node) {

  ...

    // Save the node and node revision.
    if ($node->is_new) {
      drupal_write_record('node', $node);
      ...
    }
    else {
      drupal_write_record('node', $node, 'nid');
      ...
    }

    ...

    // Clear the static loading cache.
    entity_get_controller('node')->resetCache(array($node->nid));

  ...
}

Again, everything seems to be as it should be. The cache is cleared using the Entity API (public DrupalDefaultEntityController::resetCache(array $ids = NULL)).

Nothing seems to be wrong in the code. Maybe the code doesn't clear all of the necessary cache?


texts: MSSQL Incompatibility with Organic Group Views Filter Handlers

texts:
I have a view which filters all the organic groups for a user. I wanted to add a Views Filter to filter by OG Role, however it is not possible.

I would very much appreciate any help. Basically any OG Role filter using a Views Filter Handler cannot be used if the database is an MSSQL database. When selecting one of the filters, it errors out and then the view has to be re-created since the view can no longer be shown within the UI. I opened a drupal issue a few months ago, but no response as of yet.

The error message is as follows:

  PDOException: SQLSTATE[42000]: [Microsoft][SQL Server Native Client 11.0][SQL Server]Column 'og_role.rid' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.: SELECT r.*, r.name AS _field_0 FROM {og_role} r GROUP BY r.name; Array ( ) in og_handler_filter_user_roles->get_value_options() (line 14 of C:\inetpub\wwwroot\sites\all\modules\og\includes\views\handlers\og_handler_filter_user_roles.inc).

I'm almost postive that I have to rewrite Line 13 to support SQLSRV database types.

Line 13: ->groupBy('r.name')

Here is the relevant code:

/**
 * Field handler to provide a list of OG roles of a user.
 */
class og_handler_filter_user_roles extends views_handler_filter_many_to_one {

  function get_value_options() {
    $this->value_options = array();
    // Get all role names.
    $results = db_select('og_role', 'r')
      ->fields('r')
      ->groupBy('r.name')
      ->execute();
    foreach ($results as $result) {
      $this->value_options[$result->name] = $result->name;
    }
  }

  function query() {
    // Get the og_membership table from relations.
    foreach ($this->query->relationships as $alias => $info) {
      if ($info['table'] == 'og_membership') {
        // If there is a og_membership table present. Add some conditions.
        $rel = $this->relationship;
        $this->query->add_where_expression(NULL, $alias . '.gid = ' . $rel . '.gid');
        $this->query->add_where_expression(NULL, $alias . '.group_type = ' . $rel . '.group_type');
        break;
      }
    }

    parent::query();
  }
}


texts: Boolean fields configuration - How to enter a string in ON/OFF value bigger than allowed?

texts:
How to enter a bigger string than allowed in boolean fields?

When I try to submit a string bigger than a certain value, the string is automatically cutted.

I want to put this text:

  (4% du montant total de la location et 0.5 .- par jour et par personne pour l’assistance/rapatriement en cas de location à l’étranger)

But only this is allowed:

  (4% du montant total de la location et 0.5 .- par jour et par personne pour l’assistance/rapatriement en cas de location à l’étr


texts: export search_api settings with features

texts:
I used features to export search_api settings and in the feature_module.features.inc file was code that started like below:

I am trying to do the same thing again and I can't find the option to export these settings in features any more. Any idea how to do it?

>   /**  * Implements hook_default_search_api_index().  */ function
> vimn_search_default_search_api_index() {   $items = array();
> $items['node_search'] = entity_import('search_api_index', '{
>     "name" : "Node search",
>     "machine_name" : "node_search",
>     "description" : null,
>     "server" : "solr",
>     "item_type" : "node",
>     "options" : {
>       "index_directly" : 0,
>       "cron_limit" : "50",
>       "fields" : {
>         "nid" : { "type" : "integer" },
>         "title" : { "type" : "text" },
>         "created" : { "type" : "date" },
>         "changed" : { "type" : "date" },


texts: Which view template do I need to use to customize the printing of grouped fields?

texts:
I have a view that's grouped by two fields.

(In this case, the content: title field is using rewritten output with replacement tokens [field_session_number] | [title].) I need to do some pretty heavy-duty customizing - i.e. I need to attach some javascript to the session number, but not the title. They need to display on a single line. I've tried using two separate fields and setting them to be inline, but it doesn't seem to work when you then group by both fields.

This is the desired result (shows only second-level grouping by title; the time/date was too far up the screen.)

So I've decided that the best way to do it would probably be with a template. When I look at the view's theme information link, I see possible template names for individual fields, but it seems that those only get applied if the fields are displayed in the view - when you group a view by a field, you explicitly exclude that field from the view so it doesn't display once as the group and again with each record.

Which template would I need to use to be able to get at the content of the grouped fields? I need to be able to access each grouped field separately - I looked at views-view-unformatted.tpl.php, but it looks like the only thing you have access to for grouping is $title.


texts: How to resolve rules shipping error on orders without physical products?

texts:
I have a commerce store that sells both physical and virtual products. To streamline the checkout process, I'm using hook_commerce_checkout_pane_info_alter to check orders and removing shipping altogether if the order doesn't contain any physical products. The code that removes the shipping pane is:

$checkout_pane['customer_profile_shipping']['enabled'] = FALSE;

This works fine. However, I am also using the rule "Create a new account for an anonymous order" to allow anonymous users to purchase. When orders that don't contain physical products (so have no shipping information, the rule throws an error when trying to set the uid for shipping:

Unable to modify data "commerce-order:commerce-customer-shipping:uid": Unable to set the data property uid as the parent data structure is not set.

The order still goes to checkout complete, but the errors are logged in the watchdog table.

How can I gracefully resolve this error?


texts: how can i add billing information in invoice email

texts:
I have been using commerce Invoice 7x-10-alfa3
commerce Email 7x-2x-dev
Variable email 7x-10-alpha -1x
Variable 7x-22,4-dev
HTML 7.x-2.65 modules

I want to sent an invoice email, which will include except of the order information
(included in the token [commerce-order:commerce-email-order-items] ) , also the billing information address (I need all the information as it is appearing in the order view).

However, even though i try two different tokens [commerce-invoice:order:commerce-customer-billing:commerce_customer_address] and
[commerce-order:commerce-customer-billing] none of the them renders any data but they just appear as simple strings!. Also other tokens i added in the body of the email, are just displayed as simple strings. I trying to modify the  "default" value of the email through the store->configuration->emails

From what i have seen there is an issue with commerce email ,which have not been yet resolved https://drupal.org/node/1818380 . I was wondering whether someone has found a workround solution i can use.

Failing that is there any other way i could achieve the same result ? (To be able to sent an invoice email with order details and complete billing information). Maybe a combination of tokens in rules with different  modules (or different versions of modules).

As i am pretty desperate any suggestions would be more than welcome.
Thanks in advance


texts:
I hope I could receive some help concerning Commerce Customizable Products. I am looking for a possibility to, when adding a product, selecting the options a customer could add on the 'add to card form'.

For example: Pizza A can have the toppings X, Y and Z. However, Pizza B can only have the toppings Y and Z.

How do I manage, when I add the pizzas to my store, that I can select which supplements can be added? When I have 100 pizza's, I can configure the toppings, but don't have to have 100 different taxonomy lists.

I hope my question is clear. I have watched Josh Miller his screencast on YouTube about customizable orders.

Kind regards,
Tim


texts: SESSxxxxx cookie gets removed, $_SESSION data being lost but only locally

texts:
I have just pulled deployed code down to my local setup, restarted MAMP, cleared the Drush cache, and started a process that relies on data stored in $_SESSION. We can confirm this works in prod - no data is lost from $_SESSION at any of the process' three steps.

However, when I submit data from step one and go to step two locally, the data disappears from $_SESSION. I've noticed that locally, the SESSxxxx cookie disappears when I submit my step one data.

Since this works in prod I believe my code is fine and there must be something wrong with my config, but everything related to the session cookie in php.ini is identical to my local setup.

Theres so many configs and moving pieces to checkout, is there a way I can see how the session table is being interacted with that might lead to clues as to what is going on? Or could the issue be in httpd.conf? or somewhere else?


texts: "The website encountered an unexpected error. (WSOD) Service 'twig_extensions.twig.array' for consumer 'twig'

texts:
I have an Acquia Cloud hosted site built on Drupal 8.4.3. Using Acquia Dev Desktop and Drush, I updated a local development environment to Drupal 8.4.5.

Immediately after Drush updated the site, I got this error in the Apache log and the dreaded white screen of death.

  Service 'twig_extensions.twig.array' for consumer 'twig' does not implement Twig_ExtensionInterface. in /Users/iamtheghost/Sites/devdesktop/ukhealthcare-dev/docroot/core/lib/Drupal/Core/DependencyInjection/Compiler/TaggedHandlersPass.php on line 164
  0 /Users/iamtheghost/Sites/devdesktop/ukhealthcare-dev/docroot/core/lib/Drupal/Core/DependencyInjection/Compiler/TaggedHandlersPass.php(97): Drupal\Core\DependencyInjection\Compiler\TaggedHandlersPass->processServiceCollectorPass(Array, 'twig', Object(Drupal\Core\DependencyInjection\ContainerBuilder))
  1 /Users/iamtheghost/Sites/devdesktop/ukhealthcare-dev/docroot/vendor/symfony/dependency-injection/Compiler/Compiler.php(120): Drupal\Core\DependencyInjection\Compiler\TaggedHandlersPass->process(Object(Drupal\Core\DependencyInjection\ContainerBuilder))
  2 /Users/iamtheghost/Sites/devdesktop/ukhealthcare-dev/docroot/vendor/symfony/dependency-injection/ContainerBuilder.php(573): Symfony\Component\DependencyInjection\Compiler\Compiler->compile(Object(Drupal\Core\DependencyInjection\ContainerBuilder))
  3 /Users/iamtheghost/Sites/devdesktop/ukhealthcare-dev/docroot/core/lib/Drupal/Core/DrupalKernel.php(1307): Symfony\Component\DependencyInjection\ContainerBuilder->compile()
  4 /Users/iamtheghost/Sites/devdesktop/ukhealthcare-dev/docroot/core/lib/Drupal/Core/DrupalKernel.php(884): Drupal\Core\DrupalKernel->compileContainer()
  5 /Users/iamtheghost/Sites/devdesktop/ukhealthcare-dev/docroot/core/lib/Drupal/Core/DrupalKernel.php(466): Drupal\Core\DrupalKernel->initializeContainer()
  6 /Users/iamtheghost/Sites/devdesktop/ukhealthcare-dev/docroot/core/lib/Drupal/Core/DrupalKernel.php(656): Drupal\Core\DrupalKernel->boot()
  7 /Users/iamtheghost/Sites/devdesktop/ukhealthcare-dev/docroot/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
  8 {main}

I was trying to install the latest version of the Twig module. No change. TwigArray.php looks fine. Any help with this is greatly appreciated.

The content of the /core/modules/contrib/bamboo_twig/bamboo_twig_extensions/src/TwigArray.php file is the following.

namespace Drupal\bamboo_twig_extensions\TwigExtension;

/**
 * Provides bridge for Array functions and filters.
 *
 * Expose the features of Twig_Extensions_Extension_Array.
 */
class TwigArray extends \Twig_Extension {

  /**
   * List of all Twig functions.
   */
  public function getFilters() {
    return [
      new \Twig_SimpleFilter('bamboo_extensions_shuffle', [$this, 'shuffle']),
    ];
  }

  /**
   * Unique identifier for this Twig extension.
   */
  public function getName() {
    return 'bamboo_twig_extensions.twig.array';
  }

  /**
   * Shuffles an array.
   *
   * Can't use the Twig filter callback cause the shuffle function is
   * actually declared as a global function and not method of
   * Twig_Extensions_Extension_Array.
   *
   * @param array|\Traversable $iterator
   *   An array.
   *
   * @return array|bool
   *   The shuffled array; or FALSE on failure.
   */
  public function shuffle($iterator) {
    $extension = new \Twig_Extensions_Extension_Array();
    $filters = $extension->getFilters();

    foreach ($filters as $filter) {
      if ($filter->getName() == 'shuffle') {
        $callable = $filter->getCallable();
        return $callable($iterator);
      }
    }

    return FALSE;
  }

}


texts:
I have a a custom module in which I am implementing hook_node_presave() for a content type "ABC".

I want to get the value of a text field say 'field_test' before saving the node.

How to do this.


texts: Views: how to display different buttons before/after associated date?

texts:
I've got a node that has a deadline date field.  I am configuring a view that shows a list of all the nodes.

If we are past the deadline for a given node, I want to show "closed" text.  If not, I want to show a link that says "Apply".

I suspect that I may have to use views_php but I'm not sure exactly how to do this, and I also want to make sure there isn't another way to do it without the performance hit of views_php.


texts: Field Collections not displaying in Content Template

texts:
I'm using Content Templates (Contemplate) module to style a node display for a content type that uses Field Collections. When I view the node's display page before changing anything in the Content Template, the Field Collections display fine. As soon as I tick the "Affect body output" checkbox to adjust the template, the Field Collection content no longer shows up on the display. The header is there, but the content is gone.

How can I get the Field Collection content to display? Is there an incompatibility issue with Content Templates and Field Collections?

This is a Drupal 7 site... and, before you ask, I need to use Content Templates for theming due to a somewhat locked down development environment.


texts: So, running Drush update messed up your SVN repo

texts:
I'm working on a client's site. We had the sites folder as the root of a SVN repository. At some point we ran drush to do module/core updates but Drush was (mistakenly) set to ignore the repository.

Now we have a lot of folders (mostly modules) that have the tilde SVN status. For example, here's five actual folders:

~       all/modules/webform
~       all/modules/password_policy
~       all/modules/views
~       all/modules/services
~       all/modules/pathauto

We've spent time reading about how one addresses the tilde status in a general sense. There's a Stack Overflow question on it. It's pretty clear that Drush deleted these folders that had .svn folders in them and replaced them with new ones. These new untracked folders have the same name, so the parent folder's .svn index is confused. In essence, we can't run update because there's something already there taking up the name we need.

What's the best practice?

Delete the untracked folders, run svn update, try to use Drush to update again with proper configuration. Edit: Since there are hundreds of nested folders, a bash script would be nice.
Somehow force a commit of these new files? If that's possible, how to do it? (Note: in this sort of overwhelming situation we would be okay with the revisions on those modules breaking as long as we can commit again)
Other?

Note: This is more of an SVN question than a Drupal question, but it's a direct effect of Drush. I assumed Drush-savvy users have bumped into this sort of thing before. Also, I want to know how I can solve the issues without making my client's site crumble.


texts:
I am using a Superfish 2 level navigation menu, and have 3 sub-items under an item.
The url path for the second level item is NOT item/subitem but instead just subitem, if that makes sense.

I've got Generate automatic URL alias checked.

Is it acceptable for the subitems to not have their parent items in the url path? If not, what is the easiest way to automatically have the item appended to the subitems url path?


texts: field template for a specific content type

texts:
I've read from http://drupal.org/node/1089656 that I can create a template for a field in specific content type as field--field-name--content-type.tpl.php.

I have a custom content type "festivals_events" and a cck field "field_description".
So, I created a template "field--field_description--festivals_events.tpl.php".  But it is not working.

I tried to replace _ in field name with - as suggested in Template Suggestion, http://drupal.org/node/1089656, to become my template name file name as "field--field-description--festivals_events.tpl.php"
This too is not working.

I think it is definitely can be used as it is mentioned in Template Suggestion.
What is wrong with me?

Thanks in advance.


texts:
I know how to create a view as a page or block and etc.

But The Displays seems meaning I can create lots of views?

This following is my guess:

Is it will group all kind of views to a single page?
Does Displays just easily use the previous view configuration and
just Put similar view together to manager easily?


texts: How do i change the apachesolr index environment based on node values?

texts:
I have two apachesolr environment setup in my drupal instance. I want to index some nodes to one environment and some to the other, say based on some node values.

I could see that it always indexes to default the environment. I could see the possibility of indexing in two environments, but it is irrespective of the nodes value.

How can i achieve it?

UPDATE:

To give more detail, I am trying to achieve shards in apache solr in Drupal

UPDATE - 17 DEC 2012

Modules used:

Apache solr Module and not search api/search api solr

Reason on why i need node values

I have a large nodes of a particular entity type, This makes my index so large.

So Decided to go with shards with multiple indexes of the same node type.

So based on the node size and its priority of the node or proximity of the nodes location or users location , I want to split up the index to separate cloud servers and index them.
Proximity of the node also gives me power of separate out search indexes at a later stage.


texts: How to filter views results based on entity reference field

texts:
I use Drupal 7 and entityreference module.
I have a content type with a entity refenrece field to users called field_users_referenced.

So I created a view with views module and list nodes of thats content type.
I want to order this views result based on field_users_referenced.

when I add field_users_referenced field on filter fields, and set it for exposed filter , after type a field_users_referenced value on thats field, have no any result.

I do not want to filter field_users_referenced with select box, I want to type value on exposed filter field and order results.

please help me.


texts:
I have an entity, when i submit this entity i want to add the new entity created in a menu as a link. But in this menu i have a tree links so i don't know how to put my link in a specific tree. I saw the "mlid" and the "plid", i think "mlid" is the id of the menu and the "plid" is the id of the mother link.

So if I want to add a new item, what do I need to do? Do I get the ID of the parent link?
Do I need to use menu_link_save()? How do I construct my new link?

This is the code I am using.

$menu_intervenant_loaded = menu_load_links('menu-intervenant-project'. $idProject);

foreach ($menu_intervenant_loaded as $menu_item) {
  $menutitle = str_replace(" ","+", $menu_item['link_title']);
  $mlid = $menu_item['mlid'];
  $link = menu_link_load($mlid);
  $haschildren = $menu_item['has_children'];
  if ($menutitle == "Entreprises") {
    //The parent link: here is where I need to create my link.
    $item = array(
        'title' => 'Montitre',
        'access' => TRUE,
        'link_path' => 'encore un test',
        'link_title' => 'Mon titre qui fonctionne pas',
        'plid' => $mlid,
        'customized' => 1,
        'external' => 1,
    );

    menu_link_save($item);
  }
}

EDIT : With this code the link appear when i debug my menu before submit, but doesn't appear in my administration and front-end where the menu is placed..


texts:
For some reason my DSM output is only occasionally showing up. Nothing significant is changing on the template I'm calling it from. It will show up, then on refresh go away, and randomly re-appear 10 refreshes later.

Any idea what can cause this behavior?


texts: Why is 'render element' sometime 'element' and sometime 'elements'?

texts:
I notice in Drupal source code, in core modules hook_theme(), some places are 'render element' => 'element' and some places are 'render element' => 'elements' (plural). Why? Even the render element purpose is to display a single object (e.g. node canonical), not a list of objects.

The problem is it results in different key in $variables in template_preprocess_hook(). For instance, I have a custom entity and if I use _entity_view in entity canonical route, the $variables has 'elements'. But if I manually use this entity theme in a page, the $variables has 'element'. I'm so confused.


texts: how can i translate strings in search page result?

texts:
On Drupal 8, how can i translate these strings in search page result :

Your search yielded no results

Enter your keywords

Search

Search results

I can do it with jQuery but i know it is not a good approach (even if it works)   :

$('.my-theme-search-page h2').text("Résultats de la recherche");


texts: How to add a jQuery Mobile "pageinit" bind function in Drupal?

texts:
I'm trying to add some mobile functionality to my Drupal site and need to bind some events in a "pageinit" function, NOT in a document ready, as the documentation says. Something like:

$(document).bind('pageinit', function(event){

// bind events

});

How do I do that in Drupal? Thanks a lot for your help!


texts:
Would appreciate any assistance of how to handle configurable URLs for each environment.

The links need to take the user to a different URL depending on the environment the site is installed in.  In test environment, they would go to the test site, in beta test environment, beta site.  And in production, production.

Currently I am calling the test url by h ref in the body text. However, when the site is moved to beta, I would have to manually change the url to the beta url and so forth. I have about 50 of these type of URLs throughout my site so I am looking for a automated way.

I have thought about using

https://www.drupal.org/project/scanner
https://www.drupal.org/node/257026#example-use-cases

But open to any suggestions or experience.

Many thanks in advance!

Mike


texts:
I want if user not logged in and visit any page of my website except my REST VIEWS routers I redirect him/her to  login page in drupal 8,  I found this solutions for drupal 7 but didn't find any solution for Drupal 8,

Redirect anonymous user to login page
How to redirect anonymous users to login page using Rules module?


texts:
I have exported my view, and I want to revert the same in other site environment; the revert view option is missing. Am I missing anything?

I am using Drupal 7 and Views 3.


texts: Views filter handler for user authored from Custom Form

texts:
How can I make a custom views filter handler to filter a list of users which the current user created?

For example: The user adds members to the site a view will show only the members that the user added.

In views, there is a relationship for sorting content based on the current user "Content authored" which is similar.


texts: How to set If-Modified-Since HTTP header in my drupal site

texts: I want to implement If-Modified-Since HTTP header in my drupal site. How do I ensure the If-Modified-Since HTTP header is supported and that it is active?. If it is supported but not active then how to make it active?


texts: Conf_path is deprecated but what is its replacement?

texts:
Im upgrading a D7 module to D8 and it turns out conf_path() is deprecated but I cant find the replacement.

I found a github page that said use this

 DrupalKernel::findSitePath(Request::createFromGlobals())

but I still WSOD when that is called.


texts: How to use {{string}} to assign a value to an attribute in input tag (Twig Template)

texts:
I want to do the following:

{% set var= "string"%}

<input name='{{var}}' />

All drupal does is to ignore the tag in gerneral.

If i set the tag like this everything is fine:

<input name='string' />

Setting the attribute using equals the same result (ignoring the tag):

<input {{ attributes.setAttribute('name', var ) }} />


texts: How to show appropriate country name in location module in multiplanguage sites?

texts:
Neither with i18n nor with entity translation switcher the country names are correct.

E.g. in a German/English site the country names should be Deutschland and Germany when the language is switched. But either the name is shown as Germany/Germany or as Deutschland/Deutschland. The modules addressfield and the ubercart-location module do it correctly.

I saw that when I cleared the cache of Drupal the country name was shown in the appropriate language. For instance I switched from English to German, it was shown as Germany, then cleared the cache, Deutschland was shown, then switched to the English version, again Deutschland, cleared the cache ....

Debugging of the location module shows the following:

In line 1165 the function location_load_location gives the country_name in line 1201 by calling the function location_country_name (line 610 from location.inc). This function calls "location_get_iso3166_list" in which the function country_get_list is called and the result is cached as $countries.

Which means that after the string is cached in the active language of the moment, the country name holds up until the cache expires. So the actual country name is randomized by the time the cache expires and the user language the site is called next.

But I can't find a hook to change this.

So does anyone has an idea to solve this?


texts:
I'm trying to send a newsletter with a view.
I'm using the code
<?php
  $viewName = 'my_view_name';
  print views_embed_view($viewName);
?>
which works fine when I sent a test email.
But when the newsletter is send for the users the email content is empty.

Any suggestions ?
Thanks a lot


texts:
I have a Drupal 7 site with blog and comments enabled for certain user groups and the users complain that in longer discussions like this one the order of comments is totally chaotic, they just can't follow it.

Is there please a way to change the order? I'd be happy with all blog comments sorted by the creation date.

I've looked around, but couldn't find any blog settings. I've tried to construct my own path admin/content/blog/settings too, but there was nothing about sorting.

Thank you!
Alex


texts: How to require a user to be logged in to access files

texts: On my website I currently have a way for users to upload files.  It has been brought to my attention that these files are showing up in search engines.  I'm fairly new and this is not a desired effect.  As a way to fix this for now, is there a way I can restrict access to sites/default/filesto logged in users? Thanks!


texts: Secondary menu shows for registed users only

texts:
I have created a theme from scratch but secondary menu show only two items for non logged users but show all of them in logged users. Also this menu has sub items but it won't show at all, whether for logged or not users and the Show as expanded options is selected.

here is the code I am using:

  <?php print theme('links__system_secondary_menu', array('links' => $secondary_menu,'attributes' => array('id' => 'toolMenu'))); ?>

How shall I fix that?


texts:
So I have this function:

/**
 * Implements hook_form_FORM_ID_alter().
 */
function my_module_form_user_profile_form_alter(&$form, &$form_state, $form_id) {
  dsm($form);
}

What I want to do is to remove "Language settings" fieldset with all the radio buttons inside it. But for some reason I don't have any array element which is responsible for displaying this data. I've read that this should be $form['locale'] but it's not there for sure. What migght cause this kind of behaviour?


texts: I need to hide the page title in Views but still have it appear as the page title on the browser's window tab (for SEO). Could someone help me with that? I've looked around many times for answers but I haven't had any luck yet.


texts: How can I attach a view for each row of another view?

texts:
I may not have the correct terminology here but please allow me to explain what I am trying to do.

I have a view that shows pictures that users have uploaded and that require approval.  I am handling approval through the Flag module (administrators flag a node to approve it).

I have created a view that shows all the unflagged nodes containing pictures that are awaiting approval.

Now, on this view, for each picture that a user has uploaded, I would like to show all the other pictures that the author has uploaded (Users are limited to uploading five pictures, so this can't get too crazy.  Each picture is its own node.)

To do this, I tried creating a view display attachment that shows all the pictures uploaded by a user (limited by a Contextual filter of author: uid).  I then attached this to my main view, but the contextual filter's value is not added per row.  I may be misunderstanding how views attachments work; I've never used them before.

Am I configuring this wrong?  Is there a different approach that I should be taking?

In short, this is what I am trying to achieve:

The main view shows each picture (stored as an individual node) that needs to be approved.
Next to each picture that is pending approval, I would like to show all the pictures uploaded by that user (stored as individual nodes) that have already been approved.


texts: Updated search index display, but old index is still being used

texts:
I updated the search index display for my content type (eg, from admin/structure/types/manage/page/display/search_index), but the old index is still being used.

How can I fix this?


texts: Is it possible to create a menu item and leverage path aliases?

texts:
I am trying to create a menu item that loads a view mode that calls the callback function with the path alias.

$items['node/%/%'] = array(
  'page callback' => '_node_view_load',
  'page arguments' => array(1, 2),
  'access callback' => TRUE,
  'type' => MENU_CALLBACK
 );

function _node_view_load($node_id, $view_mode = 'default') {
  return drupal_render(node_view(node_load($node_id), $view_mode));
}

This works if you go to /node/%/view_mode. However, it does not work if you got to /alias/view_mode. I get page not found. Is there a way to bind menu items to path aliases?


texts: Can I disable Toolbar in specific theme?

texts:
I have two active theme, and switching between them by themekey on specific paths.

theme #one is my main theme, and some contents load in theme #two in a modal box (lightbox2).
I need disable Toolbar on theme #two because it's load Toolbar too and I don't want it there.

my question is how can I disable Toolbar in theme #two?


texts: Book module, taxonomies, url path settings, and breadcrumbs

texts:
I am a recent convert to Drupal from Joomla, and while I'm starting to get the hang of it, I just ran into a question that I need some expert advice on.

I'd like to have online versions of a print quarterly newsletter that we produce. It would make sense for each print article to be a separate node, which could then be organized into issues and sections. Ideally, I'd like the url and breadcrumbs to reflect the hierarchy (e.g. mysite.org/newsletter/spring-2012/section-1/lorem-ipsum).

The "Book" module seems perfect for this, but I have no idea how to get the url's and breadcrumbs to work. After some googling, I found somebody somewhere saying that "Book" is somewhat outdated and that anything you could do with "Book" you could do with Taxonomies (besides the obvious differences of presentation, etc. mentioned in one of the other threads on this site). That seemed like the perfect solution for about 30 seconds, until I realized that this would require the content editor (which may not be me) to update the taxonomy terms every time he or she added a newsletter issue. This is possible, but would be a major error-prone hassle.

Any advice or suggestions?

Thanks in advance!


texts:
I've to create a custom function to display images because I've to add values from custom fields.

I've added a function to template php, like this:

function mytheme_image($variables) {
}

The problem is that in $variables I haven't the fid of the file, but only the path. I have to load the file to get values from field, how should I do?

I'm looking for functions to get fid from path but I haven't found something..


texts:
I'm trying to create a form that will allow a user to select a View from a list and then display that View on the same page. For instance:

$options = array();
$options['view_one'] = 'view_one';
$options['view_two'] = 'view_two';
$options['view_three'] = 'view_three';

$form['chooseview']=array(
    '#title'=>'Choose a View',
    '#description'=>'Which View do you want to display?',
    '#type'=>'select',
    '#name'=>'chooseview',
    '#required'=>TRUE,
    '#options' => $options,
    );

print views_embed_view($form_state['values']['chooseview'],'block_1');

My question is how do I accomplish this? Drupal is not printing the embedded View from form_submit. I don't need Ajax.