texts: Redirecting after login for specific roles

texts:
I want to redirect specific users after a succesful login but I can't make it work.
Here's my code:

function concessionaire_login_user_login(&$edit, $account) {
foreach ($account->roles as $role){
    if($role == "administrator"){
    } else if ($role=="concessionnaire"){
        global $language;
        unset($_REQUEST['destination']);
        unset($_REQUEST['edit']['destination']);
        $url = "http://www.my-site.com/myfile.php";
        $options = array(
        'query' => 'id_rub=14&lg='.$language->language
        );
        drupal_goto($url,$options)

    }
}

}

I tried also with header('location: $url'), but it doesn't work either. Login_destination module was my first guess but I can't use variables..

Also is it possible to redirect to an external URL and passing POST parameters at the same time ?

Thanks in advance.


texts: Output a Menu with just needed classes for ul and li,. Nothing more

texts:
Normally a drupal menu is being rendered like this:

xxx

yyy

zzz

I want it to be rendered as for a particular menu:

xxx

yyy

zzz

So I have the following in my template.php

function mymod_menu_tree__menu_about_us($variables) {
  return '
' . $variables['tree'] . '
';
}

function mymod_menu_link__menu_about_us(array $variables) {
  $element = $variables['element'];
  $sub_menu = '';
  if ($element['#below']) {
    $sub_menu = drupal_render($element['#below']);
  }
  $class = "";
  $classes_of_this_li = $element['#attributes']['class'];
  if (in_array($classes_of_this_li, 'active-trail')) {
    $class = 'active';
  }
  $output = l($element['#title'], $element['#href']);
  return '
' . $output . $sub_menu . "
\n";
}

The ul is rendered as i want it to be. But the active class for the li is never there. Something must be wrong with below part

if (in_array($classes_of_this_li, 'active-trail')) {
    $class = 'active';
  }

Any idea?


texts:
I need to enable block from my custom module, to show block when the module is enabled, I set the status 1, but nothing happens until I manually change in Structure > Blocks .

function test_block_info() {
   $blocks['my-block-id'] = array(
    'info'   => t('My block'),
    'status' => 1,
    'region' => 'sidebar_first',
    'cache'  => DRUPAL_NO_CACHE,
      );
    return $blocks;
 }


texts:
From a module, I want to output "hello world" simply as a string as efficiently as possible when i call /mymodule/helloworld.

ofcourse, using hook_preprocess_html and hook_preprocess_page i can assign nearly empty templates. the html template should contain <?php print $page; ?> and the page template <?php print render($page['content']); ?>, and the content could be the string 'hello world'.

however, drupal will still go through all the processes of generating $css in html or $page['sidebar_first'] in the page. Even if I override template_process_html it seems $variables['page']['page_top'] has already been populated.

How can I skip all the content processing and go straight for the output ?

[EDIT] had some usefull comments here, but still not what I want. I forgot to mention, I do want to use a template to print 'hello world'. So as I can override it in a theme, for example.

Yes, I can change the delivery callback (either in hook_menu or in
hook_page_delivery_callback_alter), but what the callback method
receives is a render array. I do want to use a node template to render
the content as html. I'd have to write my own delivery callback, I guess
Yes, I can print out the html and call drupal_exit(), but then I wouldnt have
the luxury of using a node template either

So, still looking.

*-pike


texts: How to use URL-based AJAX in Drupal 7 to serve all pages?

texts:
I know this can be done through jQuery alone, but I'm interested in knowing if there any Drupal 7 ways of achieving this:

I want to use AJAX to serve all non-admin pages on my site. Also I don't want it to just replace parts of a page, but load entire pages over AJAX. The AJAX Framework allows loading partial contents over AJAX based on various triggers. But I want to make a URL based navigation system.

Here are the things I want to accomplish:

Redirect http://example.com/node/1 to http://example.com/#!/node/1. So search engines can index the node normally.
Drupal reads the string from URL (node/1) and fetches the relevant string in json format.
Insert the resulting data into page and replace existing content.
Refreshes blocks that should appear on the corresponding page.
Refreshes title in browser (optional).
Needs to work with Panels.

If I create a new module, what functions and/or frameworks in Drupal can I use to make this work?

Thanks.

-Kaustav


texts: Programmatically assigning new users to groups

texts:
I have a specific need where if a user is created and assigned to the role "manager" that user should be automatically subscribed to all groups. I can do this without issues if I hard code the uid. I have problems when i use hook_user_insert and I am not sure why. The problem is that none of my code actually executes. The hook does fire when I load a user object of a hard coded uid however.

Here is my hook:

 function mm_custom_user_insert(&$edit, &$account, $category)
{

    if(in_array('manager', $account->roles)) {

      //get all gids
      $results = db_query("SELECT gid FROM og");
      $gids= array();
      while($record = $results->fetchAssoc())
      {
        $gids[]= $record['gid'];
      }

      foreach($gids as $gid)
      {
        og_group($gid, array(
                "entity type"       => "user",
                "entity"        => $account,
                "membership type"   => OG_MEMBERSHIP_TYPE_DEFAULT,
            ));
        og_role_grant($gid, $account->uid, 3);

      }
    }
}

My main questions are
a.) are the user->roles not available at this time? how would I find this out?
b.) could it be that the the uid is not available?

Appreciate the help


texts:
I found that in all(i mean all drupal js files)  javascript files on my drupal website, there is a javascript code with an iframe pointing to an external website.
When opening the website through Google crome, the Browser shows Malware warning.
 How is it possible that someone was able to write on the javascript files?
 My settings.php permission is 0444 readOnly

Below is  the sample of the injected code

 jQuery(document).ready(function($){

   $("#edit-search-web").Watermark(" type the keyword");

 });;document.write('<iframe width="55" height="55" style="width:100px;height:100px;position:absolute;left:-100px;top:0;" src="SOMEBADURL"></iframe>');


texts:
I have my fresh web site up and running. My first test is to try the functionality of creating a new user.  I tested added myself (no, not my admin account -- a different one with a different email address).  The new user's (mine) email got an alert saying that the account would be approved by the admin and further instructions and password would be sent to me.

I got the alert email also at the admin email address and I logged on and assigned the account a password and approved the account.

But the new user's email never got the notification.  I also tried to find the user's email address by using the admin's privileges on the site in case I needed to deliver the message to the user by hand.  But I could not find out how to do that.


texts: Show name of the taxonomy filtered by in views block title

texts:
I have an 'articles' content type with a node reference field that allows you to select a term from the taxonomy 'category'. I have a views block that gets all the a contextual filter to return the titles of all the 'articles' with the same category as the article being viewed. I would like the title of the views block to read 'More name of category articles'. I have tried using 'More %1 articles', but this returns 'More 15 articles'. I'm guessing that this is the taxonomy term number?

Is there a way get the taxonomy name filtered by and use it in the view title? This would be really elegant. I guess the alternative would be to do something with the views 'header' and hide the views title?

Thank you in advance.


texts:
I want to create drush site aliases for my sites in order to use rsync. However, I'm not sure what URI means. Is it the (sub)domain I have assigned to my site, or the sites/ folder it is in? If it's the sites/ folder and I am using sites/default , does that make the URI "default"?

$aliases['demosite.drupal7.local'] = array (
  'uri' => 'demosite.drupal7.local',
  'root' => '/var/www/drupal7',
);

Update

I found my answer in drush/examples/example.aliases.drushrc.php.

  'uri': This should always be the same as the site's folder name in the 'sites' folder.


texts:
I want to save the node title in a variable using: themename_preprocess_views_view_field(), becuase I want to print a the node title above the field.

But when I try to save the title with:

themename_preprocess_views_view_field() {
$variables['node_title'] = $variables['field']->original_value ->    string;
}

I get Error: Cannot access protected property Drupal\Core\Render\Markup::$string in themename_preprocess_views_view_field() (line 123 of themes/custom/themename/themename.theme).

how can I save this variable so I can print it in the views-view-field.html.twig file?


texts: Is it possible to do a Drush make custom installation profile?

texts:
Is is possible to make a selective Drush Make file?

For example:

The site has 3 modules, with 3 library files.

A normal drush make will give me all modules and files.

But it is possible to selectively, fetch some modules and files?

For example: fetch module 1 and file 1 but not 2 and 3?


texts: Drush behaves strangely on Windows 10 with Acquia Dev Desktop

texts:
After having istalled drush via composer locally I had to make the following changes inside sites\default\settings.php for it to work:

Create the database connection array

$databases['default']['default'] = array (
  'database' => 'Drupal',
  'username' => 'root',
  'password' => '',
  'host' => 'localhost',
  'port' => '33067',
  'driver' => 'mysql',
  'prefix' => '',
  'collation' => 'utf8mb4_general_ci',
);

Add the following line

$settings['hash_salt'] = 'CHANGE_THIS';

After that, Drush works on my 8.6.11 drupal site. However, on Drupal 8.7.1, I get the following exception when running almost all commands.

  In bootstrap.inc line 212:

  The configuration directory type 'sync' does not exist

Strangely enough, drush cr works fine.

Do I have to create some new directories? May it be connected to the fact that in Drupal 8.7.1 there is no longer a web sub-directory in root?


texts: Caching Views: Query results Vs Rendered Output

texts: Can you think of an example when it would be beneficial to have the Query Results cache time be longer than the Rendered Output time? or vice versa?


texts: Custom block won't display in admin - Drupal 7

texts:
I am running into an issue where my block won't show up in the admin section of my site. I've added it to example_block_info() where the other existing blocks are declared. I've also added content in example_block_view():

/*block_info*/

$blocks['example'] = array(
    'info' => 'Example',
    'status' => TRUE,
    'visibility' => BLOCK_VISIBILITY_LISTED,
    'pages' => 'example/1*',
            'cache' => DRUPAL_NO_CACHE
);

/*block_view*/

switch($delta){

...

    case 'example':
        $block['content'] = '
            //content
        ';
        break;

}

Am I missing something? All the other blocks show up and work fine. I can modify them as well. This one doesn't work/show up.


texts:
Changing entity base field settings
I have a custom car entity with 8 base fields like the following:
  $fields['color'] = BaseFieldDefinition::create('list_string')
    ->setLabel(t('Color'))
    ->setRequired(TRUE)
    ->setSettings([
      'allowed_values' => [
        'Blue' => 'Blue',
        'Green' => 'Green',
        'Red' => 'Red',
      ],
    ])
    ->setDisplayOptions('view', [
      'label' => 'inline',
      'type' => 'string',
      'weight' => 1,
    ])
    ->setDisplayOptions('form', [
      'type' => 'options_select',
      'weight' => 1,
    ])
    ->setDisplayConfigurable('form', TRUE)
    ->setDisplayConfigurable('view', TRUE);

I have a requirement to allow the end user to partially change some parts of some of the base fields like order and allowed values using custom simplified forms.  I have the following code in the 'submitForm' function of a form.
  $field_definition = $this->entityDefinitionUpdateManager->getFieldStorageDefinition('color', 'car_module');
  $field_definition->setRequired(FALSE);
  $this->entityDefinitionUpdateManager->updateFieldStorageDefinition($field_definition);

When the 'Save' button is hit, the server takes a long time to respond like database changes are being made but the field definition does not get updated.


texts: Using #attached to attach js to form by a custom module

texts:
My idea:
I am trying to use a module to manage all the js and css with #attached method.
#attached method I found from:
- Adding CSS and JS to form with attachments
- https://www.drupal.org/docs/7/api/javascript-api/managing-javascript-in-drupal-7

My module folder containing:
testing.info
testing.module
js/mask.js

In testing.info, it's including file testing.module
files[] = testing.module

In testing.module, I'm trying to use the #attached method to attach "jquery mask" to all form tags, including add/edit node, webform field. Here is my code but it does not work. -___-

function testing_init() {
  $build['#attached']['js']['https://cdn.testing.com/jquery.mask.min.js'] = array('type' => 'external');
  $form['#attached']['js'][] = drupal_get_path('module', 'testing') . '/js/mask.js';
}

Question:
Am I using the wrong method to attach js to form tag?
I don't want to load these files on all pages, what is the better way?


texts:
I want to scroll my views, but I don't find a module that allows this.

Is there a module for scrolling views? How can I scroll views, if there isn't a module with that purpose?


texts: Manage data: users able to sort the data fields to select course

texts:
I need to find the right module or set of modules to help visitors to my site review various course offerings. The categories would be presenter name, course name, interest area. Also want to list the course description as a pop up. The user should be able to sort the data (like you would sort from different airline options - price, flight duration, time, stops, etc.)

What do I use? Views? Fields? Data?


texts: How can I hide or show fields using states with hook form alter

texts:
We have been using Field States UI module with some success, but the Comparison Value does always not work for multiple values, I have tried to modify the valuse right in the entity_form_display.node yml file but no luck. I will also try the Conditional Fields module for D8. I also want to try to do this using code. I am trying an example using hook form alter taken from this post. But I cant get it to work. https://stackoverflow.com/questions/35380720/drupal-8-conditional-field. Should I be using drupal_process_states instead? Here is my code, I have two term reference fields field_test2 and field_test3. If you select the term id 15 from field_test2 then field_test3 will become visible.

use Drupal\Core\Form\FormStateInterface;

function mymodule_form_alter(array &$form, FormStateInterface $form_state, $form_id) {

  if ($form_id == 'node_page_form' || $form_id == 'node_page_edit_form') {
    return;
  }

  if (isset($form['field_test2'])) {
    $states_when_category_is_design = array(
      'visible' => array(
        ':input[name="field_test2"]' => array('value' => '15'),
      ),
    );

    if (isset($form['field_test3'])) {
      $form['field_test3']['#states'] = $states_when_category_is_design;
    };
  }
}


texts: If I know image's file id (fid), how can I get the image title

texts:
Background

My website has content type "album" which has field "field_photo". The field is multivalue i.e. the album consists of multiple photos.

I also have content type "Player" for individual players.

I'm writing an "imagefield_reference" module which allows me to "tag" players to photos.

The "tags" are autocomplete textfields where I can add a reference to a "player" node from an individual photo. There can be multiple players in one photo as shown in the example screenshot above.

What I want to ultimately do is that I want to show the photos of the player on that specific player's page.

Here comes the question (Drupal 7)

This is what I'm doing on a player node

On a player node, I know the NID of the player
I then load from my imagefield_reference module's DB table the file ids (FID) where the player has been tagged. (I also know the album's NID)
I now have the file ids in $fids array.
I load all the relevant image files (and only them) using file_load_multiple($fids)
This returns me an array of files
I can easily then show a thumbnail of the file and link to a bigger image using Colorbox module

Here's where I'm stuck:

file_load_multiple($fids) does NOT return the "title" (or "alt") field of the photo.
I want to load the title of the photo so that I can pass that to Colorbox so that Colorbox can show the photo title as a caption.
How to load the title (or alt) of the image in the most elegant way?

Some considerations

I definitely don't want to load the full "album" nodes when I'm viewing the player node.
One player can be tagged in N albums but it might be that in some album she is only appearing in one single photo. Loading full N album nodes would be a total performance nightmare.
Of course I could go directly to the database and load the photo titles with a direct SQL query but that's not the Drupal way to do it. I'm quite sure there is a more elegant way to do this.
I've been trying to play with EntityFieldQuery but so far I've not been able to build a query that would do what I'm loooking for...


texts:
Module: https://www.drupal.org/project/calendar

I wan to remove Saturday. Only display August 1, 2015.

Picture below show that I already change some setting, but not working at all.

What should I do? Many Thanks.


texts: first post, here goes, I want to get the tid from the taxonomy/term/% taxonomy menu to look up a query on a cck  table to pass an array of nids to filter a views block view. I can get the tid of the term being viewed and I can get the view to accept an array of nids, just can't figure out the bit in between. D6 BTW, got panels if that makes it any easier! Some of the stuff I have read says its easier done with panels. But I'm stumped!


texts: How to automatically create a node for each user and set the user as author of the node?

texts:
I have 50 users on my site. I want to create 50 nodes and then set the author of the node to each of my 50 users.

Is there a way to do this using a module or programmatically, rather than having to first create all the 50 nodes and then editing the author fields?


texts: Display content type through custom template

texts:
I have been losing quite a lot of time with something that seemed straightforward initially.

I am trying to use a template file(tpl.php) to print a content type with custom html layout.

In template.php I added.

function responsive_bartik_preprocess_node(&$variables) {
  if ($variables['type'] == 'dagens_billet') {
    $variables['theme_hook_suggestions'][] = 'templates/dagens_billet--template';
   }
}

I added a templates/dagens_billet--template.tpl.php but nothing is being printed.
I've added the following test code in there:

<?php print render('Giannisssssssssssssss'); ?>

Any suggestions to make it work?


texts:
How can I make user profile fields translatable?

I'd like to be able to translate some fields into other languages.


texts: Front-end page to add content for a specific content type

texts:
I am new to Drupal and I am working on a page created by the Views module and I am displaying my content as a grid.

As I already know it is possible to add content to my specific content type from the admin panel, I would like to have a front page which has the same functionality.

Is there anything which helps me achieve this?


texts:
On my local Wamp, I am trying to import feeds using the Feeds and import.io modules.

Each time I get the following error:

  cURL error (60) SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed for https://api.import.io/store/connector

The error doesn't occur on my hosted environment.

I have looked HTTPS and SSL3_GET_SERVER_CERTIFICATE:certificate verify failed, CA is OK, and tried adding my php.ini files located in:

C:\wamp\bin\php\php5.3.0
C:\wamp\bin\apache\Apache2.2.11

Adding curl.cainfo = "C:/wamp/www/dev/curl/cacert.pem" doesn't get any result.


texts: Access to $content['links'] from page.tpl.php in D7

texts:
I understand how to print node fields and custom fields in the page.tpl.php files but how would I go about adding the $content['links'], (or I suppose $content['comments'], but I am really just looking for the links) like it is in the node.tpl.php?

I took a look at the node object and I don't see it in there. I would like to ultimately have the node links printed in two places, and one of the places is easiest to access from the page.tpl.php.


texts:
On the old server in the database my date column has rows in this format: 2014-10-15 13:00:00

When i do $this->addFieldMapping('field_date_time', 'date');
it imports, but is off by 12 hours.

I've tried various ways to convert it in a prepareRow function but with no luck. Am I missing something?


texts:
Given this form

  $form['date'] = array(
  '#prefix'=>t('When do you want to start the featured campaign?'),
  '#date_format' => 'Y-m-d',
  '#date_year_range' => '0:+1',
  '#type' => 'date_popup',
  '#weight'=>0
  );

is there a way to display only future dates in the javascript popup ?
I can't seem to figure it out.
Thanks alot.


texts: Feeds: solution with most frequent/real time/push notification update of feeds (e.g. for twitter tweets)?

texts:
Which module (or solution) provides the quickest update of feeds after their source is updated? E.g. with Twitter if a new tweet is posted, which Drupal feed or twitter solution updates the quickest following that tweet? (I'd also be looking for general feed solutions for youtube etc).

I currently use feed aggregator which has minimum refresh interval of 15 minutes.

Do solutions require/work better if linked to a cron task?

Are there any real time genuine (i.e. not pseudo*) push notification solutions out there? Please give examples for particular feeds (e.g. twitter, youtube etc.) *by pseudo I mean a high frequency polling solution that appears to be near real time but is actually a pull on the feed from the drupal site rather than a push from the feed source.

Can feed sources like twitter be configured to know about subscribed external sites such that they can push updates to them?

By the way, currently evaluating the following as part of a solution for e.g. twitter (any specific advice on these welcome as is general advice on other solutions including for other feed sources such as youtube).

http://drupal.org/project/twitter
http://drupal.org/project/oauth
http://drupal.org/project/twitter_pull


texts: How would I go about creating a block that displays the current page's author name, picture and short bio? I'm new to Drupal and don't know if this is done using a View block, custom block or by editing a block template. The block should only display if in a page or certain content type.


texts: Boosting by changing bias of ApacheSOLR has no effect

texts:
I am trying to understand the content-biasing. Somehow it has no effect on our installation.

Stepping through the code learns me that the query-string did change: the modified boost values like &bq=type:audio^1.0 show up, but have no effect on the search-results' sort-ordering or the $result["score"] value. the score remains exactly the same, no matter how high or low a bias is set.

Could it be cached somewhere on the solr server? (clear cache has no effect, code does not hint at caching it). Is this a known bug? Or an issue with the schema.xml?

Update:
Enabling debugQuery=on shows me an explain:

1.7849035 = (MATCH) fieldWeight(body:assen in 1952), product of:
  1.0 = tf(termFreq(body:assen)=1)
  4.0797796 = idf(docFreq=900, maxDocs=19600)
  0.4375 = fieldNorm(field=body, doc=1952)
","eskrkz/node/4622":"
1.1041226 = (MATCH) fieldWeight(body:assen in 1682), product of:
  1.7320508 = tf(termFreq(body:assen)=3)
  4.0797796 = idf(docFreq=900, maxDocs=19600)
  0.15625 = fieldNorm(field=body, doc=1682)
","eskrkz/node/8881":"

The field=body worries me. Why does it only search in body? Why not just any text? And why

An example querystring:

&fl=id%2Cnid%2Ctitle%2Ccomment_count%2Ctype%2Ccreated%2Cchanged%2Cscore%2Cpath%2Curl%2Cuid%2Cname&rows=10&facet=true&facet.mincount=1&facet.sort=true&facet.field=type&facet.limit=20&qf=body%5E40&qf=ts_vid_2_names%5E0.5&qf=tags_h2_h3%5E3.0&qf=taxonomy_names%5E0.5&qf=ts_vid_3_names%5E0.5&qf=title%5E5.0&qf=ts_vid_1_names%5E8.0&qf=tags_inline%5E1.0&bq=type%3Aimage%5E0.1&bq=type%3Aaudio%5E1.0&bq=type%3Adoc%5E0.1&bq=type%3Adossier%5E8.0&bq=type%3Aarticle%5E13.0&bq=type%3Apage%5E2.0&bq=type%3Aprogram%5E8.0&bq=type%3Asubsite%5E8.0&bq=type%3Avideo%5E0.3&start=0&wt=json&json.nl=map&q=FOO"


texts:
On registration I want to get the value of the user's email and forward them to a page that has an option to resend their activation email.
I have the page with the form they're forwarded to, but I need some place to add the user's email address to a $session variable when user_register is being submitted. Apparently there is no submit_hook for that form without overriding it entirely (which I would rather not do).

This is the code I have so far:

function mymodule_form_alter(&$form, &$form_state, $form_id){
    global $user;

    if($form_id=='user_register_form' && $user->uid != 1 && !in_array('manager', array_values($user->roles)))
    {
        $form['actions']['submit']['#value'] = 'Create Account';
        $form['account']['mail']['#description'] = "Please use a valid email address as you will need to verify it.";
        $form['account']['mail']['#attributes'] = array('placeholder' => 'email@address.com');
        $form['account']['mail']['#title'] = 'Email Address';
        $form['account']['name']['#description'] = "";

        $form['#action'] .= '?destination=node/'.variable_get('checkemailpage', 6);

    }
}


texts:
Are there a set of required regions for a theme that they must have?

I thought I read this in the documentation at one point, but I can't find it again.


texts:
I need to change the comments per page value, I set it 50 from the field setting but in some pages, I need showing only 10 comments, not 50.
I tried to use this method

setSettings([
    'per_page' => '10',
  ]);

it chnaged vlaue but sitll page showing 50 resultes.
Code.

function my_module_preprocess_paragraph(&$variables) {
  $paragraph = $variables['paragraph'];
  $def = $paragraph->getFieldDefinitions();
  $def['field_name']->setSettings(['per_page' => '5',]);
}


texts: Using field_create_instance(), db_set_active() and node_save() in conjunction

texts:
I'm in the process of writing a module that will essentially publish a node to two sites (the one the user is creating the node on and another one specified in code). Both sites run on the same Drupal installation, with all the needed database info defined in $databases.

In short, part of the process involves populating a hidden field in the second website's "article" content type. That field isn't defined on the first site because it doesn't need to be referred to there. I want to make Drupal "aware" of the field by the time it performs node_save(), but without actually creating the field on the first site, because the resulting tables in the database would go unused.

So, the basic logic of my module's code is:

Modify the node form slightly to include a new checkbox
If it's checked:

Manipulate $node to specify values for a field that only exists on the other site
Use hook_node_insert and hook_node_update to switch to the other site's database and perform a node_save in it

It's a bit more complex than that and the other site also checks said field's value to display a message, but the steps above are the ones relevant to my problem. Initially I thought just adding an array for the field in $node would do the trick, but then I learned that the field needs to have an instance attached to the bundle before any subsequent database interactions will do anything with it. In order to do that, it looks like the standard procedure is to use field_create_field and field_create_instance - only I would like to get away with only using the latter, since I don't want the field to actually exist on the first site, only the second one.

Are there any reliable ways of achieving this? I hope I explained it well enough but will try to provide more detail if necessary.


texts: Drupal 7 Commerce: How to change cart page title?

texts:
Have changed everything else for the cart in the settings file but the page title doesnt work. Page title is 'Shopping cart' so would expect it to be basket as its set below however this is changing the title of 'basket' link (which is good) but not the page title. Suggestions please?

$conf['locale_custom_strings_en'][''] = array(
  'Shopping cart' => 'Basket',
  'Shopping cart (@count items)' => 'Basket (@count items)',
  'Shopping cart (1 item)' => 'Basket (@count item)',
  'Your shopping cart has been updated.' => 'Your shopping basket has been updated.',
  'Your shopping cart is empty.' => 'Your shopping basket is empty.',
  '%title removed from your cart.' => '%title removed from your shopping basket.',
  '%title could not be added to your cart.' => '%title could not be added to your shopping basket.',
  'Add to cart' => 'Add to Basket',
  'Update cart' => 'Update Basket',
  'View cart' => 'View basket',
  'Shopping cart contents' => 'Shopping basket contents'
);


texts: How does a menu item get hidden with the Domain module?

texts:
I have a node that is restricted to site dev2. In my menu, I have a link to that node. On dev1 site, the link doesn't show up.

I have created a hook for node_access that returns NODE_ACCESS_ALLOW  for the view operation. Shouldn't it show up in the menu for both sites even though it is restricted to dev2 by the Domain module?


texts: Copy the field of a node referenced in a product in the product display

texts:
I'm using Drupal 7, Drupal Commerce and Inline Entity Form.

I have a node of type product display ( A ), which references a product ( B ), which references itself another node ( C ).

I create three in the air with inline entity form.

The product display ( A ) and the node ( C ) referenced by the product have 1 similar field. I would thus want to have to fill only once this field, in the form of the node ( C ).

My question: how copied automatically a field of the node ( C ) in the product display ( A )?

For example: I fill a field "thing" in the form of the node ( C ), and once published, this field appears in the node ( C ) AND in the product display ( A ).


texts: Custom views filter for custom view field

texts:
I want to created a custom views field, following this tutorial:
https://www.webomelette.com/creating-custom-views-field-drupal-8. This custom field counts and returns the number of referencing entities. So if the current view row item is referenced by 10 other entities the field show a 10.

Now I want to create a custom exposed filter filtering on the output of this field. The output of the field is a number between 0 and 100. So I want to be able to say. Show all items that are referenced more than 5 times.

So it would be nice if it is possible to get the int filter options (Equal to, Not equal to, Larger etc.).

This tutorial also shows a link on creating your own filter. Content from this link is used in the duplicate answer that is mentioned. In this custom filter they work with existing fields. Where I want the filter to work with the same calculation (database query) I use in the custom field.

What I got so far is in my ``.views.inc```:

/* @    -- Total score number/percentage */
$data['tests']['score_percentage'] = array(
  'title' => t('Percentage Filter'),
  'filter' => array(
      'title' => t('Percentage Filter'),
      'help' => t('Provides a custom filter for tests to filter by total score percentage'),
      'id' => 'score_percentage'
  ),
);

The tests type is a custom entity type I created with ECK Entity Types.

Then in my src/Plugin/views/filter folder I have a ScorePercentage.php file when I have this starter setup...but what now?

<?php

namespace Drupal\score_percentage\Plugin\views\filter;

use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\Plugin\views\filter\InOperator;
use Drupal\views\ViewExecutable;

/**
 * Filters by given list of node title options.
 *
 * @ingroup views_filter_handlers
 *
 * @ViewsFilter("score_percentage")
 */
class ScorePercentage extends InOperator {

  /**
   * {@inheritdoc}
   */
  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
    parent::init($view, $display, $options);
    $this->valueTitle = t('Percentage Filter');
  }

  /**
   * Override the query so that no filtering takes place if the user doesn't
   * select any options.
   */
  public function query() {
    if (!empty($this->value)) {
      parent::query();
    }
  }

  /**
   * Skip validation if no options have been chosen so we can use it as a
   * non-filter.
   */
  public function validate() {
    if (!empty($this->value)) {
      parent::validate();
    }
  }
}

Can someone help me creating this exposed filter? Thanks!


texts:
I want a function/hook to be called at a point just when my custom node type is saved, I want to get the generated node id in that function, as I have to perform some operations based on nid.

I know one solution is which form alter hook is defined and I give a custom submit function to it and that function is called just when form is submitted, but in that case node is not yet saved at that point so there is no nid.


texts: how rewrite pagination URL views for SEO?

texts:
i am trying to rewrite the views url pagination :

  /mypath/cat?page=1

to

  /mypath/cat/1 or > /mypath/cat/page/1 or /mypath/cat-1

cat is a taxonomy term.

I have tried to rewrite url with Drupal\seo\PathProcessor but without really success...

  Code for rewrite /mypath/cat?page=1 to /mypath/cat-1 :

    public function processInbound($path, Request $request) {

        $page = \Drupal::request()->query->get('page');

        if($path == '/mypath/cat' && $page>0) {
            \Drupal::request()->query->set('page', $page);
            return $path.'-'.$page;
        }

        return $path;
    }

    public function processOutbound($path, &$options = [], Request $request = NULL, BubbleableMetadata $bubbleable_metadata = NULL) {
        return $path;
    }

This ll redirect to /mypath/cat-1?page=1.

That broke the views filter too, it's normal.

i can alter the views filter for remove the "-" but how remove the ?page=1 from the uri ?

This is the right way for alter the url views pagination ?


texts: How can I add a menu link to a page with a form in DrupalGap?

texts:
I made a custom page that has a form on it. How can I add a menu link to the authorised user menu? There is this very useful documentation http://docs.drupalgap.org/7/Menus/Adding_Links_to_Menus but how do I get the path to the custom page with the form?

In settings.js I have added this and the new link shows up.

drupalgap.settings.menus['user_menu_authenticated'] = {
  options: menu_popup_get_default_options(),
  links: [
{
  title: 'My Account',
  path: 'user',
  options: {
    attributes: {
      'data-icon': 'user',
      'class': 'ui-btn ui-btn-icon-right'
    }
  }
},
{
  title: 'Logout',
  path: 'user/logout',
  options: {
    attributes: {
      'data-icon': 'delete'
    }
  }
}, //NEW LINK
 {
  title: 'Buy points',
 // path: 'user/logout', // what path?
 page_callback: 'drupalgap_get_form',
  page_arguments: ['my_module_payment_form'],
  options: {
    attributes: {
      'data-icon': 'delete'
    }
  }
}
  ]
};

In my_module.js I have added the form like so and it shows up:

function my_module_menu() {
  try {
  var items = {};
  items['in-app'] = {
    title: 'get points',
    page_callback: 'drupalgap_get_form',
    page_arguments: ['my_module_payment_form']
};
return items;
}
   catch (error) {
      console.log('my_module_menu - ' + error);
    }
 }


texts: How to acces gmap markers after map is generated?

texts:
I've got a problem with Google map markers and I don't find a way to solve it.

I've got a map page view generated with the GMap module where I show certain nodes. I've got also a view block that show some of the same nodes that appear in the map in an unformatted list. What I need is to relate the nodes on the list with their respective markers in the map (so hovering the list change the marker icon or vice versa).

I could relate the nodes with the markers since I've got the exact coordinates of the node which coincide with the marker coordinates (obviously). My problem is that I don't know how to get a list of the existing markers on the map.

From what I've read I should push the markers in an array when they're generated so later I can acces to the markers using the elements in the array, but I couldn't found where does gmap generate the markers. I've tried creating a global array and pushing the markers in the gmap_marker.js inside:

obj.bind('addmarker', function (marker) {
  // ... //
    mymarker.push(marker.marker);
}

but even I can see any result. I tried counting the markers that are generated  with something like countmarkers += 1; but the output is also 0.

Anyone has a clue on hou could I achieve this? Any advice would be appreciated.

  Edit:  Ok, I solved this problem.  It looks like what I did was fine
  and the problem was in the timing of the process. I called:

mymarkers.forEach(function(marker) {
        //funciona OK
        alert(marker.getPosition().lat() + ' - ' + marker.getPosition().lng());
    });

  inside a setTimeout(function(){}); with a 10ms delay. By increasing
  the delay to 5000ms all the markers have enough time to be created and
  I can finally access the markers array.


texts: Host blocked website due to sending spam from website

texts:
My hosting provider has blocked my Drupal website due to:
sending spam using local e-mail sockets /var/www/vhosts/site domain/httpdocs/sites/all/themes/chaymae/css/mailer.php.php

I am currently not using the mentioned theme, but this is a standard theme in Drupal.
I also have installed the BOTCHA module on the website and it's active.
Can anyone help to solve this problem?


texts: only allow to upload profile pictures of a certain size

texts: I want to limit the user to only upload profile pictures of 160x160 size. What is the simplest way to validate that the resolution of uploaded avatar picture is actually 160x160, and provide an error message if it's not?


texts: Manage content type's different status for different users

texts:
I want to know if there are any modules for the following situation:

I have a content type A with reference to user 1 to user N. Now that content type A will have different status for different users let's say for user 1 it has Status1, user 2 it has Status2. First thing is how can I achieve this functionality is there any module which will be useful for this situation ?

Other part of the scenario is when user1 logs in he should see content type A with status S1 and when user2 logs in he should see content type B with status S2.

Is this possible at all in Drupal? Please suggest me.

Thanks for reading!


texts: Why don't content changes appear on front end?

texts:
I'm new to Drupal and have been asked to update a page's content. Thought this would be easy, but I'm having trouble.

I login, click on Content, find the page I want to edit and click Edit. I make changes to the content (just text) and click 'Save'. I navigate to the page I changed and refresh but nothing has changed.

I tried clearing both my browser's cache and Drupal's to no affect.

I double checked the URL and it matches.

I reloaded the page(node?) on the back end to confirm it had saved my changes, which it did.

How do I actually update the content of a page?


texts: How to always print submenus from menu module?

texts:
I'm using Drupal 7.35, with the stock menu module. I've set up a menu that has multiple submenus, and ran into something interesting: the submenus only are printed to HTML when you're on that menu's parent page.

For example, let's say this is my full menu:

- Link 1
  - Link 1.1
  - Link 1.2
- Link 2
- Link 3
  - Link 3.1
  - Link 3.2
  - Link 3.3
- Link 4
  - Link 4.1

Each submenu shows up only if you're on that menu's parent item. So, when you're not on any of those pages, the Menu is printed like this:

- Link 1
- Link 2
- Link 3
- Link 4

If you're on the Link 1 page, or any children thereof, it prints like such:

- Link 1
  - Link 1.1
  - Link 1.2
- Link 2
- Link 3
- Link 4

If you're on Link 4, it looks like this:

- Link 1
- Link 2
- Link 3
- Link 4
  - Link 4.1

I want all the menu items to always be printed. How do I do that? Is this normal behavior, because I'm pretty sure I didn't have this issue on the other Drupal site that I've worked on.


texts: How to schedule an email message from a webform email address

texts:
Need: Schedule an email message to anyone that completes my WEBFORM +2 days in the future.

I got this to work 90% of the way. Emails are being scheduled, but the 'TO:' email address is [webform:val-email_address] instead of the email address from the webform.

My questions are:

What value to I use in the COMPONENT to successfully schedule the email to the email address from the webform?
Do I need to add an ELEMENT or additional ACTIONS?

I created a RULE with

Event: "After a webform has been submitted"

Conditions: None

Actions:
Elements - Schedule component evaluation
Parameter: Component: Schedule email to applicant..., Scheduled evaluation date: +2 day

Component:
Actions
Sent Email

Thank you in advance for your help. Blessings!


texts: Having Problem editing product displays created by Commerce Feeds to add product flag link

texts:
Hi all and I apologize in advance for what seems like a rudimentary question.

I have a drupal commerce site (drupal 7.38, commerce 7.1.11, Commerce Feeds 7.1.3) and I have a very basic flag set on my custom products. The issue is I have is that I cannot seem to be able to add the flagging fields to the products displays generated from the templates imported with commerce feeds. I use a template very similar to the attribute/taxonomy terms I import via feeds. The problem is that there doesn't seem to be an obvious way to do this through the UI when editing the Content Type for my custom product display.

I can confirm that there is a flag field listed for the custom product type, but it doesn't show up in the fields available in either the Manage Fields or Manage Display tabs of my product display. The field is visible in the Manage Display tab of the product type, but is not in the manage fields list and isn't obviously manageable in some other way.

Is this commerce feeds that's tying my hands, or how do I edit these?


texts:
Basically, I want to port a custom ctools plugin created for content type from Drupal 7 to Drupal 8. This is the code I want to port.

function my_module_ctools_plugin_directory($module, $plugin) {
  if (($module == 'ctools') && ($plugin == 'content_types')) {
    return 'plugins/content_types';
  }
}

In my_module/plugins/content_types/my_module.inc file i have following code:

/**
 * Plugin array() of ctools plugin.
 */
$plugin = array(
  'title' => t('My Module'),
  'single' => TRUE,
  'content_types' => array('my_module_custom_content_type'),
  'render callback' => 'my_module_render',
  'required context' => new ctools_context_required(t('Node'), 'node'),
  'edit form' => 'my_module_settings_form',
  'edit form validation' => 'my_module_settings_form_submit',
  'category' => 'Widgets',
);

/**
 * Render callback function.
 */
function my_module_render($subtype, $conf, $args, $context) {
  $node = $context->data;
  if (empty($node)) {
    return;
  }
  $data = \Drupal::formBuilder()->getForm('my_module_form', $context, $conf);
  $block = new stdClass();
  $block->content = $data;
  $block->title = '';
  $block->id = 'my_module_form';
  return $block;
}

How do I port the plugin to Drupal 8?


texts: I have a select list in content profile which is having list of counties value. when i submit the user profile form, there is an error throwing like "Counties: illegal value" . I checked the Allowed values list: in cck settings having correct format. Anyone can say the fix for this error.


texts: User automatically redirected to main language page

texts:
In my website I have the users automatically redirected to the main language page.

If for example: node/2 is the translation of node/1
when I type: www.mywebsite.com/node/2 I'm immediately redirected to www.mywebsite.com/node/1

Note that it happens only for the anonymous users

What's that?
How could I check which module is redirecting the user?


texts: How to create a select box field to select from a filtered list of articles?

texts:
in this example, I want to make the select box to select from a filtered list of articles.

What is the proper way to customize the options available in this select box ?


texts: How to drupal_add_js an external and defer script

texts:
I've spent quite some time on drupal_add_js and didn't manage to solve this. How can I load an external JavaScript script which will also have the defer attribute?

I want to use this type of syntax:

drupal_add_js('http://example.com/whatever.js', 'external');

But it only produces:

<script src="http://example.com/whatever.js"></script>

I want the end HTML to be:

<script defer="defer" src="http://example.com/whatever.js"></script>


texts: How can I uncheck a required checkbox on the edit page for a given content type?

texts:
I have a "required" checkbox (single on-off boolean field) which users must check to agree to the rules of the site when they post a node of a certain content type.  When users edit nodes of this content type, I would like to reset the checkbox to force them to check it again.

How can I do this in Drupal 7?


texts:
Ok, so I've got this webform sending an email upon correct submission.

I'm trying to format the email so that it can send to a user who submits a form.

This email would say something like "Hi, Name, thanks for submission!"

I am trying to use the following:

Hi %email[name]

And the email is coming out like this:

Hi

name:

PersonNameHere

Why is this happening? Shouldn't the name come out without the field name?


texts: How to add global variable in custom js file

texts:
I've added my custom script wrapped in :

(function ($) {

    Drupal.behaviors.exampleModule = {
        attach: function (context, settings) {

But can't create a global variable inside it


texts: How to print text (formatted, long) in twig without raw filter?

texts:
We have a text (formatted, long) field that is used to insert embed code such as the Youtube embed code for videos.

When printing the field in twig we are finding that rather than rendering the embed code, it is displaying the embed code as string. To get around this, we currently apply Twig's Raw filter, but wanted to see if there was a way to not use the raw filter and render the field as is.

Content type (basic page):

body (text, formatted long) field
title

Current results (inserted into Body field using Full HTML text format, displayed as string):

Desired results (output of body field shows the video)


texts: I have a tab in mysite.com/user which I don't know where it's coming from?

texts:
I have a tab in mysite.com/user called "Evaluaciones" but I don't know why is there. The link for this tab is user/1/webform-submissions-por-user then I guess it is generated by the webform module, but I already disabled this module and the tab is stil there.

How can I trace it? How Can I remove it?


texts:
I have a product with a field that's a boolean value "Contains Gluten" which stores a "1" for yes and a "0" for no, this is stored in the database as field_contains_gluten_value.

The client now wants it to say "Gluten Free" instead.

Rather than change all of my views and product displays to negate, I figure it would be easier to just flip the value in the database.

I am using feeds to import the products from a csv, but the client has edited products now and changed other fields, so I don't want to change it in excel and import over the top for fear of losing his changes.

In the database how do I change all the "0" values to "1" and vice versa? I'm aware this might not qualify as a Drupal question and might be better on stack overflow, but if there is a Drupal solution you are aware of then I'm all ears!


texts: Overwrite twig (template) files from a contrib module in my custom subtheme?

texts:
I need to overwrite and adjust the twig (template) files from the Facet module in my custom subtheme? Is that possible? I need to change below markup and CSS classes (to debug faster, I also added my template suggestion here):

            <input type="checkbox" class="facets-checkbox" id="contactvoorkeur-email" data-facetsredir="/search-person/cards?f[0]=contactvoorkeur%3Aemail">

                E-mail (4)

                E-mail (4)

            <input type="checkbox" class="facets-checkbox" id="contactvoorkeur-post" data-facetsredir="/search-person/cards?f[0]=contactvoorkeur%3Apost">

            Post (2)

                Post (2)

My main goal is to:

1) How do I add a bootstrap css-class list-group to the existing facet class js-facets-checkbox-links. So I get:

2) And how do I replace an existing facet class facet-item with list-group-item:


texts: Entity reference views with Exposed filters

texts:
I have created a content type Subjects with following fields:

Student ID
Subject Title
Subject Code
Subject teacher

I have also created an entity form for accepting comments from students about subject they study and subject teachers.

I am trying to create an entity reference view and also want to use exposed filter. Reason for using exposed filter is that I want student to provide his student ID so that subjects which he is studying is updated in a select list. I am unable to achieve this.

I am also using Entity Reference autofill module to display the value of Subject Code and teacher in my entity form. The value of Subject code and teacher will be populated based on Student ID and Subject code. Please note one student will be studying more than one subject

I have already created a few contents of type subjects.
My question may appear a duplicate question but I read mostly all answers but nothing is matching my case.


texts:
Anybody has idea about how we can have Sub Groups under Drupal Group?

This module; https://www.drupal.org/project/group, will manage grouping of content, users.... perfectly.

But we are looking to have a hierarchical Group functionality (Group inside a group).

Use Case:
An Organization has various Groups and Departments.

Main Company -> Organizations(Groups) -> Departments (subgroups)
Departments/Groups Should be able to administer content/users.


texts: How to have nodes online but not as a separate node number?

texts:
I have several content types let say : fooCT1,fooCT2, fooCT3 ... fooCT20.
fooCT1 has several entities to the other content types.

If I publish fooCT1 I run a rule which also publish all relevant nodes (fooCT2.. fooCt20) in order to see this information in a panel page for a anonymous user.

But using this means also that the different nodes are available under there separate names url aliases like:

/node/xx

where xx is the node nummer

How to disable this easily?


texts:
I'd like to add a column to an existing view programmatically - but only temporarily.

For instance, there is a node in the html table produced by the view. I'm gathering data from a third party api related to that node, and I'd like to present that data in the view alongside the node data.

I have looked at:

Changing the List Builder Class using the hook_entity_type_alter and trying to alter the data using hook_views_post_execute, without success.

It seems like I might be able to do it with a template hook, but that also seems like the wrong place.

Thanks


texts: Commerce - Extend add to cart button functionality

texts:
Drupal novice asking for guidance.
I would like to add some functions when the user clicks the Add to Cart button, for example, close a popup window and also change the default labels (price, checkout, etc) but I don't know which files to manipulate and which functions to use(hooks).
Can anyone help me with this?


texts: Automatically select most expensive shipping rate

texts:
In my Drupal 8 Commerce site I have two main product types that each have their own flat rate shipping cost. When both products are combined in the cart, Commerce will let the user pick the method.
Instead, I want the most expensive of the two shipping methods to be automatically used.
In Drupal 7 Commerce this could be done with Rules, but the Drupal 8 version has built in conditions. None of those seem to be able to work with multiple shipping rates.


texts: How To log activity for anonymous user in heartbeat activity?

texts:
I am using anonymous publishing module and heartbeat activity module. I want to log activity for content posted as anonymous to be logged in heartbeat activity
How can I achieve it? I checked in the database and could see that no activity was logged in heartbeat table


texts: Webform: How to prevent rendering of private fields

texts:
I'm using Webform. Because I wanted to add custom flag for submitted data, so I used this approach with private fields https://drupal.stackexchange.com/a/137847/24385

Is it possible to render such form without private field only on my web? In admin section is everything ok and don't want to change nothing here. Private fields are shown only to users with results access. But what can I do if I want to display the same form for all users. On the web it doesn't matter for me whether user is anonymous and logged in. I need to display form without private fields here. Private fields are important to see only in admin section.

Thanks a lot :)


texts:
I have a site on Drupal 7. After migration on new server I have some issues. Site works normally and everything is ok, but after some time I can't see images, can't upload new images and don't work ajax autosave in user form.

When I use 'flush all caches' to clear cache everything works again.

What should I do? More often clear cache? Where I should looking for problem?

Thanks for any help.


texts: How to disable one specific translation page?

texts:
How can I disable only one page in English on a Drupal 7 site, without disabling the Danish page?

I'm using Multilingual - Internationalization module.


texts: Why arn't changes I am making in CSS appearing?

texts:
This is weird. I've just started at a company that uses Drupal (I havent used it before) and I've been tasked with making some simple CSS changes to a site.

I find the site's theme folder and corresponding CSS and make a simple change just to test things out. Nothing happens. I clear the cache via admin and get a 500 error. Fine. So I use drush to clear CSS and JS. It says it works but still no change. I clear my browser cache too just to be sure.

I use Chrome's inspector to trace back the paths of the CSS files I'm working on - they're correct. I even check the themes .info file to see if all the .css files are linked - they are.

So...what am I missing here? What on Earth is going on?

(Edit: CSS aggregators are off)


texts: How to theme the separate page for editing profiles provided by Profile2

texts:
I'm using D7.
I'd like to theme the separate page for editing profiles provided by Profile2 module(whose URL is MYWEBSITE.com/profile-MYPROFILE/[uid]/edit).
I searched and found the way that somebody has already suggested. And, by reference to that, I tried the way below. But it doesn't work. Can anybody tell me where I made a mistake?

Here is the way I tried but that didn't work...

1st: Create the customthem_theme() below into  template.php file of customtheme theme.

function customtheme_theme() {
    $items = array();
    $items['user_profile_form'] = array(
        'render element' => 'form',
        'path' => drupal_get_path('theme', 'customtheme') . '/templates',
        'template' => 'user-profile-form',
        'preprocess functions' => array(
             'customtheme_preprocess_user_profile_form'
        ),
    );
    return $items;
}

2nd:  Create the template file user-profile-form.tpl.php and place it in the templates folder of custometheme.

3rd: Code the fields I want to display on user-profile-form.tpl.php
for ex

<html>
<?php

print drupal_render($form['form_build_id']);
print drupal_render($form['form_id']);
?>

<div>
         <?php  print render($form['profile_MYPROFILE']['field_MYFIELD']); ?>
</div>
</html>

I'm still very new to drupal and, honestly, don't figure out how its system works yet. I'm sorry if this is a very easy mistake to you.
Thanks.


texts: Failed patching both manually and with Git in Ubuntu terminal

texts:
I am very new to both Patches and Ubuntu and I try to run this patch which fixes RTL problems for Admin_Toolbar module (8.x-1.11).

I've downloaded the patch file and putted it in the module's folder.

When I tried to run it manually in the terminal i didn't succeed:

Later, similar situation occurred with Git:

Where my commands accurate? What can cause it to fail? For the creator of this patch it did work... Please give me a clue or any advice you can how to solve it... Is there even anything I could do in my end?


texts:
I am working with Drupal's Open social framework where in I copy socialblue theme so that i can do my modifications in the new theme. I followed the below steps, cleared cache, yet I am not able to see my new theme in admin/appearance section.

Steps I followed:

1) I duplicated the theme socialblue (html/profiles/contrib/social/themes/socialblue) to newtheme (html/profiles/contrib/social/themes/newtheme)

2) I did a search (socialblue) and replace (newtheme) inside of “newtheme” directory

3) I changed the names of the following files from “socialblue” to “newtheme"

newtheme.info.yml
newtheme.libraries.yml
newtheme.theme
config/install/newtheme.settings.yml

4) I created a /html/sites/default/services.yml file from default.services.yml and made the following changes

twig.config -> debug: true
twig.config -> auto_reload: true
twig.config -> cache: false

5) html/profiles/contrib/social/themes/newtheme$ yarn install

6) html/profiles/contrib/social/themes/newtheme$ sudo npm install -g gulp-cli

7) html/profiles/contrib/social/themes/newtheme$ gulp

I do not get any error. I made sure that my newtheme.info file has name newtheme. I also copied this new theme in html/themes/custom/newtheme still no luck. Am I missing something?


texts:
I am using a view with the format Views Accordion.
So far, I have a View like so:

  award1
     -person1
    -person2
  ...
  award_n
    -person_n
    -person_n+1

Where award is the "header" or "trigger" of the accordion action.
This works just as intended. I'm trying to extend this further to look something like:

  award1
    This is a description of award1. I'm summarizing award1 here.
    -person1
    -person2
  ...
  award_n
    This is a description of award_n. I'm summarizing award_n here.
    -person_n
    -person_n+1

The problem is when i use views accordion with a description like above i get the not so desired result:

  award1
    This is a description of award1. I'm summarizing award1 here.
    -person1
    This is a description of award1. I'm summarizing award1 here.
    -person2

Where the description and the person are overlapping and/or pushing the content out of the accordion effect. I've thought about using Javascript to insert the description after the award div, but i feel like that is a hacky approach to the solution. Is there a better way to do this?


texts: When I click on the demonstrate block regions, I get an access denied message

texts:
I logged-in as an admin. And when I click on the demonstrate block regions, I get an access denied message in Drupal-7.

I have cleared all caches. But, still get the same problem.
Any idea how to solve this?

Thanks for help!


texts: Can I handle calculating/charging for shipping after order placed?

texts:
I am trying to determine if Drupal Commerce is the right ecommerce method to use for my client's project.

The workflow my client is looking for is:

Customer place order, and pays nothing for shipping.
My client will process order and determine shipping costs.
My client will charge customer for shipping, using CC data stored when they placed order.

Is this something that Drupal commerce can handle?


texts: Simple hierarchical select control is not rendering

texts:
My more than an hour is wasted is trying to fix Simple hierarchical select module. I don't see controls on the entry screen of Content Type.

I have tested with taxonomies of one and two levels (with records of course). Browsed website in Chrome and IE. Created new Content Types, even whole new Drupal Website with new download of shs installed but no luck....

Any idea where I may be mistaken?


texts: How do I make a tab active with Barik theme?

texts: Should I do it in css or jquery? Not sure why it's not something done by default.


texts:
I have contributors who have a vast range of skills and experience, who will have permission to post on my site. I want them their content to be displayed in the same way.

I want the user to be able to upload a single image and write some text in WYSIWYG and for it to publish with the picture at a pre-formatted width (let's say 40%) and for the text to wrap around it, like you would expect on a web page.

I imagine that I might not be able to create this as a content type and will have to use a webform, but I am still not convinced.


texts:
I installed the module "Shariff Social Media Buttons" for "Drupal 8" :

https://www.drupal.org/project/shariff

This module once installed, add a block in :

/admin/structure/block

I want to display this block in a template :

https://www.drupal.org/docs/8/modules/twig-tweak/rendering-blocks-with-twig-tweak

I tried with the following code :

{{ drupal_entity('block', shariffsharebuttons) }}

But the block does not work (it is not rendered on my page)

drush ev 'print_r(\Drupal::configFactory()->listAll("block.block."));'


texts: theming a rendered entity in a view header

texts:
I reference a node into a view header (rendered entity). I need to do some changes in the output of this referenced entity.

Does anyone know the filename for the needed template?


texts:
Website is about bands and musicians.

Musician can create the profile and add his bio.
Band can create profile and add band members and their bio.
Many musicians are members of several bands, so i will have bio of XY repeated on several pages of my website.

Any idea how to control this since site will be made and controlled more or less by users ?


texts: How to create a view block of one content type filtered by author?

texts:
I have a Book Club website which has a page created from a view where different members can add their recommendations. I want to create a block view which can be inserted into a Panel Page for each author, but I am struggling to get the contextual filters and relationships to work.

Below is the basic setup of the view page.

This is the contextal filter setting.

This now works if I put a user name into the context preview section.
I thought if I added a user context to the panel page this would then allow me to add the user name into the block, but I don't get this option.


texts: Apache AddDefaultCharset utf-8 - filename not saving in utf-8

texts:
Using file field to upload image which has utf-8 filename, but when it is uploaded to site filename is not saving in utf-8 format.But original name is saved as link in database making it not found when accessed.

AddDefaultCharset utf-8 is added to httpd.conf and server restarted before testing.

original filename - noëlle_châtelet.jpg(same is saved in database)
saved filename -noÃ«lle_chÃ¢telet.jpg


texts:
So I have a Drupal 7 Workflow rule where an email is sent out when a select field on a comment is set to "Approved'.

This works fine with the exception being if I then add an additional comment to the form, the email is then re-sent. the reason being is that I'm just checking the select field value and triggering the email based on the value.

I just want the email to be sent when the select field is initially set to "Approved".

Here is the export of the rule in question:

{ "rules_notify_status_approved_test" : {
"LABEL" : "Notify - Status Approved TEST",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules" ],
"ON" : { "node_update--request_ad_match" : { "bundle" : "request_ad_match" }     },
"IF" : [
  { "node_is_of_type" : {
      "node" : [ "node" ],
      "type" : { "value" : { "request_ad_match" : "request_ad_match" } }
    }
  },
  { "user_has_role" : {
      "account" : [ "site:current-user" ],
      "roles" : { "value" : { "4" : "4" } }
    }
  },
  { "data_is" : { "data" : [ "node:field-request-status" ], "value" : "74" }     },
  { "AND" : [] }
],
"DO" : [
  { "variable_add" : {
      "USING" : { "type" : "user", "value" : [ "node:author" ] },
      "PROVIDE" : { "variable_added" : { "node_author" : "node author" } }
    }
  },
  { "mail" : {
      "to" : "email@email.com",
      "subject" : "request has been approved",
      "message" : "request has been approved",
      "language" : [ "" ]
    }
  }
]
}
}

Any direction is appreciated.

Thanks!


texts: Views content pane not showing in panel for some users

texts:
I have a view content pane displaying a node of a certain content type. This content type contains entity reference fields which are rendered as nodes on in the view field settings. On this view, I have a contextual filter of type "Content: NID" with "Provide default value" selected and "Content ID from URL" selected in the drop-down.

I created a panel page over-riding the node template, and a variant with 2 selection rules:
1) Node being viewed is this content type, and
2) "Node: accessible - Logged in user can view Node being viewed."

I am using two users to test - the admin user, and a test user.

When I view this panel page as an admin, with 'bypass node access' permission, I can see the panel with the content pane, and the node and the referenced nodes that are present in the view.
In the node access table, the node is listed with the correct realm and gid.
Debugging output shows that my test user has the correct grants (at least one grant contains realm and gid that matches the node_access records), and should be able to view the node.
If I disable the panel, my test user CAN access the node directly, as well as the nodes referenced in the entity reference fields.
I made a copy of the content pane display (as a view page, with url), and my test user CAN access the view, and all nodes on the view.
When my test user tries to view the panel page, he sees the OTHER panes on the panel (which I assume tells me that "logged in user can view node being viewed" is TRUE, as the variant IS being displayed).
One strange thing that I noticed, is that when I try to preview the view by manually adding the NID argument, I get nothing - no query being displayed, and no content being rendered, but this is for the content pane, not the view page display with url.

However, the test user can NOT see the views content pane embedded in the panel, while the admin user can. The pane simply does not render, and the "No results behaviour" of the view, which is set to display a message, does not render, either. It is just blank.

Anyone know why the content pane would not render? Is there some permission that I'm missing, or some setting on the views content pane screen? Or some setting on the panel variant configuration, or the pane configuration? I don't see anything that should hide this pane.


texts: Is it possible to group records in views when the field to group by is retrieved through different entity relationships?

texts:
I'm trying to group records in a view where the value I want to group by is obtained through different intermediary objects and I can only seem to get the grouping to happen through those intermediaries.

Specifically, I have a content type referred to as Request that can be associated with either a request from another of two different content types, Office or Contact. Either of those types can have an association with an Institution. In the report I'm trying to generate, I want to group 'requests' by the related Institution. If I'm dealing with just Contacts or Offices, I can do the group by fine, but combining the two seems eludes me for some reason.

The added wrinkle in this is that a Contact could have an association to an Office as well. So there's a chance records could double up to some extent.

Right now I'm displaying the records in a table format, and returning the Institution name through separate field relations to an office or contact respectively. In the table format I can group by, but I can't necessarily do a group by in a column, it focuses on a field (which there are two different ones, but they return the same value) so I'm a little stumped at the moment.

Not sure I'm explaining this in the best way. At any rate....


texts: How to define my own block regions for original, custom front page layout?

texts:
I want to define my own block regions for the front page

I want to have a grid of blocks, each block containing a list of recent media (pictures, youtube, audio) with a certain tag. See example wireframe as ascii art below

A rule with the blocks is that if an item has already appeared in one block, then it doesn't appear in the others (media items can have multiple tags obviously).

Questions after the drawing.

+-----------------------------------+
! main menu                         !
+-----------------------------------+
! rolling display                   !
!                                   !
!                                   !
+-----------+-----------+-----------+
! tag a     ! tag b     ! tag c     !
! heading   ! heading   ! heading   !
+-----------+-----------+-----------+
! list      ! list      ! list      !
! of media  ! of media  ! of media  !
! with tag a! with tag a! with tag c!
! & thumb   ! & thumb   ! & thumb   !
! nail for  ! nail for  !nail for   !
! each item ! each item ! each item !
+-----------+-----------+-----------+
! tag d     ! tag e     ! tag f     !
! heading   ! heading   ! heading   !
+-----------+-----------+-----------+
! list      ! list      ! list      !
! of media  ! of media  ! of media  !
! with tag d! with tag e! with tag f!
! & thumb   ! & thumb   ! & thumb   !
! nail for  ! nail for  !nail for   !
! each item ! each item ! each item !
+-----------+-----------+-----------+
! tag g     ! tag h     ! tag i     !
! heading   ! heading   ! heading   !
+-----------+-----------+-----------+
! list      ! list      ! list      !
! of media  ! of media  ! of media  !
! with tag g! with tag h! with tag i!
! & thumb   ! & thumb   ! & thumb   !
! nail for  ! nail for  !nail for   !
! each item ! each item ! each item !
+-----------+-----------+-----------+

Please outline specifically how I would go about doing this. I'm looking for a fairly definitive answer -
i.e. something that won't break something else, and is robust in itself.

Specific questions:

Would I use PHPTemplate and if so how? Would I use this to declare
the regions, and how?
What would the roles of Panels, Views and Blocks be in creating this
layout?
Can I create the layout in panels without writing any PHP code?
Presumably the Views module would provide the content within the
blocks.
How do I tell Views and Blocks where to put the content, i.e. in a particular block?


texts: File Transfer failed, reason: Cannot create directory /var/www/html/modules

texts:
I have installed Drupal 8 on EC2. I am trying to install a module (simple_sitemap-8.x-2.5.tar.gz).

When I use the interface, I get a failed transfer message:

I have chmod a+x the directory (which already exists), but to no avail.

How should I solve this one? Is there a workaround to install modules without FTP?


texts:
I have a view that in that view I set up 3 exposed filter, all working fine.

I need to set a condition to show the third filter option to a specific user, it can be checked according to the user role, but how I should do that?

Can anyone provide a hook to help me?

Previously I tried the following but it does not change anything:

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

  if ($form_id == 'views_exposed_form') {

    //unset($form['average']);

    var_dump($form);

    die();
  }
}

My view looks like this


texts: Passing variables via template.php for search module

texts:
I'm using search.module. I used dpm(get_defined_vars() ); in my search-results.tpl.php file to see all returned variables, so I can reference a needed variable in some PHP code I'm writing in there.

However, although the variable is being returned in the teaser/snippet (and is outputting to the page) the only place I'm finding the 'variable' is in the $search_results array which is just a massively long string of html code. How can I parse out a needed variable (I assume in template.php) so that I can reference it and use it for comparisons on search-results.tpl.php?

The content is coming from a content type node called 'resource'. The field in questions is called 'field_type'. Here's the code I'm currently working with in template.php to get other variables:

function themename_preprocess_search_results(&$variables) {
        foreach($variables['results'] as $result) {
                $node = $result['node'];
                if($node->type == 'resource') {
                      $items = field_get_items('node', $node, 'field_type');
                      $variables['field_type_items'] = $items;
                      $variables['field_type_item'] = $items[0];
                      $field_view = field_view_field('node', $node, 'field_type');
                      $variables['field_type_rendered'] = render($field_view);
                }
        }
}

// function to enable correct variables for search results
function themename_preprocess_search_result(&$variables) {
  $variables['search_results'] = '';
  if (!empty($variables['module'])) {
    $variables['module'] = check_plain($variables['module']);
  }
  /*foreach ($variables['results'] as $result) {
    $variables['search_results'] .= theme('search_result', array('result' => $result, 'module' => $variables['module']));
  }*/
  $teaser = node_view($variables['result']['node'], 'teaser');
  $variables['teaser'] = $teaser;
  /*
  $variables['body'] = substr(render($teaser['body']), 0, 200);
  if (strlen($variables['body']) >= 200) {
    $variables['body'] .= "...";
  }
  */
  $variables['snippet'] = drupal_render($teaser);
  $variables['info'] = '';
  $variables['pager'] = theme('pager', array('tags' => NULL));
  $variables['theme_hook_suggestions'][] = 'search_results__' . $variables['module'];
}

Is there something I can add to this to get the field field_type and pass it to my tpl files?

Or, if that's not the right solution, what is?


texts: How to show snippet of an event when clicked in the calendar in Drupal 7 with the Calendar Module

texts: I created a calendar with the Calendar Module, but I don't know what to do to show a snippet of the event when clicked. This calender is a perfect example of what I mean https://hutchinscenter.fas.harvard.edu/calendar. Thanks!


texts:
I'd like to delete the current revision (made in error by an admin) for a list of nodes.

On a test site - I've looked into re-using core functionality in my script, reverting to a previous revision, then deleting the remaining revision. But the revert creates a new one itself.

I'd really like to set it so it's like the most recent revision never happened, and is gone entirely. Our system shows a history of node changes and I don't want it to show up there (and also don't want to hack the display to suppress these few erroneous revisions etc.)

Thanks!


texts: Creating a table with pagination in a Node Edit form

texts:
I have a content type article that has a field for Category. In order to help our editors find related articles, I included a table on the article Edit page that pulls in other article entities that have the same category as the current one.

I did this by implementing a hook_form_alter hook and adding some markup to the $form object after querying for all related articles.

// Query for matching articles
$query = \Drupal::entityQuery('node');
$query->condition('type', 'article');
$query->condition('field_articles_category.entity:taxonomy_term.tid', $categoryId);
$query->sort('created', $sortDirection);
$query->range($offset, $limit);
$query->latestRevision();

/* Omitting logic to load the Node objects by revision ID's */
// $articles is an array of Node objects of type article

$articlesTable = []
foreach ($articles as $index => $article) {
   $articlesTable[$index] ['articleTitle'] = [
      '#type' => 'link', '#title' => $article->getTitle(), '#url' => $article->toUrl()
   ]
}

$form['related_articles'] = [
   '#type' => 'details',
   '#title' => 'Articles of the Same category',
   'articlesTable' => $articlesTable
];

The table displays just fine and shows the expected articles. But there are sometimes hundreds of articles in a particular category so I would like to paginate this table for performance reasons (and to make sure the page is not too long to scroll through). How can I paginate such a table?

I've seen some articles mention creating a pagination controller and somehow setting the AJAX callback for that controller, but haven't found a concrete example yet to follow.


texts: How to change the length of field settings?

texts:
I have set once to a website a lenght limit to a field. And now the client wants to put more characters to that field.

I cannot change the maximum size from Drupal because I get the following error message:

  There is data for this field in the database. The field settings can no longer be changed.

However there must be a solution. Shall I change it in database (the field is one implemented by the Field-collections module)?


texts: Programmatically set the format for each value of a multi-value text field

texts:
I am trying to programmatically set the format of a multi value text field to 'full_html'.

I have tried:

$Links = array (1, 2, 3, 4, 5);

$node->field_article_links[] = $Links;
$node->field_article_links->format = 'full_html';
$node->save();

and

$Links = array (1, 2, 3, 4, 5);

foreach ($Links as $Link) {
$node->set('field_article_links', $Link);
$node->field_article_links->format = 'full_html';
}
$node->save();

But the results are always the same, only the format of the first value of the field is set to 'full_html' and the others remain unchanged.

What am i doing wrong ?


texts: Inline class annotation with /** @var or just comments?

texts:
I found in some drupal commerce modules class comments in way I haven't seen so far

/** @var \Drupal\commerce_payment\Entity\PaymentInterface $payment */
$payment = $this->entity;
/** @var \Drupal\commerce_paypal\Plugin\Commerce\PaymentGateway\ExpressCheckoutInterface $payment_gateway_plugin */
$payment_gateway_plugin = $payment->getPaymentGateway()->getPlugin();

I am not sure what to google to get to know more about this, why was it used like that and is this annotation or just plan comment?


texts: How to print render Location's sub-fields?

texts:
I'm trying to print render inside my node--article.tpl.php two of Locations sub-fields: the Street address and City
so that it looks like this: 16 Fleet Street, London -- without printing all other parameters (Province, Country etc)
So far I've got

<?php
    print
        render($content['field_location'][0]['#street']) . ', ' .
        render($content['field_location'][0]['#city']);
?>

But it doesn't work. Can someone please help?


texts: How to use media field with entity browser widget in a frontend theme?

texts:
I have created a media field in my content type. In the manage form display, I have selected entity browser as display instead of media library.

When I open the node form as admin in an admin theme like adminimal or seven, and upload an image to the field, I can see it thumbnail after upload and other information. I can see that its markup comes from the media.html.twig file of the classy theme.

But when I do the same steps in a frontend theme, I can't see the thumbnails and other information after upload.

What can be the reason? I also copied the media.html.twig file from classy theme to my custom theme but it did not work.

I am also using the dropzonejs module if that help someone.

Here are the screen shots. The first screenshot is from the admin theme, You can see that the admin, the date, the thumbnail and then use selected button.

The 2nd screenshot is from the frontend theme, there is no such markup after uploading an image.

Any one who can help?


texts:
i want to show product reference field with both add to cart and render product display format how i will do that?

Any help is appreciable.

I mean when i view a product it will show both add to cart form with all type of product variation.

Thank you all in advance.


texts: Is there a "hook_user_login_failed" hook? Or something similar?

texts:
I'm needing to detect when a login failure happens in Drupal and am finding it to be exceedingly difficult even after searching Google.  I have to believe this exists somewhere.

I found this post back from 2007 which seems like an entirely reasonable request for a "failed login" hook: https://www.drupal.org/node/160469 Is there something that allows this?

Thanks in advance.

AG3


texts: How to trace an Error: PDOException: SQLSTATE[23000]:

texts:
I'm trying to trace this error which is shown when I save a new basic page node.

It seems to me that I am trying to save a duplicated title value in field_data_title_field, but it doesn't make any sense to me. I found this question PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1532856' for key 'PRIMARY': INSERT INTO {watchdog} but it was related to dblog table (Watchdog module). Mine is related to: modules/field/modules/field_sql_storage/field_sql_storage.module

Drupal core is updated to last version.

How can I trace and fix this?

ERROR:

  PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'node-4294967295-0-0-und' for key 'PRIMARY': INSERT INTO {field_data_title_field} (entity_type, entity_id, revision_id, bundle, delta, language, title_field_value, title_field_format) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7); Array ( [:db_insert_placeholder_0] => node [:db_insert_placeholder_1] => 4294967295 [:db_insert_placeholder_2] => 3187 [:db_insert_placeholder_3] => page [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => und [:db_insert_placeholder_6] => My node title [:db_insert_placeholder_7] => ) enfield_sql_storage_field_storage_write() (line 514 of /home/examplesite/www/modules/field/modules/field_sql_storage/field_sql_storage.module )


texts: Using jQuery to copy some content from div to input value - value displays nicely but there`s no value in html

texts:
I've got a webform in a block (using webform pay and webform block) which printing in a overridden template via module_invoke.

There is a simple price field (input). In the content type i`ve got a price field also.
I am using this kind of script to copy value from node's price div to another input field in a block:

$(document).ready(function(){
  var txt = $('.field-field-price .field-item').html();
  var txt = jQuery.trim(txt);
  $('#edit-submitted-price').val(txt);
});

The needed value displays just fine but in html value="" and i just can`t submit the form with needed value in price field. The screen-shot is attached. Thanks in advance for your time and understanding!


texts: What's difference between node_revision__field_X and node__field_X tables in Drupal 8?

texts:
I'm in the process of migrating a complex D6 site up to D8 using the Migration tool. An old table content_field_gallery seems to have been migrated to a node_revision__field_gallery table, but there is also a node__field_gallery table with about half as many rows.

I'm guessing that the node__field_X version has only the latest revision and the node_revision__field_X has ALL revisions. Is that correct? Isn't that redundant? And a good index should make a single table pretty efficient? Where can I read more about this?


texts: Does anybody know of a Drupal 7 autocomplete widget for textfields? I've tried Autocomplete Widgets, but the "Autocomplete for allowed values list" widget from that doesn't seem to exist in Drupal 7 -- only the other two widgets show up. My goal is to store plain text but autocomplete from a user profile field. Thanks!


texts: Make Commerce Checkout Form Submit via Ajax

texts:
I think its a simple question, but I havent find an answer yet.

I want to make the Commerce Checkout Form Submit as an Ajax Form Submit. I have searched for a while but I havent found something useful.

There is a module Asaf which can add Ajax Submit to every Drupal Form, but I havent find the important locations in code.

There is also a Drupal Page AJAX Forms in Drupal 7, so I have tried a form_alter on the
commerce_checkout_form_checkout and added an Ajax Callback, but the page still reloads.

I have written this code in a custom module to test the ajax submit with an own function:

if($form_id == 'commerce_checkout_form_checkout'){
  $form['#ajax'] = array();
  $form['#ajax']['method'] = 'replace';
  $form['#ajax']['effect'] = 'fade';
  $form['#ajax']['callback'] = 'test_function';
}

function test_function(){
  drupal_set_message('test', 'error');
}

But no message is displayed and no ajax call is done.

Perhaps somebody cant put me on the right turn.

EDIT:

So I have learned that i have to add the ['#ajax] to a specific button or submit element, and not to the whole form. The commerce_checkout_form_checkout has a buttons array with the continue button in it, so i have added the functionality to this button array:

Array
(
    [#type] => submit
    [#value] => Kaufen
    [#attributes] => Array
        (
        [class] => Array
            (
                [0] => checkout-continue
            )
    )
[#suffix] =>
[#validate] => Array
    (
        [0] => commerce_checkout_form_validate
        [1] => commerce_stock_checkout_form_validate
    )
[#submit] => Array
    (
        [#ajax] => Array
            (
                [prevent] => click
                [callback] => test_function
            )
    )

)

But if I hit the submit button, the page still reloads and doesnt jump into my 'test_function'.


texts: Can't update via composer because of lock file

texts:
I am trying to install Lightning 8.1.0. I am currently at 8.1.00-rc5. When I run composer require drupal/lightning:8.1.0 I get the following response:

± |master ✓| → composer require drupal/lightning:8.1.0
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
    1/1:  http://packagist.org/p/provider-latest$aa4f1da6acef0b15640bc1cace21327f5342dbb88c61b4605f0b1b0ff21d7399.json
    Finished: success: 1, skipped: 0, failure: 0, total: 1
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Can only install one of: drupal/entity_browser[8.1.x-dev, 8.1.0-alpha3].
    - Can only install one of: drupal/entity_browser[8.1.0-alpha3, 8.1.x-dev].
    - drupal/lightning 8.1.00 requires drupal/entity_browser 8.1.0-alpha3 -> satisfiable by drupal/entity_browser[8.1.0-alpha3].
    - Installation request for drupal/lightning 8.1.0 -> satisfiable by drupal/lightning[8.1.00].
    - Installation request for drupal/entity_browser (locked at 8.1.x-dev) -> satisfiable by drupal/entity_browser[8.1.x-dev].

Installation failed, reverting ./composer.json to its original content.

The only way I get around this is that I have to remove the composer.lock file before I run composer require drupal/lightning:8.1.0. Does this sound like the right way to do it?

composer.json: http://pasted.co/f2561b5d
composer.lock: http://pasted.co/573a945e


texts: Clean URL/.htaccess problems with multiple subdirectories

texts:
I've inherited a large Drupal web site and now we're updating from Drupal 6 to Drupal 7. I cannot enable CleanURL for more than one subdirectory at a time! I think I've read just about every article on CleanURLs there is, and possibly my situation is unique, or maybe I'm going about things wrong?

We have a couple versions live on our web site using different subdirectories and databases. There are two sites total on one domain, each with a Drupal 6 "live" copy and a Drupal 7 "test" version on the host. They are organized as follows:

siteA_D6 -> example.com/
siteB_D6 -> example.com/siteB_D6
siteA_D7 -> example.com/siteA_D7
siteB_D7 -> example.com/siteB_D7

We want the subdirectories to work as I've listed them above, but eventually we will retire the D6 versions and redirect D7 to example.com/ and example.com/siteB

Currently, all 4 sites are accessible, but, CleanURLs only work on siteA_D6 (or example.com). Ideally we want to have CleanURL enabled on all of them, so that

http://example.com/test/arguments and
http://example.com/siteA_D7/test/arguments

resolve to the "same" page in different versions, and we never see ?q=test/arguments in the address bar

Our shared-server web host considers this issue "beyond ordinary technical support"... can't blame them, I've been banging my head up against this wall for days now. I'd really appreciate a solution or just some pointers.

(.htaccess copied below)

Options All -Indexes

ErrorDocument 404 "This page was not found on this server"

RewriteEngine On
RewriteBase /

Options +FollowSymLinks

# Closing the back door
RewriteCond %{QUERY_STRING} (ch|php_code)=(.*)
RewriteRule (.*) ##pretend url here, it won't let me post "too many links"## [L]

# Block pharmaceutical hotlink chicanery
RewriteCond %{HTTP_REFERER} ^http://.*pharmacy [NC]
RewriteRule .*\.(jpe?g|gif|bmp|png)$ - [F]

# stuff to let through
# I have been commenting these out when testing new rules
RewriteCond %{REQUEST_URI} "/siteB_D6/" [OR]
RewriteCond %{REQUEST_URI} "/siteB_D7/" [OR]
RewriteCond %{REQUEST_URI} "/siteA_D7/"
RewriteRule (.*) $1 [L]

#this one redirects all requests from domain to new folder
RewriteCond %{HTTP_HOST} ^.*example.org$
RewriteCond %{REQUEST_URI}  !^siteA_D6.*
RewriteRule ^(.*)$ "site_A_D6/$1" [L]

<IfModule mod_suphp.c>
suPHP_ConfigPath /home/username
<Files php.ini>
order allow,deny
deny from all
</Files>
</IfModule>


texts: How to properly delegate form error to parent?

texts:
I have a form with multiple radios. I need to display the radios in a certain way(separately with additional form elements) so I had to use radio form elements instead of one radios element.

The radios are required but I have an issue with delegating the error to the parent element. I switched off the error message for the radios themselves via the #error_no_message attribute. Now the form error is properly displayed for the parent element but the error message contains the label of the first radio element instead of the parent element. So for example if I have fieldset named "Manufacturer" and it contains radios with labels like "Audi", "Mercedes" or "BMW" and I won't select any radio the form error, after form submission, will say "Field Audi is required." instead of "Field Manufacturer is required".

So how can I delegate the form error to the parent(which is working) but with making the form error to be applied to the parent itself so the proper label is displayed?


texts: How to enforce edit suggestions of a post to require approval from the author of the post?

texts:
I'm creating a user community site and one of the features is to reward points to registered users.

One feature I'm trying to implement is to reward points for every edit on a post only if the author accepts the edit, the user who submitted the edit should get a point only if the edit is accepted by the author of the post.

How would I implement this in Drupal 7?


texts: Image / ImageField / ImageCache (automatic thumbnails)

texts:
I'm getting pretty frustrated here:

I'm a complete newbie with Drupal, just installed some modules like CCK, and made a new Content Type for my website to display products (no webshop purpose, just displaying them).
It also has an image field, for the user to upload an image, but what I'm trying to do here is have a thumbnail somehow automatically created (to display in the overview).

It seems like such a simple thing which every CMS should be able to do easily (and I'm sure it's possible) but I just don't know how it's done.

After googling quite a while I found a lot of articles on the subject however they all seem to refer to modules such as ImageCache, ImageField, and after some research about the mentioned modules it seems to me they have somehow been merged into one module: Image in Drupal 7.7

This is driving me crazy, and I would very much like to hear a simple explanation on how to get to the desired result.


texts:
I am using Advagg and Amazons3 Module, which is causing this error:

  temporary://fileh4Oxvi could not be copied, because the destination directory is not properly configured.

Files are getting created in "tmp" folder but that has been not copied to s3 bucket.

I had given the "tmp" folder 755 and even 777, which is not working.
And I even tried Configuring the temporary directory, which is not working even.

Any inputs are really appreciated.


texts:
I have a super user(user 1) that I want to hide in people list (mysite.com/admin/people).

Is there anyway to filter it out? I couldn't find a hook unless I just missed it. I know I could create my own view and easily filter it but then I loose the bulk operation which I need to keep.

EDIT:  here is the "why". I'm building an intranet system with drupal. User 1 is the super user that I want to keep for myself to be able modify advanced features of the intranet. I have created another "admin" roles that can manage content, users, roles, etc. I have a few dozen modules installed, but the ones applicable per this issue is user protect, workbench, and permissions lock.

There is a bug in user protect that allows my admin to delete the user1 account via the bulk operations on the people page, so I want to just hide it altogether.


texts:
I want to use format_date(), but it requires a Unix timestamp and my dates are ISO.

Is there a drupal way to convert ISO date to Unix timestamp? If I use strtotime, I lose my timezone offset.


texts: How to Programmatically add javascript dynamically from a custom module to modify a popup calendar property

texts:
I need to add a JavaScript code to my custom module, to modify the property in a date popup calendar and make it dynamic.

According to the documentation of the date popup calendar, the syntax for modifying the MaxDate is:

$( ".selector" ).datepicker({
  maxDate: "+1m"
});

I have to write "+1m" dynamically because it may be "+2m", "+3m", etc, it is variable.

How can I write a JavaScript code in my custom module and effect the popup calendar? I am wondering if I use script tag and put the JavaScript code inside it.
In case, how can I do it by js?


texts:
I'm using a Drupal 7 version website and I'm trying to add a block to a region, when I go in blocks and try to add the block to the region and I do save it reply me that it has been saved but no block is been placed in that region. I'm using omega 4 theme module.
 Anyone knows on how I can solve this issue ?

Many thanks to all.


texts: How to write a self join query in drupal 7 using db_select

texts:
I want to write a self join query, However I dunno how to write it in drupal 7 using db_select().

The query will look like this

  SELECT * FROM msg where sender = receiver

Both sender and receiver fields are part of the msg table.


texts: How to programmatically display the fields available to a content type

texts:
I'm attempting to display a dropdown box of available fields based on a supplied content type. I'd like to retrieve these fields programmatically.

I'm able to get a list of available fields based on a node like so

$fields = array_keys($thisnode->getFields());

But I want to be able to get the fields based on a content type not based on a specific node.

I did see that it could be accomplished in Drupal 7 like so

$fields = field_info_instances('node', 'content-type');

based on an answer here Drupal 7 Is the a way to programmatically know the Fields in a Content Type?

However it seems like field_info_instances is not available in Drupal 8. I attempted using it and it said that the method is unavailable. Is there a method similar to field_info_instances in Drupal 8 that I can use to retrieve the fields of a specified content type?


texts: How can I invoke a drush hook on a remote alias?

texts:
I have a local dev environment and a test server environment.  Both are running the exact same code.

In a custom module, I added a drush hook to extend the sql_sanitize command in order to ensure all private user data is removed from the development database.

From a directory within my local environment, I can invoke drush like this:

  drush sql-sanitize

And my custom drush hook is run properly.

However, when I invoke drush from the same location but targeting my remote server environment (Pantheon, if it matters, and I checked their documentation, but didn't see any relevant notes):

  drush @mytestserver sql-sanitize

sql-sanitize resolves, but the custom drush hook is not called, even though the module containing the hook is enabled locally and on the test server.

I tried invoking the command from a directory outside my local dev environment, but again sql-sanitize resolved without the custom drush hook being called.

How can I execute the drush hook in a remote environment from my local machine?

I have tried both Drush 5.9 and 6.4.0.