texts: Problem installing Drupal 6.22 with Drush

texts:
I'm trying to install Drupal 6.22 with Drush 4.4 on my CentOS 5.6 box, but am having problems getting it to work.

I run the following command:

drush dl drupal-6.22 --drupal-project-rename=drupal1

Then I run:

drush status

and get:

 Drupal version         :  6.22
 Default theme          :  garland
 Administration theme   :  garland
 PHP configuration      :  /etc/php.ini
 Drush version          :  4.4
 Drush configuration    :
 Drush alias files      :
 Drupal root            :  /var/www/html/drupal1

Which seems to suggest that all was downloaded properly.

Then I run the following command to start setting it up:

drush site-install standard --account-name=admin --account-pass=REMOVED --db-url=mysql://admin:REMOVED@localhost/drupal1db

It asks me if I want to continue and I choose 'yes'. After a second or two, it returns me to the command line prompt.

Then I run 'drush status' again, which returns the following error:

Table 'drupal1db.access' doesn't exist                [warning]
query: SELECT 1 FROM access WHERE type = 'host' AND
LOWER('127.0.0.1') LIKE LOWER(mask) AND status = 0 LIMIT 0,
1 database.mysql.inc:135
Table 'drupal1db.cache' doesn't exist                 [warning]
query: SELECT data, created, headers, expire, serialized FROM cache
WHERE cid = 'variables' database.mysql.inc:135
Table 'drupal1db.variable' doesn't exist              [warning]
query: SELECT * FROM variable database.mysql.inc:135
Table 'drupal1db.cache' doesn't exist                 [warning]
query: UPDATE cache SET data = '', created = 1309816902,
expire = 0, headers = '', serialized = 0 WHERE cid =
'variables' database.mysql.inc:135
Table 'drupal1db.system' doesn't exist                [warning]
query: SELECT name, filename, throttle FROM system WHERE type =
'module' AND status = 1 AND bootstrap = 1 ORDER BY weight
ASC, filename ASC database.mysql.inc:135
Table 'drupal1db.url_alias' doesn't exist             [warning]
query: SELECT COUNT(pid) FROM url_alias database.mysql.inc:135
PHP Fatal error:  Call to undefined function filter_xss() in /var/www/html/drupal1/includes/common.inc on line 655
Drush command terminated abnormally due to an unrecoverable error.   [error]
Error: Call to undefined function filter_xss() in
/var/www/html/drupal1/includes/common.inc, line 655

I go to the Drupal directory in my browser and it just shows a blank white page.

Any ideas?


texts:
When I click on certain links in menu in IE a page with error message "Internet Explorer cannot display this page" appears. Other browsers are OK.

Problem is with these two links
"http://localhost/?q=calendar"
"http://localhost/?q=user/login"

Do you know what is wrong?

thank you


texts: Not all fields of node are present in content

texts:
I've set up a custom content on my multilang site type with several fields that are all configured to be translatable. But when I try to theme that node I only habe a subset of the field available, although all the other field are saved in fieldDefinitions array. How to have all the fields available in fields array?

I have a node template node--products.html.twig Therein I access the values with {{ content.field_content_rating_level }} which works fine for the 4 fields in the fields array above, but not for the rest of theme even thought the share the same type of field. All fields are editable without any error in the backend. All fields are filled and translatable.

I use some of the missing fields in views and they work.


texts: Useability of the user registration workflow

texts:
When you want to create an account on a drupal7 page, you have to click very often to create the account finaly.

Go on user/register
Click on one time login link
Open the one time login page and click an login
Change password
Now your done

Are there any approaches to modify the registration process without loosing the email verification? There so many Websites doing it better. Is there a Drupal way?


texts: Is it possible to run Acquia Dev Destop without admin rights on Windows?

texts:
I would like to know if it is possible to run Acquia Dev Desktop without local Admin rights on Windows machine?

I requested admin right and was given for temporary period and installed the software and was able to run it. But can no longer Run Acquia Dev Desktop (after my admin rights expired). Launching the application just asks for admin credentials.

So how would I be able to run the software without getting elevated rights?


texts: I want to retrieve some images from my website to my local Drupal website but my website is under .htaccess password protect so I need to enter a username and password to login. I know the password and username but when I try to get the images through stage file proxy it doesn't work and it's probably because the website is under shield. What should I add in my settings.php file in order for stage file proxy to go through the shield?


texts: After publish node send email to someone

texts:
Let's say i have a custom module in D7 , i want to add a feature to  this .

the feature is : when a user publish a node send an email to someone .

   function sending_email_node_update($node){
    if (isset($node->original->status) && $node->original->status == 0 && $node->status == 1){
        drupal_mail('sending_email','email_action','soheilsadeghbayan@yahoo.com',language_default());
  }
}

function sending_mail_mail($key, &$message, $params) {
switch ($key){
    case 'sending_email_node_update':
        $message['subject'] = t('this is my action report');
        $message['body'][] = t('this is a reporting from sending email made by soheil') ;

        break;
}
}

Could you please help me how to do this ?


texts: footer block through custom module and fetch node image field in Drupal 7

texts:
I want to create footer block through custom module and want to add five images through node.Five images should change one by one after one hour.

Can anybody tell me how to do this ?

<?php

function chat_block_info() {
  $blocks['chat_footer'] = array(
    'info' => t(' FOOTER'),
    'cache' => DRUPAL_CACHE_GLOBAL,
  );
  return $blocks;
}

function chat_block_view($delta = '') {
  $block = array();

  switch($delta) {

    case 'chat_footer' :
      $block['chat_footer'] = array(
        '#markup' => chat_footer_block('footer'),
      );
      break;
  }
  return $block;
}

function chat_footer_block($parm) {
 if ($param == 'footer')
 {
   $node = node_load(11111);
    $uri_top = $node->field_footer_image['und'][0]['uri'];
    $alt_top =$node->field_footer_image['und'][0]['alt'];
   $image_top = theme('image_style', array('style_name' => $footer_chat,
        'path' => $uri_top,
        'getsize' => TRUE,
        'alt' => $alt_top,
        'title' => "IMG"
      ));

}

}


texts: How do I control the available options for an exposed filter?

texts:
I have an exposed filter "country" for my member list view  (I'm using addressfield module to store the country).
I would like to only show countries in my exposed filters where I have members. I can manually restrict the filter by select countries.

Which one would be the best option, between the following ones?

theming views-exposed-form.tpl.php
using hook_form_alter()
hiding some fields with CSS


texts: How to make a CCK field appear as single-value on one Node Type, and multi-value on another Node Type?

texts:
I have a CCK field (text, options widget, predefined value list) I'm using on two Node Types.  On one Node Type, I'd like to allow an unlimited number of selections.  On the other Node Type, I'd like to restrict the user to a single selection.

Currently, I've configured the CCK field to allow unlimited values, and am using this hook_form_alter() code:

/*
 * Implementation of hook_form_FORM_ID_alter().
 */
function custom_form_custom_node_form_alter(&$form, &$form_state) {
  // http://drupal.org/node/726282
  $form['#after_build'][] = 'custom_after_build';
}
function custom_after_build($form, &$form_state) {
  $form['field_custom' ]['value']['#multiple'] = false;
  return $form;
}

So far, so good: the field shows up as single-value on one Node Type, and multi-value on the other.

But when I click Save, the data doesn't end up in the node — I presume this is because the single-value and multi-value fields store data differently, and CCK's submit handler is expecting the data in a different format.

What do I need to do to get the single-value field data into a format CCK will understand for a multi-value field?

So far I've tried:

implementing a #validate handler to alter the $form_state array to match the $form_state array produced by submitting a multi-value field — no effect
implementing hook_nodeapi() $op==='validate' to alter the field values in the $node object — no effect


texts: which one has better performance to load views

texts:
When I want to print my views block result(or views) in my tpl files,I have several ways,

views_embed_view

views_get_view

module_invoke for block ( I means something like $block = module_invoke('views', 'block', 'view', 'map-block_1'); )

which one is better and has better performance?


texts: How to get field value after getting a node?

texts:
I have a content type which contains school information. School name and school id are two fields in the content type. I have the school ID and I am able to retrieve the node. How do I get the school name? Below is how I retrieve the particular school node. I used the getValue() to retrieve the school name however, I get an empty array as a response for that. I am able to see the school name if I var_dump the school node.

$schoolNode = \Drupal::entityTypeManager()
      ->getStorage('node')
      ->loadByProperties(['field_school_id' => $item['schoolId']]);
$schoolNode->field_school_name->getValue()


texts: Get the node count by its node type and node status in Drupal 8

texts:
I was wondering how to get the number of nodes I have, filtered by the node count and status.

For example: how many published articles I have.

I was thinking about using Entity Query to get the node count.


texts: Create two views this the same url and different permissions

texts:
I would like to build a set of views, all of which use the same url.  I also want to set up role based permissions for each one so each users get routed to a different view when they visit the url (the url which all the views share.)  Is it possible to build this view system?

My final goal is to have a single navbar link which sends normal users to a view that filters content based on the users NID.  Admin users will be sent sent to a view that shows everything.


texts:
I'm finding that the biggest problem in working with Drupal 8 is I can't get the data I need.  Drupal 8 wants me to use public methods rather than manually drilling down thru an object.  The problem is, I can't figure out a consistent way for getting a list of available methods! (they magically exist, and I feel like I'm just supposed to know about them).=

For this example, let's say I have a content type with a video field.  I need to get the raw URL of the video file in that field.

So I'd start with a node id ($nid), and somehow I have to figure out how to load the node.  This isn't too bad because there's lots of examples.  So I do something like $node = \Drupal\node\Entity\Node::load($nid);.

So far so good.  Then I need to get the value of my video field (field_main_video).  This took me FOREVER to figure out because there's conflicting documentation around the 'net.  Finally I figured out I'd have to do something like this (because it is a multivalue item):

$video = \Drupal\node\Entity\Node::load($nid)->field_main_video->getValue();

...then loop thru the array etc.  Using kint didn't help me find this, either.  Because, for example, if I kint($node) and look under methods, I don't see getValue() as an item there.  Still not terrible, because there were enough examples around to figure it out.

As I go deeper, though,  what I didn't know (this is the important part) was that rather than getting the video field entity id, then loading the entity, then finding the "uri" field in the entity, etc (like I would in D7):  There was a method that lets me get the URI all in this same line of code!

$url = \Drupal\node\Entity\Node::load($nid)->field_main_video->entity->getFileUri();

But how could I possibly have known this getFileUri() existed?  I happened to stumble upon it in a blog post.  This truly DOES make getting a URI easier than in D7...but only if you know (magically) what methods exist for each 'level' of an object.

In the end, with this example I'm asking: How do you find all public methods for each level of an object in a way that's easy to read and understand?  Note that it seems there should be a drupal-centric (ie. devel module) way of doing this rather than manually searching api.drupal.org or using something IDE specific?


texts:
I am trying to add a hidden field to all nodes in my module (for any node type even new ones being created later on). Would this be the correct code?

$field_storage = FieldStorageConfig::loadByName('node', $field_name);

if(empty($field_storage)){
  $field_storage = entity_create('field_storage_config', array(
    'field_name' => $field_name,
    'entity_type' => 'node',
    'type' => 'string',
  ));
  $field_storage->save();
}

 // Add the field, if needed.
$field = FieldConfig::loadByName('node', $node_type, $field_name);

if (empty($field)) {
  $field = entity_create('field_config', array(
    'entity_type' => 'node',
    'field_name' => $field_name,
    'field_storage' => $field_storage,
    'bundle' => $node_type,
    'label' => $label,
  ));
  $field->save();
}

I am just not sure which hook I should put it in. Most are giving me different errors…
Also I want the field to be updated when the title field of a node is changed, which hooks would be the best to get the new title the user types? Or ist there some kind of event one could subscribe to?


texts: I am trying to write a views_query_alter hook and I want to identify the query I'm interested in. I have found the methods hasTag(), hasAllTags(), and hasAnyTag(), but I don't already know which tags I'm looking for. How can I get Drupal to tell me what tags already exist on queries? I didn't see any getTags() method.


texts: How to rewrite paths delivered by solr search (to view instead of node)

texts:
How can i rewrite the path of results delivered by solr search? Or is it possible to configure it the way i need?

The content of that particular website is organized in views. I do not want users to navigate to the node-view mode of the content, instead i want to redirect them to the specific views-page. Is there a way to show only views-pages as search-results? Or do i have to rewrite the links somehow?


texts: Set a page to show only to registered users

texts:
I have a website with two pages. The "home page" and a "notice page". The notice page should only be viewable to people who are logged in or people who have the role called "Basic User". I have created the role, but I cannot find how to set this notice page (basic page) to require log in.

Here is a similar question, but I think it is regarding drupal 6 and I know that a lot has changed when drupal 7 was released.

Set a page to be only viewed by users who are logged in


texts: Define a resource of Service module, But 'access callback' cannot work

texts:
This following is my resource:

For clearly read, I delete some line.

/**
 * Implementation of hook_services_resources().
 */

function baidu_push_services_services_resources() {
  $resources = array();

  $resources['message']['actions']['send'] = [
    'file' => array(
      'type' => 'inc',
      'module' => 'baidu_push_services',
      'name' => 'baidu_push_services',
    ),
    'access callback' => '_message_access',
    'callback' => 'baidu_push_services_send',
    'args' => array(
      array(
        'name' => 'uid',
        'type' => 'string',
        'source' => 'data',
        'optional' => FALSE,
      ),
  ];

  return $resources;
}

In order to test my 'access callback' function will be invoked, I always return FALSE in my 'access callback' function:

function _message_access($op = 'view', $args = array()) {
  return FALSE;
}

But when I try to use curl command line to test with no SESSION and no Token, but It work!(return the right result to me), Did that mean 'access callback' not be invoked?

So I try to use drush cc all to clear cache, But still above problem.


texts:
I have added this:

    function ahml_form_alter(&$form, $form_state, $form_id) {
      if ($form_id == 'user_login') {
        $form['my_field'] = array(
        '#type' => 'link',
        '#title' => t('Example link'),
        '#href' => 'login'
      );
    }

into a custom module and instead of a link in the output I have two text boxes: one reads
"example link title", the other "example link url".

Do I have this wrong of is there just something else in the system causing this to happen?


texts: How to include specific roles in auto-complete search?

texts: I am using the auto-complete module for searches. It works like a charm. I am looking for to learn how to show only specific roles on the results it pulls. There are advanced areas in the configuration and I think something could be used there, yet I am not sure what.


texts:
I have a field that holds a vimeo video ID, I'm trying to display this content using a view where I'm rewriting this field, but the markup is getting stripped out.

<iframe src="//player.vimeo.com/video/[view_field_id]" width="WIDTH" height="HEIGHT" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>

How can I display a vimeo iframe in drupal using views?


texts: Add the same field multiple times to a display suite node display

texts:
So I'm using display suite with a 2-column layout, and my node has an entity reference field (field_journal). I'm already displaying field_journal as a rendered entity in the LH column, but I'd also like to display a different grouping of fields from the linked entity in the RH column.

I was thinking the best way to do that would be to add field_journal again to the RH column, but I can't figure out how to duplicate fields in display suite.

Is there some way to add the same field to a node display in 2 different places in the layout? Or can anyone help me with a workaround?


texts: How to change Option Label with Hook_form_alter

texts:
I've added the Cheque module to my Drupal Commerce site so that users can select that payment option instead of paying by credit card.

However, I'm seemingly unable to edit the label for that payment option which currently reads as 'Cheque' next to the radio button.

In hook_form_alter, I'm attempting the following, but all it does is add another radio button and another option...it doesn't change the existing option.

$form['commerce_payment']['payment_method']['#options']
['commerce_payment_commerce_cheque'] = t('Send me an Invoice');

Note: I also tried the above code with ['#title'] at the end and it just gives me another option with the label 'Array' attached to it.

So, how do you change the label text of an option with hook_form_alter?


texts: Display link after complete countdown time

texts:
I am using Field Timer module.

Is there any option to display a link after finishing countdown ?


texts: How/where to change the default size of inline images?

texts: For the life of me, I can't seem to figure out how/where to change the default size of inline images (that is, images that have been inserted into the body by way of the wysiwyg editor's Insert/Edit Image button). It's likely that I'm missing something obvious here as I've only had one cup of coffee today... tragic, I know.


texts: What options are there to allow users who have not logged in to see content on the home page?

texts:
I have a site where users must log in to access content.  For the home page, I'd like these anonymous users to be able to view this content and the login box.  Below are the ways I have done this in the past, but I'm looking for comments on how others may do this.  Especially for ways that it could be done without touching templates or code.

Modify page-front.tpl.php when a user is not logged in.  This allows me to remove the "Access denied message"
Create a block that is displayed on the home page for anonymous users.  However, this still displays the "Access denied message"
Implement Taxonomy access and have a term that allows anonymous access.  This would eliminate the "Access denied message"

Are there other better methods to do this with as little code as possible?  What is the best way?

Thanks.


texts: How to set default form values based on query string, if the form uses AJAX file upload

texts:
I have a Book content type with a file upload field.
I'm using Filefield Sources module with Plupload integration for getting the file upload widget.

I need to set a default value based on the query string passed on node/add/book page.

However, the files are uploaded via AJAX, calling the file/ajax page, and losing all default values I set. Obviously, custom query string is not present in that call, and when the form is re-generated, I get an error.

Any ideas on how can I make sure that default values stay in the form?

Thanks!


texts: Let users create / list their own restaurant menu

texts:
I am building a site where a restaurants visitors could register. Now, I have created a content type where the restaurant owners could list up there restaurant. I have to also allow them to add there restaurant menu based on categories like 'starters', 'mains' etc.

Is there any module which could help me achieve this?


texts: How to display the data of a View in table format?

texts:
I created a view using "Table" as its format already. When I click on the title column record it shows the fields one by one.

Can I display the data of a view as table format?


texts: Display files uploaded to a node's body through editor in drupal 7?

texts:
Is there any way to display name of files uploaded to a node body through editor in drupal 7?
I know all the content in body of a node stored as text in database but want to know if there is any way to filter file uploads in body per node basis?


texts:
On a rather old drupal site (D5) I get a 302 on calling cron.php when doing this via wget or curl. It worked fine for many years (via crontab). If I use a browser for that I get a 200 and a blank page (which is normal) the cron runner runs successfully. After trying to find a solution for a couple of hours it works fine with curl for no apparent reason, but not with wget and only if I run it directly (still 302 with crontab). As I type this I try again just to make sure and now neither wget nor curl work anymore, but running it through the browser still works just fine. Strange.

curl: curl -s http://www.mysite.com/cron.php
wget: wget -O - -q -t 1 http://www.mysite.com/cron.php

Any ideas?


texts: Echo taxonomy description based on specific value of a field in a custom template

texts:
I'm trying to check the value of a field on my content type that is a list of taxonomy terms to see if it matches a specific taxonomy term, then if it does match, echo the description field of the taxonomy term I checked. Else, if it does not match, then nothing is to be printed out.

Here is the code I've been experimenting with, but thus far have been unsuccessful getting to work properly:

if ( isset($facil->field_facility_type['und']) &&
 $facil->field_facility_type['und'][0]['value'] == "Hospital")) {
foreach ($facil->field_facility_type['und'] as $description ) {
    echo '
 Say something wild and crazy!
'.$description["value"].'';
    echo '
';
}

}

I'm confused on how to get it to check the value of the field of taxonomy terms, of which the specific one I'm trying to target for this piece is one of about 15 different terms.


texts: How do I set, and return, a value in Views PHP?

texts:
I'm not going to use the real scenario here, just a very simple one that I think should be working.

I have a View.  This view does access some Solr stuff.

I've added a new field to the view.  It's a Global PHP field.  My end goal of this is that I'd like to make this field sortable when you click the table heading.

In the "Value code":

return "asdfasdf";

In the "Output code"

<?php
  print $value;
?>

This returns... nothing. No errors, no output. This is the simplest example I could think of. Am I missing something here?

"Output code" does display other things, even complex things if I ask it to.  It just seems like "Value code" is being completely ignored.


texts:
I'm using Views RSS module to generate a custom RSS feed. I want to be able to limit the results by adding ?offset=50&limit=50 . How could I achieve that? Is there any Views plugin I could use?

Thanks


texts: Is it possible to add translation to smiley alt and title in CKEditor?

texts:
I'm using Drupal 7 with CKEditor module which permit to insert smiley from editor. I've found that the source code of CKEditor fix the smiley description in JS :

config.smiley_descriptions = [
    'smiley', 'sad', 'wink', 'laugh', 'frown', 'cheeky', 'blush', 'surprise',
    'indecision', 'angry', 'angel', 'cool', 'devil', 'crying', 'enlightened', 'no',
    'yes', 'heart', 'broken heart', 'kiss', 'mail'
];

So when I insert a smiley, the code will be

<img alt="laugh" height="23" src="//cdn.ckeditor.com/4.4.3/full-all/plugins/smiley/images/teeth_smile.png" title="laugh" width="23">

But I want to modify the language of alt and title attributs according to the language  used in my site.  Is it possible to do that?
Thanks in advance.


texts:
Is there is a module like dbcm in Drupal 7?

I want to know changes happen in database, so I can update my production sites with all configuration changes: new block, new views, new (CCK) fields.

I have tried the feature module to export my changes, but it doesn't export everything I need. There are also some configuration changes missed after exporting.

Is there a module that store in the database such configuration changes?


texts: Pre-process node type for each node and print within region.html.twig template

texts:
I'm trying to figure out how I can check the node type/content type for each node using pre-process and print it on a region template (region.html.twig)

It seems to be returning NULL

function iom_preprocess_node(&$variables) {
    $node = $variables["node"];
    $variables['content_type'] = load($node->bundle())->label();
}

{{ content_type }}


texts:
(Drupal 7.22)
We need to create a menu link to an external site, "https://example.com/some/path"
/some/path is static, whereas "https://example.com" depends on site instance, such as

web-dev.example.com

web-qa.exmple.com

web-rc.example.com

I would think that this could be accomplished with $GLOBALS['base_root'];
for example:
$url = $GLOBALS['base_root'] . '/some/path';

On local (laptop) $GLOBALS['base_root'] resolves correctly, but on CentoOS
$GLOBALS['base_root'] resolves to [http://default]

How do we dynamically get the actual current site domain?
This can't be so hard, what are we missing?


texts: cron for rebuild xmlsitemap mannually without drush in cpanel

texts:
I'm using this: XMLsitemap module: https://www.drupal.org/project/xmlsitemap

I have a cpanel shared hosting in hostgator and drupal 7. I can not install Drush, ssh access is not enabled. i go to tasks cron in cpanel and setup the cronjob, but in field 'COMMAND' i tried :

curl drush xmlsitemap-rebuild http://link.com.br/cron.php?cron_key=xxxxx

Nothing , because i dont have a drush installed.
So, i tried:

curl xmlsitemap-rebuild http://link.com.br/cron.php?cron_key=xxxxx

Nothing too,lastly I used:

xmlsitemap-rebuild http://link.com.br/cron.php?cron_key=xxxxx

But that is not recognized as Linux command in Terminal .... cron does not happen, what should I do?

EDIT 1:
the task only works if i press the button on image,


texts:
On one of my production sites I wrote a jQuery stylesheet switcher. It drops a cookie when a selection is made and uses php to select the corresponding stylesheet on pageload which overrides styles. All is great until I enable performance caching mode, whereby the cookie is ignored on each pageload. Obviously this isn't the desired effect and I can see why this is occuring: being that the pages are cached and no longer truly dynamic with respect to loading what's seen as a 'dynamically' changing stylesheet. You can change the stylesheet however upon returning to a page the initial style is applied. Just for reference I have coded the php into each page template (page-front.tpl.php and page.tpl.php) and the javascript is located in my scripts.js. The php is basically just a couple of if else statements.

Due to a large volume of traffic I have to enable caching on the site, however ideally would like to retain this style-switcher functionality. Is there a method of making an exception to the caching rule for this or will I have to disable the switcher? Would packing it into a module help?

Thanks in advance :)


texts: User can change `Moderation State` on content without having permissions to do so - Workbench

texts:
I am using Workbench, Workbench Moderation and Workbench access.

I have a content manager role, who should be able to only create unpublished content, edit content that is flagged as Needs review and change the moderation state from Needs review to Draft. But as i'm testing the role, the manager can go into the draft and change the moderation state to published, or even needs review, and I do not have the permissions set for the user to change the moderation state.

At least I think. I've followed a couple tutorials and my site is configured the same, but when they go to change the moderation state their drop down select list only has the options they specified, while mine has all states available regardless of permissions.

I've tested back and forth between the roles and there is differences in the permissions and what each user role can do, but I can't set the role to allow users to moderate specific state transitions.

I literally can turn off all workbench moderate state permissions and they still have access to change the moderation state to anything they want.

As you can see in the bottom right hand corner of the image, the permissions for Moderate all content from ___ to ____ is turned off for my content manager role, and I still have permissions to moderate all content from either state. If i sign is as the reviewer role, I can also turn off all permissions and still be able to moderate the content and change the states without permissions.

No I do not have another role enabled for this user, I have cleared every cache and used different machines, same issue.

My questions are:

if I have a setting on that allow the user to moderate the states of content, what is it?

If I do not have the correct permissions enabled, what should I do to correct it?

If the issue does not lie within the workbench permissions then what should I be looking for?

Thank you regardless.


texts:
If I create a custom module for a single site where should I put it?  Previously I would put it in sites/all/modules, or possibly sites/all/modules/custom.  However I just read this article, Creating Your First Module in Drupal 7 Module Development which say the best practice is to put them in sites/default/modules:

  However, as of this writing, /sites/all/modules is not the recommended
  place to put custom modules unless you are running a multi-site
  configuration and the custom module needs to be accessible on all
  sites.

  The current recommendation is to put custom modules in the
  /sites/default/modules directory, which does not exist by default.
  This has a few advantages. One is that standard add-on modules are
  stored elsewhere, and this separation makes it easier for us to find
  our own code without sorting through clutter. There are other benefits
  (such as the loading order of module directories), but none will have
  a direct impact on us.

  We will always be putting our custom modules in
  /sites/default/modules. This follows Drupal best practices, and also
  makes it easy to find our modules as opposed to all of the other
  add-on modules.

Is this really considered the current best practice?  Is there some official reference to this?


texts: Retrieve the default image from an image field programatically

texts:
Currently im using the following code to retrieve the uri of an image field:

$field = $paragraph->field_background_image_left;
$uri = $field->entity->getFileUri();

This seems to work fine when the field contains a value.
But when no value is set, '$field->entity' will contain null, even when a default image was set for this field.

How do I retrieve the uri of the default image from my field?


texts:
I have a site that's already on the host.
So what I want to do is to put in on my PC , and so I could edit it.
I have already installed WAMP and download a backup with the site from the host, and downloaded the DB from the host also.

What I have to do next?


texts: How to prevent executing .php files in sites/default/files directory for nginx+php7.0-fpm?

texts:
URL to Drupal.org article Preventing execution of untrusted PHP

By default .htaccess inside sites/default/files contains:

<IfModule mod_php5.c>
  php_flag engine off
</IfModule>

Adding mod_php7.c version doesn't fix.

Temporary solutions are:

ProxyPassMatch ^/(.*\.php(/.*)?)$ "fcgi://127.0.0.1:9000/var/www/drupal"

And

<FilesMatch \.php$>
   SetHandler "proxy:fcgi://127.0.0.1:9000"
</FilesMatch>

But they are not recommended and they are overrideable.

There is a Drupal Core issue for adding mod_php7.c to .htaccess, but it's only for Drupal 8 (so how is this solved in Drupal 7 then?) https://www.drupal.org/node/2455465

There is solution for Apache How to disable PHP files from being run in the sites/default/files directory? but not nginx and php7.0-fpm.

So what is the solution?

(I'm running Security Review module that reports PHPs are executable within sites/defaul/files)

Screenshots:

Permissions:

www-data:www-data 755 for dirs / 644 for files

.htaccess:

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

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

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

<IfModule mod_php7.c>
  php_flag engine off
</IfModule>

I did restart nginx and php7.0-fpm.


texts: How can I e-mail the content of a view to myself with Rules?

texts:
I'm using Drupal 7, Views 3.5, and Rules 2.2.  I have a view that provides a page accessible only to admin users on my site, and once a week I would like to e-mail the content of that page to myself.

I know how to use Rules Scheduler to set this action up to occur weekly.  What I don't know is how to get the page provided by the view as a value that can be input into the body of the e-mail sent via Rules.

If it was a node, I could use Fetch entity to pull it in by ID, but since it's provided by a view, there is no such ID (that I know of) to speak of...


texts: Event does not trigger each time I load a page

texts:
I'm using event dispatcher in a custom module to auto login users in a Drupal 8 website. I'm using the KernelEvents::REQUEST, with a onRequest fonction. I put an echo for testing that the function was call :

When the user is already log in, the event work and my function was call on every request
When the user IS NOT log in (anonymous), the function was call on the only first request of a page. Never call again if you reload the page. Only way to get my echo again is to empty drupal cache (I make a drush cr).

Don't know exactly how Drupal cache work... Is there any way to trigger my event on every request, anonymous or not ? Or another better way to do my auto login ? Thanks.

my module structure :

/mymodule
|-- /src
|---- /Controller
|------ MyModuleController.php
|---- /EventSubscriber
|------ MyModuleEventSubscriber.php
mymodule.info.yml
mymodule.routing.yml
mymodule.services.yml

MyModuleEventSubscriber.php

<?php

namespace Drupal\mymodule\EventSubscriber;

use Drupal\Core\Routing\ResettableStackedRouteMatchInterface;
use Drupal\Core\Session\AccountProxyInterface;
use Drupal\externalauth\ExternalAuthInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpFoundation\RedirectResponse;

class MyModuleEventSubscriber implements EventSubscriberInterface {

  protected $currentRouteMatch;
  protected $externalauth;
  protected $currentUser;

  /**
   * Constructs a MyModuleEventSubscriber object.
   */
  public function __construct(ResettableStackedRouteMatchInterface $currentRouteMatch, ExternalAuthInterface $externalauth, AccountProxyInterface $currentUser) {
    $this->currentRouteMatch = $currentRouteMatch;
    $this->externalauth = $externalauth;
    $this->currentUser = $currentUser;
  }

  /**
   * Implements EventSubscriberInterface::getSubscribedEvents().
   *
   * @return array
   *   An array of event listener definitions.
   */
  static function getSubscribedEvents() {
    $events[KernelEvents::REQUEST][] = array('onRequest');
    return $events;
  }

  public function onRequest(GetResponseEvent $event) {
      // echo 'test' => do my echo here
      if ($this->currentUser->id() == '0') {
         auto_login(); // I simplified the code here, but you get the idea
      }
  }
}

mymodule.services.yml

services:
  mymodule.event_subscriber:
    class: Drupal\mymodule\EventSubscriber\MyModuleEventSubscriber
    arguments: ['@current_route_match', '@externalauth.externalauth', '@current_user']
    tags:
      - { name: event_subscriber }


texts: Drupal integration with external binary program to convert an image?

texts:
Using Drupal 8. On a cloud based site, I have a program for converting images into svgs that takes, at times, a few hours of run time. I can easily run the external binary program (configured to run through java as a commandline). At the end I have the program spit out the relevant files. I need to integrate this with Drupal and am wondering the best procedures.

What do I use to grab the image and have an actual file on disk? How can I get the files back into drupal whenever this program finishes. I can easily add in commands to run after the program finishes, and can get the program to run with an exec() but how do I hook the rest of it up? A working proof of concept would be great. Even better if it could run on a spun up virtual computer on google cloud services.


texts: How do I know Honeypot is working on my custom module form?

texts:
I have a custom module that renders a form. In hook_form_alter() I have added honeypot_add_form_protection($form, $form_state, array('honeypot'));

Though, when I perform 'Inspect Element usnig chrome I cannot see any honeypot fields in the html of the page. So, I'm slightly confused on whether this actually work or not.

Any idera on how to test this or atleast see that the form is protected by the Honeypot module?


texts: Create content within the site instead of the Drupal modal popup?

texts:
I have a content-type "client-request" and I would the form to be displayed within the site (inside the banner and sidebar) when the user clicks new request instead of opening up in the Drupal modal popup.

Is this do-able?


texts: How to optimize performance rendering node with two entity reference fields without using Views?

texts:
I'm challenging myself to not use Views and instead rely on EntityFieldQuery() or Dynamic Database Queries.

I have a node Event with a date field and two entity field references to artists that will be preforming at the event and the venue the artist is playing out.

On the venue page, the venue information is displayed and I'm trying to display the list of events grouped by event NID and some of the artist's information like artist name and embedded YouTube video.

I built the query using Views in about 2 minutes to pull all the information. It takes 600ms to load the page without caching. Using EntityFieldQuery without rendering the information it takes 550ms or 300ms over the time it takes to render the page without all the queries.

function helper_load_events_by_venue_id($nid) {
  // this venue reference target id is found on the eventy enitity.
  // We pull and load all the events

  $query = new EntityFieldQuery();

  $query->entityCondition('entity_type', 'node')
      ->entityCondition('bundle', 'event')
      ->fieldCondition('field_venue_reference', 'target_id', $nid);

  $result = $query->execute();

  if (isset($result['node'])) {
    $event_items_nids = array_keys($result['node']);
    $event_items = entity_load('node', $event_items_nids);
  }
  $events = array();

  foreach ($event_items as $event_nid => $event) {
    $event_node_wrapper = entity_metadata_wrapper('node', $event);
    $events[$event_nid] = array();
    $events[$event_nid]['date'] = $event_node_wrapper->field_event_date->value();
    foreach ($event_node_wrapper->field_artist_reference->value() as $artist) {
      node_build_content($artist);
      $events[$event_nid][] = $artist;
    }
  }

  return $events;
}

What is the best way to create an unordered list of upcoming events to be listed on a venue page without using views. It gets complicated because I want to show the event day, the artists that are playing at that event, the formatted embedded YouTube video of the artist, and taxonomy terms associated with the artist. Am I going to have to create queries to the database with lots of joins passing the information through theme function or can I use abstractions like EntityFieldQuery() and field_view_field()?


texts: Change navigation (sublinks) according to main menu (headlinks)

texts:
I would like to create a main menu with some links in it. And when you click on a link in the submenu, the content of the navigation menu changes according to the link clicked in the main menu (= subnavigation elements). Here is an image to clarify:

I now have a main menu and a navigation, but the links stay the same for this moment. So now I would like to get the navigation to be dynamic. How could I do this the best way?


texts: How to add a fields into custom registration form in drupal7 and how to give the link so that annonmous user can register.


texts:
I am going to start work on a website that is already developed in Joomla 1.5
What are the possible ways to migrate the contents from Joomla.

PS: I have looked into joomla module but no luck!

Any ideas will highly be appreciated!


texts: Why am I missing 'notification' features on my entityforms?

texts:
A coworker installed entityforms on a staging site and it delivers email notifications nicely.  I am trying to replicate the process on the production site, but I am missing all the features/UI related to email notifications.

Below you can see I'm missing access/submission/validation options.  I am also missing the 'Notifications' tab that should show up on the entityform 'edit' page.

Staging server

Production server

I have the rules module and other dependencies (auto-installed with drush)
I have Entityforms Notifications enabled
I have Rules UI enabled

What am I missing?


texts:
I have an existing web application written in Flask. I want to create a Drupal site that integrates this existing web application, so that the existing webapp will just be a back end, and the Drupal site will contain all the forms that submit data to the web app and displays the results from the web app.
I was thinking that Drupal Services could do that for me, but it looks like it is more for the reverse use case: to use an external web app as front end to Drupal..

So my question is: What is the best way of using Drupal as a front end to an existing web application?

Or is this even possible?

Some extra info about the web app:

Web app is written in Python/Flask
It is a web shop like application that allows users to search for products based on various criteria.
Web app is highly modular and cleanly split into views, forms, model, so it would be fairly straight forward to change the web app in order to present data via another protocol/API. I figure it would be possible to create new views that present the data in JSON or something like that and I hope that Drupal can somehow pick that up and display it in its templates.
Database is PostgreSQL
Frameworks used: Flask, SQLAlchemy, WTForms

Update 2015-05-15: More details

I have considered using Drupal Services because it sounded like it was an API for this, however, it turned out that Services solves the reverse problem: Makes it possible to use an external app as front end for a Drupal site.

How I think this could be done: Make the existing Flask webapp into a REST server allowing the Drupal site to send requests to the app for search queries, product displays, etc. So the external app will respond with some JSON that contains all the content and URLs to images, etc. In Drupal there will have to be a template for each view on the external app. E.g.:

Search form
Search result
Product display
etc.

I have zero experience in doing this stuff from Drupal. I have some experience with using Drupal. But mostly vanilla Drupal.

I was hoping that there were either a plugin or framework or something that would make it easier to do this. that is something that will make it easy in Drupal to create the following kinds of elements:

A form/template that upon submit sends request to REST service and displays results (e.g. serach)
A template that renders a page according to some JSON data gotten from a RESTful service.

Regarding PDO, I am not sure what that is. I am using PostgreSQL. I was not planning on letting Drupal access the external web app's database directly. That would essentially require me to reimplement the entire application in Drupal.

As mentioned above, the external app is written in Flask. Flask is a Python framework for making web applications. For short introduction, see http://flask.pocoo.org/.


texts: How to convert objects into array using serialization API?

texts:
I'm trying to convert entity objects into array but it's not working. Can you please help me spotting the mistake. I need to use `serializer.normalizer.content_entity' service. The code I have written is:

class ComplexMergeResolver implements ConflictResolverInterface {

  protected $serializer;

  protected function setUp() {
    $this->serializer = $this->container->get('serializer.normalizer.content_entity');
  }

  /**
   * {@inheritdoc}
   */
  public function applies() {
   return TRUE;
  }

  /**
   * @param RevisionableInterface $revision1
   * @param RevisionableInterface $revision2
   * @param RevisionableInterface $revision3
   *
   * @return array
   */
  public function merge(RevisionableInterface $revision1, RevisionableInterface $revision2, RevisionableInterface $revision3) {
    $r1_array = $this->serializer->normalize($revision1, 'array');
    $r2_array = $this->serializer->normalize($revision2, 'array');
    $r3_array = $this->serializer->normalize($revision3, 'array');
    $merge = new ThreeWayMerge();
    $result = $merge->performMerge($r1_array, $r2_array, $r3_array);
    return $result;
  }
}

r1_array is returned empty, which means normalize method is not being called properly. Any help would do great. Thanks in advance.


texts:
I want to duplicate my locally hosted website to a friend's environment. He says he needs a copy of website's database. I'm a bit of a an Drupal rookie so I have no clue of how do this. We are using a code base so all the other files are in there.

I check settings.php and it says I have mysql as the driver
I have drush and run the command

drush mysql-dump > random.sql

This didn't work. I got an error saying; the drush command mysql-dump could not be found.

Please follow me through the steps of how do this. I really need to sent share this website with my friend as quickly as possible.

Thank you


texts:
I'm sick of moderating comments in my sites. Currently in Admin I'd see all comment titles with view/edit link on each.
What I want a table in which I can see each comment full text(which I can edit) along with delete/approval buttons so that I can moderate all of them at once in single screen.

Is there any module which can give me this view.


texts: "Downgrading" module to dev branch without drush

texts:
Due to some 'interesting' hosting choices by my predecessor, I'm stuck managing a dedicated server without SSH access -- FTP only. It's rough, in a lot of ways.

I have a highly customized Commerce Kickstart site where I need to include the Commerce UPS module, which requires the 2.x-dev branch instead of the recommended stable.

Short of switching to a new server provider, anyone have a solution to downgrade without Drush?


texts: How to create a template for a Views row style?

texts:
I want to create a template file for a Views row style. I have created a template file for a field as views-view-fields--menu.tpl.php and output style file as views-view--menu.tpl.php.

How to create a template for a view row style?


texts: using drupal7 commerce and trying to figure out how to have a product assigned to multiple categories(old ubercart user here). The only way I have found so far is to create a new product view for each category(seems kind of cumbersome).


texts: How to fix "Unable to save a field collection item without a valid reference to a host entity" error?

texts:
I programmatically created a series of custom content entities which contain field collections. My site had an execution timeout error in the middle of entity creation and saving.

I can not delete some of these entities. Any attempt is met with:

  The website encountered an unexpected error. Please try again later.

  Drupal\Core\Entity\EntityStorageException: Unable to save a field
  collection item without a valid reference to a host entity in
  Drupal\Core\Entity\Sql\SqlContentEntityStorage->delete() (line 718 of
  core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

I need to be able to delete these host entities. They are still showing up in my entity list. I can edit and save them, I just cannot delete them.

How can I delete the host entities?


texts: Drupal 7 Custom Theme - Administration menu missing or not showing

texts:
This should be an easy query for those that have been using Drupal 7 for some time and have created their own custom themes.  I have created a custom theme which appears to be working, but it does not show the administration menu which is normally located at the top of the screen does anyone know what needs to be done to get it too show - e.g. what line needs to be added to the html.tpl.php file ...

one source suggested

<?php print $closure; ?>

But this might have been more geared towards Drupal 6 ... I'm working with Drupal 7... another source suggested adding:

<?php print $page_top; ?>

But that doesn't appear to help either.

Anyone got any ideas on how to added the administration menu which normally shows at the top of the page?

Side Note:
Are other themes making use of template.php files and hooks to get the administration menu to show?


texts:
I know that using hook_menu_link I can add classes to the <li> tags but I need to add a class to the <a> tags within the <li> of a menu. I've looked and can't find a way.

Any ideas?


texts: $.cookie is not a function from form.js with block cache

texts:
I am getting this error if I turn my block caches on.
I have traced back the origin back to Drupal core form.js but can't seem to see what's going on here.
Any ideas?

Here is the debug:

form.js?v=7.56:69 Uncaught TypeError: $.cookie is not a function
at String.<anonymous> (form.js?v=7.56:69)
at Function.each (jquery.min.js?v=1.7.2:2)
at HTMLFormElement.<anonymous> (form.js?v=7.56:67)
at Function.each (jquery.min.js?v=1.7.2:2)
at $.fn.init.each (jquery.min.js?v=1.7.2:2)
at $.fn.init.$.fn.once (jquery.once.js?v=1.2:55)
at Object.attach (form.js?v=7.56:65)
at Object.<anonymous> (drupal.js?p3kpc3:76)
at Function.each (jquery.min.js?v=1.7.2:2)
at Object.Drupal.attachBehaviors (drupal.js?p3kpc3:74)

Update: I think I am isolated this problem to a webform in a block on the page. If I get rid of that form, the error goes away. Also, this error doesn't happen every single time. Sometimes I have to change browser or open in incognito for it to crash, and then it happens repeatedly.

I can see that jquery.cookie is there when it works. But when there is a crash and I see the page source it's not there, so somehow it seems it's failing to load and when it happens I get the error. I am using JQuery Update (1.7).


texts: Creating user alert node on User Alert module

texts:
The steps for using the User Alert module are the following:

  Enable User Alerts
  Set the appropriate permissions for selected roles
  Set the User Alert block in the appropriate region of your theme.
  Create a user alert node.

How can you create a user alert node in Step 4?


texts: How can I quickly re-save all the nodes on my site (to trigger a rule that activates on content update)?

texts: I made some mistakes configuring a certain content type on my site.  To fix these mistakes, I made a rule that performs some actions "when existing content is updated."  However, I don't want to go through my site and manually save all the nodes again one by one.  Is there a way to use Rules or Views Bulk Operations to quickly re-save all the nodes?


texts: Print #field_suffix with drupal_render($form['field_custom_text_field'])

texts:
I have a custom module that defines a field_suffix for a custom text field

function custom_check_form_user_register_form_alter(&$form){
$form['field_url']['und'][0]['#field_suffix']='text goes here';
}

I then am calling the field in a user-register.tpl.php as

print drupal_render($form['field_reg_site_url']);

However, the #field_suffix isn't printing (checked that the value is in the array - yes). It does work (same code pattern) for username. Any ideas what I'm missing?


texts: Entity references from a view with list of nodes that can be references to nodes that keeps references

texts:
I have a package (node with few entity reference fields - one per content type).
Example

So on package node I can select nodes that are related (one reference per content type).

Now I have new request:
create a view with a list of all products and on each row (product) make possible to select package this product belongs to - for example: set ref_to_shirt if product in this row is a shirt.

Note that reference field is on package and there are multiple reference fields (one per content type).

List will look something like this:

Any sugestion? I was wondering if its possible to set this as VBO action with some Rules component, but for now I'm open to any solution.

Thanks


texts: Add more than 2 profile in Civicrm contribution page

texts:
I'm using civicrm contribution page to create a membership renewal page. But in the "Profile" tab, I'm only able to add  two profile, one in top of the page, one in bottom of the page.

Is there any way I can add in more than two profiles in the page? Just like in event page, I can add 7 profile.

Thank you.


texts: Views - Change view based on number of results

texts:
With Views, can you change the display of the view depending on the number of nodes being displayed?

For example:
Let say you are using views to override a taxonomy page.
If the taxonomy page has only one node present, then the one node should be displayed in full.
However, if the taxonomy page has more than one node, then a list of nodes should be displayed (so the user click on the node they want.)

Is this possible with views?

(This question applies to Drupal 7).


texts: Where do views/panels get their source html code

texts:
I'm working on a few sites that use views/views-ui/panels to display content.

The entry points of the templates are located in the active theme directory
for example 1 view with settings of Format: Bootstrap Thumbnails renders the file views-bootstrap-thumbnail-plugin-style--title.tpl.php

But inside here is only a loop which prints out $rows of large html strings.

This is the same for most sections which simply print $variable.

I've tried using xdebug and followed the stacktrace but get completely lost in the nested functions, and can't keep up with the large unorganised $this variable.

I've also tried root directory searches of strings from the HTML which only finds html in the cache.

Where do views/panels get their source html that's inserted into $row $content etc.. ?


texts: Modal Popup for Vimeo when clicking on Vimeo Thumbnail Link

texts:
I have a basic link field and in this link field I just have a vimeo/youtube link. What are some of the available modules that can give the functionality of:

Render the display of the video link with a thumbnail of the video on teaser/full display
When clicking on the video link, a modal popup overlay will show with the video.
The popup can also be responsive. (i guess this can be done manually via css)


texts: Drupal showing blank page after migrating to a local server

texts:
(this question has been asked on Stackoverflow so I apologise for the repitition)

Firstly some background,..

IVe started a new job as PHP developer with a company that hosts 2 Drupal (6.x) sites.

While I have years of experience in PHP, Drupal ( and indeed off the shelf content management systems in general ) is a new one on me. Still, there is loads of documentation and its not rocket science, so no problems there.

The server environment is IIS (live server 7.0, locally 7.5) IIS is a totally new beast to me too, so it adds to teh learning curve.

I have successfully gotten a clean install of Drupal (7.x) to run locally, so I know the server is up and running correctly

The problem happens when I try to pull down the live site. I have replicated the database locally, and I know that it is connecting, however when I try to run the local site I get a blank page with the following source c ode:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en">
  <head>
    <?include '_inc_head_common.tpl.php';?>
  </head>

  <body id="body">

      <?include '_inc_header.tpl.php';?>
      <?include '_inc_content_3col.tpl.php';?>
      <?include '_inc_footer.tpl.php';?>
  </body>
</html>

So it seems that it is getting to a point and no further..

has anyone encountered this before or could someone point me in the direction that I should be looking at?

Thanks

Kevin


texts: How to create toggle effect using jQuery?

texts:
I am using views to to display title,image,date,description of a specific content type. By default the first element in the views has to be shown, where else the remaining![enter image description here][1] would be hidden . When the user clicks the 2nd title the 2nd node's content has to be shown and the rest has to be hidden.
It would be great if some one can help me to achieve this.


texts: Better Exposed filter when shown in pane configuration, then they are all coming as checked

texts:
Create a view of type Content Type, add a filter expose it, select it as drop down (Will be better if term reference field). After that select Exposed Form Style as Better Exposed Filters, and under BEF settings, show the filter as checkbox. After that under Pane Settings >> Allow Settings >> Check the checkbox "Use exposed widgets form as pane configuration", and save the view. After that create a mini panel through pane, and under settings you will see filters as checked.

Please give me some idea for the same.


texts: Enable a button basing on multiple form values being equal

texts:
I would not like users to be able to submit a form until:

All fields are filled out
The password and confirm password fields are equal

I can do this with JavaScript, potentially, but then the JavaScript code would managing some states and the PHP code would manage other states. It seems messy.

This is the code I wrote.

'disabled' => array(
// disable button if missing required fields
        array(
          ':input[name="field1"]' => array('value' => ''),
        ),
        array(
          ':input[name="field2"]' => array('value' => ''),
        ),
        array(
          ':input[name="password"]' => array('value' => ''),
        ),
        array(
          ':input[name="confirm_password"]' => array('value' => ''),
        ),
      ),

      // only enable the button when passwords are ==
'enabled' => array(
        array(
          ':input[name="password"]' => array('value' => ':input[name="confirm_password"]')
        )
      )


texts:
I want to create a views with scrollable content. I've searched using google and found this : http://drupal.org/project/scrollable  but it is abandoned.

Is there anything similar to it ? I use Drupal 6.


texts: How to use picture element as background image?

texts:
With the simple image field we are able to set the image style and use that to set the image as a background for a div tag (see example below). HOwever, as Drupal 8 has Responsive Image module, the image field will generate like below. With different breakpoints, different images are fetched by the browser, but this make it difficult to set the image as a background.

The current implementation is flexible because as the text grows so does the height of the div containing the image as a background image.

How would you use the picture tag to set the image as a background? I have not found a way to have Drupal detect what image is being fetched by the browser.

Goal:

Have image as a background
Overlay text on top of image
As the overlay text grows, so does the div containing the text. As such the image as a background should grow as well.

Current implementation without Responsive Images:

Authoritatively reinvent magnetic ROI without excellent interfaces. Professionally drive extensive manufactured products through 24/365 leadership.

Responsive image outputs which makes it difficult to set the background image (banner_large, banner_medium, banner_small are image styles)

<picture>
<source srcset="/sites/default/files/banner_large/name.jpg 1x" media="all and (min-width:1200px) type="image/png" >
<source srcset="/sites/default/files/banner_medium/name.jpg 1x" media="all and (min-width:768px) type="image/png" >
<source srcset="/sites/default/files/banner_small/name.jpg 1x" media="all and (min-width:320px) type="image/png" >

</picture>


texts: Filtering a views result two month ago from now

texts:
I'm using drupal 7.
I building a views with date filter but how to filter the nodes between the date i will select and two months earlier?
I tried with relative date value but i did not knew how i should set it correctly.
Thanks.


texts: How to allow editing a single node to a single user?

texts:
I am building 500 nodes of same type with different info in them.
When I am finished, I want to give each user that will register 1 node that is already in the system, and only that user can edit or add data to that particular node.

Any suggestions about how to do so?


texts: How to provide a filter based on json:api for referencing nodes with a term reference field?

texts:
I am working with the Entity Share module to synchronize content between Drupal instances and I need a filter to define which content can be shared.

My use case is almost identical to the one mentioned in this support issue. The only differences being that the content type is a basic page and the term reference field is called field_share_to which in turn references a taxonomy vocab called Sites. I also have only two sites; 1 server and 1 client.

I am struggling to configure the correct path for term reference field and value for the term ID(64)

  Enter the machine name of the field / property you want to filter on. You can reference field / property of a referenced entity. Example: uid.name for the name of the author.

So. How to define the machine name for the jsonapi property that would return nodes filtered by term id 64?

I ask this question as a site builder rather than someone who spends a lot of time working with code.


texts: How to get a list/array of all content entities?

texts:
I need a list of all content entities, to query them all and check if they have a specific field.

Couldn't find this in the API doku.


texts: Enable placeholder translation for exposed filters

texts:
I'm building a multilingual site using Drupal 8 and I already managed the creation of a search tool using Views and Exposed Filters. My issue is with the translation of this tool: Drupal gives me the option for the translation of most of the elements of the view, but I can't find any options to translate the placeholder used in the exposed filter.

Is there any way to translate placeholders for those filters?


texts: How to add completely custom URLs to Sitemap in module XMLSitemap in Drupal 7

texts:
I have a website with which has some different URLs that are not inserted in the url_alias table not embedded into Drupal content system, but they are generated on-the-fly by custom PHP logic inside a module.

How can I alter the sitemap generated by XMLSitemap modules in order to include these generated "artificial" URLs?

For example:

www.example.com/products is a content node.

When accessing

www.example.com/products/category1/subcategory2

I see the list of the products under category1 and subcategory 2, but generated on the fly by custom code, from data from other repository different to Drupal's one.

The URL

 www.example.com/products/category1/subcategory2

is not in the database table: url_alias and it does not pertain to a different node to the first one (whithout parameters), either: the screen displays different info based only on the custom module.

I would like to know how to include this URL in a automated way in the xml sitemap.


texts: Selectively clear cache, without AdminMenu

texts: I've been using AdminMenu on my site, and have noticed significant performance issues. I'd like to disable it, but I have a number of "Admin Lite" users, who depend on being able to selectively clear parts of the cache - css/js, theme cache, etc. They're not the type of users who are going to install Drush, so I'd really like a simple web based UI that allows selective cache clearing. Rules & Cache Actions feels close, but I don't actually want automated rules for clearing the cache. Is there a module out there? Or do I need to write one?


texts: Get field content of all instances of a field

texts:
I'm trying to get the content of all instances of certain fields based on their names. I've got a list of fields (which are in nodes/paragraphs and blocks) of which I want to extract the values from.

For example field_call_to_action_link. I need values of all the instances of this field.

Each field has it's own database table, like: node__field_name, paragraph__fieldname, block_content__fieldname.

I get the field names like this ($configFieldTypes is an array of types I want):

foreach ($configFieldTypes as $fieldType) {
  $fieldNamesFiltered[] = $this->entityFieldManager->getFieldMapByFieldType($fieldType);
}

Then I filter based on the name starting with 'field_' and make an array with the fieldname as key and the bundles associated with each field:

  private function recursiveKeys($fields, &$fieldNames) {
    foreach ($fields as $key => $field) {
      if ($key === 'parent_field_name'){
        continue;
      }
      if (FALSE !== strpos($key, 'field_')) {
        $fieldNames[$key] = [$field][0]['bundles'];
      }
      if (is_array($field)) {
        $this->recursiveKeys($field, $fieldNames);
      }
    }
  }

The endresult is an array like this:

  ["field_call_to_action_link"]=>
  array(1) {
    ["call_to_action_button"]=>
    string(21) "call_to_action_button"
  }
  ["field_image_gallery_link"]=>
  array(1) {
    ["image_gallery"]=>
    string(13) "image_gallery"
  }

Now I need to know if field_call_to_action_link is a node, block, or paragraph.

How can I determine which database table to query?

Drupal 8.8.x


texts: How to call helper function from my_module.admin.inc file in drush command?

texts:
I have some function in the mymodule.admin.inc file that i want call from a drush command and i have done the following below in the mymodule.drush.inc

function mymodule_drush_command() {
      $items['custom-cmd'] = array(
         'description' =>'some description',
         'aliases' => array('ccmd'),
         'examples' => array('drush ccmd'),
      );
      return $items;
 }

 function drush_mymodule_custom_cmd() {
     module_load_include('inc', 'mymodule', 'includes/mymodule.admin');
     _helper_func();
 }

The helper function is something along the lines of this (mymodule.admin.inc):

function _helper_func() {
    //do something
}

When i try the module_load_include function and i run the drush command i get an error similar to:

'PHP Fatal error:  Call to undefined function module_load_include()...'

I am unable to find a good resource to help me figure out why the helper function is not called from the drush command.


texts: Is a mailchimp newsletter with an entity view in the content area possible?

texts:
I am a newbie on emailing solutions and I have to design a newsletter system that allows the customer to create a newsletter with some content + the 3 most recent articles.
I guess it could be possible with simplenews, but mailchimp is a requirement. So I was wondering if anyone has already tried to add an entity of view type in the content part of a mailchimp newsletter like it is possible to add a node entity type. Or by using a module like Insert view or by simply adding a little token like this one:

[view:my_view=my_display]

The context of the project is D8, but a D7 solution might help.


texts: $GLOBALS['user']->uid returns same uid for different logged in users?

texts:
I'm implementing hook_menu in my custom module. Implementation works fine except, it turns out that $GLOBALS['user']->uid returns always same value no matter which user is currently logged in. Sounds absurd! What could be the problem?

Below is a full hook_menu:

function my_tab_menu(){

    $current_user_id = $GLOBALS['user']->uid;  // $current_user_id=202 for each

    $query = new EntityFieldQuery();
        $result = $query
                ->entityCondition('entity_type', 'node')
                ->entityCondition('bundle', 'profile')
                ->propertyCondition('status', 1)
                ->propertyCondition('uid', $current_user_id)
                ->propertyOrderBy('created', 'DESC')
                ->range(0,1)
                ->execute();

    if (isset($result['node'])) {
        return array(
        'user/%/alumni-spotlight' => array(
                'title' => 'Alumni spotlight',
                'page callback' => 'user_tab_page',
                'page arguments' => array(1,$result['node'],$current_user_id),
                'access callback' => 'user_tab_access',
                'access arguments' => array(1),
                'type' => MENU_LOCAL_TASK,
            ),
           );
    }
}


texts:
How can I make it so roles that are denied access to a page can still see overview of page i.e. title and description but get an access denied message if not granted access?

I have tried different combinations of per node access along with content access but because in permissions there is only a view published content for all content which if deselected renders every page access denied regardless of content or node access...my only option it seems is the invisible page for no content access which is not at all preferable.


texts: How do I customize node.tpl to print an entity reference field in a specific format

texts:
I have content type called collection that has an entity reference field (multiple)  that references another content type called books. One the collection node page, I want to render all of the books as linkable titles, with a button next to them that says "add annotation to book" this will link the user to create a third type (entity) that has a reference field pre - populated.

So my question is this, how do I re- format the books fields of my collection type to meet my use case. So far I have toyed with the following options.

Add a custom node--book.tpl.php file and place code that take the reference field, loops through it, does and entity load on each referenced entity, then adds custom html to the add form of the third content type
Alter the field--type.tpl,php and add it in here - can't figure out this option because I'm not sure how to retrieve the nid, link, and title from this template.
Create a custom display for my book entity and set the field on my collection to render as this new display (this created other problems, I don't know if it's possible to have a separate template for this new display, and this complicated it).


texts: Infinit loop when I 'print_r' variables like $form_state, $form

texts:
I don't understand, I want show some vars during my dev. I work on windows and Linux.

On windows, When I use print_r for show $form or $form_state (from the hook form_alter). There isn't any problem, when the page is loaded, I can see the content of theses vars.

But on linux, when I use print_r, I see the RAM (via top/htop) rise continuously until 4Go and my OS freeze x) The page I request is never loaded.

I don't understand because I don't think have a special configuration. My configuration is recent.

On Linux (Mint)

php -v : 5.6.14
apache2 -v : 2.4.10 (Raspbian)

Solution

Activate the sub-extend drupal Kint from the devel package :)


texts:
I have a drupal form that contains a select box. Next to the select box is a link that pops a ctools modal up with an inner form that adds a value to the database table that drives the original select box. When someone clicks submit on the modal form, I would like to rebuild the select box on the original form and set the new value to the default. I've had success with adding the new elements to the select box by doing some ajax in the form_submit hook for the modal form, but it seems like Drupal ignores the value in #default_value in my render array. I have the following in my form_submit hook after the database update and after getting the render array from another function:

if(isset($id)) {
   $newdata['data_source']['#default_value'] = $id;
}
$commands = array();
$commands[] = ctools_modal_command_dismiss();
$commands[] = ajax_command_html('#measure-data-source', drupal_render($newdata));
print ajax_render($commands);
exit();

Again, the select box is getting the new value, and my render array seems fine. I just can't get it to select the new value by default.


texts: how to alter "other" field label or change the label name

texts:
How to alter "other" field label or change the label name
Please see the image

Also,

How to constrain the sum of these responses to be 100?
Please see the image


texts: How to cache forms with a reverse proxy and deal with stale form tokens?

texts:
When Form API generates a form, it also generates a token that is passed out with the form in a hidden field, and expected to be returned back. If it is, the form is processed.

If a rendered form where ever to be cached, say, by Varnish, this mechanism breaks. The first user submitting the form will consume the token, and following attempts to use the form will be rejected.

What strategies are available to keep forms working while caching their rendered form?


texts: Commerce- How to add a product image on a product display to the shopping cart summary view

texts:
I have two products on my site that are named similarly but easily distinguished by their images.  Users sometimes buy the wrong one by mistake, so I want to put the product image on the Shopping cart summary view.  By default, this view can be used to add fields of products.

My product images, however, are on the Product display content type.  Though the Product display has a product reference to Products, there seems to be no way to get the reverse of that relationship (in other words, to get the Product Display from the Product).

There aren't too many products, so I thought about just adding an image field to Product as well and duplicating all the data, but that is definitely a maintenance problem down the line.  Is there a way to get the image on the Product Display with just the Product in Views without duplicating data?


texts:
I want to do array_unshift for submit function in D8.
Array_unshift working perfectly for validate function but not submit function.
Below is my code:

function example_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
  if ($form_id == "commerce_order_default_edit_form") {
    array_unshift($form['#validate'], 'example_manual_validate');
    array_unshift($form['#submit'], 'example_manual_submit');
  }
}
function example_manual_validate(&$form, \Drupal\Core\Form\FormStateInterface &$form_state) {
  $values = $form_state->getValues();
  dsm($values);
}

function example_manual_submit(&$form, \Drupal\Core\Form\FormStateInterface &$form_state) {
  $values = $form_state->getValues();
  dsm($values);
}


texts: Drupal lets you sub-theme a theme, basically like inheritance.  How can I print out a list of all themes that a drupal site is 'using'.  For example: actual theme -> parent theme 1 -> base theme


texts: Ajax doesn't properly work: The success function is called but the page is being printed instead of the page callback results

texts:
I am using AJAX in Drupal 7 to get data from the bounds of a map, serialize it as a string, and submit as post to server to be added as a filter for a view to make a display respond to changes in zoom and array bounds.

The success callback is called, but the data returned is not the result of the page callback function: The XHTML response in Firebug is the entire web page.

I would really appreciate to know what is preventing the page callback function value from being returned.

(function ($) {
Drupal.behaviors.mapresults = {
attach: function() {
// Dynamically show  the marker nodes
 // first find the right map
$.each(Drupal.settings.getlocations, function (key, settings) {
// this is the one we want
alert("0");
if (1 == 1) {
  // an event handler on map zoom to check if the view results needs to be updated
  on zoom
  // hooking another event and checking zoom may work better.
  google.maps.event.addListener(getlocations_map[key], 'bounds_changed', function()
  {

    // count number of markers <= 10'
    // global_settings.mgr
    //mgr = new MarkerManager(getlocations_map[key]);

     //zoomcount = mgr.getMarkerCount(getlocations_map[key].getZoom());
     zoomcount = 10;
     if(zoomcount < 100){
         // get bounds
         marker_bounds = getlocations_map[key].getBounds();

     // calculate horizontal distance from bounds to get max  and min latitude and
     longitude for the for box
    // submit data with jquery get bounds etc.
    var marker_bounds_string = JSON.stringify(marker_bounds);

    // ajax link to submit data by post
    $.ajax({
        type: 'POST',
        url: 'ajax/mapresults',
        dataType: "json",
        data : {marker_bounds : marker_bounds_string},
        success: function (data)
 {document.getElementById('map_results').innerHTML = "success";},
        error: function (xmlhttp)
 {document.getElementById('map_results').innerHTML = xmlhttp.status;}
        });

    }
     else{

     }
  });
}
});
}
};
}(jQuery));

This is the module code.

function mapresults_menu() {
  $items['ajax/mapresults'] = array(
    'title' => t('mapresults AJAX'),
    'type' => MENU_CALLBACK,
    'page callback' => 'mapresults_ajax',
    'access arguments' => array('access content'),
  );
  return $items;
}
function mapresults_ajax() {
// call back for display map options
drupal_exit();
$view = views_get_view('search');

// set display
$display_id = 'default';

// add filters from ajax
// float
$bounds_array = json_decode($_POST['marker_bounds'])

//get cordinates from bounds_array
$lat_min = $bounds_array[0][0];
$lat_max = $bounds_array[1][0];
$lon_min  = $bounds_array[0][1];
$lon_max = $bounds_array[1][1];

// add filters to view
$view->exposed_input['ubicacion_latitiude'] = $lat_min;
$view->exposed_input['ubicacion_latitiude_1'] = $lat_max;
$view->exposed_input['ubicacion_longitude'] = $lon_min;
$view->exposed_input['ubicacion_longitude_1'] = $lon_max;


texts: Cached rendering depending on a parameter

texts:
I'm trying to render a template given a request parameter but I get the same result once the cache is set.

Let's say I have this template :

-- {{ step }} -- {{ xxx }} --
{% if not step %}not step{% endif %}
{% if step == 1 %}step 1{% endif %}
{% if step == 2 %}step 2{% endif %}

And this preprocessor

function themename_preprocess_page(&$variables) {
    $request = \Drupal::request();
    $variables['step'] = null;
    $variables['xxx'] = rand ();

    if ($request->query->has('step')) {
        $variables['step'] = $request->query->get('step');
    }
}

When I work with the cache template disabled, I get the expected resut, e.g when requesting page?step=1, I get step 1, page?step=2, I get step 2 and so on. However, when the cache is enabled, the first page load is correct and the subsequent loads take the same markup (if I first load page?step=1, I get step 1 whatever parameter I use after that).

How can I tell Drupal to process my variable even if the cache is enabled?


texts:
In Drupal 7, the Media module allowed you to add fields on a file entity. I don't see this ability out of the box in Drupal 8.

How can I add fields to file entities in Drupal 8?


texts: Validating a Webform with CAPTCHA locally before submitting to an external URL

texts:
I have the following setup

Drupal 6.x
Webform 6.x - 3.17
reCAPTCHA 6.x - 1.17

I also have the following custom module

function webform_to_data_repo_form_alter(&$form, &$form_state, $form_id)
{
if ($form_id == 'webform_client_form_765')
    {
        $form['#action'] = url('some-external-site.com', array('external' => true));
        $form['#method'] = 'post';
    }
}

As it is now, the form is able to communicate with the external website. It cannot however validate entered values before it submits.

This lack of validation is a problem for several reasons because

The CAPTCHA field can be left blank, which defeats its purpose.
Any field that I specifically made mandatory can now be left blank, again defeating its purpose.

I've also read on multiple occasions that once you use $form['#action'], any attempts on validation will cease to work.

I was wondering if there was a way I could prioritize the validation of forms over $form['#action'] and if so, how?

If you could just point me to the right direction, in terms of what my custom module is missing, I'd appreciate it.

Thanks in advance.


texts:
I'm using Drupal 7 and Views. I have 4 different content types and I want to be able to display each content type in separate view. What i did is I create a view and a page and i set the view Path to node/%

After that I'm using contextual filters to get specific node. It's working when I'm on view creator page and the preview.

I have 4 such views, each for particular content type.

When I save the view and I'm trying to load a page it takes wrong view and it gives no results found.

How to solve that issue and have multiple node/% pages? Is there something like views order or priority in loading? Shouldn't it have any filtration and pick the correct view based on content type?

Any tips will be appreciated:)


texts: js file in custom module's library is not attached when big pipe is running

texts:
I have a custom module, filter_component, that provides a form. In the form I have:

$form['#attached']['library'][] = 'filter_component/filter-component';

In filter_component.libraries.yml I have:

filter-component:
  version: 1.x
  js:
    js/filter_component.js: {}
  dependencies:
    - core/jquery
    - core/jquery.once

filter_component.js begins with:

(function ($, Drupal) {
    Drupal.behaviors.filterComponent = {
        attach: function (context, settings) {
            $('.block-filter-component', context).once('filterComponent').each(function() {

Everything works fine, but only if big_pipe is disabled. When it is enabled, the code is not attached and the js file is not listed in page source or in browser tools as a source.


texts: 7 - Posting www links without http prefix

texts:
I have a simple body field that uses an input format with only "Limit allowed HTML tags".

If I enter a link ... say Test
The node will transform the link's href to read http://www.mydomain.com/www.google.com

If I enter Test, it will work as expected.

Is there a reason why not including http:// causes this? Is there a way around it?

I was hoping Pathologic would solve this but it doesn't seem to have.

Thanks!


texts: How to check if managed_file has uploaded a video and use it in states

texts:
I want to disable the submit button in a form for as long as there are no value/uploaded video in a managed_file but I can't seem to find what form name or element property I have to check for in #states.
I have the following:
$form['file'] = [
  '#type' => 'managed_file',
  '#title' => t('File'),
  '#description' => $this->t('Choose video to upload.'),
  '#upload_validators' => $validators,
];
$form["submit"] = [
  "#type" => "submit",
  "#value" => t('Submit'),
  '#states' => [
    'enabled' => [
      ':input[name="file"]' => ['empty' => FALSE],
    ],
  ],
];

I've also tried using value => true, :input[name="files[0] and :input[name="files[file] without luck. How can I enable the submit button when file has been processed?


texts: Placing the comment form on a separate page

texts: Is it possible to place the comment form for a content type on a separate page? I have some teasers on the home page and since I did them using Views, I need to find a way for people to add comments to it. If I can place a link which opens another page with just the comment form then that would be great.


texts:
Wondering how Drupal manages hooks outside of the core in modules. Seems like parsing the code in modules would add a lot of overhead, and that it's more likely that the code is doing something else to manage the calls; for example, indexing or compiling the code when Drupal boots for the first time.

If there's a difference between how 6 and 7 handles this, please explain how each handles it, or clearly state which version you've explained.


texts: How do I calculate and permanently store a field value with code

texts:
I would like to know how I can manually insert some PHP code inside a CCK node.

What I have is the following code for Drupal 6:

$output .= '<br>';
$mor = _pitch_detalle($cid, $previamente, $luego);
if (sizeof($mor) > 0) {
  $output .= theme('pitch', $mor);
}
return $output;

This code shows some information that changes from day to day, and each time the users view the page, the information changes.
I want the user to see an unmodified version of that code, the same information that existed when the user created the page.

As the user cannot edit the page, I´m looking to insert a php snippet inside a CCK field that will remain unchanged. But that could lead to problems, so is there any way to do that in a safe way?
Or maybe to insert code inside the template in other way?


texts: Display Text using flags on user profile?

texts:
I'm running a D7 site and want to use a flag to display message/text on user profiles.

I'm currently using 'Form' to capture message when user flags himself/herself but cannot find a way to display that message/text on user profile.

Is there any way to capture that message using 'Form' within flags and than display that message on user profile flag till unflagged.


texts: SWF Tools install/ setup of media players

texts:
I'm trying to get any of the mp3 players in the SWF tools to work they all say (under /admin/settings/swftools/handling):

JW player: Missing flash_media_player/player-viral.swf
1 pixel out: Missing 1pixelout/player.swf
etc. for the other players...

I followed the download link and tried putting the downloads under /SwfTools/Shared -- and in the players direct folder e.x. /sites/all/libraries/mediaplayer4/player.swf.  But, the missing file warning isn't going away which is preventing me from being able to activate any of the mp3 players.
I just wanna get these media players working.  Anyone come across this situation?  Thank you.


texts: Why exposed filter doesn't appear, when ajax is off in block view

texts: I have a view as a block and I am using the exposed filter for content.I need a exposed filter value in the url but due to ajax ON its value doesn't pass to url, when ajax OFF then exposed filter is not appear. Please give me solution. how to resolve this problem.


texts:
I wondering if this is possible.
I can not find any information on this topic, but I am trying to make my pager that is in a Views slideshow into the menu tabs of my navigation, so that if I scroll over the "home" menu button, the image would change, or if I scroll over "about us," the image would change to the "about us" image. Can anyone give me some suggestions on what I can do to achieve this?


texts:
I would like to create a node that displays 5 RSS feeds from 5 different external sites. I have the RSS URL of the external sites, and I would like to find a simple way to display the last elements of these feeds inside my node.

I have already looked at the Feeds module, but it creates a node for each element of the given RSS feeds.
How can I display the last elements from different RSS feeds?


texts: I use module ubercart. Payment method is PayPal. I want process some task after user payment successfully. I write custom module. I want know how to check user payment successfully with some hook, event can catch?


texts: When creating a Chaos Tools content type plugin, what is a subtype and how are they used?

texts:
I'm perfectly fine with creating Chaos Tools content types for use in Panels, but I've always used single => TRUE.

I've looked through the docs, but still can't quite seem to grok how to utilise subtypes.  None of the examples shipped with Chaos Tools seem to use them (they also all implement single => TRUE, and a quick grep of the Chaos Tools directory only shows the Custom Content type using subtypes, and it only appears to use it for including the export functionality (unless I'm reading it wrong - which is likely).


texts: How to change color and sidebar menu without using themes

texts:
We have a number of different themes on our website as we have different departments with different color styles. However, the only thing that changes are the colors of the sidebar and which menu is displayed on the sidebar; the layout of these pages remain the same almost exclusively. It seems as though having 16 different themes, which we do, is unnecessary if these are the only things changing (sidebar color and menu).

Are there any good modules which could achieve this functionality (changing color and menu depending on department) without having all these different themes? Or are themes the only/best way to go to achieve this functionality? Also is having this many themes the average or is that a lot?


texts:
I am trying to set up the following in Views:

Review 1
-Example Field
-All Comments of the Review

Review 2
-Example Field
-All Comments of the Review

I'm pulling in the comments from a relationship. However, rather than grouping all the comments under the review, it duplicates the Review:

Review 1
-Example Field
-Comment 1

Review 1
-Example Field
-Comment 2

And so forth. How can I group all the comments to not duplicate the node, and just appear in order and grouped for the review node?


texts:
I need to restrict access to a node based on the distance of the current user to a location attached to the node (with Location module). The distance to decide, if access is allowed is node based and stored in a field of the node.
Currently I achive this feature with hook_node_access(). I get the current location of the user through the Smart IP module and are able to calculate the distance by passing the coordinates of the user and the node to location_distance_between(), which is provided by the Location module.

Because hook_node_access() isn't considered by Views I think about accomplishing this feature with hook_node_access_records() and hook_node_grants(). Since the distance is dynamically, I have no idea how to achive this. In my understanding hook_node_grants() is called before the database query, so I have no chance to get the distance right?

Any ideas?

Thanks, Daniel


texts: When a variable parameter is changed in a Rules loop, the variable is unchanged outside the loop

texts:
I have a Rules loop in which a variable parameter is modified.
The variable was created before the loop, and added as parameter in the loop.

However, If I check the value of the variable after the loop, it is unchanged.

Is this by design or what causes this?


texts: Getting site-offline message when trying to drupal_bootstrap from command line

texts:
I'm trying to bootstrap drupal from a standalone PHP script at the command line from sites/all/modules/mymodule/mymodule.php.

<?php
  chdir('/sandbox/mysite/');
  require_once './includes/bootstrap.inc';
  drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

I'm attempting to run it from the command line, but I get Drupal site-offline when I do (trimmed for brevity):

cd /sandbox/mysite
php sites/all/modules/mymodule/mymodule.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Site off-line | Pressflow</title>

The site is online and works fine from the browser. DRUPAL_BOOTSTRAP_DATABASE is where this fails, since I can bootstrap the DRUPAL_BOOTSTRAP_CONFIGURATION and DRUPAL_BOOTSTRAP_EARLY_PAGE_CACHE phases without a problem. Anyone run into this before? Thanks in advance.


texts: migrate import image (image_import plugin doesn't existe)

texts:
I'm trying to import content from a csv source file, the csv file contains a field of image URL, and I'm trying to import that image using contrib modules migrate_plus, migrate_source_csv, migrate_tools.

Here is my configuration YAML file:

id: my_csv_import
label: Import test
migration_groups:
  - ACME import

source:
  plugin: csv
  # Full path to the file.
  path: 'news.csv'
  # Column delimiter. Comma (,) by default.
  delimiter: ','
  # Field enclosure. Double quotation marks (") by default.
  enclosure: '"'
  # The number of rows at the beginning which are not data.
  header_row_count: 1
  # The column(s) to use as a key. Each column specified will
  # create an index in the migration table and too many columns
  # may throw an index size error.
  keys:
    - Title

  constants:
    file_destination: 'public://images/'

process:
  title: Titre
  field_image:
    plugin: image_import
    source: Image
    destination: 'constants/file_destination'
    title: file_title
    alt: !title
  type:
    plugin: default_value
    default_value: posts

destination:
  plugin: entity:node

CSV file:

Titre,Image
title 1, http://my_domaine.com/images/image1.jpg
title 2, http://my_domaine.com/images/image2.jpg

Question:
While executing the command line drush mim my_csv_import drush return the following error message:

Drupal\Component\Plugin\Exception\PluginNotFoundException: The "image_import" plugin does not exist. in                                        [error]
/Users/brahim/void/Sites/news8/core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php:52

Any help is appreciated!


texts: Content organization for complex website

texts:
I know this is a trivial question but before to continue I would like to hear some opinions from You experts. I am organizing my content in D7 website in two section "Activities" and "Our Projects". The "Activities" will have the bellow pattern:

activities/public-buildings/schools/project-1.

I've created a CCK for company projects (aka project-1,2,3 etc) However for each category I would like to have a landing page which will show its sub-directories. For example a landing page for "public-buildings" will include a text with images and also a list with "schools" etc. A landing page "schools" will include  a text with images and also a list with "projects".
Last, "Our Projects" section will again include projects. So the question is, which way should I proceed (taxonomy) or node reference or?


texts: Is it possible customize user login page on Adaptive Theme?

texts:
I tried many solutions for change my mysite.com/user page. I want, only login-register-forgotten form is visible, other block hidden. But what i try a solution, don't working.

Is it possible? How can i do this?

This is my past question: https://drupal.stackexchange.com/questions/65475/error-when-creating-a-custom-page-in-d7


texts:
Firebug is complaining about a error in <!DOCTYPE html>,  but the HTML source is passing without problems the HTML W3C validator.

Do you have any idea? Sorry, I can't share the source code.


texts: /admin/* pages "The website encountered an unexpected error"

texts:
After two clean installs of Drupal 8.0.2 without issues on my server (Debian 7.1 / PHP 5.6.17 / MySQL 5.5.31) I can log in and out fine and view my user profile page, but that's it.

Any /admin/* pages returns the following error:

  The website encountered an unexpected error. Please try again later.

I'm a little stuck as effectively I can't do anything and this wasn't an issue locally on WAMP. Can someone offer me guidance please? I've had a look for error logs on the server but unless I'm looking in the wrong places I'm not seeing anything.

Database watchdog shows the following error. (The serialized array has been edited to show the relevant parts.)

  GuzzleHttp requires cURL, the allow_url_fopen ini setting, or a custom HTTP handler.
  GuzzleHttp\choose_handler()
  /var/www/virtual/mysite.info/drupaltest/htdocs/vendor/guzzlehttp/guzzle/src/functions.php";
  line 116

As suggested in other similar posts I have tried increasing max_allowed_packet.


texts:
I'm using drupal 7 with feeds module.

I've followed this tutorial to try to create nodes with the feed but it didn't work.

Here is the feed : https://cb1-demo-fr-staffing.luceosolutions.com/openrest/requisitions/active
Does anyone know why ?