texts: How can I get an entityform attached to an order in drupal commerce?

texts:
I'm trying to append an entityform to an order in Drupal commerce. I included the several attempts in my code snippet. Version 1 just throws the following error:

Fatal error: Cannot use object of type EntityValueWrapper as array in /sites/all/modules/kalamuna/tb_commerce_panes/tb_commerce_panes.module on line 374

I tried two other attempts. Version 2 and 3 show up in $order, but when I get to the checkout page and var_dump $order it isn't there. Any ideas why?

function commerce_panes_custom_submit($form, &$form_state, $checkout_pane, $order) {
  // Strip out the entityform type.
  $values = $form_state['values'];
  $entityform_type_name = $values['entityform_bundle'];

  // Create a new entityform from the remaining fields.
  global $user;
  $form = new Entityform(
    array(
      'type'     => $entityform_type_name,
      'created'  => time(),
      'changed'  => time(),
      'language' => LANGUAGE_NONE,
      'uid'      => 2
    )
  );

  // The process the rest entityform fields.
  foreach ($values as $k => $v) {
    if (strstr($k, 'field_')) {
      $form->$k = $v;
    }
  }

  //Version 1 - Original
  $order_wrapper = entity_metadata_wrapper('commerce_order', $order);
  $order_wrapper->field_tb_registration_forms[] = $form;
  $order_wrapper->save();

  //Version 2 - Modified Original
  $order_wrapper = entity_metadata_wrapper('commerce_order', $order);
  $node = $order_wrapper->values();
  $node->field_tb_registration_forms[] = $form;
  $order_wrapper->save();

  //Version 3 - modify $order and save it
  $order->field_tb_registration_forms = $form;
  commerce_order_save($order);

}


texts: Migrate content based on publish date content

texts:
i use d2d migrate module to migrate content between D6 and D7 websites.Actually my migration class do partially the job for all content of a type (some issue on mapping custom fields), but i would to add an argument about specifying to migrate content publish after a specific date, this to add content to current website, or ask to migrate to ignore content created yet on system..how can i do this ?

thanks


texts: Comment validation errors to show on node?

texts: I am trying to get comment validation errors to show on the node that it was posted from. I know that the comment form action on the node points to the comment URL itself, but I would like it to redirect back to the node to show any validation errors at the top of the node instead of at the top of the add comment page.


texts:
How do I create a user registration form where username field cannot be modified by the user and is auto-generated on the basis of two other fields in form (dynamically).

I know there are some modules available for the task in Drupal 7, but how do I achieve this in Drupal 8?


texts: Migrating site from localhost to production some images does not show

texts:
I am in process of creating a new website from old Joomla based site. I manage to import with feeds module all the old content.
On the localhost server there is no problem but on production server all of the imported images and their derivatives are not showing.
The problem links looks something like this

news_thumb/public/field/image/274f1bf2bd18e7f0d33d6244e658426e.jpg?itok=AUwo0SYX

My first suggestion was that this images have problem with the image style 'itok' token

Any suggestion would be deeply appreciated. Thanks.

What I tried so far:
First all images were imported with single space after the extension so the link looks like this:

news_thumb/public/field/image/274f1bf2bd18e7f0d33d6244e658426e.jpg%20?itok=AUwo0SYX

I didn't catch it before uploading finished site on production where all the images disappeared so I thought that this is the problem and after trying some weird things with no avail import again all joomla based content without the space.
Second I presume that I have some problem with itok token and flushed all images and regenerated them again.

Now I uploaded the whole site on different hosting where all worked correctly so after conversing directly with the gays from original hosting company it turns out that they are updating their server on the fly during working hours and all my jumbo mumbo with database and files were restored few times on the row.

So I finished with apologies from them and one day spend searching for something that was not there.


texts: Do not create new nodes, only update existing

texts: I have a CSV feed that contains only prices and stock levels. The feed has to update only stock and price of existing products. What is the easiest way to block (just "in case") creating new products for the given feed?


texts:
At my Drupal 7.4 website with the default Bartik theme and no contributed modules, I have a big logo (715 x 280 px) and no slogan. These are my settings:

I'm trying to figure out the best way to add a sponsored link to the rectangle orange area (with the white example text "Plastikovie okna !!") at the screenshot below:

If a tilted rectangle isn't possible, I can live with a straight rectangle too.

If there is a CSS/JS solution, it is welcome too, but please tell me which CSS and JavaScript files to edit, so that the solution works at every page of my site.


texts: Creating nodes with cURL that have multiple tags and a content moderation transition

texts:
I've enabled the rest restui serialization hal and basic_auth modules and enabled and configured the Content resource like this:

I'm able to create nodes with:

X_CSRF_TOKEN=$(curl http://d8.local.org/session/token)
curl --include \
--request POST \
--user test:"test" \
--header 'Content-type: application/hal+json' \
--header "X-CSRF-Token: $X_CSRF_TOKEN" \
--insecure \
--data-binary '{"_links":{"type":
{"href":"http://d8.local.org/rest/type/node/article"}},
"title":[{"value":"Test"}],
"body":[{"value":"Body text."}],
"field_tags":[{"target_id":1}],
"type":[{"target_id":"article"}]}' \
http://d8.local.org/entity/node?_format=hal_json

How do I add multiple terms to field_tags? Every combination I try, like

"field_tags":[{"target_id":1,2,3}],

returns a 400 Bad Request

Also, how do I add a content moderation transition to the new node?


texts:
How can I create a custom sort of items in a view? For example, I want to order content by: (rating * 10) - age in hours. (Rating is 5 star module percentage.)

I've been looking at the Computed Field module and the Views API but I'm not finding what I need.


texts: How can I speed up drupal's node_save() function?

texts:
I am having a lot of trouble with the inefficiency of node_save().  But is node save my problem? That's ultimately what I am trying to find out.

I created a loop with 100,000 iterations. I created the bare minimum for the node object to be valid and save correctly. Here is the node save code:

$node = new stdClass();
        $node->type = "test_page";

        node_object_prepare($node);

        $node->uid = 1;
        $node->title = $node_title;
        $node->status = 1;
        $node->language = LANGUAGE_NONE;
        if($node = node_submit($node)){
            node_save($node);
}

Here are the results:

100,000 nodes were saved, each using node_save().
It took 5196.22 seconds to complete.
That is ONLY 19 saves a second.

To say the least, that is not acceptable, especially when this person is getting around 1200 individual insert queries per second, and this person is getting 25,000 inserts per second.

So, what's going on here? Where is the bottleneck? Is it the with the node_save() function and how it's designed?

Could it be my hardware? My hardware is a development server, no one on it except for me - Intel dual core, 3Ghz, Ubuntu 12.04 with 16 gigs of ram.

While the loop runs my resource usage is: MySQL 27% CPU, 6M RAM; PHP 22% CPU 2M RAM.

My mysql configuration was done by the percona wizard.

Mysql says that if my CPU usage is under 70% my problem is disk bound. Granted, I have only a run of the mill WD Caviar 7200 RPM, but I should be getting more than 19 inserts a sec with it I hope!

Not too long ago I wrote about saving 30,000 nodes in a day. However, to be  clear, this node has nothing to do with any external forces.  It's purely a benchmark to learn about how to increase the speed of calls to node_save().

Realistically, I need to get 30,000 items into the database every minute using node_save.  If node save is not an option, I wonder if I can write my own drupal api function "node_batch_save()" or something that takes advantage of mysql's ability to to do bulk inserts with the INSERT query.  Thoughts on how to approach this?


texts: Give a specific user role the ability to give a user a role but not the 'administrator' role

texts:
I have a set up using drupal 7 where, as a super administrator, I can add a user with a role of 'manager' (who can also add users to his shop) but I want to also give 'manager' the ability to specify if the user he wants to add will have either of the two simple roles (one to create/add data and one to view reports on sales only) say, 'sales-agent', 'sales-report'. Currently, in my setup, the manager can specify all roles including the 'administrator' role which I should have access only as a developer/super admin.

I have been looking around for modules to fit this but my time is running out.

Thanks for all your help. Drupal is great!


texts:
I have a Drupal 7 dev-site hosted on pantheon. Using git bash and composer I installed drush on my windows 10 machine and I thought I did so globally. When I run composer --version and drush status I get what appear to be good responses. However, when I try to enable a module using drush or rebuild the registry I get ...

samha@LAPTOP-99SBTCQM /c/localworking/thecottagepress (master *=) $ drush
@pantheon.thecottagepress.dev rr
/bin/bash: -c: line 0: unexpected EOF while looking for matching `''
/bin/bash: -c: line 1: syntax error: unexpected end of file

Here is what I get when I run drush status...

samha@LAPTOP-99SBTCQM /c/localworking/thecottagepress (master *=) $ drush
status Drupal version         :  7.56
Site URI               :  http://default
PHP configuration      :  C:\PHP\php.ini
PHP OS                 :  WINNT
Drush script           :
C:/LocalWorking/thecottagepress/vendor/drush/drush/drush.php
Drush version          :  8.1.15
Drush temp directory   :  C:\Users\samha\AppData\Local\Temp
Drush configuration    :
Drush alias files      :  C:/Users/samha/.drush/pantheon.aliases.drushrc.php
Drupal root            :  C:\LocalWorking\thecottagepress
Drupal Settings File   :  sites/default/settings.php
Site path              :  sites/default

What do I need to do to make drush fully functional? I have researched for most of today whith no luck. Thank you. Sam


texts: Token [commerce-order:payment-method-information] does not display anything

texts: I 've tried adding a token [commerce-order:payment-method-information] for emails , but the token does not work or does not display anything in the email sent . Please help


texts: Autopopulate "Postal Code" from taxonomy in Location module

texts:
In Location module input I want to disable "Postal Code" field but the node will have a mandatory vocabulary selection (vocabulary name: Postal Code).

What I want is that when I create a node with the postal code term selection it should automatically populate the "Postal Code" field of location module input from this term.

What is the right way to do it?


texts: Not able to map all the product variations fields in commerce feeds importer

texts:
I have one content type and added one field Product Variations' as product reference with widget 'Inline entity form - Multiple values'. But when I used Node Processor, I am not able to map other fields of the product variations. It only shows SKU and Product ID fields in target drop-down. It shows all the fields from node but not from the product variations.

Because of this I am not able to add more fields in my CSV file except title and sku.
Does anyone have any ideas on this?
Thanks


texts: Achievement Popup notification doesnt appear on cache page

texts:
I am using achievement module on site , it shows a popup notification when a particular achievement is reached . However due to caching (Authcache for authenticated user) , the popup doesn't appear .

The only way I could thought of is to prevent the site from grabbing the cached page ( from cache_page) when the criteria for showing pop is satisfied .

Any pointers on how can it be done ?

Thanks ,
Murali

There is custom module which triggers the pop up :

   function geld_achievements_pks_response($user_id) {

   $current_count = achievements_storage_get('forum-node-count', $user_id) +      5;
   achievements_storage_set('forum-node-count', $current_count, $user_id);

   if ($current_count == 25) {
       achievements_unlocked('Level 1', $user_id);
       }


texts: What is the purpose of entity_keys in ContentEntityBase?

texts:
I'm trying to figure out what is the purpose of entity_keys in ContentEntityBase entities and what fields should be set as entity_keys.

For example in \Drupal\node\Entity\Node we have such entity_keys:

entity_keys = {
 "id" = "nid",
 "revision" = "vid",
 "bundle" = "type",
 "label" = "title",
 "langcode" = "langcode",
 "uuid" = "uuid",
 "status" = "status",
 "uid" = "uid",
}

Why exactly these fields are selected to be entity_keys? And, for example, why in \Drupal\comment\Entity\Comment status isn't in entity_keys?


texts: Where can I check my module information in database?

texts: When I create a module, where does the information of the newly created module is stored in the database?


texts: Adding user roles without access to permissions

texts:
I want an administrator to add roles to a user without having access to admin/user/permissions where he can alter user permissions.
Currently, on the user permissions form there is only one checkbox that allowes neither one of them or both.
What is the correct way to achieve this?


texts: Entity queue JSONAPI pagination & How to add JSON API in views?

texts:
I'm using below modules

https://www.drupal.org/project/entityqueue & JSON API

Through entity queue. I have added 5 Articles.

Now I would like to apply pagination on that.

We are accessing via

http://domain.com/jsonapi/my-5-articles?include=items

I tried to add include=items&items[paging]=1. but seems not working

I need to add limit & offset

If we do same in

http://domain.com/jsonapi/node/article?page[limit]=1

then we are getting

"links": {
"self": "http://domain.com/jsonapi/node/article?page%5Blimit%5D=1",
"next": "http://domain.com/jsonapi/node/article?page%5Boffset%5D=1&page%5Blimit%5D=1",
"last": "http://domain.com/jsonapi/node/article?page%5Boffset%5D=31&page%5Blimit%5D=1"
},

We are not able to get same in entityqueue.

How to add JSON API in views?


texts: Drush can't find commands inside vagrant VM

texts:
I have a new install of Drupal 9.1.8, with drush 10.5 installed through composer inside a Vagrant VM.
But drush list gives:
Available commands:
  help  Displays help for a command
  list  Lists commands

And nothing else.
The commandfile search path is the default:
/var/www/vendor/drush/drush/src,/var/www/drush

Where are my drush commands?
Things I've checked:

Yes, drush/drush has installed everything - I want the site:install command and it exists in the files.
I've checked the commandfile search path and it points to the right place.
The file permissions are 777, and that's fixed inside the VM.

Manually running ../vendor/bin/drush si --debug inside the VM gives the following:
vagrant@vagrant:/var/www/web$ ../vendor/bin/drush si --debug
 [preflight] Config paths: /var/www/vendor/drush/drush/drush.yml,/var/www/drush/drush.yml
 [preflight] Alias paths: /var/www/web/drush/sites,/var/www/drush/sites
 [preflight] Commandfile search paths: /var/www/vendor/drush/drush/src,/var/www/drush
 [debug] Bootstrap further to find site:install [0.11 sec, 6.89 MB]
 [debug] Trying to bootstrap as far as we can [0.11 sec, 6.9 MB]
 [debug] Drush bootstrap phase: bootstrapDrupalRoot() [0.11 sec, 6.9 MB]
 [debug] Change working directory to /var/www/web [0.11 sec, 6.9 MB]
 [debug] Initialized Drupal 9.1.8 root directory at /var/www/web [0.11 sec, 6.9 MB]
 [debug] Drush bootstrap phase: bootstrapDrupalSite() [0.12 sec, 7.22 MB]
 [debug] Initialized Drupal site default at sites/default [0.12 sec, 7.45 MB]
 [debug] Drush bootstrap phase: bootstrapDrupalConfiguration() [0.12 sec, 7.45 MB]
 [debug] Add service modifier [0.13 sec, 7.64 MB]
 [debug] key_value table not found. Database may be empty. [0.14 sec, 8.14 MB]
 [debug] Bootstrap phase bootstrapDrupalDatabase() failed to validate; continuing at bootstrapDrupalConfiguration() [0.14 sec, 8.14 MB]
 [debug] Done with bootstrap max in Application::bootstrapAndFind(): trying to find site:install again. [0.14 sec, 8.14 MB]

In Application.php line 243:

  [Symfony\Component\Console\Exception\CommandNotFoundException]
  Command site:install was not found. Drush was unable to query the database. As a result, many commands are
   unavailable. Re-run your command with --debug to see relevant log messages.

Exception trace:
  at /var/www/vendor/drush/drush/src/Application.php:243
 Drush\Application->bootstrapAndFind() at /var/www/vendor/drush/drush/src/Application.php:196
 Drush\Application->find() at /var/www/vendor/symfony/console/Application.php:237
 Symfony\Component\Console\Application->doRun() at /var/www/vendor/symfony/console/Application.php:149
 Symfony\Component\Console\Application->run() at /var/www/vendor/drush/drush/src/Runtime/Runtime.php:118
 Drush\Runtime\Runtime->doRun() at /var/www/vendor/drush/drush/src/Runtime/Runtime.php:48
 Drush\Runtime\Runtime->run() at /var/www/vendor/drush/drush/drush.php:72
 require() at /var/www/vendor/drush/drush/drush:4

The message "Drush was unable to query the database" seems irrelevant because to do site:install (at least initially) does not require the database at all. It only tries because it can't find the command in the first place. But the credentials are all set up in settings.php anyway.


texts: Why are the Recent log messages not shown within admin/reports?

texts:
The usual log reporting option "Recent log messages" is not showing up under 'admin/reports' (in the admin menu).

Any idea what might be causing that? Is there a module that provides this functionality?


texts:
I want to POST json data to a custom REST resource. I tested with postman and Insomnia but i get the message as if would've done a GET request and returns the get functions result. The GET function works fine btw.

In the logs it says "Switched from post to get".

I just want to return the data the user passes. This is the code of my custom REST resource:

<?php
namespace Drupal\foolzz_rest_api\Plugin\rest\resource;

use Drupal\rest\Plugin\ResourceBase;
use Drupal\rest\ResourceResponse;

/**
 * Provides User Profile REST Resource
 *
 * @RestResource(
 *   id = "profile_resource",
 *   label = @Translation("Profile resource"),
 *   uri_paths = {
 *     "canonical" = "/foolzz_rest_api/profile/{uid}"
 *   }
 * )
 */
class ProfileResource extends ResourceBase
{
    /**
     * Responds to entity GET requests.
     * @return \Drupal\rest\ResourceResponse
     */
    public function get($uid = NULL)
    {
        $query = \Drupal::database()->select('foolzz_users_profile', 'data');
        $query->fields('data', array('fk_users_uid','status','displayname','birthdate','biography','gender','realname'));
        $query->condition('data.fk_users_uid', $uid);

        $profile = $query->execute()->fetchAssoc();

        $response = ['profile' => $profile
        ];

        $build = array(
            '#cache' => array(
                'max-age' => 0,
            ),
        );

        return (new ResourceResponse($response))->addCacheableDependency($build);
    }

    /**
     * Responds to POST requests.
     * @return \Drupal\rest\ResourceResponse
     * Returns a list of bundles for specified entity.
     *
     * @throws \Symfony\Component\HttpKernel\Exception\HttpException
     *   Throws exception expected.
     */
    public function post(array $data = []) {

        $response = array(
            "data" => $data,
        );

        $build = array(
            '#cache' => array(
                'max-age' => 0,
            ),
        );

        return (new ResourceResponse($response))->addCacheableDependency($build);
    }
}


texts: What is wrong with my Opencalais installation?

texts:
I have installed and configured the OpenCalais module (7.x-1.0-rc1) as specified in the readme text to tag feed items during feed import. But I am getting these error messages

  Notice: Undefined property: stdClass::$body in
  opencalais_get_suggestions() (line 378 of
  /home/websitename/public_html/sites/all/modules/opencalais/opencalais.module).

and

  Unable to process, ARC2 Library is missing

I put the arc2 library in /sites/all/libraries/arc/

What is wrong with my installations? I tried different versions but I am getting the same error messages.


texts: What could be causing a file filed attachment not to upload?

texts:
I have a content type which has a file field for PDF attachments.

Sometimes a file will refuse to upload and the throbber just spins and spins. The only way out is to reload the page or navigate away. After doing this, the page will often lose it's menu link and need reinstating. The same file will not upload from that location, but others will.

Usually the attached files will have been created in Microsoft Word and then saved as PDF.
The page in question also has a link in the main menu.
Many of the users are based in schools and there often behind a firewall.
Most users will Windows users

The same file can often be uploaded from a different location (at home say) without problem.

What could be preventing a file uploading from one location but not another?

Upon a failed upload, what causes the menu system to break?


texts:
There are two possible solutions ( php field and view field are not recommended as I know ) to override output of a view field

Create template (tpl) file for field and code for desired output
Use hook hook_views_pre_render

as per the various articles, its not good to have too much templates in drupal.

which approach is good and loads fast ?


texts: Distribute configuration to several sites

texts:
There should be several sites, starting with something like a similar distribution, but over time, each site might get some individual modules. Yet, I'd like to keep the site updated with new versions and new configurations over time as well.

So I can't use the full import/export of configuration management, since this would delete my individual additions on some sites, if I understood it correctly. And I need to be very careful with single exports, since those don't care about dependencies.
Configuration Packager has been merged into Features, so it seems as I need to use features anyway.

So what do I put into a configuration? And what into a feature?
And how would I distribute the preconfigured stuff to all sites? Use a feature server like in Drupal 7? (If the Github process is setup and I've got a dev and several production sites, how do I push configuration and feature updates to production?)


texts: Exposed filters -"An illegal choice has been detected. Please contact the site administrator." error

texts:
I want to change the value of "any" option's value. So I changed the value as "something" for using Jquery.

Now I click the any option, then its showing an error like

  An illegal choice has been detected. Please contact the site administrator.

How do I change the value of 'any' without getting this error.


texts:
I have a site where the conditional,

<!--[if IE]><![endif]-->
<!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />

shows in the header, but I can't figure out where it's coming from. I've checked the template.php, .htaccess, html.tpl.php, common.inc, an everywhere else i can think of.  Any ideas of where this is hiding, or how I can find it would be greatly appreciated.


texts: Create a pager with "Yesterday", "Monday", "Sunday" etc

texts:
I have a view which through contextual filters show content created on the current day, and I would like to add a pager to allow users to go back in time one day at a time.

Say we visit the site on a Tuesday. So when viewing today's posts there is one link to the left which says "Yesterday" and no link to the right (since there are no future posts), and when this link is clicked we are show yesterdays content (Monday). The links are now "Sunday" to the left and "Today" to the right. Again we click the left link and are shown the content created on Sunday, and the links now show "Saturday" to the left and "Yesterday" to the right.

I've tried using exposed filters but they only output drop downs and only let me sort by asc/desc.

Is this possible?


texts:
I need an advice. Is there any downsides when embedding views in the page/node tpl files like the following:

<?php print views_embed_view('course_videos', 'block_1'); ?> and this <?php $key =  views_get_view_result('course_videos', 'block_2');  ?> in the node.tpl files

I am little bit concerned cause I've read several articles saying you must not query the db or use a complex php logic in the tpl files. Everything's working like a charm now. The site is still not in production though...

Thank you in advance!


texts: Create node programmatically with menu entries

texts:
I created an action in Rules, which generates a duplicate of a node. If I am creating a node of the type "basic", it will duplicate the node for every taxonomy term. So when I have a node with three taxonomy terms, the action will generate three nodes.

The only difference are the taxonomy terms, because the created nodes should get the URL '/taxonomy-term1/node-title', '/taxonomy-term2/node-title', ...

My problem: If I have the taxonomy terms Taxonomy_Term1, Taxonomy_Term2 and Taxonomy_Term3, I get the following result:

/taxonomy-term1/node-title

/default/node-title

/default/node-title-0

I am thinking the problem lies in the array which was created from the latest nid. But when I am printing each term_name (to know what it looks like), the results are the Strings Taxonomy_Term1, Taxonomy_Term2 and so on.

function autocreatenode_rules_action() {
$nid = db_query_range("SELECT nid FROM {node} ORDER BY nid DESC", 0, 1)->   fetchField();
$string = token_replace('[node:field_tags]', array('node' => node_load($nid)));
$terms = explode(',', $string);
$i = 0;
foreach ($terms as $term_name) {
    $i++;
}
    if($i >= 2) {
        foreach ($terms as $term_name) {
            $node = new stdClass();
            $node->type = 'basic';
            $node->language = 'de';
            node_object_prepare($node);
            $node->title = 'Title';
            $node->field_body[LANGUAGE_NONE][0]['value'] = 'Something in the body';
            $menu = array();
            $menu['link_title'] = 'Menu Link title';
            $menu['description'] = '';
            $menu['menu_name'] = 'main-menu';

            switch($term_name) {
                case 'Taxonomy_Term1':
                    $menu['plid'] = 5;
                    break;
                case 'Taxonomy_Term2':
                    $menu['plid'] = 6;
                    break;
                case 'Taxonomy_Term3':
                    $menu['plid'] = 7;
                    break;
                default:
                    $menu['plid'] = 1;
            }

            $menu['enabled'] = 1;
            $node->menu = $menu;
            $node->status = 1;
            $node->promote = 0;
            $node->sticky = 0;
            $node->comment = 2;
            $node->uid = 1;
            $node->date = 'complaint_post_date';
            $node->created = strtotime('complaint_post_date');
            $node = node_submit($node);
            node_save($node);
        }
    }}


texts: How to implement a booking system using Drupal Commerce for checkout?

texts:
I have been playing with Rooms, Availability Calendars, commerce availability, and many other modules to achieve my goal but I have had no luck in trying to achieve exactly what I want to do.

Does anyone know of the best solution to achieve the following:

A holiday home booking system where users can search node teasers via available dates and checkout via Drupal Commerce.
Views integration: Search nodes on available dates
Checkout: be able to choose a date range from available dates and checkout through Drupal Commerce.


texts: access denied when viewing profiles of other users

texts:
I am having a hard time finding out why non admins (and anonymous users) are having
"access denied" errors when looking at Drupal-7 profiles of other users.

The "View user profiles" permission is checked.

My user's profile page is a panel, but the 'access denied' errors even if the profile is not a panel.

Any idea? Please help.

Additional Information:

Using a code inspired by Yuriy Babenko's answer, and filterning for uniqueness, I see the following pemissions are denied when user 163 views the profile of user 174 (goes to /user/174) :

access administration menu
access administration pages
access all views
administer block classes
administer blocks
administer contexts
administer less
administer media
administer menu
administer user relationship
administer users
administer views
bypass node access
execute php code
view any private_notification content
view own unpublished content
view the administration theme

I don't see anything related to user access...

The nice Access Denied Backtrace module gives the following backtrace, but how to interpret it?

Array
(
    [ 2: drupal_deliver_page()] => Array
        (
            [file] => includes/common.inc:2564
            [args] => Array
                (
                    [0] => 3
                    [1] =>
                )

        )

    [ 1: menu_execute_active_handler()] => Array
        (
            [file] => includes/menu.inc:532
            [args] => Array
                (
                )

        )

    [ 0: main()] => Array
        (
            [file] => index.php:21
            [args] => Array
                (
                    [q] => user/174
                )

        )

)

HOTFIX: Adding the following code before line 820 of user.module temporarily solved the issue:

if (arg(0) == 'user' && is_numeric(arg(1)) && is_null(arg(2)) &&
    $string == 'administer users' ) {
  return TRUE;
}

But how do I find why the 'administer users' permission to view other user profiles?


texts: How can i change registration email send to admin

texts:
I was wondering how to change the standard text in the email send to the administrator when a new user has registered.

Is there a way to change the text? Maybe the same way as you can change the emails send to the user when registered?

thanks


texts: error Refused to execute script, because its MIME type ('text/html') is not executable

texts:
When migrated my site from localhost to webserver. I see an error in chromeconsole. I used git clone to transfer my site.

  Refused to execute script from http://mydomain because its MIME type
  ('text/html') is not executable, and strict MIME type checking is
  enabled.

Mysite is unformatted.
Theme bartik, core drupal-8.2.5

It's running smooth on localhost.

I contacted serversupport, they say it's a debug problem and not a server problem.

there is an refer in the stylesheet to ojqe8x, but is empty, how to solve this?

<title>mysite | mysite</title>
<link rel="stylesheet" href="/joehoe/mysite/?ojqe8x" media="all" />

Edit:

on this domain http://pcwebber.nl/alex/lkch/

I get this error Refused to execute script from 'http://pcwebber.nl/alex/lkch/' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.


texts: Create the pdf version of a node programatically (and attaching that pdf version to that node)

texts:
I have installed the print module. Every time I create a node of type X a print version can be generated each time I click the print link.

The thing is that I need that pdf to be generated programatically, and not by hand every time I click on the link.

I need (I´ve tried with rules module, without any success) to create the pdf version of that specific nodetype X, and attach that pdf version to the node that is being created.... without me clicking to the print link, downloading the file, editing the node and then attaching that file to it.

Is there a way to do that?

Thanks for your insight!!!

Rosamunda


texts: Specifying a custom node id when creating new content

texts: I want to prevent merge conflicts caused by POST requests on the API at a later stage. Is it possible to specify a custom node id when creating new content in the Drupal user interface or database? What's the fastest, most efficient way to do this?


texts:
I done a migration of a website, but new content were created during I done that. So how can I refresh default migrations created by the drush command :

drush @alias  migrate-upgrade --legacy-db-url=mysql://user:pass@localhost/d6ce --legacy-root=http://d6-site.vmdev --configure-only

I know about the update option for drush mim "migration" but here, I need to recreate migration.
Perhaps I just need to re-run the original command ?

Thanks

EDIT:
the way seem to be:

- drush @alias mr "migration_name"(rollback migration)
 - drush @alias mrs "migration_name"(set to Idle)
 - drush @alias migrate-upgrade XXX (re-create migration)

EDIT2:
I get an error on a content type:

Drupal\Core\Database\IntegrityConstraintViolationException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '591' for key 'node__vid': INSERT   [error]
INTO {node} (nid, vid, type, uuid, langcode) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3,
:db_insert_placeholder_4); Array
(
    [:db_insert_placeholder_0] => 494
    [:db_insert_placeholder_1] => 591
    [:db_insert_placeholder_2] => page_europe
    [:db_insert_placeholder_3] => 95cc248e-6c93-4cfa-ad29-b19db86425c5
    [:db_insert_placeholder_4] => fr
)
 in Drupal\Core\Database\Connection->handleQueryException() (line 683 of /var/www/drupal-8/core/lib/Drupal/Core/Database/Connection.php).
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '591' for key 'node__vid': INSERT INTO {node} (nid, vid, type, uuid, langcode) VALUES           [error]
(:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4); Array
(
    [:db_insert_placeholder_0] => 494
    [:db_insert_placeholder_1] => 591
    [:db_insert_placeholder_2] => page_europe
    [:db_insert_placeholder_3] => 95cc248e-6c93-4cfa-ad29-b19db86425c5
    [:db_insert_placeholder_4] => fr
)
 (/var/www/drupal-8/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php:783)
Processed 31 items (30 created, 0 updated, 1 failed, 0 ignored) - done with 'd6_node:page_europe'                                                                     [status]
d6_node:page_europe Migration - 1 failed.

With or without roolback...no issue on another content type.Related to taxonomy ? How can I fix that ?
I notify that if I just run: drush @alias ms I get this kind of infos:

upgrade_d6_file      Idle  1521   1497      21         2018-10-29 14:57:40

So new files are mentionned and would be able to be imported as is with --update option ,not ?


texts: How to read input username to drush script?

texts:
I need to complete a script  which gets a username from terminal to a php script and then deletes the user's comments.

So I am wondering how the username should be read by the php script, the same way that one can read a value in a bash script.

Thanks


texts: After enabling MySQL replication getting deadlocks when clearing cache

texts:
I recently setup my production MySQL server for replication. To do this I enabled innodb_flush_log_at_trx_commit and sync_binlog and set bind-address. A slave server on the opposite corner of the US is now happily replicating the master.

It's been fine, except that every time the cache is cleared (manually, because a module was enabled/disabled, etc) the site becomes unresponsive for about 5 minutes. It reports the following error (though, sometimes the query changes, the error is the same. This is the most common query to show this):

  PDOException: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction: DELETE FROM {semaphore} WHERE (name = :db_condition_placeholder_0) AND (value = :db_condition_placeholder_1) AND (expire <= :db_condition_placeholder_2) ; Array ( [:db_condition_placeholder_0] => variable_init [:db_condition_placeholder_1] => 300377225537241be5ddc00.97685038 [:db_condition_placeholder_2] => 1399996863.3809 ) in lock_may_be_available() (line 181 of /usr/local/www/r/example.com/web/includes/lock.inc).

Clearing the cache now takes much longer. Before it would take 10 seconds at most. Now, it takes 5+ minutes. While I have run into this error occasionally elsewhere (during an hours long batch process with update.php; randomly in other places, though very rare), it's really causing problems when needing to push updates and clear the cache.

Note that the slave server is not actually serving the website at this time; it is only a backup.

mysql  Ver 14.14 Distrib 5.5.14, for Linux (x86_64) using readline 5.1
PHP 5.3.8 (cli) (built: Aug 31 2011 16:27:31)
Drupal 7.8

And the master server's my.cnf:

[mysqld]
datadir = /usr/local/mysql/db
socket  = /usr/local/mysql/mysql.sock
user    = mysql

old_passwords      = 1
key_buffer         = 16M
max_allowed_packet = 16M
thread_stack       = 128K
max_connections    = 1024

log_slow_queries     = 1
slow_query_log_file  = /usr/local/mysql/log/slow.log
long_query_time      = 10
ft_min_word_len      = 2
skip-external-locking

# Query cache configuration
query-cache-type  = 1
query_cache_limit = 2M
query_cache_size  = 16M
thread-cache-size = 8

# InnoDB Buffer Pool
innodb_buffer_pool_size=8G

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links                 = 0
innodb_flush_log_at_trx_commit = 1
innodb_file_per_table
default-storage-engine=InnoDB

# For replication
server-id        = 100
log_bin          = /usr/local/mysql/log/mysql-bin.log
sync_binlog      = 1
expire_logs_days = 10
max_binlog_size  = 100M
bind-address     = example

[mysqld_safe]
socket     = /usr/local/mysql/mysql.sock
log-error  = /var/log/mysqld.log
pid-file   = /var/run/mysqld/mysqld.pid

[client]
socket = /usr/local/mysql/mysql.sock

In my searches, I've seen some suggest enabling inndb_locks_unsafe_for_binlog though the name itself seems to say that it shouldn't be used along with sync_binlog.


texts:
I am specifically asking for a D7 site, however I wouldn't mind know for D8 as well.

Scenario

Save an image in Photoshop as a progressive image.
Upload this to an Drupal image field that utilizes image styles.

Question

When doing this image styles creates a new image, is the new image still progressive or is there something I would need to configure to make sure that image styles does this automatically?


texts: Include content of subdomain inside a block or view?

texts:
I have created a subdomain - example sub.homepage.com. The subdomain is pointing to a server. But I need the template to be the same as my website.

My question:
Can I somehow include the content of that subdomain inside a block or view, or something else?

thanks


texts:
I'm looking for a drupal module, that allows me to have a fivestar voting for every user (also anonymous) and for every value of a certain field in a node.

What am I trying to do?
I'm trying to have a gallery. Each node with the content-type of "gallery" represents a gallery. In it there is one Image field which allows multiple values. And each image-value should be rateable.

Does anyone know such a module for Drupal 7?

Thanks


texts:
I am writing a custom module for my project which handles a list of content (from custom db table) and content addition, following is my code.

function cp_menu() {
    $items = array();
    $items['admin/structure/package'] = array(
    'title' => t('Packages'),
        'page callback' => 'cp_packages_list',
        'access arguments' => array('administer access control'),
        'description' => t('Packages'),
        'type' => MENU_CALLBACK,
    );
    $items['admin/structure/package/add'] = array(
    'title' => t('Add package'),
        'page callback' => 'cp_form',
        'access arguments' => array('administer access control'),
        'description' => t('Add package'),
        'type' => MENU_CALLBACK,
    );
    return $items;
}

function cp_packages_list(){
    return 'this is a test page';
}
function cp_form() {
    return array('#markup'=>drupal_get_form('cp_my_form'));
}

it is working properly, but i want to show action links (add content type) at top of page like

How can i add action links on page?

my action links would be 'Add package' and 'View orders'


texts: Ubercart particular item has extra shipping fee domestic vs international

texts:
I am using Ubercart 2.9 with Drupal 6.

Is there a way to add an extra fee to a certain product that has one value for domestic and a different value for international?


texts: How to change the order in which Views SQL joins are executed?

texts:
Views creates certain JOINs behind the scenes, e.g. for fields or filders added via the UI.

I have a view with such an implicit join based on an entityreference field. In order to get the desired results I need this join to be the first one, but Views happens to place it as the last JOIN (other joins in the query come from other fields and Views relationships).

Can I change the order of the joins, while keeping all fields and filters configured via the Views UI?

As a workaround I can explicitly add a relationship based on the entityreference field in question and order it as the first one. This works, but it adds an extra join that I don't need, which has a performance impact.


texts: Omega theme node template renders outside any regions

texts:
The node template should render within the content region or at least should be replaced by the node template. But I am finding that it is not rendering within any regions, but it does rend within the content zone.

Now to be fair, Omega works correctly on a different site that I am working on. Just not here. At first I thought it was the sub-theme that was jacked. But I created a brand new empty one and it had the same problem. I also tried using the Omega base theme as the theme and had the same problem. So now I am at a loss as to what is causing this.

On my other site I tried to add the Delta module to see if that affected it, but no dice. So either another module is breaking it or something else is wrong in the config.

Do you have any idea?


texts: Alter default message presented to user on failed login attempt

texts:
I need to alter the default D7 message that gets presented to the user on a failed login attempt. I need to give them one message if their username isn't found, and another if their password is wrong. Default Drupal behavior is to give a single, generic error message that doesn't distinguish between the two.

For the password check, The best solution I've found is user_check_password(). This doesn't sit well with me. The password.inc file isn't included in all page requests, and as there are several different context dependent login pages on the site, it isn't always there. I've been forced to require_once it in my custom validation handler which seems very un-drupal-ish.


texts: Custom module .install does not create table in database

texts:
I want to create database table for my custom module.

Inside mymodule.install I have:

function mymodule_schema(){
    $schema['a_visits'] = array(

    'description' => 'visits table',
    'fields' => array(
        'id' => array(
            'description' => 'make id primary key auto increment',
            'type' => 'serial',
            'not null' => TRUE,
        ),
        'oferta' => array(
            'description' => 'nazwa oferty',
            'type' => 'varchar',
            'length' => '255',
            'not null' => TRUE,
        )
    ),
    'primary key' => array('id'),
    );
    return $schema;
}

function mymodule_install() {
   drupal_install_schema('a_visits');
}

function mymodule_uninstall() {
   drupal_uninstall_schema('a_visits');
}

Then I've moved the module's file to server under sites/all/modules/custom/mymodule and enabled it via admin panel. Unfortunately no table in database has been created (the module is listed as active now).


texts: How to truncate a given menu setting an expanded menu item as the root menu in drupal 7?

texts:
In my template preprocess html and page hooks, I test the current page of being a certain kind of node, set by the menu structure. Given such a menu:

main menu

link 1
link 2 (specials)
> link 2.1
> link 2.2
link 3

Every node which menu's link has the menu parent link 2 gets a treatment. On those nodes, I also want to only show all links inside link 2 menu, so start the main menu from that, so basically the main menu would then consist of link 2.1 and link 2.2. How would you do that?

function mytheme_preprocess_html(&$vars) {

    $special = is_special_page();

    if ($special) {
        // alter menu
    }
}

function mytheme_preprocess_page(&$vars) {

    $special = is_special_page();

    if ($special) {
        // alter menu
    }
}

function is_special_page($node) {
    $breadcrumbs = drupal_get_breadcrumb();
    $businessMatch = preg_grep("/(specials?)/i", $breadcrumbs);

    return (count($businessMatch) > 0);
}


texts: Show a link in a menu even if user has no access

texts:
I created a node/add/content-type menu link in my main menu, but it only shows to those who have access to it.

How could I show this to everyone, including anonymous users, and use http://drupal.org/project/r4032login for those who have no access?


texts: $_POST returns empty value in custom service

texts:
created a custom service resource to catch some data from the user through post method. but while I am accessing the service ie
    http://dev.localhost:8082/rest/send_mail/retrive.json

Query: curl -X POST -H "Accept-Encoding: gzip" -H "Content-Type: application/json; charset=utf-8"

sending the  data in POST is :
     {
     "nid" :"1834",
     "recipient" :"charubachi.rath@abc.com",
     "sender":"charubachi.rath@abc.com",
     "subject": "xyz",
     "body":"a"
    }

How to accept the data

in my .module file

<?php

/**
 * Implementation of hook_services_resources().
*/
function send_mail_service_services_resources() {
 $api = array(
'send_mail' => array(
  'operations' => array(
    'create' => array(
      'help' => 'Drupal 7 Services 3 test',
      'file' => array('file' => 'inc', 'module' => 'send_mail_service'),
      'callback' => '_send_mail_service_create',
      'access callback' => 'user_access',
      'access arguments' => array('access content'),
      'access arguments append' => FALSE,
      'args' => array(
        array(
          'name' => 'nid',
          'optional' => FALSE,
          'source' => array('data' => 'nid'),
          'type' => 'int',
          'description' => 'The nid of the node to get',
        ),
        array(
          'name' => 'recipient',
          'type' => 'string',
          'description' => t('recipient'),
          'source' => array('data' => 'recipient'),
          'optional' => TRUE,
          'default' => '0',
        ),
        array(
          'name' => 'sender',
          'type' => 'string',
          'description' => 'sender',
          'source' => array('data' => 'sender'),
          'optional' => TRUE,
          'default' => '0',
        ),
        array(
          'name' => 'subject',
          'type' => 'string',
          'description' => 'subject',
          'source' => array('data' => 'subject'),
          'optional' => TRUE,
          'default' => '0',
        ),
        array(
          'name' => 'body',
          'type' => 'string',
          'description' => 'body',
          'source' => array('data' => 'body'),
          'optional' => TRUE,
          'default' => '0',
        ),
      ),
    ),
  ),
),
);
 return $api;
}

in my call back function when I am trying to print $_POST I am getting empty values.


texts: What does "Revision translation affected" indicate?

texts:
In views there is a boolean field named Revision translation affected. The description for the field is "Indicates if the last edit of a translation belongs to current revision". To me it is not so clear. What exactly does it mean?

Does it indicate what language that was changed in that revision? And what happens when non-translatable fields are edited?


texts:
I would like to display current date and time to the header section.

I am using a subtheme of Bartik. Any suggestions?


texts: Git with Drupal 7 multi-site, naming directories

texts:
I have been working in a single installation of Drupal 7, which has two sites built upon it.

In Drupal 7 multiple sites are served by naming a directory for each site to be served under /sites and include settings, themes and modules specific to that site.

sites
|
|__ 8888.website-one.dev
|   |__ settings.php
|   |__ files
|   |__ themes
|
|__ 8888.website-two.dev
    |__ settings.php
    |__ files
    |__ themes

So the system identifies the site based upon the domain (in my case the preceding 8888 is the port number I use to work internally).

When I push this installation to a remote dev server using Git, the domains I use to access the installation will need to change, and so the directory names would have to change too; which means that I wouldn't be able to have the installation working on both my local and remote development boxes.

Is it possible, with Git, to change a directory name on the remote server, and keep it the same on my local server, while still tracking the files inside those folders?

Many thanks!


texts: Modify VIEWS query without custom module

texts:
I have to do a very simple thing but I'm not good at writing modules. Here is the the query that VIEWS generates

SELECT users.name AS users_name, users.uid AS uid, node_users__field_data_field_mine.field_mine_value AS node_users__field_data_field_punch_start_field_mine_v

and I need this to become

SELECT users.name AS users_name, users.uid AS uid,DATE(node_users__field_data_field_mine.field_mine_value)AS node_users__field_data_field_punch_start_field_mine_vm

Any advices are welcommed.


texts: Import image with migrate tools changing its name

texts:
I’m trying to migrate some data from a remote rest/api (json) using the plugin source url. My problem is in the json i consume the image name field comes with an incorrect value.

In imageName comes '0_3.jpg' and the correct name is '0_3.png', for example

So i have the following code trying to transform the name:

  source_full_path:
    -
      plugin: concat
      delimiter: /
      source:
        - constants/source_base_path
        - imageName:
            plugin: str_replace
            source: imageName
            search: "jpg"
            replace: "png"

but this gives the following error:

  TypeError: Argument 2 passed to Drupal\Component\Utility\NestedArray::getValue() must be of the type array, null given

Anyone has any idea?


texts: Convert User object to same JSON Structure as D7's

texts:
We are migrating a D7 site to D8 and I have an API endpoint that returns the current user that I need to migrate. In D7, I would do something like:
global $user;
$u = user_load($user->uid);
return drupal_json_output($u);

This ends up returning a body like:
{
  "uid": "1111",
  "name": "SomeUser",
  "roles": [
    "2": "authenticated",
    "3": "premium"
  ],
  "field_matched_nodes": [
    "und": [
      {
         "target_id": "2222"
      },
      {
        "target_id": "3333"
      }
    ]
  ],
  ...
}

Now in D8, I'm trying to mimic the same thing. The key is that the return body needs to be exactly that is was in D7, or else the apps we have that use this endpoint won't work until push and update to the apps and our users update their app version.
So I'm trying something like:
$uid = \Drupal::currentUser()->id();
$current_user = User::load($uid);

$user_json = \Drupal::service('serializer')->serialize($user, 'json');
return JsonResponse($user_json, 200)

This gets me the user object in JSON, but it's structure is like:
{
  "uid": [
    {
      "value": 1111
    }
  ],
  "name": [
    {
      "value": "SomeUser"
    }
  ],
  "field_matched_nodes": [
    {
      "target_id": 2222,
      "target_type": "node",
      "target_uuid": "3248789345-23894798324-328498234",
      "url": "/en/node/2222",
    },
    {
      "target_id": 3333,
      "target_type": "node",
      "target_uuid": "3248789345-23894798324-328498234",
      "url": "/en/node/2222",
    }
  ],
  ...
}

Some notable differences:

Roles isn't even included in D8, but is in D7,
Basic field values like name are nested as a value for key "value" in an object in an array in D8, where in D7 it was simply the value for the field key
Custom fields aren't nested under "und" like they are in D7

Is there some sort of D7 serializer for D8 that constructs User objects as the same json structure it did for D8? Id be surprised if this doesn't exist, as I'm sure I'm not the only one who migrated to D8 with a public API...


texts: date in spanish webform component coming out in day month year , need month day year

texts:
My webform in english shows  the date component as month day year.
but when I translate it to spanish it shows the date as day month year.  How can I modify the format for dates when in different languages?

FOUND THE ANSWER: go to /admin/config/regional/date-time/locale/es/edit and change the date format to month first for the long, short and medium dates


texts:
I want to change default login page to html login page because I like the theme (bought theme but still in html). After googling:
1. I use bluemarine theme,  as a start i modify page.tpl.php and replace all html parts
2. Place assets folder in the "themes/bluemarine" folder and replace "assets/.." to "themes/bluemarine/assets/..", until this step login page has been changed flawlessly

But, I don't know how to routing login page to normal destination. In the html code in point 1, I changed this:

"<form class="login-form" action="index.html" method="post">

to this one:

<form class="login-form" action="?q=dashboard" method="post">

Because I have a custom module called dashboard.

Please help me, thanks before...


texts: Couple of important issues before I migrate into Drupal

texts:
Currently my website is in .NET and I would like to migrate to Drupal in order to manage the content better.
My site currently supports 22 languages having different domain names for each language. The site has the same theme for all of the domains.
Generally, the site (including all of its domains/languages) is divided into 3 subfolders/sections which are responsible for different content and slight changes in the theme. for example:
The URL http://www.example.fr (which is responsible for the French language) is divided into 3 content sections:

http://www.example.fr/sec1/
http://www.example.fr/sec2/
http://www.example.fr/sec3/

and so is the other domains/languages. As a matter of fact, each section contains a slightly different version of the whole site.
I have installed fresh D7 and also I have installed i18n (and its dependencies),pathauto, panels and context modules but I have yet succeeded to answer the following questions:

How can I create a node and assign it to one of the above sections ?
Once I have managed to assign a node to a section, how can I make it have a URL prefixed by the appropriate section prefix like sec1,sec2 etc. ?
How can I have my theme changed according to the section the user is in?

I have heard that Drupal has a very supportive community so I am really looking forward to someone who will be able to help me in these matters as soon as possible.
So thank you all.


texts: Contextual links don't display in a floated custom region

texts:
I created two custom regions in my Drupal 7 theme and used CSS to float them side-by-side (to create columns). That worked fine, and I'm able to place blocks in the regions, but the contextual links don't display.

I tested them without the float, and the contextual links are right where they should be, leading me to believe that it's the float positioning that's causing the problem.

This isn't too big a deal, since I can go to Structure --> Blocks to administer them, but the contextual links are handy, and besides, it's bugging me and I want to figure it out. Any suggestions?


texts: How to add any kind of links and do not to think about it's protocol

texts: a itms-services protocol link confused me a lot,I wonder if We can create links that do not have to think about it's protocol


texts:
I have a render array I'm caching as follows:

$build['friend_link'] = [
  '#type' => 'item',
  '#markup' => $link,
  '#cache' => [
    'keys' => ['friendship', $user->id()],
  ],
];

I need to delete this cache when the friendship is invalidated. However, I'm having a lot of troubles with retrieving the cache in order to invalidate it. I'm attempting to use the following code to retrieve the cache item:

$render_cache = \Drupal::cache('render');
$render_cache->get('friendship:' . $friend->id()); // id = 4

However, this doesn't work, because the actual cache key in the DB is:

friendship:4:[languages:language_interface]=en:[theme]=bartik:[user.permissions]=80e4ddd871aca07e035f618b532bc75cb7c155caaaedd08a4ae17e5e137ca30f

I tried setting the cache contexts to an empty array:

'#cache' => [
  'keys' => ['friendship', $user->id()],
  'contexts' => [],
],

But this didn't change the key. So I set the contexts to a value:

'#cache' => [
  'keys' => ['friendship', $user->id()],
  'contexts' => ['user'],
],

This changed the key to:

friendship:4:[languages:language_interface]=en:[theme]=bartik:[user]=1

So while this does make it potentially easier to build the key manually, it seems like I'm missing something.

I did find RenderCache::createCacheID(), however it's protected so I can't call it.

I'm at a bit of a loss here, is there an API function I'm missing somewhere to retrieve the cache?


texts: Cloned node entity reference field stay in sync with parent node

texts:
I have three content types A, B and C. A have entity reference fields to B and C. I create a Node of type A say a1. When i clone a1 node as a2 with node clone module i get the same value for entity reference fields in a2 same as a1. In a2 i can change the entity reference field value so that they refer to another nodes of B and C content type.

But with node clone module there is no way to maintain relationship between parent node and cloned node.

So I basically have two requirements:

In cloned node i can override the entity reference field value or leave it same as parent node. If i override, later i should be able to revert back to those values same as parent node. Currently there is no way to do this.
If parent node change the value of those entity reference fields then in all the cloned node of this parent node also change their respective entity reference field value except overridden cloned nodes.

The solution i found so far during searching is using Replicate, replicate_ui module which provide more hook to alter the cloning process. The another module is Corresponding Entity References which create entity reference field back to parent node.

I don't need comprehensive solution but anything existing solution can do almost this functionality?


texts: How do I let non-admin user approve comments?

texts:
I'm looking for a way to allow a non-admin user to approve comments. I thought a Flag/Rules combination might be a solution but I can't figure it out.

I added a content-moderator role, then I created a view listing comments awaiting moderation. After that, I set up a flag to approve comments and added the flag link within the view, bu there is no Rules action that approves comments once the flag is clicked.

Do you have any idea?


texts: Separate Comment Form DIV from Comments DIV

texts:
Is there a way to edit the output of a specific file/line of code that will remove the comment form div from the comments div? Currently, I cannot separate the two to place them next to each other, rather than stacked on one another. It doesn't really work with the theme I'm editing, but cannot find a way to remove it.

Here as a really basic example is how the code looks now:

    (comments go here)

    (comment form goes here)

But what I need is this:

        (comments go here)

        (comment form goes here)

Thanks ahead of time!


texts:
I have a field in a view that shows some HTML tags that, no matter what I do, keep showing up:

What's adding them? How do I get rid of them?


texts:
How can I create a panels page for path admin/commerce/orders/*
I've set a existing page override

And created the panel with selection rules.

It still doesnt work. Is this the correct way to do this?


texts: Only show the complete form at the end of the quiz

texts:
In the Quiz module, After each question that the user answers, it shows a page that have some information (such as: right or wrong, question, answers, etc.).

And in the last of quiz it shows a complete form too.

I want to change this, so that the form is shown just at the end and not after each question. Is there a template I should change or some other way I can change the normal module behaviour?


texts: Social Field Module: Icons not showing up in options

texts:
Trying to use Social Field Module for general user Profile. Followed through module text but no icons appear to show up for the module in either the Field itself or from an End-user logged in perspective. Installed Font Icon Module also.

Anyone any ideas why this is? Module seems quite simple, but maybe I'm missing something or it's lost in translation somewhere.


texts: How can I serve a separate CSS file for Internet Explorer?

texts:
I am setting responsive design for only IE (Internet Explorer) in Drupal 7.

Is there any method or solution this file is working with only IE not for Firefox and Chrome?


texts: How to add Callback function for delete operation?

texts:
I want to add a custom callback function for my delete operation.

$form['table'][$entity->id()] = [
        'title' => [
          '#type' => 'textfield',
          '#default_value' => $title,
        ],
        'status' => [
          '#type' => 'checkbox',
          '#default_value' => 1,
          '#disabled' => ($delta == 0),
        ],
        'weight' => [
          '#type' => 'weight',
          '#default_value' => $delta,
          '#attributes' => array('class' => array('mytable-order-weight')),
        ],
        'operations' => [
          '#type' => 'operations',
          '#links' => [
            'view' => [
              'title' => $this->t('View'),
              'url' => $entity->toUrl(),
            ],
            'edit' => [
              'title' => $this->t('Edit'),
              'url' => $entity->toUrl('edit-form'),
            ],
            'delete' => [
              'title' => $this->t('Delete'),
              // add callback function.
            ],
          ],
        ],
      ];

How do I do this?

What I tried so far was

'delete' => [
              'title' => $this->t('Delete'),
              '#callback' => 'myDeleteFunction'
            ],


texts:
The user has to agree to a terms of use at EACH login, not just at registration.
What is the easiest way to do this?

Right now, I have a login page with only a login block on it (asking for username and password); once logged in the users are sent to the homepage. I need a pop up with terms of usage to appear after the login. The user accepts the 'terms of use' and are then directed to homepage, or are logged out.

There are several good modules that do what I want but only at registration, not for EACH login.


texts: Update to Drupal Core 7.34 and the Password Fields are missing

texts:
Update to Drupal Core 7.34 and the Password fields are missing in the user registration are no longer appearing.

Can't understand why. In the code they simply aren't being rendered.

site: http://kickstart.actliveonline.org/user/register


texts: Trying to add CSS to certain pages using a custom module in 7.x

texts:
I tried following the instructions here: How to override some admin theme CSS rules? and have spent a lot of time and energy googling and iterating this, so I'm turning to the stack exchange community for help.

What I'm trying to do is make some text fields larger when a user tries to edit a page. I'm attempting to do this by writing a custom module that checks if the page's url contains the string edit, and if so, enabling the custom css. The version is drupal 7, and I am working with Pantheon. So far, my module looks like this:

<?php

function admincss_preprocess_html(&$variables) {

$url_string = $_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];

if (strpos($url_string, 'edit') !== FALSE) {

  // reference your current admin theme
    $theme_path = drupal_get_path('theme', 'seven');

  // reference your own stylesheet
    drupal_add_css('sites/all/modules/admincss/css/admincss.css', array('weight' => CSS_THEME));
}

Why isn't my module being used by edit pages? And what, specifically, is the $variables variable referencing?
Thank you in advance!


texts: Why is the programmatically removed paragraph item still showing after adding a new paragraph to the node?

texts:
I have a paragraph field in a node with unlimited add paragraph. I am removing these paragraph programatically. Its removing but when I am adding a new paragraph its adding blank paragraph along with.

I am using this code to remove paragraph

use Drupal\paragraphs\ParagraphInterface;
use Drupal\paragraphs\Entity\Paragraph;

$ids = \Drupal::entityQuery('paragraph')->execute();
foreach ($ids as $id) {
  $paragraph = Paragraph::load($id);
  if ($paragraph instanceof ParagraphInterface) {
    $paragraph->delete();
  }
}


texts: Best approach to inject variable data into JavaScript files?

texts:
I'm looking for a good approach to manipulate some JS code from within a module call. (Using Drupal 6.)

I have a set of JavaScript functions I need to add to a page. (Regular JavaScript, no jQuery.) Unfortunately they rely on some variables from the page they are shown on. So my current approach is to generate all the JavaScript from within PHP code which results in a whole lot of escaped strings like $output .= '  var url = "'. $url . '";' . "\n";, which is not so nice after 20-30 lines of code.

So I would like to move all the JavaScript code into it's own .js file, and find a way to inject my variables. So far, the only solution I could come up with is putting it in a temporary file, read that, modify and save it to the /files directory. But is there another, more preferred way?


texts: Using getThirdPartySetting() to get node type configurations in other hooks

texts:
In a Drupal 8 instance, getThirdPartySetting() function to save node type configurations using the NodeTypeInterface object like below

  $type = $form_state->getFormObject()->getEntity();
  $fields = $type->getThirdPartySetting('field_config', 'type_fields', array(''));

Now I need to use the configurations in a hook for validation, to be particular in hook_entity_bundle_field_info_alter()

function hook_entity_bundle_field_info_alter(&$fields
  , \Drupal\Core\Entity\EntityTypeInterface $entity_type, $bundle)

It contains objects of EntityTypeInterface but not that of NodeTypeInterface. Now how can I access the configuration of the particular node type in the hook?

When I tried something like this in hook_entity_bundle_field_info_alter:

  $node_type = \Drupal\node\Entity\NodeType::load($bundle);
  $selected_fields = $node_type->getThirdPartySetting('field_config',
    'field_scope', '');

It throws an error as : Call to a member function getThirdPartySetting() on a non-object


texts: Drupal performance issue - too much time to establish a connection!

texts:
My drupal site was working fine. Then i disabled access to public with some session thing, After a week or something , it is taking more than 12 second to establish a connection, then the loading is real quick.

79 requests  ❘  35.47KB transferred  ❘  14.87s (onload: 14.87s, DOMContentLoaded: 13.06s)
home
12.24s

css_6b268b79fc331b4fe1492e8a55b94a94.css
/sites/default/files/css
206ms

cometchatcss.php
394ms

........

another thing is its better for garland theme, so possibly theme problem , what what may cause this much waiting? not db_query as i checked even with blank page.tpl its taking 8+ sec!
Please help!


texts: Repository-based site deployment -- what to do about sites/default/files?

texts:
I'm trying to get more rigorous about my process for deploying Drupal sites across development and production servers.  In particular, I'm experimenting with pulling the site from my SVN repository into a directory on the server and flipping a symlink to point the server to the updated site.  This makes sense to me, but I'm not sure how to handle the sites/default/files folder -- it's not in the repository created by the development process since those files are produced by the production users, and the directories inside this folder have different permissions than the default 0755 that I'm getting from doing the export.

So, what to do here?  My current guess is that sites/default/files should be physically moved out of the site directory and then symlinked back in, but wanted to check with others with more experience in this.  A related question is whether there are other files or directories in a Drupal installation that would need to have their permissions updated after an svn-based installation like this.  sites/default/settings.php comes to mind, for instance.  Anyway, is there any advice out there?  Thanks!


texts: Completing commerce order triggering other modules rules checkout complete

texts:
i've coded a checkout complete but aint triggering other modules checkout complete rules, i'm assuming commerce_checkout_complete($order->order_id); will do this.

The most important thing for me is that, the items on the cart are files, hence i have commerce licence that grant license to each files which is not triggered by the code below. Any tips on how to do this please?

Thank you very much.

<?php
    function custom_module_complete_order($order_id) {

     $order = commerce_order_load($order_id);

     commerce_order_status_update($order, 'checkout_checkout');

      $payment_method = commerce_payment_method_instance_load('commerce_payment_example|commerce_payment_commerce_payment_example');

      $transaction = commerce_payment_transaction_new('commerce_payment_example', $order->order_id);
      $transaction->instance_id = $payment_method['instance_id'];
      $transaction->amount = $order->commerce_order_total['und'][0]['amount'];
      $transaction->currency_code = $order->commerce_order_total['und'][0]['currency_code'];
      $transaction->status = COMMERCE_PAYMENT_STATUS_SUCCESS;
      $transaction->message = 'Name: @name';
      $transaction->message_variables = array('@name' => 'Commerce Cartmaker Payment');

      commerce_payment_transaction_save($transaction);
      commerce_payment_commerce_payment_transaction_insert($transaction);

     commerce_order_save($order);
     commerce_checkout_complete($order->order_id);
}
?>


texts:
I am trying to render the Fivestrar widget programmatically. I have tried the following code, without success:

$settings = array(
  'content_type' => 'parce',
  'content_id' => $nid,
  'stars' => 5,
  'autosubmit' => TRUE,
  'allow_clear' => FALSE,
  'required' => FALSE,
  'tag' => 'vote'
);

print drupal_render(drupal_get_form('fivestar_custom_widget', $field_rating['0'], $settings));

I do get the widget form to print, but on submission the votes don't register; plus in this way I do not have the vote summary.

Am I missing something?


texts: Disable cache during development: Templates are not discovered

texts:
I have followed all steps reported on https://www.drupal.org/node/2598914. However, if I create an new template file in my theme folder, it does not get discovered until I flush the cache manually via drush cr.

Is rebuilding the cache a must to discover new templates, or can I optimize the developer settings to auto-discover templates during development?


texts: Varnish causes page load time to increase

texts:
I am running Drupal 6 with pressflow on Ubuntu 11.04.
I installed Varnish http accelerator and Varnish Drupal module. The Varnish is running and the Varnish page at admin/settings/varnish confirms this.

I measured the Time per request before and after installing Varnish with apache bench like this:

ab -n 10 http://my-site.local/

Installing varnish actually increases the Time per request from about 1 second to 1.3 seconds so there must be something wrong in my configuration of Varnish http accelerator.

In php.ini I have set a memory_limit of 512M.

While configuring Varnish to talk with Drupal I followed these instructions given in http://groups.drupal.org/node/25425.

Here is the contents of my /etc/default/varnish

 # Configuration file for varnish
    #
    # /etc/init.d/varnish expects the variables $DAEMON_OPTS, $NFILES and $MEMLOCK
    # to be set from this shell script fragment.
    #

    # Should we start varnishd at boot?  Set to "yes" to enable.
    START=yes

# Maximum number of open files (for ulimit -n)
NFILES=131072

# Maximum locked memory size (for ulimit -l)
# Used for locking the shared memory log in memory.  If you increase log size,
# you need to increase this number as well
MEMLOCK=82000

# Default varnish instance name is the local nodename.  Can be overridden with
# the -n switch, to have more instances on a single server.
INSTANCE=pressflow

# This file contains 4 alternatives, please use only one.

## Alternative 2, Configuration with VCL
#
# Listen on port 6081, administration on localhost:6082, and forward to
# one content server selected by the vcl file, based on the request.  Use a 1GB
# fixed-size cache file.
#

DAEMON_OPTS="-a :80 \
             -T localhost:6082 \
             -f /etc/varnish/default.vcl \
             -u varnish -g varnish \
             -S /etc/varnish/secret \
             -s malloc,256M"

And here is the statistics Varnish module gives after running apache bench few times:

      41  Client connections accepted
      41  Client requests received
      29  Cache hits for pass
      12  Cache misses
      41  Backend conn. success
      12  Backend conn. was closed
      12  Backend conn. recycles
       1  Fetch with Length
      11  Fetch chunked
      29  Fetch wanted close
      11  N struct sess_mem
       2  N struct object
       4  N struct objectcore
       4  N struct objecthead
      10  N worker threads
      10  N worker threads created
       1  N backends
      10  N expired objects
      40  Objects sent with write
      41  Total Sessions
      41  Total Requests
      29  Total pass
      41  Total fetch
   16495  Total header bytes
  645600  Total body bytes
      41  Session Closed
       1  Session Linger
    3776  SHM records
     899  SHM writes
      53  SMA allocator requests
       4  SMA outstanding allocations
   19984  SMA outstanding bytes
 5254284  SMA bytes allocated
 5234300  SMA bytes free
      41  Backend requests made
       1  N vcl total
       1  N vcl available
       1  N total active purges
       1  N new purges added
      41  HCB Lookups without lock
       3  HCB Lookups with lock
       3  HCB Inserts
     922  Client uptime


texts:
How to pass wildcard via drush exec on remote host (via ssh)?

I've tried already:

$ drush @foo exec 'ls -al *'
$ drush @foo exec "ls -al *"
sh: 1: ls -al *: not found
Command 'ls -al *' failed.
$ drush @foo exec "ls -al \*"
sh: 1: ls -al \*: not found
Command 'ls -al \*' failed.
$ drush @foo exec 'sh -c "ls -al *"'

Local shell is bash, remote shell is sh.


texts: Saving and retrieving EntityAutocomplete value

texts:
I'm building a block plugin that allows users to specify a menu to appear in a block plugin. I'm taking advantage of the EntityAutocomplete form element.

https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Entity%21Element%21EntityAutocomplete.php/class/EntityAutocomplete/8.2.x

Here is how the form is built.

public function blockForm($form, FormStateInterface $form_state) {
    $form['menu'] = [
        '#type'          => 'entity_autocomplete',
        '#target_type'   => 'menu',
        '#default_value' => $this->configuration['menu'],
    ];
    return $form;
}

It's able to display the form element just fine. And it allows users to select menus as well. I then save the item on submit like this.

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

However after saving it and opening it again I receive this error

  InvalidArgumentException: The #default_value property has to be an
  entity object or an array of entity object

How do I successfully save or retrieve the menu? Do I need to put something like $this->configuration['menu']['value']?

Update: When I perform

die(print_r($this->configuration['menu']));

It just prints the machine name of the menu I selected. So maybe the issue is that the default value it's being supplied is just a string instead of the actual entity? But if so how would I get the entity from the machine name?

Update 2: I tried using

$menu = Entity::load($this->configuration['menu']);
die(print_r($menu));

But that didn't produce anything.


texts: How to show specific views for certain combinations of taxonomy terms?

texts:
I have searched and not been able to find anything related to this specific situation.

I would like to show specific views for certain combinations of taxonomy terms in Drupal 7.

I have three different taxonomies each with different terms (I have changed the terms here to make them easier to understand):

Fruit
  - Apples
  - Oranges
  - Bananas

Numbers
  - 1
  - 2
  - 3

Letters
  - a
  - b
  - c

Using these terms I already have a view that shows all items tagged with specific terms based on url such as:

/fruit/apples/1/a
/fruit/apples/2/c
/fruit/bananas/3/b

I achieved this with a view which uses a url in the form of /fruit/%/%/% and multiple contextual filters of type 'Has taxonomy term ID'.

So far so good.

What I would like to do is have different view displays that show for specific urls/combinations of terms:

/fruit/apples/1/a  - display 1
/fruit/apples/1/b  - display 2
/fruit/bananas     - display 3
/fruit/oranges/1/a - display 1
/fruit/oranges/1/b - display 2

Does anyone know how I can achieve this or have any alternate solutions/ideas?


texts: Views Contextual Filter by Day and Night

texts:
I have a content type with a boolean field, using radio buttons for day and night.

I would like to create a view with a contextual filter, which shows "day content" between 8:00 am - 8:00 pm and "night content" between 8:00 pm and 8:00 am.

Which is the best way for creating the contextual filter or view?

Or if you'd have a better suggestion, I could change my content type and fields too.


texts: Changing the file of a file field (drupal 7)

texts:
I have a content type that contains a file field which is always a .zip file.  When a file is uploaded I have a module that unzips the file to make a few changes then re zips the file to a new location.  I would like to associate this newly created .zip file with my content type but so far I have not been able to find a way to do that.  I initially tried to change the url of the file field in which it worked temporarily but it seems that the file field was later re-saved with the initial value.

I do my unzipping and re-zipped from hook_node_presave (I also tried to do from hook_node_insert) but neither seemed to work.  Could anyone offer me any advice about how to change the file of a file field?


texts:
I have some code:

 http://mysite.com/node/1/edit
 <?php echo "Hello World!"; ?>

I have a content that processes it:

 http://mysite.com/node/1
 Hello World!

I have a view that displays the code based on context:

http://mysite.com/node/1/code
[[php]]<?php echo "Hello World!"; ?>[[/php]]

How do I apply Syntax Highlighter or Geshi to the output of a view to get it looking pretty?


texts: How to use t() function with node_load in custom drupal module?

texts:
I am using a custom module for my site, and I am using node_load to get the field value of type "long text" field and field of value of type "text".

Something like this

$com_types = "".$ucom->node_title."";

How should I translate $ucom->node_title ?

t() function does not translate variables.

Thanks


texts: How to hide a view when moving through pages with contextual filters?

texts:
I'm new at drupal and I´ve been struggling with contextual filters. Here is my situation: I have 2 views in one page. One of them displays an article list which creates a pager and the other view is at the very top of the page displaying only 3 main articles.

What I want is to hide that view (the top one) when the user move through the pages and only display it when is on the first page.

I have read that I could use a contextual filter to get the value of the page from the URL but so far I haven't been able to do it.


texts: Textfield is not made visible when the radio form element is checked

texts:
In my form I have the following:

$form['text_2'] = [
    '#type' => 'textfield',
    '#title' => $this->t('Text'),
    '#default_value' => isset($config['text_2']) ? $config['text_2'] : '',
    '#states' => [
        'visible' => [
            ':input[name="search_radio"]' => ['checked' => true],
        ],
    ]
];

The search_radio field is:

$form['search_radio'] = array(
  '#type' => 'checkbox',
  '#title' => $this->t('Enable radio buttons'),
  '#default_value' => isset($config['search_radio']) ? $config['search_radio'] : false,
);

Checking and unchecking the search_radio field has no effect at all on this field.


texts: How to add 'Set-cookie' header on rest POST response

texts:
I have subdomain front.test.local as frontend ngx-app and another subdomain back.test.local for the backend pure Drupal both on https - cookie-domain is set to '.test.local'. I need cookie because views resource with image thumbnails in private://.
I trying to get a cookie on frontend after login response in a second request to custom post resource /custom/cookie again basic_auth.
I adding a headers array

    $headers = ['Set-cookie'=>'sess_name=sess_id', 'test: name=value;'];

to return from post resource

    new ModifiedResourceResponse($data, 200, $headers);

The response headers seem the same every time: ["content-language", "cache-control", "content-type", "expires"] - no 'test', no cookies

Is it possible to set additional response headers, 'Set-cookie' or another?
For now, I sending a sessName and sessID in this second response and frontend create a cookie - and this works fine, but it will be nice to set this cookie through a set-cookie header though.

edit2:
improved workaround to skip doubled post with basic_auth (which produce 2 sessions) to one - gist to CustomLoginResource https://gist.github.com/svetlio/156ed32ecccbd38cfae32357a5d6093d return sessId&sessName alongside user id name roles but missing csrf_token , still missing Set-cookie header


texts: Corporate website, each page different style

texts:
I need to create a corporate business website under Drupal 7, and on each page (home, about, sevices, contact, etc.) the design is really different.

What would be the best way to structure/build this in Drupal? I'm used to Wordpress theme per page, but this does not look like it's built in Drupal.

Like thi theme: http://demo.drupalizing.com/?theme=corporateclean
http://drupal.org/project/corporateclean

The design change quite a bit for each page. But when I download the theme, I don't see how they did that, since there's only that general page...


texts: How can I get an absolute path to a theme?

texts:
Is there a Drupal function that returns the absolute theme path? Or is there a canonical / base practice way of doing this correctly returning the theme path?

What I've found so far is this:

<?php
// @file template.php
$template_path = DRUPAL_ROOT . drupal_get_path('theme', 'foo');

I'm looking to require_once the template path in a template.php file like so:

<?php
$template_path = DRUPAL_ROOT . drupal_get_path('theme', 'coo');
// ...
// Check file exists etc
require_once $template_path;


texts: I have content type named recipe, Recipe have some fields like name, image, description. And also have a Boolean field name editors picks. I want to get last checked 3 posts of editors picks field in a view. or i want to limit this field can check only in 3 post. How can i do this. Please help me


texts: How to add the configuration changes from a website to another website?

texts:
This is what I'm trying to do:

I have a website A where I make configuration changes and add other stuff. Now I create a website B. I would like to add the configuration changes from website A to this website.

I know the UUID of both websites have to be the same (like staging & production environment). In "How can I import the configuration on a different site?" they explain how to do this with drush cget system.site.

The problem is when I run drush cget system.site in my website A I get the following drush error:

  Command config-get needs a higher bootstrap level to run - you will need to invoke drush from a more functional Drupal environment to run this command.                                                               [error]
  The drush command 'cget system.site' could not be executed.                                                                                [error]
  Drush was not able to start (bootstrap) the Drupal database.                                                                                [error]
  Hint: This may occur when Drush is trying to:
   * bootstrap a site that has not been installed or does not have a configured database. In this case you can select another site with a working database setup by specifying the URI to use with the --uri parameter
  on the command line. See drush topic docs-aliases for details.
   * connect the database through a socket. The socket file may be wrong or the php-cli may have no access to it in a jailed shell. See http://drupal.org/node/1428638 for details.

Drush was attempting to connect to:
 Drupal version         :  8.0.0-rc1
 Site URI               :  http://default
 Database driver        :  mysql
 Database hostname      :  localhost
 Database port          :  3306
 Database username      :  root
 Database name          :  s_1
 PHP executable         :  /Applications/MAMP/bin/php/php5.5.10/bin//php
 PHP configuration      :  /Applications/MAMP/bin/php/php5.5.10/conf/php.ini
 PHP OS                 :  Darwin
 Drush script           :  /Users/myname/.composer/vendor/drush/drush/drush.php
 Drush version          :  8.0-dev
 Drush temp directory   :  /tmp
 Drush configuration    :
 Drush alias files      :
 Drupal root            :  /Applications/MAMP/htdocs/s1
 Site path              :  sites/default
 Sync config path       :  sites/default/files/config_bZM1aJhLcWGpFZJEzfEw_pKF4g71jOdkSRti30k540BAwE9GQ4U6p469a9VxyJS4j4JVfC58qg/sync

I've installed the latest version of drush .. . I'm working with the release candidate of Drupal 8. Is there another way to get my UUID? Or do you have a tutorial or a video/blogpost of somebody who already did this?

UPDATE:

Ok, I was able to retrieve the UUID from website A and changed the UUID in website B so they have the equal UUID.

After that I changed the system site slogan of website A.

Then I did an export of the configuration in website A. But when I tried to import it in website B I got 137 new files to sync .. . The UUID is different in all files like this:

When I tried to synchronize I got the following error:


texts:
I have created a custom block that shows some parking information for the user (using json) and this worked fine for most pages, but when I visit any created nodes (pages like /node/1,/node/2) the jquery get executed twice (so the information is added twice to the parkings-div in the block). After some searching, I thought using "once" would solve my problem but after adding this it doesn't execute at all.

(function ($) {
    "use strict";

Drupal.behaviors.Parkings = {
    attach: function (context, settings) {
        $('#parkings',context).once('parkingsbehavior', function () {
            getAndShowResults();
        });

        function getAndShowResults() {
            var root_url = getRootUrl();
            $.get(root_url + "parkings", {})
                    .done(function (data) {
                        var i;
                        for (i = 0; i < data.length; i++) {
                            var p = $(document.createElement("p"));
                            var p_text = data[i].description + ', free: ' + data[i].parkingStatus.availableCapacity;
                            p.append(p_text);
                            p.appendTo("#parkings");
                        }
                    });
        }

        function getRootUrl() {
            return window.location.origin ? window.location.origin + '/' : window.location.protocol + '/' + window.location.host + '/';
        }
}};

}(jQuery));

This is my routing file:

parkings.content:
      path: '/parkings'
      defaults:
        _controller: '\Drupal\parkings\Controller\ParkingsController::content'
        _title: 'Parkings Gent'
      requirements:
       _permission: 'access content'

and I've added these dependencies:

    - core/jquery
    - core/drupal.ajax
    - core/drupal
    - core/drupalSettings
    - core/jquery.once

Am I misunderstanding how once() works or am I just using it wrong?

(I'm using Drupal 8 v1.8)


texts:
The node created field is not the same time as when it was finally published (or I guess maybe promoted, instead of published).

I've loaded a node using node_load() in my module code, how can I access when this node was actually published?


texts: I have recently attempted to update from Drupal 8.2 to 8.3.  After updating, all pages that use Display Suite do not render correctly. The markup generated contains a bunch of "<>" instead of the proper markup, and when I go do Display Suite configuration, all custom of fields of the node types that previously were used are do not show up in the list of fields to be placed in the layout elements.  Anyone have idea as to how to troubleshoot something like this?


texts: Can I create views for error logs, or directly expose them to services? How can I maintain my own error logs and expose them in services?


texts: How to add additional tab in the User Profile page using views

texts:
I have installed the flag module and it comes with some 2 views that are added to the list of views. One of them will stick to the user page as an additional tab and when clicked will show a list of all the nodes that were flagged by that specific user being previewed. So far so good.

The problem is that in my website I don't use the path "user/uid" for the user pages. I use the path (example) "somethingelse/uid". When I enter the view and edit the path for this tab page with "somethingelse/uid", save the view and reload the user page... the tab with the list of items flagged by the current user disappears completely.

How can I bring that tab back on the user page? I am on Drupal 7.


texts:
I can see the picture field in the user table, and it seems the field accepts a picture address.
I want to allow users to upload their picture to the site.

Is there any module or code to use this field?


texts: View, Nodes categorized by field with counter just right to Category name

texts:
I would like to split my 100 nodes by category field and display amount of nodes (from 1 category) near Category name.

Here is a screenshot of what I want to get at the end.

  (X documents)

Could you please give me a hint/direction how can I do that?

"X" - number of documents in category
"documents" - word that could be translated in other languages.


texts: Creating a bootstrap sub-theme with the SASS starter kit

texts:
I am attempting to create a bootstrap sub-theme using the SASS starter kit in the the bootstrap base theme. I'm using bootstrap version 7-3.16.

I followed the directions here: How to create bootstrap subtheme using sass? as best as I could.

I copied the SASS starter kit into a new directory in the sites/all/themes directory and named it "bootsub". Then I changed the sass.starterkit file to "bootsub.info" and edited the file to reflect the name "bootsub".

Then I copied the bootstrap framework files into a file in the subtheme named "bootstrap". I had previously installed compass and sass.

I then ran the command "compass init" from the command line (in the subtheme root directory). This created the config.rb file. I then ran the command "compass compile" in the subtheme root directory.

I am still not able to see any styling on the site. I have flushed the cache and I have double checked to make sure that the subtheme is enabled and set as default and the bootstrap base theme is enabled.

I am including an images of the directory structure and a copy of the config.rb file

require 'compass/import-once/activate'
# Require any additional compass plugins here.

# Set this to the root of your project when deployed:
http_path = "/sites/all/themes/bootsub"
css_dir = "stylesheets"
sass_dir = "sass"
images_dir = "images"
javascripts_dir = "javascripts"

# You can select your preferred output style here (can be overridden
via the command line):
# output_style = :expanded or :nested or :compact or :compressed

# To enable relative paths to assets via compass helper functions.
Uncomment:
# relative_assets = true

# To disable debugging comments that display the original location of
your selectors. Uncomment:
# line_comments = false

# If you prefer the indented syntax, you might want to regenerate this
# project again passing --syntax sass, or you can uncomment this:
# preferred_syntax = :sass
# and then run:
# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv
scss sass


texts:
Please bear with me, I am new to Drupal (I've been adding content for 3 years, now been asked to edit some structural aspects of a site.)

I've been asked to add a static frontpage/homepage to an existing Drupal site with no menus, no headers. This would be a very basic HTML page with an image and 2 links which connect to English and French versions of the main Drupal site.

Is the best way to use a module? I see there is a module called Front Page, but it hasn't been updated in almost 2 years (maybe this is normal?). Is there a more basic way to get a static front page in Drupal, without installing another module?

Also, I am concerned about what will happen to the URL of the current front page if I override it with the Front Page module.

Thank you!


texts:
I created a view and set it as in the following screenshots.

  [

If (under the Format section) I select Show:Content or any other setting, I can see the view being displayed on page and on the preview like I want it to show; if I select Show:Fields, the view doesn't show on page, but it does show on the preview.

To clarify the it shows on page part:

The theme is the right one
The region is defined on that particular theme, and I can display content on that region besides the one I really want to show, which also dismisses block settings preventing it from showing

Why is this happening? What can I do to make the view show on page when selecting the Show:Fields option?

Since I am a Drupal beginner, I don't know if the issue is merely caused from a wrong value I set for one or more settings.


texts: How do I send verification mail from my drupal custom module?

texts:
I have written a custom module, which can send simple mail. how do I send mail so that user should get the verification link or something similar.

<?php
/**
* implements hooks_menu
*/

function planet_extension_menu(){
$items['planetext']=array(
'title' => t('DEMO Planet Extension'),
'description' => 'Feeds aggregation ',
'page callback' => 'drupal_get_form',
'page arguments' => array('planet_extension'),
'access callback' => TRUE,
);
return $items;
}

// callback function
function planet_extension($form,&$form_submit){
$form['url']=array(
'#title' => 'URL',
'#type' => 'textfield',
'#required' => TRUE,
'#size' => 35,
'#description' => t('Enter the URL'),
'#attributes' =>array('placeholder' => t('www.example.com'))
);
$form['title']=array(
'#title' => 'Title',
'#type' => 'textfield',
'#required' => TRUE,
'#size' => 35,
'#description' => t('Enter the Title'),
'#attributes' =>array('placeholder' => t('Title'))
);
$form['email']=array(
'#title' => 'email',
'#type' => 'textfield',
'#required' => TRUE,
'#size' => 35,
'#description' => t('Enter you valid email'),
'#attributes' =>array('placeholder' => t('example@example.com'))
);
$form['submit']=array(
'#type' =>'submit',
'#value' => 'Submit',
);
return $form;
}

// below is the form submission function
function planet_extension_submit($form,$form_state){
//store the values entered in form into variables
$values = array(
'url' => $form_state['values']['url'],
'title' => $form_state['values']['title'],
'email' => $form_state['values']['email'],
);
//insert the variables into the table
$insert = db_insert('planet_extension')
                -> fields(array(
                        'url' => $values['url'],
                        'title' => $values['title'],
                        'email' => $values['email'],
                ))
                ->execute();

drupal_mail('planet_extension', 'planet_extension_mail', $form_state['values']['email'], 'en', array('values' => $values));

        drupal_set_message(t('Form submitted. Check your email for verification')); //custom message after form submission is successful
}

//implements hook_mail
function planet_extension_mail ($key, &$message, $params) {
  switch ($key) {
    case 'planet_extension_mail':
      $message['subject'] = t('Hello');
      $message['body'][] = t('Hello user');
      $message['body'][] = t('The main part of the message.');
      break;
  }
}