texts: Unset email address requirement on User Form not taking

texts:
The scope of our project doesn't require users to have an email (they can use phone instead), therefore, I'm trying to unset the email requirement like so:
function my_module_form_user_form_alter(&$form, &$form_state, $form_id) {
   $form['account']['mail']['#required'] = false;
}

However, this doesn't seem to actually change the requirement because when I submit the form without an Email I still get the error Email field is required... I used kint to view the form object $form['account']['mail'] and it shows that the required attribute is set to false, yet I still get the error that it's required...
How can I make it so that I can save a user record without an email using this form?


texts:
I'm having a bit of a problem when using multiple aliases regarding which alias appears on a menu.

For example, I have create a page /node/1, give it an alias /page1 and add it into the navigation menu.

Browsing to the index page I can see the page in the navigation at /page1.

I also want the page to be available at another alias /page2 so I add this through the URL aliases functionality. Unfortunately this updates my menu so the link in the menu now points to the URL /page2 instead of /page1.

If I have multiple aliases to a node, how does Drupal decide which is used in a menu and how can I change this


texts: Attributes are not changing in the placed order

texts:
I have a commerce site with T-shirts as products. I have added custom attributes of size and type.

By default L Size is selected. But even if the user changes the size to something else say M or S, in the order that is placed the size is still being shown as L.

I am assuming that this is because of caching. I currently have authcache enabled with Mem-cache in the backend.

I checked the XHR call that is being made. I see that the size that is being sent in the call is the one selected by the user. But however when the order is placed it still says L. Any help where to start debugging would be greatly appreciated.


texts:
I am facing trouble with view having 2 content type without relationship.

content type 1: (toys) title, body, series_taxomony, price

content type 2: (areas) title, area_name, percentage

I'd like to have a view to display a form like
series_taxonomy and area_name are exposed to user select from list and show detail

serias_taxonomy
price
area_name
percentage

In order to complete view, what should i do and is there any way to restructure content type to do easier

Thanks in advance


texts: Using taxonomy filter produces duplicate content in node view

texts:
Each "info page" node on my site has a field referencing or more taxonomy terms from the 'info page' vocabulary.

I'm trying to use a node view to make it possible to find any/all content which references a particular taxonomy term. I'm getting duplicates in my node view whenever content has more than one taxonomy term and "Any" taxonomy terms are all searched. Within the returned results, nodes repeat a number of times equal to the number of terms the node references.
Eg. a node with 4 different taxonomy terms shows up 4 times in my table of results after searching using the view.

The view is output as an html table and using the filter -
Taxonomy:has taxonomy terms (i've selected all terms in my info page vocabulary) and exposed the filter.

The search works fine when any specific, but I get duplicates when searching "Any" terms within the vocabulary.

There are countless articles about how to solve duplication issues in views, none have worked for me so far, so I'm hoping that maybe the issue is with the way my view is setup.

Here's the export http://pastebin.com/P7EkC8KX


texts: if function getValue() on null return nothing

texts:
I looked around, but am not exactly sure how to ask this question.

Is there a means of not erroring out on "function getValue() on null". Basically I'd like to return nothing and move on if getValue is being called on something that doesn't exist.


texts: How can I show selected items without exposed filters?

texts:
I have a views which contains block and page view with exposed filter with my categories/taxonomy.

This is a beginner page for my users, so I just want to Show some items before they apply any filter.
For this issue; I can add a checkbox to my content-type 'this is important'

Examples:
3 node added: 1,2,3. Node2 is important and needs to Show it without applying filters or like that. If a filter applyed, other node1 and 3 will be shown.

I'm using Drupal7 and latest version of Views, CCK etc.
Best regards.


texts: How to correct my rule to prevent duplicate taxonomy terms to be created?

texts:
This is a followup of my question at How to create a rule to combine the terms of 2 fields to create a new term and store it in a 3rd field?.

How can I prevent that each time a node is viewed, it creates duplicate taxonomy terms, as shown in this example:

Any suggestions?


texts: How to get Product name instead of sku in email to admin in authorize.net?

texts:
My client has a drupal site where the admin gets a SKU in the confirmation email. He wants to replace that with product name. How can I do that and where do I have to change it?

I found this patch, but I don't see the file in authorize.net module to patch the code.

Can anyone help me out.

Thank You.


texts: Views Page Showing Root Title in Window (not views title + root title)

texts: My views page title is set to "The Title" but my window title shows as "Website" rather than "The Title | Website". This is only for my views. Any ideas what would cause this? I have a few other modules installed but not Page Title, that's disabled.


texts:
I need to make a redirect after a customer added something to his cart so I write this:

function MODULE_form_alter(&$form, &$form_state, $form_id) {
  array_push($form['#submit'], '_MODULE_redirect_to_products');
}

function  _MODULE_redirect_to_products(&$form, &$form_state){
  global $language ;

  $form_state['redirect'] = url('prodotti', array('language' => $language));
}

but this code redirect me to

/dev/azzurra/?q=it//dev/azzurra/%3Fq%3Dit/prodotti

but I need to redirect to

/dev/azzurra/?q=it/prodotti

according to the language obviously.

UPDATE:
I'm try to use

 $form_state['redirect']

but if I display this field before modify it I can see this

Array
(
    [0] => prodotti
    [1] => Array
        (
            [language] => stdClass Object
                (
                    [language] => it
                    [name] => Italian
                    [native] => Italiano
                    [direction] => 0
                    [enabled] => 1
                    [plurals] => 2
                    [formula] => ($n!=1)
                    [domain] =>
                    [prefix] => it
                    [weight] => 0
                    [javascript] => a97-0F_JBbaSYaN4XQBbFbhCLCysRpSabTcDmQjB73E
                    [provider] => locale-url
                )

        )

    [2] => 302
)

but the form redirect me to 'it/testate/name' because the form 'add product' is displayed in a view so I think that the views module override the $form_state['redirect'] after me so the default redirect [and mine one..].

I think I can't use this kind of redirect..
How can I achieve this redirect correctly?


texts: Use drupal.settings variables on javascript

texts:
I'm using the Google Maps API on my website regarding restaurants.
The map loads when a restaurant has been selected.
I was initially using the google embed map, but I got some errors (e.g. markers not showing), so I switched to gm API.

How do I use a drupal.setting variable to a javascript? This is my code.

var myCenter = new google.maps.LatLng(Drupal.settings.eatery_geo.address);
function initialize() {
  var mapProp = {
    center:myCenter,
    zoom:16,
    mapTypeId:google.maps.MapTypeId.ROADMAP
  };

  var map = new google.maps.Map(document.getElementById("map-canvas"),mapProp);

  var marker = new google.maps.Marker({
    position:myCenter,
  });

  marker.setMap(map);
}

google.maps.event.addDomListener(window, 'load', initialize);

Where Drupal.settings.eatery_geo.address has the variable?

This doesn't seem to work; it only shows a blank <div>.


texts:
I'm using the flag module to provide my site admins with a simple "Approve Membership" button. When the button is clicked the system automatically associates the new user account with several roles and then changes the accounts status from "Blocked" to "Active.

So far the roles assign perfectly. The problem is that I can't figure out how to switch an account from Blocked to Active using flags.

Any ideas?


texts: searching custom node type contents from a module

texts: If I create my own custom node type by writing my own module(s), is Drupal "smart" enough to index the contents of this new node type from my module?  If not, then would I need to use the Search API's so that contents are included in search results?


texts: Views and Filter Criteria - is this normal behavour? Drupal 7

texts:
I decided to modify the View after all the content had been uploaded to the site. Now I am experiencing issues with the Filter Criteria, not picking up the nodes which I would expect to be picked up...

Here are the two different sets of Filter criteria I tried:

This View displays 2 search results.

The view above displays 3 results!

Now, what I was expecting is that the first set of filters would display the same number of results (at least) as the filter above. Because, the condition is OR. But that's not the case...

Is this normal behaviour?

I must not be reading the conditional statements correctly, because I am not displaying the results I am expecting...


texts: How to create a view type of Entity reference display?

texts:
I have an entity which contains a field collection of entity references and can edit the entity references with the Entity selection mode is Simple (with optional filter by bundle), but only Entity Field Name x shows in the list.

I also created a view which displays information from the referenced entity, but when I switch the Entity selection mode to Views I get the message:

  No eligible views were found. Create a view with an Entity Reference
  display, or add such a display to an existing view

.

After that I created a number of views of the Entity Reference display type, which display the same information but error message still comes up.

Can someone show me the steps to creating Entity Reference display views?
PS. I think what I am doing my be tricker than usual because the entity reference is a multivalued element in a field collection, but I am able t create views on it though>


texts: How do I debug connection problems while testing Deploy module while using local host?

texts:
I'm attempting to properly set up between the Deploy Module between these two by follow these instructions. I've used Drush QuickDrupal to set up two new Drupal 7 instances.

$ drush qd d7-deploy-stage
$ drush qd d7-deploy-live

Initially, I ran them as on the same host machine via PHP's internal development server

$ php -S localhost:8000 # d7-deploy-stage
$ php -S localhost:9000 # d7-deploy-live

The end point is listed as http://localhost:9000/services/rest and the authentication (and only user) is admin with password of admin.

However upon a cron run on the d7-deploy-stage instance I

  DeployAuthenticationException: Authentication error:-111 Connection refused in DeployAuthenticatorSession->deploy()

Question(s): How would I begin to debug this? Since the error reads "connection refused", I'm also curious if I start the servers with a fully qualified domain name (or my machine's IP) or if the port numbers an issue in the addressing

What I've tried so far:

The Patch:
The '#31' has failed with the following output patch -p1 < deploy-404_CSRF_error-2017767-31.patch

  patching file plugins/DeployAuthenticatorSession.inc Hunk #1 FAILED at
  76. 1 out of 1 hunk FAILED -- saving rejects to file plugins/DeployAuthenticatorSession.inc.rej

Update

On both instances, based this answer below, I downloaded the 'add start up .ht.route' patch, applied and restarted

wget https://www.drupal.org/files/issues/add_a_startup-1543858-58.patch
patch < add_a_startup-1543858-58.patch to each instance.
php -S public-ip-number:8000 .ht.router.php # stage
php -S public-ip-number:9000 .ht.router.php # live

The error on drush cron has changed

  WD deploy: DeployAuthenticationException: Authentication error: 404 Not found : Could not find resource user. in DeployAuthenticatorSession deploy() (line 76 modules/deploy/plugins/DeployAuthenticatorSession.inc).


texts: Deleting non-active users (e.g., users who didn't log in for 90 days)

texts:
We use Drupal as an employee portal; as such, when new starters join the business they create an account.

However, we are trying to figure out a good leaving process; right now I get a list and have to manually delete all the users.

Ideally, we would like something which send an email to a user after 14 days and then again after 30 days informing them that they have not logged in into the system; then, after 60 days, they are automatically deleted.

I am guessing that using Rules is the answer, but I cant find any option to delete users.


texts: Image 404 with private files itok and cache

texts:
From some time I have a problem with my private files pictures with itok.
Here is the problem:
When I am not connected, ALL private image with itok, cropped (with Crop API & ImageWidgetCrop) are missing (404 error).
When I am logged, I can see them. If we look at the file URL of a img:
404, when NOT logged, URL image: /my_site/system/files/styles/slideshow/private/2020-06/stat.png?itok=hmdVwV4u = 404 error
200 working, when logged, URL image: /my_site/system/files/styles/slideshow/private/2020-06/stat.png?itok=9aPOzUBD = WORKING
Then, if I clear the cache, the problem is gone even if we are not logged. But after a few hours, the problem is back and the itok URL is not updated. As if there was a cache.
What I understand? When we are not connected, it look like there is a cache or something else. But disabling Advagg cache or Drupal cache didn't solve the problem.
What do you think? This is a cache problem? A itok problem? Crop problem?
I looked to the server side, everything is good about permissions.


texts: How can I update an user field via JSON:API?

texts:
How do I update user field via JSON API with D8?

EndPoint:https://domainname.com/jsonapi/user/user/

Method:PATCH

Request Header;

Accept:application/vnd.api+json
Content-Type:application/vnd.api+json
X-CSRF-Token:xxxxxxxxxx

Body:

"data": {
        "type": "user--user",
        "id": "xxxxxx-7798-45e5-a16c-xxxxxxxxxxxx",
        "attributes": {
            "field_test1": [
                "data1",
                "dara2"
            ]
        }
    }

But below error

        "title": "Method Not Allowed",
        "status": "405",
        "detail": "No route found for \"PATCH /jsonapi/user/user/\": Method
        Not Allowed (Allow: POST, GET, HEAD)",


texts: This works as a module, but think it should go in my .theme file instead

texts:
This is some code which we're using to merge together content types into the body of an article:

<?php

function remove_p($string) {
  $first_p=substr($string,0,3);
  if($first_p=="
") {
    $string=str_replace('
','',$string,$temp=1);
  }
  return $string;
}

function custom_press_release_node_view(array &$build, \Drupal\Core\Entity\EntityInterface $entity, \Drupal\Core\Entity\Display\EntityViewDisplayInterface $display, $view_mode) {

  $node_array = $build['#node']->toArray();
  if ($node_array['type'][0]['target_id'] == 'press_release' || $node_array['type'][0]['target_id'] == 'article') {

    // Get the location entity ID
    $field_name = $entity->get('field_office_location')->getValue();

    $location_id = $field_name[0]['target_id'];

    // Get the location name
    $term_object = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->load($location_id);

    if(is_object($term_object)) {
      $term_array = $term_object->toArray();
    }

    // Generate output like - December 5, 2017
    $new_time_format = date('F d, Y', strtotime(substr($build['created'][0]['#markup'], 0, -7)));

    // Body text from Drupal
    $old_body = $build['body'][0]['#text'];

    $body = '
';
    if (is_array($term_array)) {
      $body .= $term_array['name'][0]['value'] . ', ';
    }
    $body .= $new_time_format . ' – ';
    $body .= remove_p($old_body) . '
';

    // Modified body text
    $build['body'][0]['#text'] = $body;

  }

}

I think that this would be better done in my theme file, but we weren't able to call the functions we needed within the theme.

Did we just miss something, or is this something that just needs to be done as a separate module?


texts: render form in page--node--add--contenttype.tpl.php

texts:
In Drupal 6, there was a method to theme the edit form for nodes of a custom type:

 /**
* Implements hook_theme().
*/
function hook_theme($existing, $type, $theme, $path) {
    return array(
   'node-type_node_form' => array(
   'variables' => array(
   'form' => NULL,
     ),
   'template' => 'node_type-node-form',
   ),
 );
}

Drupal 7 handles this method with the following template files: page--node--add--contenttype.tpl.php, or, page--node--edit--contenttype.tpl.php.

I didn't find any documentation about how I should render form items in these templates. $form is null.

Which variable should I use to render the edit form for my content type?


texts:
I have a list of links that are all displayed as one list.
They are currently sorted by 'Title' asc.

I would like to customize the order of this list.

How can I do that in Drupal 6.

Example:

A1
B1
C1

But I want instead to have (not sorted or organized in any specific order):

A1
C1
B1

This is my backend interface in Drupal 6:

Thank you for your help!
Izumi.


texts: How to print "Time" field in twig template

texts:
I have a time field in my content type. But when I entered time in the format 05:00 AM, I get a five digit timestamp eg. 18000 (for 05:00 AM).
When I print this using node.field_time.value|date('h:i A') it prints

10:30 AM

which is 05:30 Hrs extra than the entered one.
How do I'll get the correct time?
The default timezone is set to Kolkata which is +05:30 UTC. Is this something causing the problem?


texts: Can't access to password input on registration form

texts:
I have a problem. I can't access through module to password field on registration page.

function customization_form_user_register_form_alter(&$form, &$form_state, $form_id) {
$form['account']['pass']['#id'] = 'userRegInput';
}

It wont change id of input. I don't know why...

Thank you!

EDIT: Btw. i have installed user_registrationpassword module, maybe is because of that...


texts: How to skip empty and missing values from a migration

texts:
I'm trying to skip fields that are not present in my source file or that are empty, but I keep getting "Migration failed with source plugin exception: Passed variable is not an array or object"

This is what I've tried in YML:

field_contact:
    -
      plugin: skip_on_empty
      method: process
      source: contact_array
    -
      plugin: sub_process
      source: contact_array
      process:
        target_id:
          plugin: migration_lookup
          migration: import_contact_json
          source: Name

and

field_point_of_contact:
    plugin: sub_process
    source: contact_array
    process:
      target_id:
        -
          plugin: skip_on_empty
          method: process
          source: name
        -
          plugin: migration_lookup
          migration: registry_import_pocs_json
          source: Name

Both of them have the same output (i.e. the error described above).

Can someone point me in the right direction, please?


texts: Show profile2 fields only to specific user register path

texts:
I am interested in showing profile2 fields only to specific user register path (I have 2 user register path).
How can I do this without using the Profile2 registration path module as another module creates the paths?
thanks


texts: Confirmation email for newsletter signups drupal 7

texts: Is it possible to send a confirmation email when someone signs up to my newsletter. When the user signs up an email should be sent to his mail conforming his subscripition and to await more info. Is this possible through the webform?


texts: Cannot use my drupal installation after enabling new custom theme

texts:
I keep geting this error message on every page request:

Fatal error: Allowed memory size of 167772160 bytes exhausted (tried to allocate 36 bytes) in C:\wamp\www\mydrupal2\includes\theme.inc on line 98
Call Stack
#   Time    Memory  Function    Location
1   0.0100  142240  {main}( )   ..\index.php:0
2   0.0220  449448  drupal_bootstrap( ) ..\index.php:20
3   0.2050  3025040 _drupal_bootstrap_full( )   ..\bootstrap.inc:2259
4   0.6290  15508712    drupal_theme_initialize( )  ..\common.inc:5144

Increasing memory allowance has not had any effects. I try using drush to disable the offending theme or go back to the last working one, it's the same error message. I can't even use drush for anything else. It reports the same error message. I tried the SQL method on this drupal.org page. Same result.


texts: What URL do I use to view an OG membership entity?

texts:
I see one can edit a membership entity by going to:

group/node/204/admin/people/edit-membership/32

What is the URL to view the entity?

I see the membership entity has a display mode that allows you to rearrange the fields but there is no view link in the OG membership (people) admin area.


texts: Showing group managers a list of pending users

texts: We're using Drupal Commons 3.3 and our group managers have been asking for a single view of all pending users. Email is becoming too cumbersome and unmanageable. Is there a View or Pane that I can add showing our Group Managers which users should become members?


texts:
I have two content types: Medical Records and Resident Profile. Each Medical Records node is associated to a Resident Profile through an Associated Resident entity reference field added to the first content type.

In the node display page for the Resident Profile nodes, I want to have a block on the side that displays all the associated Medical Records nodes.

I know I have to do something with the contextual filters and relationships settings of a view, but I am not sure how to proceed.

How can I achieve what I described?


texts:
Is the "parent" key supported in Drush 9? It isn't in the example file here https://github.com/drush-ops/drush/blob/master/examples/example.site.yml or drush docs:aliases and I am trying to get a bastion working off of the Drush 8 docs (https://docs.drush.org/en/8.x/bastion/).

Can anyone confirm it should pickup a "parent" key?

edit: I see here http://api.drush.org/api/drush/examples%21example.aliases.drushrc.php/master that "parent" was deprecated before the switch to YAML in Drush 9 so maybe it is called something else now. Not sure how to specify merging key values in YAML.


texts: Omega 3 and node--[content type].tpl.php not detected. How to apply custom tpl files?

texts:
We are trying to format the layout for a specific node type and from what I can gather from the net the node--[content type].tpl.php file is the place to do that. We have created the file and placed it in the sub theme directory. After a "drush cc all" the tpl file is still not being applied to output.

Is this the correct way to change the layout of a content type, where their are fields that need theming? Should we just use filed override function instead? Using delta will not work as we want to format the display of the node fields in a particular way and not just move it whole sale to a new region.

I have also seen reference to editing the region--content.tpl.php file but its not the region we want to edit, just the way the node is displayed.

thanks


texts: menus from modules: help me understand basic menu concept in drupal7

texts:
Here's some paths I'm using in my module

control (this isn't really a page, it just goes to the next item)
control/jobs (provides list of jobs)
control/jobs/% (path for editing a particular job)
control/download (separate page)
control/settings (separate page)

I would like a simple menu that shows jobs, download and settings. I would like it to add the 'active' class when visiting the page. And when visiting a particular subpage (e.g. a particular job), I would like the parent menu items to have an "active-trail" class or such.

Using hook_menu I've created these menu items, all as MENU_NORMAL_ITEMs and I've put them in a new menu called menu-control. I've added this menu's block to my page. I get the menu items listed. But when I visit a particular job, there is nothing to indicate I'm on a child page of 'jobs' (or indeed, 'control').

This seems like the simplest implementation of a menu and I've been hacking at it for weeks (on and off!). Can anyone help?


texts: Image link does not href to proper page in multilingual site

texts:
I am honing my Drupal skills by developing a small website: www.find-word.com. It is multilingual with English and French enabled.

On the top right of the screen, I have two flags. The French flag is a link to the French page, but when I click on it, it displays the English page.

I checked with FireBug, and the href is correct:

When I type the full French URL in my browser, it is converted into the English one.

I have no idea what's happening. Does anyone know what is causing this? Does anyone have ideas, suggestions? Thanks.


texts: Show relationship summary using Entity Reference

texts:
First question, hope I can get some answers. I have this information schema:

Books: Title and Author (Entity Reference field to Books content type)

Author: Name and Books (Entity Reference field to Author content type)

I created a view to show the authors with their ID's. I want to also show in the Books field the ID's for the books that reference them. I already created the relationship and turned aggregation on and asigned it to the books field. The view looks like it's working and aggregation also seems to be working, however, no results are showing in the books field. Any ideas?

I'll appreciate any answer. Thanks!


texts: Create a route to show a node with a custom display/view mode

texts:
In Drupal 8, it is easy to add display/view modes. Let say I created the tech display mode and I set it up for the film content type.

Now, I would like to create a route for it and access it as local task of entity.node.canonical.

How can I achieve this?


texts: Can't understand Contextual Filter + Relationship Result in View

texts:
Drupal 8

Goal
When viewing a content type Story, I want a view to show other Story nodes that do not have the same taxonomy term as the Story that is being viewed. To achieve this I created a view with:

Contextual Filter Content ID, Provide default value, Raw value from URL, Path component 2, More - Exclude  so as to not have the viewed Story show up on the view
Relationship from the Taxonomy Term ID referenced by a field in Story content type
Contextual Filter Term ID that uses previous relationship: Provide default value, Taxonomy term ID from URL, Load default filter from term page, Load default filter from node page, Limit terms by vocabulary, More - Exclude

And it works, sort of. When accessing a Story that has at least one taxonomy term associated to it, the view shows other stories that don't have the same taxonomy term. But, when viewing a story that has no taxonomy term associated to it, the view shows nothing.

Am I wrong to think that the view should be showing all the results?


texts: Disable the default username in the registration form

texts:
I just installed and configured the logintoboggan module; I created extra fields and they are displayed just fine. I can't remember how to disable the drupal default username field on the registration form.

Can anyone assist me?


texts: How to send html/plain-text mails based on user settings?

texts: Using mail function i am send mails to multiple users with comma separated values in Drupal 8. But in that mail id users, some users selected mail preference as html and some users selected plain-text settings. So how can i send the html/plain-text mails programatically based on users settings?


texts: I created a view content about active classes and now I want to show them inside of user edit form to that they can see their clasess active with a contextual fiter url at view content, how can I make that? please help


texts: Custom node migration for multi-value imagefield

texts:
I'm working on a custom migration module to "link" images to the imagefield.
It's work well for an unique value image field like this:

field_illus_vdl:
  -
    plugin: d6_field_file
    source: field_illus_vdl
    migration: upgrade_d6_file
  -
    plugin: skip_on_empty
    method: process

But not for a multivalue imagefield after different tests:

field_galerie_image_vdl:
  -
    plugin: skip_on_empty
    method: process
  -
    plugin: sub_process
    source: field_galerie_image_vdl
    process:
      target_id:
        plugin: migration_lookup
        migration: d6_file (upgrade_d6_file doesn't change result)
        source: fid
      alt: alt
      title: title
      description: description

I try with iterator plugin, but no change.What is missing or wrong ? Do order is important between for chained processes ?

thanks

EDIT: I see there that sub_process replace iterator plugin.But I don't find infos about a cckfield plugin.

Devel data example:

field_galerie_image_vdl (Array, 6 elements)
0 (Array, 10 elements)
1 (Array, 10 elements)
fid (String, 4 characters ) 2006
uid (String, 1 characters ) 8
filename (String, 11 characters ) niger_3.jpg
filepath (String, 48 characters ) sites/all/media/galerie/actu/2018/20/niger_3.jpg
filemime (String, 10 characters ) image/jpeg
filesize (String, 6 characters ) 113504
status (String, 1 characters ) 1
timestamp (String, 10 characters ) 1526837277
list (String, 1 characters ) 1
data (Array, 3 elements)
description (String, 0 characters )
alt (String, 0 characters )
title (String, 0 characters )

Extract of a value for a filefield from var_dump:

[field_illus_vdl] => Array
    (
        [0] => Array
            (
                [fid] => 2004
                [uid] => 8
                [filename] => niger4.jpg
                [filepath] => sites/all/media/illustration_vdl/2018/20/niger4.jpg
                [filemime] => image/jpeg
                [filesize] => 181770
                [status] => 1
                [timestamp] => 1526837126
                [list] => 1
                [data] => Array
                    (
                        [alt] => Lycée Célony - Aix en provence
                        [title] => Lycée Célony
                    )

                [nid] => 471
                [view] => Lycée Célony - Aix en provence
            )

    )

This source could be the right way,but I can't it work actually.

EDIT2: an format error in my YML file break the process, so after reorder the file, files are migrated.With a more simple code too:

 field_galerie_image_vdl:
  -
    plugin: d6_field_file
    source: field_galerie_image_vdl
    migration: upgrade_d6_file
  -
    plugin: skip_on_empty
    method: process


texts: Why does drupal_add_css and drupal_add_html not always work?

texts:
I have a drupal_add_css in my template.php, following a series of drupal_add_html calls.

The drupal_add_html calls, adding meta tags, work except for the first one (regardless of the order I put them in) which is for a meta generator tag, which the jquery form library I'm using requires. I've also tried getting it in by doing the call for markup rather than a tag...same...it doesn't appear.

The drupal_add_css call does not add the css file (I'm not aggregating), even if I specify the full url. If I add the css file to the list in the .info file, it appears, but I only want the file for a specific page, so I'm doing in the pre-render. When the file is not added, there is no reference to it in the page resources or network list as 404. It does get referenced in the js behaviors object that Drupal inserts.


texts: UTMs stopped being caught on webform submission

texts:
Forms has hidden inputs in the components to collect UTM values from the URL.

Once the form was filled in, the submission appeares correctly in the results table, both the public fields like the name, surname, etc ... as the content of the utm.

Recently, the new forms created do not store utm values, not even the cloned forms of a functional form.

Identical forms, in some takes the UTMs (forms with some time), in others not (created / cloned recently). Even shown in the same view.

I have tried to see with the devel module  if there was a failure when interpreting the forms or the hidden fields ... without result.

Any idea or direction where the problem could go?

Thanks for your time.


texts: Configuring the url for facet api and pretty path

texts:
Use Drupal 7, Drupal Commerce, Search_api, Facetapi, facetapi_pretty_path.

There menu directory, built on the basis of a dictionary "catalog". When you select a block appears with the selection of facets.

The current URL = domain / category / blabla / 113, and the url at the facets - domain / category / blabla / 113? F [0] = field_firstfield: 103, domain / category / blabla / 113? F [0] = field_secondfield: 126.

So far, so good.

I turn prettypath. and instead of the domain / category / blabla / 113? f [0] = field_firstfield: 103 url formed domain / taxonomy / term / 113 / field_firstfield / data-103.

Why that takes crude prettypath term path (taxonomy / term / 113), rather than to substitute the alias (category / blabla / 113).

1) How to make the url for facets with an alias

2) How to make this way: domain / category / blabla / 113 / options = 102-108-220, where 102, 108, 220 - it was going taxonomy terms.

Thank you.


texts: Moved Drupal site trying to load old directory

texts:
I've been building a Drupal site in a subdomain/directory called "new". I've now gone to move the site to the root, so it loads on www and the website will not load, instead giving the following error:

Fatal error: Class 'SelectQuery' not found in /usr/www/redacted/public/new/includes/database/database.inc on line 813

To be clear, it was located in /public/new, now it's just in /public.

Why oh why is it still trying to load stuff from the old folder? Is Drupal 7.37.
Thanks


texts: Commerce- How can I add a custom field to Account Information on checkout

texts:
I am using Commerce but I do not require customers' billing or shipping information.  However, I do need them to provide their name.

Since I have a field for the name in the user profile, I want to require anonymous users (only) to provide their name.  By default, in Commerce the Account Information pane requires users to input their e-mail addresses if anonymous and is hidden if they are authenticated.

This is exactly the behavior I want, so I was hoping to add my name field from the user profile to the Account Information, but I can't find a way to do that.

Approach I tried and rejected

By adding the name field under Checkout settings-> Order-> Manage display, I was able to add the field, and using the Commerce Fieldgroup Panes module I could even display it in a custom fieldgroup.  However, when taking this approach, authenticated users are prompted for their names and their names aren't prepopulated.


texts: What code should .htaccess of files directory hold in drupal 7.25?

texts:
The module Security Review gives the report my .htaccess in files directory is a security risk because says it has insufficient code to protect the site from anyone wanting to make php edits. However, have checked it with drupal org docs and I can see the .htaccess in files directory matches up with correct security script to keep out any such attempts.

Anyway I am trying to ascertain correct code input for .htaccess in the files directory. I remember there was a bug with this so maybe the security module is picking it up, I don't know.

# Turn off all options we don't need.
Options None
Options +FollowSymLinks

# Set the catch-all handler to prevent scripts from being executed.
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
<Files *>
# Override the handler again if we're run later in the evaluation list.
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2013_003
</Files>

# If we know how to do it safely, disable the PHP engine entirely.
<IfModule mod_php5.c>
php_flag engine off
</IfModule>


texts:
I am using drupal 6. I have a variable in a function which I saved with variable_set. I called variable_get in a different function and it keeps giving me the default. Why wont it save the variable? I know that the variable has a value because its used in sql query.

here's my set:

    $staff_action = $_GET['staff_action'];
$first_name = $_GET['first_name'];
variable_set('first_name', $first_name);
$last_name = $_GET['last_name'];
variable_set('last_name', $last_name);
$email = $_GET['email'];
variable_set('email', $email);
drupal_set_message($email . " in first function");

here's my get in second function:

$first_name = $_GET['first_name'];
$last_name = $_GET['last_name'];
$email = variable_get('email', 'none found');
drupal_set_message($email . " in second function");


texts: Equivalent of "Plain Text" body field display format

texts: I was moving my views to Drupal 8 and one of the things I need to do is display only text from the Node body. In Drupal 7 I had simply set the Body field display format to "Plain text" in Teaser view mode. This worked brilliantly, since it ignored HTML such as images (instead of displaying raw HTML which would not work). Most of my nodes have images near the beginning of the Body text so these images show up on my view and ruin it. I can't find the Plain Text field display format; has it been removed? Is this done differently now?


texts: How to use ctools_ajax_command_redirect with $_GET parameters

texts:
Is it possible to use ctools_ajax_command_redirect with $_GET Parameters ?
I am only able to redirect it to an absolute path as of now ..


texts: Block visibility according to breakpoint

texts:
I have different blocks for different breakpoints and I hide blocks through CSS in media queries.

I have some images in blocks and I noticed that all these images is loaded even block is display: none;, and I don't want to load them on mobile for example.

So, I'm wondering is it possible somehow not to render block at all on some device width range (like media query) and not to do it through CSS?


texts:
I have two content types

For example say X and Y

Every Y should refer any one of the X . I want to display how many number of Y is refering a particular X while viewing the X node. Please suggest some module which direclty achieve this requirement.


texts: I would like to theme an attachment display differently if there are no results for the parent display

texts: I have a view attachment that displays featured content. It's attached to a block that shows non-featured content. Which template should I use to theme the attachment in case there are no results for the block? If I theme the attachment, I'm not able to access anything I could use from the block for a conditional statement.


texts: Hide empty results in views caused by entity translation?

texts:
I have a view generated by Views module and Entity Translation module enabled with the option "Enable language fallback" disabled. This should mean that if the language is not available the post should not be shown.

So if I'm showing the site in English and a post is only available in Italian it should not be considered.

In fact, in the view the post are shown as they have all fields empty.

I tried to check, inside, every field of the view

"Hide if empty"
"Hide rewriting if empty"
"Count the number 0 as empty" and even
"Remove whitespace" in rewrite result.

In the "Format" part of the view I choose "Grid" and "Fields" and in fields setting checked "Hide empty fields"

I tried to apply path 35 and 40, no fortune.

  https://www.drupal.org/node/1452820

Any ideas?


texts: How to upload image to media library? (No upload field)

texts:
I'm missing something in media_library. When I click "Add media" in the media library (/media/add/image) there's no browse/upload field.

All of the other media types have an upload field.

This document in the Drupal Media Guide seems to imply that there should be an upload field.


texts: Running EntityFieldQuery on restricted content (with cron)

texts:
I’ve got a small issue running the following query:

$qry = new EntityFieldQuery();
$qry->entityCondition('entity_type', 'node')
        ->propertyCondition('status', 1)
        ->propertyCondition('changed', $since, '>')
        ->fieldCondition('group_audience', 'gid', (array) $groups, 'IN' );

When I run this manually as user #1 it is all fine. When I run this through cron (which has no user) the organic group access control appears to forbid returning any results (based on no permissions for the current user I guess). This issue is with the last fieldCondition, when removed, it all works as expected.


texts:
I'm new in Drupal 7, and I'd like to change the media list upload behavior, most precisely the way elements are displayed.

This is what I have now.

This is what I want.

I searched all over the web, but I only found tutorials to make custom field widgets, or something (useless for me).


texts: Updating core from 8.5.4 to 8.6.3, can I skip the releases in between?

texts:
I have a website that is running on Drupal 8.5.4. I want to update it to Drupal 8.6.3 through the manual update option (link).

Can I directly update it to 8.6.3 skipping the releases in between? None of the releases in between (8.5.5, 8.5.6, 8.6.0, 8.5.7, 8.6.1, 8.5.8, 8.6.2) had updates to the default.settings.php file, and I don't have any custom modifications to the files composer.json, .htaccess and robots.txt either (which means I can overwrite these 3 files with the ones that come with the updated Drupal code).

I read somewhere on the internet (link) that, while updating Drupal, we can skip minor and patch updates in between. But the release notes for 8.6.2 (link) says sites running Drupal 8.5.X should first update to 8.5.8 and update to 8.6.X later.

Does this mean I should first update to 8.5.8 and then to 8.6.3? Or can I directly update to 8.6.3?


texts: Why might the user's email address not show up in Views Send or as a Token?

texts:
I have set up a User view, with User: Email as one of the fields (the others are username and some text fields) .  The email address of each user shows correctly in the view, either formatted as text, or as a link.

I was hoping to use Views Send to send an email from that view.  When I tick the Views Send tickbox and click 'send email' the dropdown displayed against 'Field used for recipient's e-mail' shows all the fields in the view apart from the email field.

I tried pulling in another text field and rewriting that to show [user:mail] or [mail] as a Token, but the rewritten field is empty.

I've been all around the houses trying to work out why that field is not showing in the dropdown and I'm stumped.  Any help would be greatly appreciated.


texts: how to get uri of an image field in a views_view_list twig template using drupal 8?

texts:
I have a twig template generated from views-view-list.html.twig!
Its a view uses ECK entities.

Available variables:
- attributes: HTML attributes for the container.
- rows: A list of rows for this list.
  - attributes: The row's HTML attributes.
  - content: The row's contents.
- title: The title of this group of rows. May be empty.
- list: @todo.
  - type: Starting tag will be either a ul or ol.
  - attributes: HTML attributes for the list element.

I would need to access the image field of my eck entity (field_background_image) in this template, because it is necessary for the slideshow logic to display the thumbnail. I tried a lot of different ways.

This is how my template looks like

    <{{ list.type }}{{ list.attributes }}>

      {% for row in rows %}

{{ row.content }}

      {% endfor %}

    </{{ list.type }}>

I can access the title property this way (is there a better way?):

{{ row.content['#slider'].title[0].value }}

I would like to access the field_background_image property of my entity.

row.content['#slider'].field_background_image[0] is a Drupal\image\Plugin\Field\FieldType\ImageItem.
I would need to get the uri value of the field_background_image field so that I can use the ImageStyle on it:

ImageStyle::load($imageStyle)->buildUrl($imageField[0]['#item']->entity->uri->value)

I don't find this in the tree..


texts: Best Practice: Remove UUID or default_config_hash from Custom Content Type definitions?

texts:
When I'm exporting the custom content type definitions using the UI, many of the resulting YML files hold a uuid and default_config_hash, like:
uuid: b69d8e54-076c-4a15-a396-19f49369fa68
...
_core:
  default_config_hash: 3aSvUp4PtrivflrkaLdNRL1USkZLsS7NdQroSiRX9mA
...

Now, when I'm using this as a basis for my custom module, is it recommended to remove those lines?


texts: fetching taxonomy tree from database from query

texts: I add a vocablary named "product sub categories" and I want to fetch the whole tree structure from datebase through query? Can anybody can help me?


texts: I was wondering how to make "custom fields" in Drupal 7?

texts:
I want to have a extra input field, called "URL" when adding content in drupal admin,
and then print that out in the template if something was inserted there.

My guess is that custom module is needed, but that's how far I got, as I have no idea what hook I need to use and how.
Or am I trying to solve this the wrong way?


texts: I have added a 20% vat on my products. This is added during checkout. How can I add it to the display price when you view the product?


texts: Render taxonomy type custom fields individually

texts:
I'm kind of a twig newbie so I'm hoping that someone can point me in the right direction.

I've added a custom field field_url to a taxonomy type called field_type_poi. How would you render that taxonomy type's individual field in node.html.twig?
I know that I can use {{ content.field_type_poi }} to render the entire contents of the taxonomy type, but I'm looking for a way to render one field specifically.


texts:
I try to setup a Centos 7 enviorment in order to install Drupal 8.
I have followed a few tutorials like these ones:

http://orangeweb.com.au/installing-drupal-8-centos-7

http://www.linuxtechi.com/how-to-install-drupal-8-on-centos-7/

Every thing goes well until I try to install the drupal site.
when I try to install it, I get an error massage that Drupal requires a higher PHP version (5.5.9 or higher).

when i try to update the PHP version to 5.6 (according this tutorial). I still get the same error.

writing php -v on the terminal I see that the php version is now 5.6.
but when i upload a phpinfo(); file to the server I still see that the version is still 5.4.

why in the phpinfo I still see the 5.4 version?


texts:
i have a simple function to return 404 on some content-type

function module_type_node_view($node, $view_mode, $langcode) {
  // variables
  $type = $node['#node']->getType();
  $userRole = \Drupal::currentUser()->getRoles();
  // if is events2/subsidiary
  if(($type === 'events2' || $type === 'subsidiary') &&
  (in_array('anonymous', $userRole))) {
    throw new NotFoundHttpException();
  }
}

But if i run drush cron i have this error:

Symfony\Component\HttpKernel\Exception\NotFoundHttpException:  in module_type_node_view() (

The crohn is performed anonymously, I have no way to create an exception


texts:
I need to remove "Create new account" from the tabs on /user page.

I was suggested to use hook_menu, but:

It seems that hook_menu can only add, not remove items.
hook_menu does not work for me as I described in Why my hook_menu does not work?

Further: I've found that there is also hook_menu_alter hook. But it does not work for me also. I created the following function for testing:

function cleanetica_advanced_menu_alter(&$items) {
    $items['user'] = array(
       'title' => 'blogs',
       'description' => 'Listing of blogs.',
       #'page callback' => 'blog_page',
       'access arguments' => array('access content'),
       'type' => MENU_DEFAULT_LOCAL_TASK
     );
    //$items = array();
}

I see no changes in /user page after I have added this function into the module,


texts: Add body class to both Node add and Node Edit Page

texts:
I want to add a Body class to my Node Add pages and my Node Edit Pages.

How can I do this?

I know that I need use the following in template.php to add a class to Node Edit:

function MYTHEME_preprocess_html(&$variables) {
     if (arg(0)=='node' && arg(2)=='edit') {
      $variables['classes_array'][] = 'node-edit-page';
    }
}

But how can I modify the code to work with node add?

Note: Node Add is when you create a node (e.g. yousite.com/node/add/page).

Node Edit is when you edit an existing page  (e.g. yousite.com/node/1/edit)


texts: Theme Preprocess Conditional Field Display

texts:
Looking for a way to preprocess two fields. I am trying to hide Field 1 from display if Field 2 has value.

If Field 1 has value and Field 2 has value display Field 2 only.
If Field 1 has value and Field 2 has NO value display Field 1.

This should only apply to content type USER POSTS. And I am using Display Suite to arrange the fields if that makes a difference.

What would be the preprocess hook to place on mytheme.theme?

Any help is greatly appreciated.


texts:
In my project I have companies, which are taxonomy terms, which can create invoices. Users and companies are a many-to-many relationship. I'm able to control access to the invoices using tac_lite, but I've searched everywhere and can't find how to control access to the term page (/taxonomy/term/%). I want users to be able to see a list of their companies and a detailed page of each company, while denying access to other users' companies. Can I do that with tac_lite? If not, how can I approach this? Sorry if this is not the right place to ask and if this is an obvious problem, I'm new to Drupal.

Thank you


texts: How to set up a trial-based account for users on an ubercart site?

texts:
I want to set up a trial based account for an user who will sell his products. After he paid the payment, i will upgrade him to role seller.

Until his role is upgraded to role seller, i don't want to show add to cart button for the added products.

First of all how can i differentiate it to be a trail site for example. 30days until he pays, if not i want the role to be expired. How can i do it. Any suggestions will be helpful?


texts:
I'm attempting to use queries within a block plugin to avoid using views for performance purposes.

namespace Drupal\my_plugins\Plugin\Block;

use Drupal\Core\Block\BlockBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Entity\Query;

/**
 * @Block(
 *   id = "basic_text",
 *   admin_label = @Translation("Basic Block")
 * )
 */

class Basic extends BlockBase {

    /**
     * {@inheritdoc}
     */
    public function defaultConfiguration() {
        return array(
            'bodytext-submit' => $this->t('Enter text here'),
            'layout' => array('pane-type-submit' => 'box'),
            );
    }

    /**
     * {@inheritdoc}
     */
    public function blockForm($form, FormStateInterface $form_state){
        include 'StyleForm.php';

        $form['bodytext'] = array(
          '#type' => 'text_format',
          '#title' => $this->t('Block contents'),
          '#format' => 'full_html',
          '#description' => $this->t('This text will appear in the block.'),
          '#default_value' => $this->configuration['bodytext-submit'],
        );
        return $form;
    }

    public function blockSubmit($form, FormStateInterface $form_state) {
        $this->configuration['bodytext-submit']  = $form_state->getValue('bodytext');
        }

    public function build(){
        $query = \Drupal::entityQuery('node');
        $nids = $query->execute();
        return array(
            '#type' => 'markup',
            '#markup' => $this->configuration['bodytext-submit']['value'],
        );
    }
}

I ultimately want to be able to perform a query and display a list of nodes that fulfill a certain requirement. As a test I performed an empty query for all nodes without displaying any of the results. But when I add

$query = \Drupal::entityQuery('node');
$nids = $query->execute();

to the build() function. It makes it so I can't render the block. I would like to be able to perform entity queries and display the results within the block.


texts: How can I keep the files uploaded by filefield module even though users delete them on node edit form?

texts:
On my site users can upload photos by using CCK image field.  However I would like to keep the  images uploaded by users on the server even though users delete them on node edit form.

I'm not sure if this is possible or not..  Or backing up the images frequently is the only way?


texts: Form elements created with AJAX aren't sending values through form_state

texts:
I've created a AJAX block form that allows a user to specify the number of fields they would like to have available. like so

    $form['columnNum'] = [
        '#title'   => t('Number of Columns'),
        '#type'    => 'select',
        '#options' => [
            1         => '1',
            2         => '2',
            3         => '3',
        ],
        '#default_value' => $this->configuration['columnNum'],
        '#empty_option'  => t('-select-'),
        '#ajax'          => [
            'callback'      => [$this, 'columnCallback'],
        ],
    ];

    $columns = $this->colFieldGen($this->configuration['columnNum'], $this->configuration['columns']);

    $form['column_wrapper'] = [
        '#type'       => 'container',
        '#attributes' => ['id' => 'column_wrapper'],
        $columns,

    ];
return $form;

the colFieldGen form, generates the number of fields like so.

public function colFieldGen($num, array $config) {
    for ($i = 0; $i < $num; $i += 1) {
        $numTitle    = $i+1;
        $columns[$i] = [
            $i             => [
                '#type'       => 'details',
                '#title'      => t('Column '.$numTitle),
                '#open'       => FALSE,
                'columnTitle' => [
                    '#type'      => 'textfield',
                    '#title'     => t('Column Title'),
                ],
            ],
          ];

And below is the callback.

public function columnCallback(array&$form, FormStateInterface $form_state) {
        $response = new AjaxResponse();
        $columns = $this->colFieldGen($number, $this->configuration['columns']);

        $content = [
            '#type'       => 'container',
            '#attributes' => ['id' => 'column_wrapper'],
            $columns,
        ];

        $response->addCommand(new ReplaceCommand('#column_wrapper', $content));
        return $response;
    }

I'm using the replace command to replace the fields that were present in the container, with a set of new fields. However any of the data in the new fields aren't sent through form_state. Fields that existed already like $form['columnNum'] are sent through $form_state just fine.

Is there a way to see values of ajax created form elements in $form_state? Or is there a better way to do this entirely?

NOTE: This is all being performed in a blockForm if that makes any difference.

UPDATE:

I changed the field generator to be based on a form_state variable like so

if (empty($form_state->getValue('number'))) {
    $form_state->setValue('number', 1);
}

$columns = $this->colFieldGen($form_state->getValue('number'), $this->configuration['columns']);

and then in the AJAX call performed this

public function columnCallback(array&$form, FormStateInterface $form_state) {
    $form_state->setValue('number', 10);
    $form_state->setRebuild(true);
    return $form;
}

But the form never rebuilds with the new amount of specified fields. I receive the progress animation on change, so I know something is firing. I just get no results. To see if the form was attempting a rebuild I added

if (empty($form_state->getValue('number'))) {
    $form_state->setValue('number', 1);
} else {
    die($form_state->getValue('number'));
}

to have the form fail if the form_state already exists but it never dies.


texts: Defining hook_menu() paths for specific base URLs

texts:
I have a multi-site; each site has its own database but they all share the same codebase. I would like to know if there is a way to define hook_menu() paths at specific base URLs.

Being it a multisite, I have created a common module used by all the sites. I wanted something like this in hook_menu().

 if (base_url == 'wmc.en') {
   $items['wmc/contact-us'] = array('hook menu stuffs');
 }
 if (base_url == 'gmc.es') {
   $items['gmc/contact-us'] = array('hook menu stuffs');
 }

I tried this type of code, but hook_menu() doesn't seem to recognize base_url or $_SERVER['SERVER_NAME'].

Is it possible to achieve what I am trying to do?


texts: how to found out if a custom hook_cron has been run?

texts:
what is the best way to find out if a custom hook_cron which runs automatically , has been run?
I did use drupal_set_message and watchdog but they weren't suitable for automatic crons.


texts: Zen theme created new region but it is not pushing other divs down when it has content added to it - css related

texts:
Hello i am currently using 7.23 core version of drupal and have a customized version of the zen theme that i am using, in my markup i have added my own theme region regions

[video]          = Featured video

the way my theme is setup i have 3 equal width columns

First sidebar | main content | second sidebar|

but what i am trying to achieve is something like this

First sidebar |------------Video ----------- |
First sidebar | main content | second sidebar|

i have achieved the look stated above the only problem now is that when i add content to the video region it will not push the main content and second sidebar  down accordingly.
any help with this is much appreciated i hope this doesn't get to much hate as i know its more of a css issue i think more than anything, thank you in advance!

.two-sidebars #content {
    float: left;
    width: 33.33%;
    margin-left: 33.45%;
    margin-right: -97%;
    margin-top:475px
}
/* Span 1 column, starting in 1st column from left. */
.two-sidebars .region-sidebar-first {
    float: left;
    width: 33.33%;
    margin-left: -1%;
    margin-right: -25%;

}
/* Span 1 column, starting in 5th column from left. */
.two-sidebars .region-sidebar-second {
    float: left;
    width: 33.33%;
    margin-left: 60.33%;
    margin-right: -100%;
    margin-top:475px

}
.two-sidebars #video {
    height:auto;
    float:right;
    background:#fff;
    width:63.5%;
    border: 1px solid #CCCCCC;
    padding-left:10px;
    padding-right:10px;
}

above is the following css for the regions


texts: force block module to load admin panel theme

texts:
I use diffident themes for admin panel and content pages. when I want to use block module, it loads my content page theme (made by me) and doesn't work correctly.

how can I force block module to display admin panel theme?

or maybe force it to display a specific theme?


texts: Is there a way to add field(s) to menu links in Drupal 8? Like an image field to output above certain links?


texts: Best way to test if a commerce price field has a value

texts:
So I have an entity called "Discount" with the following fields:

field_discount_percentage is an integer field.
field_discount_price is a commerce price field.

I can test whether the percentage field contains a value to avoid exceptions via:

if (empty($discount_wrapper->field_discount_percentage))

However this does not work for commerce price fields, as $discount_wrapper->field_discount_price is an object in itself and so the following is always true:

if (empty($discount_wrapper->field_discount_price))

Alternatively I tried:

if (empty($discount_wrapper->field_discount_price->amount))

However this produces an exception on zero values, and the following:

if (empty($discount_wrapper->field_discount_price->value()))

Which returns a PHP Fatal error as empty() can only take variables and not functions.

I am now resorting to:

if ($discount_wrapper->field_discount_price->value())

However this does not feel explicit and I was hoping there is a more conventional means to test price fields.


texts:
In drupal commerce, I would like to add booking feature if the product is not available for now. If the product is not available for now, I want to allow user to make booking of this product, I also want to reply email to user as soon as the product is available. Does drupal commerce support for booking? Any suggestion, pls!

Thanks


texts:
I'm trying to build a simple module that renders facebook like boxes for each article. To do that, I need to know full absolute path to article.

I have my views set up to show all published posts as content (teaser). But I would like to insert a custom markup after each item. For that I need to know nid, so I can build a link that leads to article. How can I do that?

Here is how my views is set up: http://i.imgur.com/bMHtzTo.jpg


texts: I have added users and want to display a list of members as a block in a space on Open Atrium. I have looked in menus and Open Atrium when trying to add content but cannot find anything that will allow me to do this?


texts: Image path all 404 after move my remote site to localhost

texts:
I just moved everything from my remote Drupal site to localhost (C:\xampp\htdocs\folder). All links (content images, menu links) are shown like http://localhost/sites/default/files/inline-images/magento.png when it should be http://localhost/foldername/sites/default/files/inline-images/magento.png.

Is there any quick method I can use to fix this problem like using mod_rewrite?


texts: How can I create some specific content with a cron job

texts:
I need to create a specific content, for instance, a Page, every 15 days.

Of course that goes into some cron job.

But how can I do that? Do I need to implement the hook_cron at my .module?


texts: Force initialization of custom field set in CiviCRM

texts:
I have created a custom fieldset "Social Profile" in CiviCRM which contains one Yes/No field "Publish my profile" that is set to Yes (value 1) by default. If i edit the fieldset in one contact, i can see my default value is working fine.

Then, I have created a membership page that allow people to become new members. When they fill the form a new CiviCRM contact is created. The form doesn't contains the "Social Profile".

When a new member register, the information Publish my profile is not initialized. After verification, it seems that the custom fieldset is not initialized for the contact - no data in civicrm_value_xx for entity_id = <NEW_CONTACT_ID>

So my question : Is there a way to force initialization of the custom field set for a new contact ?


texts:
I have created a configuration object which looks like:

message: 'Here we go!'
langcode: en

And I've created a form which allows me to change that message. However, I am not entirely sure how to work with translations for this message.

Ideally, I would want to display fields for each language in my module settings.
And how can I retrieve the translation for that message?

Currently I can grab that message using the following code, but I cannot figure out how it works with language translation, and how I could render a form for each language available.

  $config = \Drupal::config('my_module.settings');
  $message = $config->get('message');

How can I achieve what I am trying to do?


texts: Request::create is not working in EventSubscriber service class

texts:
Drupal 8 doesn't allows changing the current page in hook_init as we could do it in drupal 7 using following way :

$_GET['q'] = '/my-url';

But according to documentation we can do it using following way :

$request = \Drupal::service('request_stack');
$current_request = $request->getCurrentRequest();
Request::create('/my-url', 'GET', $current_request->query->all(), $current_request->cookies->all(), array(), $current_request->server->all());

But it still doesn't work.

Note: I have successfully converted the hook_init to EventSubscriber and other code is working fine.


texts: Display all nodes posted on a certain month and day between 1990 and 2014

texts: I want to display all nodes created on lets say, March 30 (between 1990 to 2014). Views contextual filters seems to display nodes posted on March 30 this year, how do i make the contextual filters include content posted on March 30 between lets say 1990 till 2014?


texts:
I have a switch statement in my content type tpl file for 2 different view modes:

<?php
switch ($view_mode) {
case 'full' :
?>

//content for full view mode here

<?php break;
case 'custom-display-mode' : ?>

//content for custom display mode view mode here

<?php break;
} ?>

How can I print the teaser view mode within full display mode? Can I print it out in the same way you can print fileds in a tpl file?

<?php
switch ($view_mode) {
case 'full' :
?>

//content for full view mode here
//********* also print teaser view mode here **********

<?php break;
case 'custom-display-mode' : ?>

//content for custom display mode view mode here

<?php break;
} ?>


texts: Drupal 8, make comment subject a required field

texts:
I am pretty new to Drupal and simply cant figure it out. I've set up a comment type for a content type. I want to use the default subject field as comment title and want to make it required.

I know, I could simply create a text field named "title" and make it required. But if I manage the comments in backend, there will always be (no subject) in the comments overview list. Is there any way to set it to required?

Thanks in advance!


texts:
I am trying to add an extra text field to the menu entity. My field is showing up and saving input but the input saves for all menus not just the one I entered the data for.
This is how it is now:
function myModule_form_alter(&$form, $form_state, $form_id) {
  if ($form_id == 'menu_edit_form') {
    $config = \Drupal::service('config.factory')->getEditable('myModule.settings');
    $my_field = $config->get('my_field');
    $form['my_field'] = array(
    '#type' => 'textfield',
    '#title' => t('Title'),
    '#default_value' => $my_field,
    '#weight' => '0',
    '#required' => FALSE,
    );

    $form['actions']['submit']['#submit'][] = 'myModule_menu_edit_submit';
  }
}

function myModule_menu_edit_submit($form, $form_state) {
  $config = \Drupal::service('config.factory')->getEditable('myModule.settings');
  $config->set('my_field', $form_state->getValue('my_field'))->save();
}

I need to save different data for each form, so I was trying to do change the submit function to:
function myModule_menu_edit_submit($form, $form_state) {
  $key = $form_state->getformObject()->getEntity()->id();
  $config = \Drupal::service('config.factory')->getEditable('myModule.settings');
  $config->set($key, $form_state->getValue('my_field'))->save();
}

If I do this though, when I enter the data in the field and save, it says updated successfully but the field is blank. Not sure what I'm doing wrong.


texts: How can I allow users to opt out of receiving e-mails with one-time login links?

texts:
So I have been working on an update to my site to allow users to log in via one-time login links when they receive a Private Message.  Unfortunately, this kind of feature recently has been in the news as a security issue, so I want to make sure that I give users a way to opt out.

The one-time login links are provided by the Login One Time module.  The e-mail notifications are provided by the Privatemsg module's PM E-mail Notify submodule, but ideally the solution would also work for e-mails sent by Rules, system e-mails, etc.

How I add the login link

In the PM E-mail Notify UI, in the body of the "You have received a new message" e-mail, I insert the following token:

[privatemsg_message:recipient:login-one-time]

and the whole link is:

[privatemsg_message:recipient:login-one-time]?edit[name]=[privatemsg_message:recipient:mail]

This provides the user with a one-time login link that looks like this:

  http://localhost:8888/en/login_one_time/1173/1377182743/RZCfB7uwKRB_bFVCeKPNwtOnDn2jFfGMO2FdaE_cpxI?destination=?edit[name]=useremail@example.com

(Note: the ?edit[name]=useremail@example.com part is a query string for the Prepopulate module which pre-fills the e-mail address on the login form in the event that the one-time login link has already been used.)

What I want to do

Add a boolean field to the user profile, "Do not send me one-time login links in my e-mail."
Somehow check the value of that field when sending e-mail notifications.

Is there a robust way to do this?  Here is what I have thought of so far:

Instead of using Privatemsg to send the e-mail notifications, attempt to create the notifications in Rules.  But if I do this, then I cannot use any of the nice Privatemsg configuration settings (such as allowing users to choose when they would like to receive e-mails, e.g. every time they receive a message, only once per sender, etc.)
I could somehow create a token that gives the one-time link if the user has not opted out or the regular link if the user has opted out. (I'm not really sure how to do this.)
I could hack the PM E-mail Notify submodule to do what I want.

Ideally, I want to do the following: if a user has opted out, I want to replace the one-time login link in any e-mail sent by the site with a link to the login form.

Note: My site is multilingual, and I am translating the e-mails sent with the site using the Variable and i18n modules.  So, any solution needs to be robust enough to handle multilingual e-mails.


texts: How to show a message to a list of article publishers using Rules?

texts:
I am trying to send a simple message to each user in a list of particular users (article publishers) on the site, using the Rules module.

More specifically:

Event: After saving new content
Condition: Content is of type: Article
Action: Load a user list with views (using Rules Bonus pack - user list of article publishers)
Action: Loop (above user list)
Loop action: Show a message on the site

But with above configuration:

1) the only user who's getting the message is the current article publisher and

2) the message is displayed x times where x is the number of users in the user's list.

Apparently something is missing and/or the rule has mistakes.

Can anyone help?


texts: Automatically generate product variations

texts:
I'm creating a webshop with Drupal Commerce.

I have a product variation called T-shirt. It has three product attributes, color, size and print.

My problem

Let's say I need a T-shirt with 5 different colors, 5 different sizes and 5 different prints. Then I need to enter 125 product variations manually in the Admin UI.

What I need

I need to be able to automatically generate those product variations, since it takes extremely long time to create them manually.

It should be possible to enter the default price for all the variations.

Am I the only one who has had the need to do this? I feel like this should be possible, but I can't find any help on how to do it.

I found this thread, but it says that the functionality has been made in the Commerce Bulk module. I tried to install that module, but I can't find the option to bulk generate the product variations.

Have any of you tried this before, or know how to do it?


texts: Selecting correct entities and fields in Rules

texts:
I am using the Rules interface to set up some rules about a booking site I am building. (using AGReservations+Ubercart in Drupal 7)

I have a field called Duration which is part of an entity called Reservation, which is itself is part of Ubercart's Order entity. I am having trouble getting my conditions to fire on the value of Duration, because there are many different entities and I am not sure if fields bundled with Entities are entities themselves, or how to pull the values out so that I can run my conditions and have the desired action.

Is there any module or tutorial to simplify this process? Something that makes it easier to know what kinds of data you have rather than plain trial and error?


texts:
I'm using Salesforce suite & Salesforce webforms to map fields between Drupal and Salesforce. I can map every field type except the 'lookup' type because I don't have that as an option. Can I get a solution to it?

Thanks,

Suby


texts:
Recently, we did a complete overhaul of our theme. We have been working with a subtheme of Zen. We are still working with one, but we made it from scratch. Though it is now in place, we are receiving "Page Not Found" errors with calls to the old css files. Has anyone experienced this before, where could they be getting called from?

I've checked to make sure no css file is importing them and no info file is calling them.


texts: webform save draft after each field update - ajax error for anonymous user

texts:
I wanted to save webform's draft after each field's update, and i did it with help of this post: Webform save draft after each field update .

But it is only working for logged in user, if i try it with anonymous i get ajax error

"An AJAX HTTP request terminated abnormally.
Debugging information follows.
Path: /system/ajax
StatusText: n/a"

Does anybody have any idea why is this happening? thank you ..


texts: How do I convert a database from MyISAM to InnoDB?

texts: I am going to convert all the tables of 500MB database from MyISAM to InnoDB to see whether it will improve the overall performance of a busy Drupal 6 site. I am wondering what is the best (i.e. safest/easiest/fastest) way to do the conversion.


texts: How to uninstall the Service links module?

texts:
I had a hard time with the Service links module (version 7.x-2.1) in Drupal 7. All the harder that links showed for some articles and not others. So while testing and trying to figure out how to configure, it took some time before I realized there were some issues in it.

Anyway, icons are poors, and I replaced it by the Easy Social module, which is quite fine for me and such a pleasure to configure as it is so easy and understandable.

The issue I have now is to remove the Service links module: I could disable it, and it remains listed as part of the modules (actually there is quite a bunch of modules in Service links). But then when I go to the uninstall tab, it does not show up.

I tried the module widgets on top of Service links to see if I could better configure the display of the links, but it didn't help. And I can't remove it either. My install is quite new and clean.

Any suggestions about how to uninstall the Service links module?


texts:
I'm working through the second post in this thread, so I can call a custom method from jQuery.
https://stackoverflow.com/questions/4834132/how-to-pass-jquery-variable-to-drupal-ajax

(I already have a html form, so the Forms API doesn't really help me)

The post mentions a menu_hook, but always describes the hook, as belonging to a module. I only plan on adding one method, so I don't really want (or know) how to create a module from scratch.

Is it possible to add the menu hook to my template.php, or another file which already exists?


texts: Drupal 7 adds a new 'weight' option to drupal_add_js so that you can control the order in which Javascript files are added to the page. Is there any way to do this when adding Javascript in .info files?


texts: When reimplementing Drupal.tableDrag.prototype.dropRow(), how do I access classes of would-be parent?

texts:
Using code below, I can access classes of a row that's being dropped:

Drupal.tableDrag.prototype._dropRow = Drupal.tableDrag.prototype.dropRow;
Drupal.tableDrag.prototype.dropRow = function(event, self) {
  console.log('dropRow');
  console.log("feature-group: " + $(self.rowObject.element).hasClass('feature-group'));
  console.log("feature: " + $(self.rowObject.element).hasClass('feature'));
  if ( /* use classes here */ ) {
    /* return custom result here */
  }
  /* fallback to default here */
  return self._dropRow(event, self);
};

But now I don't want to test classes of a dragged row, but ones of a row that would be a parent. How do I do that?

To clarify: I need tabledrag parent, not DOM parent. All tabledrag rows are DOM siblings, and I need the row with ID field value equal to the would-be Parent ID field value (class="parent") of a dragged row.

Something in JavaScript sets the parent ID properly, during either drag or drop (can't tell), so I'm sure there is a way. I just don't know how to find it.


texts:
I have two submit buttons in two field .
My problem is that if I press ENTER from the field 2 of textfield , Submit 1  gets triggered instead of trigger submit 2.
but submit handler works perfectly for both submit button when it is clicked.


texts: Verify a node with a given node ID exists

texts:
I created a module that receives the node ID from the form. On form validation, it needs to verify a node with that node ID exists.

How can I verify it?


texts: How to override theme for quicktabs which actually renders a view

texts:
In D8, I want to display a view through quicktabs. For this, at first I have created a view file and call the view through QT. The view is displays well through QT. Now, I want to change the look & feel of the view. Please look into the screen of view which I've created before.

Now, based on the below theme suggestions I created the file block--quicktabs-block--gallery-tab.html.twig to override and place it under the "templates" folder in my theme.

When I write something fixed like "Hello Test" in the block--quicktabs-block--gallery-tab.html.twig, its showing well. However, when I tried to do something dynamic coding like below, nothing appeared.

{% if title %}

{{ title }}

{% endif %}
{% for key, row in rows %}
  {% if key in rows_with_tabs %}
    {{ tabs }}

  {% endif %}
  {% if key in rows_with_page_starts %}
    {% for page_key, page in rows_with_page_starts %}
      {% if key == page %}

 0 ? ' quicktabs-hide' : '' }}" id="quicktabs-tabpage-{{ quicktab_id }}-{{ page_key }}">
        {% set page_number = page_key %}
      {% endif %}
    {% endfor %}
  {% endif %}
  {{ row.content }}
  {% if key in rows_with_page_endings %}
    {# close .quicktabs-tabpage #}

  {% endif %}
  {% if key == last_index %}
    {# close .quicktabs-main #}

  {% endif %}
{% endfor %}

Am I overriding the correct file? Any suggestion?

PS:
after implementing the template file as said above, the suggestions looks like:


texts: Call a custom module's function from template file

texts:
In the same context that this question, I want to add a link to a function in my custom module from a template file.

Something like this:

In my template file: Action

In my custom module

function my_function($id){
//update data base
}


texts: Views exposed filter to take multiple values

texts:
I'm running a D7 system and have a requirement where I want user to be able to pass multiple values in one of the exposed filters.

I've got hundreds of nodes called 'group' and I want user to be able to pass multiple 'group' names in order to filter results.

is this possible?


texts: Drupal load form with ajax callback in Bootstrap modal

texts:
I need to load a form into a 'bootstrap modal dialog' which will submit data via ajax callback to callback function.

The form display properly when the modal dialog is launched:

The menu 'document/share call the function 'modal_share()' that display the modal content

...
content
...

Within this function modal_share(), a form is called for render:

function modal_share($fid) {

$f = drupal_get_form('modal_share_form',$fid);
....
....
echo
 .... ".drupal_render($f) .".....

}

So far so good and the modal is correctly output with the form 'modal_share_form' as per below structure:

function modal_share_form($form,&$form_state,$fid) {
form['share_list'] = array(
  '#type' => 'select',
  '#multiple' => TRUE,
  '#options' => $option ,
  '#title' => t(""),
  '#description' => "",
  '#required' => false,
  '#default_value' => $default

);

$form['share'] = array (
        '#type' => 'button',
        '#value' => " ".t('record')."",
        '#ajax' => array(
          'callback' => "modal_share_form_submit",
          'wrapper' => 'shareMessage',
          'effect' => 'fade',
          'method'=>'html'
        ),

        '#id' => 'modalsharebutton',
);
return $form;
}

Now the problem is the the #ajax function in the button is not rendered by drupal as it should.

the html rendering is:

<button id="modalsharebutton" class="btn btn-primary form-submit" type="button" value="record" name="op">

without the "ajax-processed" class attached

The thing is that if I load the form on a main page ajax function is rendered properly.

So my conclusion is that when building the form for modal, it is not going through the proper ajax build process...

But I can't see the solution.

Thanks for help.


texts:
I have created a menu with items and one item has second level. So I created child links.

The problem is that the item which has second level links to some page and I would like to make it to link nowhere. It would be only collaps/expand link that shows or hides the child links.

I have found only possibility to set the link as <front> but this does not make what I want. Is this possible in Drupal 7?

OK, I found some modules the could help, Menu block and Nice menus but it seems that my problem could have some easier solution. How would you solve it? With some javascript?

thank you


texts: A text field is being added to the facet

texts:
I have a text field,whose value when filled,is added to the facet (using Search api and facet api).How can I prevent it from not being added to the facet?I want to index it but not being added to the facet.
Thanks


texts: Change content of email verification email based on gender provided by user

texts:
In my website when a user submits the registration form and email verification is sent to them. Is there a way to change the content of the verification email that is sent after the user submits the registration form based on the gender they have selected. I'm trying to make a separate emails for male and female users.

The default email provided by Drupal says

  [user:name],

  Your account at [site:name] is created. You may now log in by clicking
  this link or copying and pasting it to your browser:
       [user:one-time-login-url]

  This link can only be used once to log in and will lead you to a page
  where you can set your password.

  After setting your password, you will be able to log in at
  [site:login-url] in the future using: username: [user:name]
  password: Your password

  --  [site:name] team

I want to change this. For example if the user selects "Male" for gender in the registration form so instead of [user:name], it says "Hey Boy!" and if the user selects "Female" in the registration form the email says "Hey Girl!".

Is it possible to make that change?

Thank You.


texts: How do I detect if Twig is in debug mode?

texts:
I have set Twig to be in debug mode in  the development.services.yml file. I would like to alter the behaviour of a custom Twig function, based upon debug being enabled or not.

Is it possible to detect if Twig is in debug mode from the Twig_extension object?


texts: how to redirect to another site but still have same url

texts: Is it possible to have an entire path from a drupal 7 site , eg. /externalpaths  which will go to an outside application, yet still have the same domain name in the url, so that it looks like you have not left the drupal site ?


texts:
I would like to add a custom webform confirmation page that displays form submissions and then subsequent conditional markup.

Background
Ten question webform (assessment). User answers the questions. I'd like the confirmation page to display (on a per question/answer basis) a certain snippet of text.

Example below.
Question 1: If user answers XX, display certain snippet text OR if user answers A, display a different snipper of text.

Question 2: If user answers XX, display certain snippet text OR if user answers A, display a different snipper of text.

I've researched Webform Conditional Confirmation Messages module, but you it seems like you can only do a conditional confirmation based on a collection of answers and not individual answer values.

I was thinking of writing a php page that would pull all of the necessary fields and values and then redirecting the user, but that seems like overkill.

Thoughts? Any modules out there that can this?


texts: Drupal use Node or not? And how to use them?

texts:
I'm on the way to develop a website for a kind of a sport-league where we have every year one season with different teams.
A team can be built out of two Users and they can play against other teams. There will be a kind of different Leagues (depending on how good they are..)

So my question is now, how to implement this? :P (Of course this is nit the main question, but I need some hints for my drupal-start :)

In drupal there is this concept of "Nodes". As I understood, a Node is a Content. And depending on the NodeType it is shown different.

How should I now implement for example a "Game". To the beginning of a season the site will create all the game-records. During the Season the users will enter the results into this game-records. They can write comments and probably rate the game.

For the edit-page I'm going to write my own module (guess this is the right path to go..) same I'll do for the rankings.. this should work! But how can i combine this "Node"-Concept with my "Database"-Concept I've learned before I get known to drupal?

Is it then possible to hide a specific Node-Type from Administration -> Content? I do not want to see there all the Games played during the last 10 Years as this would be quite a big list...

Any help/idea/hint would be very appreciated :)


texts: Looking for "Edit own Blocks" permission?

texts:
It would be very useful for me to have something like "Edit own Blocks" permission.

As administrator (user 1) I created some blocks in a site. I also gave permission to create new blocks to other role users.

Then these user now can edit and delete my blocks. I need them to be able to create their own block but not to edit nor to delete mines.

I tried with the https://drupal.org/project/block_access modulen which does the job but it adds a lot configuration stuff in every block which I just see "too much" for what I need.

Any other way to do this?


texts: How to create a new entity that is fieldable

texts:
I am currently learning how to create entities in Drupal 7. I have successfully defined a new entity and made it fieldable. My question is how do a create a new instance of that entity? I understand that if I want to create a form in a normal module I use the field API to create the form to collect the information that I want. Since the entity is fieldable, I am assuming that there must be a function that creates the form for you based on the form elements that you have defined. I mean that would make sense considering the field definitions are stored in a consistent format in the database so it would stand to reason that a function could be created to automate the process of creating the form from that information. I assume this is what happens when you create a new article that has had fields added to it.

Does anyone know what this function is or what the proper procedure is to accomplish this task?


texts: How can I export my translation changes?

texts: I am using Core Module Locale in Drupal 7. What is the easiest way to export just my language changes? How do I find out which strings have been modified?


texts:
I want to truncate the table 'watchdog' once a day.

So I heave:

to set the maximum rows number from the 'Logging and Alerts' (of Site Configuration) to 1000
create a crontab on my system to run the root/cron.php once a day

But I can't understand how the process goes. The crontab calls the cron.php . What is the process next?

I see the file cron.php includes the bootstrap.inc. Why is that?

Where is the actual code with the mysql queries (truncate) inside?

I need to understand the process to make some changes to a site.

I have googled it enough and have not find any information.


texts: Migrate D2D UI - Source field missing from dropdown menu when editing field mappings

texts:
I got an PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value error on one of the fields for a content type that I'm importing from a D6 site to a D7 site, and the import of all those nodes is failing. I looked at the field on the Field Mappings page, and found that the field is not in the Source dropdown menu, and therefore cannot be mapped. I think this is why the import is failing. The field exists in both the source D6 database and the destination D7 database.

How do I get Migrate D2D to recognize this field so that it appears in the field mappings menu?


texts: How do I update a site after its installation profile is updated?

texts:
Say I decide to add a new module to an installation profile I've created and used to build a bunch of sites with.  Can I easily use Drush to update all of those sites to the latest version of the Installation Profile?

I've just recently started to grok installation profiles, but I'm not sure if they are useful after a site has been set up.  I manage 40+ sites at work, so this would be amazing if possible.

TIA.

Aaron


texts: Banner block (referenced by url) not displayed when using language extensions

texts:
I have a Banner View block that appears on pages using a reference url field.

When the url: thispage is entered in the reference field of the banner, it appears on domain.com/thispage.

Now that i enabled 2 other languages en + de this reference is not working. Entering the url with the language extension (en/thispage) neither.

I looked into the Views Block. Maybe some code needs to be added. The block has this code under Visibility settings:

<?php $nids=arg(1); $datas=node_load($nids); if ( $datas->type=='referenced' ) { return false; } else{ return true; } ?>

In the View under contextual filter there is some global php. This might be changed to match the path from other languages (de/thispage)

This is the code from Views:

$match_path = ltrim($_SERVER['REQUEST_URI'], '/');

$match_path=explode("/",$match_path);
$match_path=explode("?",$match_path[0]);
return $match_path[0];
//return $_GET['q'];

Any suggestions about how to resolve this?


texts:
I've looked at this post https://stackoverflow.com/questions/9578013/how-to-unset-a-js-file-from-a-drupal6-installation-doesn%C2%B4t-work-with-remove-sc and this one How can I remove Javascript files?

and I've tried to duplicated it, but it wont work. I am trying to unset the regular jquery version. I've added this inside my phptemplate_preprocess_page function:

$js = drupal_add_js();
  unset($js['core']['misc/jquery.js']);
  $vars['scripts'] = $js;

when I print out $vars, it looks like it worked, but the original jquery is still included!


texts:
with Apache Solr Views, I created a view with some exposed filters (a textbox, and a bunch of checkboxes on 2 taxonomy vocabularies) to satisfy very picky specs.

When a user launches a text search (with or without checking the box of some taxonomy terms), the taxonomy term's labels that match the results must be highlighted so the user knows which taxonomy terms he can use to narrow his search.  Also, the WHERE conditions must be OR, not AND.  I was able to do that by creating the same query that is used in my view using template_preprocess_views_view__viewname, checking the facet count of the response and modifying the $variables['exposed'] value to put in bold the labels of the taxonomy terms that had results. I couldn't use the response of the query passed in the function parameters because its facet count only takes into account the first 10 results ... I needed all of them.  I also modified the query in mymodule_apachesolr_query_prepare to change the query's WHERE condition from AND to OR.

So that works well enough.

Now I'm asked to, if a user launches a text search and he also checked the box of some taxonomy terms, to highlight the taxonomy term's labels as if the user had not also checked some taxonomy terms ... to let the user know in which taxonomy terms the text he's searching for was found, regardless of what taxonomy term checkboxes he selected.

So I created another query in template_preprocess_views_view__viewname and modified that query in mymodule_apachesolr_query_prepare so that it removes the filters on the taxonomy terms ... but the results of that query are always the same as the results of the first query I created in template_preprocess_views_view__viewname.  I did a quick search and found this issue for apache solr views module : Problem with multiple views (or displays) in same page https://www.drupal.org/node/1766254, which tell me that having multiple queries must also be problematic.

I applied the patches suggested in that issue but my queries still return the same result and I don't know what to do ... any hints or suggestions are appreciated.

Thanks !


texts: Stop Drupal Commerce automatically adding hyphens before product variations radio button labels

texts:
Using Drupal Commerce I have created product variations with attributes that correspond to my taxonomies. When I use radio buttons to allow the user to select a specific variation Drupal Commerce adds a hyphen to the start the radio button label. For example my taxonomy term is 'White gold' but the radio button label that is displayed is '-White gold'.

How do I stop these hyphens from being added?


texts: I got duplicated modules after updating an installation. How to remove them?

texts:
I have a site built using the Commerce Kickstart profile. Then there are enabled modules provided by the distribution at:

  profiles/commerce_kickstart/modules/contrit

and also there are modules which I added at:

  sites/all/modules

The distribution added some modules: colorbox, entity, etc. in its last version.

The problem is that I already had these modules at sites/all/modules.

The I got those modules duplicated at:

  profiles/commerce_kickstart/modules/contrit/colorbox

and

  site/all/modules/colorbox

I guess this is wrong. My question is which folder do I have to delete?


texts: Drupal fboauth module - how to get the friendlist of a user

texts: I have checked the friendlist field in configuration settings of the fboauth module. Now what do I do to get the friend list of the logged in user.


texts: How to implement access permissions per individual field and individual nodes?

texts:
I know there is https://www.drupal.org/project/field_permissions module, which allows to set field permissions per role, however what I need is to provide each individual field access permissions. As put on https://www.drupal.org/node/1376182

  It looks that there is no module allowing to restrict access to
  certain files / images per role. What I think about is having
  checkboxes beside each file/image where to select the roles to have
  view access to the according entry.

I can't believe this was not implemented before, so hopefully someone can point out a viable solution.

Edit: I've got couple responses confused about what I wanted, so I believe I have to elaborate little more.

Field Permissions set role permissions for the field across all the nodes. What I am looking for is role permissions for individual field PER NODE. For example, an admin for Drupal 7 site could edit node 1 and make the file attached to it viewable to role "subscriber", but that wouldn't change any permission for another file attached to node 2. I hope it is now clear.


texts: When to use drush_log() or drush_set_error()?

texts:
I just trying to show an error message with drush and I see that you can achieve this with

drush_set_error('NON_EXISTENT', 'Message');

and with

drush_log('Message', 'error');

In both cases you will see the same error message, I read the functions documentation but I can't figure out are the differences between they?


texts:
I'm using the Filtered HTML input format without a WYSIWYG editor.

When editing text, if I put some text onto a new line by hitting return, when I save its fine.

However if I add another line (so there is a space between the 2 lines of text) by hitting return twice, when I save this extra line disappears. How can I stop this from happening? Thanks

So I can do this:

1
2

But I can't do this:

1

2


texts: Multilingual site - Adding translation but keeping link to old site till everything is ready

texts:
There is a old Drupal 6 site(lets say www.oldwebsite.com), I am redesigning it in drupal 7(lets say www.newwebsite.com) from ground up and also on other server.

I know how to use i18n and locale module to add new translations. Currently new website is in English and language switcher is pointing to old website for translations which is on other server. I want to add new translations on new website but keeping it hidden till everything is ready meantime users will still be redirected to old server old website for translated site.

How can I achieve this? Language settings(admin/config/regional/language) does not allow to add two translation for same language. I want to have something like following,

www.newwebsite.com     : New D7 site in English
www.oldwebsite.com     : Old D6 site in English on other server. Not used any more.
www.oldwebsite.se      : Old D6 site in Swedish. Users directed from new site to here for Swedish translation.
se.www.newwebsites.com : Want to create this one but will keep it secret till its ready.

I have not worked on any translation setup before so I am feeling completely lost. Any help will be appreciated.


texts: I have a view of some content types set up. Is there a way to filter the view using the URL without using the actual values of the field?  For example, say I have content type with a field that can contain the state using the full name (i.e. Washington, Oregon, California).  I would like to use WA in the contextual filter, not Washington.  Is this possible?