texts: drupal_add_tabledrag dragging but not dropping

texts:
I am trying to use the drupal_add_tabledrag in a form table, the dragging is added fine, but dropping is not working

    $entity_ids = range(10,20); // Loading dummy data

    $entities = entity_load('node', $entity_ids);
    $rows = array();

    foreach ($entities as $id => $entity) {
        $rows[$id] = array(
            'data' => array($entity->title),
            'class' => array('draggable', 'entity-weight'),
        );
    }

    $form['settings']['entities'] = array(
        '#tree' => TRUE,
        '#theme' => 'table',
        '#header' => array(t('Title')),
        '#rows' => $rows,
        '#attributes' => array('id' => 'entity_table')
    );

    $form['settings']['title'] = array(
        '#type' => 'textfield',
        '#title' => t('Find entity'),
        '#autocomplete_path' => 'list_bean/autocomplete',
    );

    drupal_add_tabledrag('entity_table', 'order', 'self', 'entity-weight');

    return $form;

I can rearrange items using drag, but I cannot drop the item I drag, it sticks tot he cursor.


texts: I noticed that when I added a new menu link, an icon is now show like groups, events, etc. How do I add an icon for that menu link item?


texts:
I've made two yml files, for both routing and menu item:

Route:

tester_helper.products_controller_overview:
  path: '/assortment'
  defaults:
    _controller: '\Drupal\tester_helper\Controller\ProductsController::overview'
    _title: 'Assortment'
  requirements:
    _permission: 'access content'

Menu item:

tester_helper.products_controller_overview_link:
  title: Assortment
  parent: main
  route_name: tester_helper.products_controller_overview
  menu_name: main
  weight: 3

Is it possible to translate both the path and the menu item title?

For example:
EN (english):
"Assortment" => /assortment

DE (german):
"Sortiment" => /sortiment


texts: Getting redirected to the referenced node instead of the created node after node save

texts:
I have two organic nodetypes.
One of the types has a prepopulated reference field referencing the other nodetype.
This means that when i create a node of OG type A it will automatically reference to OG type B.

My problem however is that when i save nodetype A it i get redirected to nodetype B.

I am looking for a way to (using rules ) redirect to nodetype A (the node just created, which is the normal workflow).

Help appreciated..


texts: How to target non admin pages (front end) from a module?

texts:
From my custom module I'd like to target essentially all front end pages on my site whether it be a node, front page, a views page or taxonomy page. I started out thinking it would be better to use logic that said if not admin or node edit / add but did not seem to have much luck. I came up with this and it seems to work fine but I don't know if accounts for every possible front end type of page that I have mentioned.

function mymodule_page_build(&$vars) {

  // Global node.
  $node = menu_get_object ();

  // Target front end pages
      if ((!empty($node) && arg(2) === null) || (drupal_is_front_page())) {

// do stuff

  }
}

I have a feeling the code does not account for all possible conditions I have mentioned so I am looking for some suggestions. I was thinking to exclude by path would be good except that node edit and node add don't have /admin in the url.

Note: By Target, I simply mean to focus or act upon. Example: If you want to add javascript or css to a specific page or pages from a module, you are "targeting" those pages.


texts:
I want to display the content of a page in the manner as present in the image below:

Are any module present for this?


texts:
After installing Drupal 7, the site seems to run fine, however looking in phpMyAdmin I don't see a "node" table. According to this image, used from the documentation on Drupal.org, it should have that table.

When I try to run various SQL queries that mention the "node" table they fail. However the Views module shows Drupal apparently internally able to query against the "node" table.
Also, using a raw SQL module I am able to write SQL against node.title, for example. However, it fails from phpMyAdmin.

I notice that Drupal 8 installations on the same server seem to have a node table. If it's relevant, these were all installed with Softaculous on Arvixe.

What is going on here?


texts: Check performance of drupal websites using some modules or tools

texts: My website starts well and after few days of access it goes terribly slow. Is there any module or any external tool to check the performance of the drupal website. So that we can point out where we are facing issues in drupal so that we can solve them. My pages are built out of average 5-6 views, does this effect the performance of the website ?


texts: Drupal 8: How to get the ['third_party_settings'] of an image field inside hook_preprocess_image_formatter(&$variables)

texts:
I have a custom module that requires that I pass variables to my image-formatter template via hook_preprocess_hook(), in this case hook_preprocess_image_formatter().

From within the preprocessor, I would like to acquire $field_display['third_party_settings']['My_Module']

I should be able to do that by exposing the #view_mode and the #field_name of the ImageObject I am preprocessing. I may even be able to hard-code #view_mode = 'full' in which case all I need to do is exposed the #field_name in my processor to acquire the ['third_party_settings']. Any ideas?

EDIT: I forgot to mention that I will be heavily depending on the data that is contained in the image object that is contained within $variables['item'] to acquire the info needed for this. A gist of part of that object can be found at the following url with data containing the field_name: https://gist.github.com/awasson/55ad5da56076e5cb57dd8f3aa68a05f0

Thanks!


texts:
I successfully migrated a Drupal site I'd been working on to my local machine. The site itself and its content are all fine, but when I login as administrator, the admin toolbar is an unstyled list, as seen here.

I seem to have the same problem as described in this other thread; however, I have tried the solution suggested with no success.

All the permissions are correct, either 755 (folders) 644(files), and I did a recursive chown on the entire directory. I flushed the caches before I migrated the site and then again when I got it live locally. I am using the admin toolbar module, so I tried uninstalling, no change, and reinstalling, no change.

If I observer the console output from web browser, when I log in as admin, I get the following:

  The stylesheet http://localhost/drupal/?og6o9k was not loaded because its MIME type, “text/html”, is not “text/css”.

  SyntaxError: expected expression, got '<'

I don't know if these are related, but they are the only noticeable difference when I log in as admin, so I'm acting as if they are related.


texts: How to fix sorting by node title in glossary View when viewing page in non default language?

texts:
There is ton of materials how to do it in 7, but I was not able to find or adapt based on those solutions.

My View has fields:

Content: Title
Title first letter [hidden]

Filters:

Content: Publishing status (= Yes)
Content: Content type (= Basic page)
Content: List page in glossary (= True)

Sort criteria:
- Content: Title (asc)

Relationships:
- Node

Rendering Language:
Interface text language selected for page

When viewing page with default language (which is a source language for a nodes) sorting is working good. After switching language sorting not working well, seems like it's based on source translation content every time.

Generated SQL:

SELECT node_field_data.title AS node_field_data_title, node_field_data.nid AS nid, node_taxonomy_index.nid AS node_taxonomy_index_nid
FROM
{node_field_data} node_field_data
LEFT JOIN {taxonomy_index} taxonomy_index ON node_field_data.nid = taxonomy_index.nid
LEFT JOIN {node} node_taxonomy_index ON taxonomy_index.nid = node_taxonomy_index.nid
LEFT JOIN {node__field_glossary_enabled} node__field_glossary_enabled ON node_field_data.nid = node__field_glossary_enabled.entity_id AND (node__field_glossary_enabled.deleted = '0' AND node__field_glossary_enabled.langcode = node_field_data.langcode)
WHERE (node_field_data.status = '1') AND (node_field_data.type IN ('page')) AND (node__field_glossary_enabled.field_glossary_enabled_value = '1')
ORDER BY node_field_data_title ASC


texts: How to filter by month in view using a date field

texts: I have a field called birthday that is defined for users. In views, is there any way to create a filter that filters only by month? Smallest values it lets me select is year and month where I only need month. (to find users who are born in April for example). Thanks for any help.


texts: Display file upload images in webform view

texts:
I have a webform where users can upload images. For easier administration, I created a view of these submissions.

The default behavior of the field is to display as a link. However, I would like to preview the images by displaying them in an image tag.

I looked at the field re-write behavior, but it only gives me the entire href.

How can I display image field values as images in a webform view?


texts:
I have a list form in a module, which is giving me three columns, the first of which is a checkbox column.

function popups_list_form($form, &$form_state){
        global $base_url;
        $header = array("Title", "Popup");

        $result = db_query("SELECT * FROM popups");
        }
        # build the table fields
        $rows = array();
        $options = array();
        $ppups = array();

        foreach ($result as $row){
            $rows[$row->popup_id] = array($row->title, $row->popup_org_name);
         }

        $form['table'] = array(
            '#type' => 'tableselect',
            '#header' => $header,
            '#options' => $rows,
            '#default_value' => $ppups,
            '#empty' => t('No Popups Available'),
        );
        return $form;
    }

Why is it happening?


texts:
In Drupal 7, I have defined a block called mycontenttype_block. I would like the output of the block to be the node submit form for an existing content type, like this:

function mymodule_block_view($delta = '')
{
    switch ($delta)
    {
        case 'mycontenttype_block':
            $block['subject'] = t('Mycontenttype submission form');
            $block['content'] .= $something;
            return $block;
            break;
    }
}

Where $something is the form output. I tried setting $something to drupal_get_form('mycontenttype_form) but I can't get any output...


texts:
i have a problem theming my user-profile-edit.php
the user name field (name) is rendering nothing, while other fields like 'mail' are working good.

//contents of user-profile-edit.php
<?php
print render($form['form_id']);
print render($form['form_build_id']);
print render($form['form_token']);
print render($form['account']['name']);
print render($form['account']['mail']);
?>

//contents of template.php
...
function MY_THEME_theme($existing, $type, $theme, $path){
  return array(
    'user_register' => array(
      'render element' => 'form',
      'template' => 'templates/user-register',
    ),
    'user_login' => array(
      'render element' => 'form',
      'template' => 'templates/user-login',
    ),
    'user_profile_form' => array(
      'render element' => 'form',
      'template' => 'templates/user-profile-edit',
    ),
    'user_pass' => array(
      'render element' => 'form',
      'template' => 'templates/user-pass',
    ),
    'user_pass_reset' => array(
      'render element' => 'form',
      'template' => 'templates/user-pass-reset',
    ),
  );
}

in the end when I open the page mysite.com/user/1/edit I can only see the mail field.

any idea of what am I doing wrong?? or how can I render that name field so I can customize the visualization?


texts: How to join 2 tables hook_views_data drupal 7

texts:
I have 3 tables : societe, field_data_field_idsociete, users

Im trying to get data from societe and users. Below is my code for hook_views_data.

$data['societe']['table'] = array(
    'group' => t('Societe'),
    'join' => array(
        'field_data_field_idsociete' => array(
            'left_field' => 'field_idsociete_value',
            'field' => 'societe_id',
        ),
        'users' => array(
            'left_field' => 'entity_id',
            'field' => 'uid',
        ),
    ),
);

i got this error :  Unknown column 'societe.uid' in 'on clause'


texts: How to create Facebook style user notifications?

texts:
Using Heartbeat I have been able to effectively make streams of user activities through Rules triggers. However I would like to be able to have users notified of new activities, and keep a count of the number of new activities like in facebook, or even similar to new email counts in most email systems.

In Drupal 6 there were a few modules which could achieve this well, however how can this be done in Drupal 7?

I have done quite extensive research on this but am unable to find the right module at this point:
There's the User Notifications and Notifier modules, which would be the perfect solutions except only D6 versions exist. There's Notifications which cannot be integrated with any activity logging module since it lacks proper Rules support. Two interesting implementations are Appbar and Taskbar which provide dropdown trays with lists of activities, but don't count the number of new activities and no longer integrate with Rules. Finally DLike is great as a dynamic counter, even though at the moment it only counts Flags and provides a link to a list of the flagging users. Perhaps with some tweaking it could be used via Flags Rules integration to track recent (flagged) activities and link to a list of these recent activities.

Is it possible to achieve functionality similar to this in Drupal 7?


texts:
I have a list of images on my node that I want to output wrapped in an anchor tag for linking to external webpages. Images are coming from fields in my content type. I'm not using the Views or the Panels module, and I've edited my page.tpl.php and node.tpl.php files for a rather intricate "About Us" page.

So how do I do this? I'm using Drupal 7.


texts: Risks of developping your own theme from scratch?

texts:
I read several answers about "Is it better to develop your own theme from scratch or extend a existing one?".

Here is my situation: I just got an existing project and I have to debug it and evolve it. I'm in the audit phase and I was wondering if, in a theme developed from scratch, you forgot to provide the code for render some elements, are they going to stay hidden?

The specific case in this project is the absence of drupal status messages. They never appear. I guess there are plenty of them that are generated by the core, like when you fail at login or something. But they just don't happen.

It is very problematic and I want to fix that.

Is that because developers forgot to render them manually somewhere?

Thanks in advance


texts: Why am I getting a 200 status header when the page is being served from cache?

texts:
Been running into a weird issue with all of our Drupal 8 websites, hosted on different servers.

The pages are caching correctly, x-drupal-cache header shows a HIT as well. The page however has it's headers set to 200, instead of 304. None of the sites are live yet, so i can't provide a link.

Request Headers:

HTTP/1.1 200 OK
Date: Fri, 18 Mar 2016 20:09:41 GMT
Server: Apache/2.4.7 (Ubuntu)
Cache-Control: max-age=900, public
Expires: Sun, 19 Nov 1978 05:00:00 GMT (Dries' birthdate? O.o)
Last-Modified: Fri, 18 Mar 2016 19:49:21 GMT
Vary: Cookie,Accept-Encoding
X-Drupal-Cache: HIT
Keep-Alive:timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html;
charset=UTF-8

Debugging the code Drupal uses to serve pages with 304 headers ( lines 165 to 170 of PageCache.php ) I have found that HTTP_IF_MODIFIED_SINCE and HTTP_IF_NONE_MATCH are not being set.

Thanks!


texts: foreign keys between tables of the same module

texts:
I'm trying to find out how to create relationships between tables that are created in the same modules. I create my entity with the console and I declare several tables.
How can I declare shared keys in the baseFieldDefinitions of my entity and tables declared in my address_schema()

My way (is it the right method) :

my_module / address.install> address_schema ()

    'foreign keys' => [
      'lin_id' => [
        'table' => 'coo_address',
        'columns' => [
          'lin_id' => 'lin_id',
        ]
      ]
    ]

my_module / Entity> baseFieldDefinitions

$ fields ['lin_id'] = BaseFieldDefinition :: create ('integer')
      -> setLabel (t ( 'Address'))
      -> setDescription (t ('Une ligne pour l'adresse de réference.'))
      -> setSetting ('unsigned', TRUE)
      -> setDisplayOptions ('view', array (
        'label' => 'hidden',
        'weight' => 2,
      ))
      -> setDisplayOptions ('form', array (
        'type' => 'number',
        'weight' => 2,
      ))
      -> setDisplayConfigurable ('form', TRUE)
      -> setDisplayConfigurable ('view', TRUE);

I wish I had something like, but there is error. coo_address_lin being a table create in address_schema ()

$fields['lin_id'] = BaseFieldDefinition::create('entity_reference')
      ->setLabel(t('Adresse'))
      ->setDescription(t('The refence of the line for the address reference.'))
      ->setSetting('target_type', 'coo_address_lin')
      ->setDefaultValue(0)
      ->setTranslatable(TRUE)
      ->setDisplayOptions('view', [
        'label' => 'hidden',
        'weight' => -4,
      ])
      ->setDisplayOptions('form', [
        'type' => 'entity_reference_autocomplete',
        'weight' => -4,
        'settings' => [
          'match_operator' => 'CONTAINS',
          'size' => '60',
          'autocomplete_type' => 'tags',
          'placeholder' => '',
        ],
      ])
      ->setDisplayConfigurable('form', TRUE)
      ->setDisplayConfigurable('view', TRUE);


texts: I want to change the order of fields in login/registration form

texts: I've user login/registration form in my drupal 7 site. Two links in this form: "Create new account" and "Request new password" are appearing before captcha. And I'm trying to place these links after captcha and before button. How can I achieve this?:


texts: How do I add a Drupal 8 project (e.g. the Panels module) to my site?


texts:
I am trying to install a drupal site that I built a while back. I put it in a sub folder for viewing purposes and am having trouble logging in. I got the site installed, the DB connected but when I go to myurl.com/sitename/user I get a 404 error. The site is in  maintenance mode so I can't get into the backend system. I know the site is partially working as when I go to myurl.com/sitename I get the maintenance page with all broken links. I did some searching and made sure my .htacces file was updated with this code:

RewriteBase /sitename
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

But still not working...
What else should I be doing here?
THanks


texts: How can I save an Advanced Action on Drupal 7 installation when there's no save button?

texts:
I am at the 'edit / configure an advanced action page' and I try to create or edit one of my "send email" actions (admin/config/system/actions/configure/...) However, I notice that the form has no save button.  It's not there whether overlay is on or off.  How do I save it?  My core and modules are all up to date as of today.  I am logged in as adminstrator and have rights to do everything (I checked that).

Here's my setup:
Drupal core 7.15
Includes: Aggregator, Block, Blog, Book, Color, Comment, Contact, Contextual links, Dashboard, Database logging, Field, Field SQL storage, Field UI, File, Filter, Forum, Help, Image, List, Menu, Node, Number, Options, Overlay, PHP filter, Path, RDF, Search, Seven, Shortcut, System, Taxonomy, Text, Toolbar, Tracker, Trigger, Update manager, User

Modules

Backup and Migrate 7.x-2.4
Chaos tool suite (ctools) 7.x-1.2
Content Access 7.x-1.2-beta1
Entity API 7.x-1.0-rc3
Features 7.x-1.0
Feeds 7.x-2.0-alpha5
Job Scheduler 7.x-2.0-alpha3
Mailhandler 7.x-2.5
Pathauto 7.x-1.2
Rules 7.x-2.2
Strongarm 7.x-2.0
Token 7.x-1.2
Token Filter 7.x-1.1
Webform 7.x-3.18
Release notes

Includes: Webform

Themes
The Morning After 7.x-1.0-beta3.


texts:
I am currently developing a website using the framework Symfony2. I am nearly at the end of its development, and just the "security" part is missing (authentication and authorization). What I would like is to use Symfony2 core bundle to authorize the user but I want to use my Drupal database to get the authentication of the user.

I have previously used the module Services 3 with a REST server to get the user information and to authorize him/she to go on my website (which was flat php coded). Now, I want to make something robust and secure, so here my question, do you know a method for getting the authentication from the Drupal website and then authorize the user via Symfony core bundle?

Here are my 2 thoughts about it:

-> Fetch the user data ($username & $password) using the REST server and a query made in my custom UserProvider (Symfony Doc) and then leave Symfony makes the authentication using the Drupal's password encoder. But here the problem is that when you fetch the user data using the REST server, you get everything but the password.

-> Get access to the Drupal database using Doctrine as usual in my application and fetch the user & pass from it. Then use the Drupal's password encoder to check this result.

To conclude, I am really far to be an expert on this kind of stuff, so I would really appreciate your help.


texts: How can I make form_alter work with Ajax Comments?

texts:
I did some manipulation (with JavaScript and CSS) on my comment form. It works good. Then I needed to install the Ajax Comments module because I don't want visitors to go another page while replying a comment.

My customization on the comment form doesn't work after enabling the Ajax Comments module.

This is the custom code that works without Ajax Comments:

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

      if($form_id == 'comment_node_blog_form') {
        $form['comment_body']['#weight'] = -100;
        $form['#attached']['js'][] = drupal_get_path('theme', 'mytheme') . '/js/jquery.validationEngine-en.js';
        $form['#attached']['js'][] = drupal_get_path('theme', 'mytheme') . '/js/jquery.validationEngine.js';
        $form['#attached']['js'][] = drupal_get_path('theme', 'mytheme') . '/js/scripts.js';
      }
    }

And this is the JavaScript code:

(function ($) {
    $(document).ready(function(){
        $("#comment-form").validationEngine();
        $('#comment-form').find('.form-type-textfield').hide();
        $('#edit-comment-body').click(function() {
                $('#comment-form').find('.form-type-textfield').slideDown();
        });
    });
})(jQuery);

I tried the code above with behavior format but it also didn't work.

How can I make this code work with Ajax Comments?


texts: Using user_load() and user_save() to change the status of a logged out user

texts:
I'm fairly new to Drupal, and I am currently working on a Drupal user registration mechanism that involves authentication on a different website.
The flow is as follows:
- A user registers on a Drupal user/register form. Using user_register_submit() I set the the user's status to blocked.
- After registering, the user is being redirected to a different website where he is required to log in. In that redirect, I pass the newly registered Drupal username as a parameter. If the login on that external site is successful, I'd like to redirect the user back to a .php page on the Drupal site (also sending back the username parameter via POST), and then change the status of that user to Active.

In order to achieve that, I've tried using the following code in a page called auth.php I placed under my theme's root directory. This code is failing:

<?php
    $username = $_POST['user'];
    $user_to_activate = user_load(array('name' => $username));
    user_save($user_to_activate, array('status' => 1);
?>

After stumbling upon this http://drupal.org/node/820506, I realized core functions (such as user_load() and user_save() from the user.module) should be available from other modules. So I'd like to put my code inside a custom module, thing is I don't know in which function should I put it. Also, I wouldn't want this module to be called on every page load, only when being redirected from the external website I mentioned in the first comment.

Could someone offer some guidance?


texts: Attaching additional queries to webforms

texts:
I'd like to limit the ability of a form submission based on whether a user has submitted the form already.

So basically if a user has submitted a form, they can not submit again.
I've already created the form using webforms, I just need to figure out how to limit the submissions now.


texts: Can I use I18N or another module to house regional variations of a site in a single installation?

texts:
I have a large build coming up and am planning to attack it in Drupal 8.

The client will have three regional variations of their site, a .com, a .co.uk, and a .es. The goal is for them to look like one site. The sitemap will be 98% symmetrical between the three sites, only a handful of pages may exist in one menu and not in another. The .es will be in spanish, the .co.uk will be in UK English, .com in US English.

Is there any better way to approach the three sites that would make it easier to manage? For instance, using I18N? Having translations of each region is not a requirement, and almost every page will be shared between all three, with language variations (in .co.uk probably changes for SEO sake so we don't look like duplicate content).

Thank you for any input!


texts:
Below is an example of adding an additional submit handler to a node form. I don't like how in the submit handler I have a giant nested structure just to check if a file was uploaded...Is there a better way?

<?php
function rocdocs_polygons_form_polygons_node_form_alter(&$form, &$form_state, $form_id)
{
    $form['#submit'][] = 'rocdocs_polygons_form_polygons_node_form_submit';
}

function rocdocs_polygons_form_polygons_node_form_submit($form, &$form_state)
{
    if ($form_state['values']['field_shapes_file']['und'][0]['fid'])
    {

    }
}


texts:
I am running a drupal 7 site and i have the following problem : I have multiple audio files (1000+) and i need to create a custom node for each of them.

I managed to do it (almost) but i don't know how to send the field_fisier_display value for the column.
The initial table was created (automatically by drupal) to not allow NULL and to have a 1 as default value. But when i run my script I get a PDO statemnt error that says i cannot insert NULL in that field.

I fixed it (for now) by changing the tables drp7_field_data_field_fisier and drp7_field_revision_field_fisier to allow NULL and to run an UPDATE statement after the node ceration. I don't like this fix.

Please share your wisdome with me in solving this problem.

My current script is :

for ($i = 0; $i < count($predici_neprocesate); $i++) {
    $predica = $predici_neprocesate[$i];
    $new_node = new stdClass();
    $new_node->type = 'predica';
    node_object_prepare($new_node);

    $new_node->uid = 1;
    $new_node->title = $predica;
    $new_node->body['und'][0]['value'] = "value";
    $new_node->body['und'][0]['format'] = 'filtered_html';
    $file_path = drupal_realpath($predica);
    $file = (object) array(
                'uid' => 1,
                'uri' => $file_path,
                'filemime' => file_get_mimetype($file_path),
                'status' => 1,
                'filename' => $predica,
                'type' => 'audio'
    );
    $file = file_copy($file, 'address');
    $new_node->field_fisier['und'][0] = (array) $file;

    node_submit($new_node);
    $new = node_save($new_node);

    unlink($file_path);
    $sql = "UPDATE drp7_field_revision_field_fisier SET field_fisier_display = 1 WHERE entity_id = " . $new_node->nid;
    executeSQL($sql);
    $sql = "UPDATE drp7_field_data_field_fisier SET field_fisier_display = 1 WHERE entity_id = " . $new_node->nid;
    executeSQL($sql);
}

Please let me know what information do you need, in order to give me an ideea (table structure / content type structure etc).


texts: Determining unauthenticated user when session cookie exists

texts:
We've been experiencing some strange behavior in regards to user sessions that I need help understanding how Drupal determines if a user is authenticated or not.
We have a custom endpoint to log in users because we needed to provide some extra data that the basic endpoint does not. Here is how we do that:
    // Retrieve and validate the sent data
    $data = Json::decode($request->getContent(), TRUE);

    // Prepare a request to Drupal's default login
    $client = \Drupal::httpClient();
    $host = \Drupal::request()->getSchemeAndHttpHost();
    $url = "$host/user/login?_format=json";
    $req_options = [
      'json' => [
        'name' => $data['username'] ?? '',
        'pass' => $data['password'] ?? ''
      ],
      'allow_redirects' => false
    ];

    try {
      // Make request to Drupal's default login
      $response = $client->request('POST', $url, $req_options);
    } catch (\Exception $e) {
      $res_body = Json::decode($e->getResponse()->getBody());
      return new JsonResponse($res_body, $e->getCode());
    }

    // Get the Set Cookie header from the login response to transfer the session data to this
    // request
    $set_cookie = $response->getHeaders()['Set-Cookie'];
    $set_cookie_arr = explode(';', $set_cookie[0]);
    $session_arr = explode('=', $set_cookie_arr[0]);
    $session_id = $session_arr[0];
    $session_name = $session_arr[1];

    // Parse the login response body to get some information to pass along to this request's
    // response
    $body = Json::decode($response->getBody());
    $user = $this->constructUserJson($body['current_user']['uid']);
    $response_body = [
      'sessid' => $session_id,
      'session_name' => $session_name,
      'token' => $body['csrf_token'],
      'logout_token' => $body['logout_token'],
      'user' => $user
    ];

    // Determine response
    return new JsonResponse($response_body, 200, ['Set-Cookie' => $set_cookie]);

This works fine and the user is able to login. Then the next request that is made is set up like so:
my_module.api.levels:
  path: "/api/v1/user/levels"
  defaults:
    _title: "User API Levels"
    _controller: '\Drupal\my_module\Controller\UserAPIController::levels'
  methods: [GET, POST, PUT]
  requirements:
    _user_is_logged_in: "TRUE"
    _format: "json"

When I run this sequence of requests (/login then /levels) on Postman, everything works fine. However, when I run this sequence of requests on an mobile application, it fails. I thought this might be the mobile application not sending the session cookie, but determined it was and that it had all the same information as the session cookie when calling it via postman.
Using $request->headers and session_get_cookie_params() I was able to pull the following:
From Postman

From mobile apps

This to me suggests that the apps are correctly sending the session cookie back as it clearly exists in the request, but why does Drupal not recognize the session here?


texts: "Really" disable entire cache during development (also routing, twig templates, css+js libraries)

texts:
I have followed the community documentation page at https://www.drupal.org/node/2598914 (Disable Drupal 8 caching during development). Now I expect that the caching in my Drupal 8 site is entirely switched off. However, for setting up an new route, a twig template or any css/js library in mymodule/mymodule.libraries.yml, I still need to run

drush cr

to get my stuff recognized by Drupal 8. How can I "fully" disable caching? It is annoying to run "drush cr" dozens of times and repeatedly guess if the specific item is either cached or not..


texts: How to remove "There is currently no content classified with this term." phrase?

texts:
I have multiple terms created and for each I have created direct links. However under the content this message is displayed (because there are no content linked to the node) :

  There is currently no content classified with this term.

How to get rid of it ?

I don't like the CSS solution display:none.


texts:
I've searched a bit for the answer to this, but all the answers seem to refer to single sites, or they just don't work (or I'm doing them wrong).

I have an out-of-the-box Bitnami image setup on Amazon EC2, and when I point my domain to the server, then visit the domain, I need to put a /drupal on the end to get to the drupal sites.

I need to figure out how to make example.com and example2.com point to the drupal installation instead of example.com/drupal and example2.com/drupal.

Is this a drupal configuration that I need to change, or an Apache configuration, or what?


texts: Printing Region With Content in Custom HTML

texts:
I am creating a custom first page that is blank and built up from scratch. However I want to print certain regions (e.g. the footer) on this page. How can I grab the region information/content and print it in the html in the welcomegeneratepage function.

<?php

//Create the redirect page
function module_name_menu() {
    $items['welcometest'] = array(
        'title' => 'Redirecting',
        'access callback' => TRUE,
        'delivery callback' => 'welcome_blank_page'
    );
    return $items;
}

//Function generate the redirect page
function welcome_blank_page() {
    //Get the redirect URL
    //Generate the HTML for the page
    $html = welcomegeneratepage();
    print $html;
}

//Generates the page html
function welcomegeneratepage() {
    print $footer;
    $html = "

                    <link rel=\"stylesheet\" type=\"text/css\" href=\"".drupal_get_path('module', 'module_name')."/css/module_name.css\">
                    <link rel=\"shortcut icon\" href=\"".variable_get('file_'.file_default_scheme().'_path',conf_path().'/files')."/favicon.ico\" type=\"image/vnd.microsoft.icon\" />

                <title>
                        Welcome to ".variable_get('site_name')."
                </title>

Welcome

             ";
    return $html;
}


texts:
How can I hide the /node page in Drupal 8?

This site: https://www.drupalaid.com/blog/3-things-you-should-hide describes the reasons for hiding it and the process for Drupal 6 and 7, though no information for Drupal 8 now hook_menu_alter() has been removed.


texts: Drupal Commons 7.x 3.9 misses "Create a Post" on front page

texts:
I am not sure what happened, but I seem to have lost the "Create a Post" item at the top of the "What's going on?" default front page. I did not consciously delete it.

I compared the site missing "Create A Post" with another site having it, but I cannot find any difference.

Any troubleshooting help much appreciated.


texts: I need to load DB configuration dynamically in Drupal 7

texts: Can I put variable_get in settings.php to load DB settings dynamically or there is a better way.


texts: search-index with drush fails on field_collection error

texts:
I've been rebuilding my search index using "drush search-index" for the better part of the day. There have been a few odd errors that I have handled as I went along, making some fixes in the process and learning as I went along about things I could do better. but now I am stuck as drush is exiting unexpectedly with the following error:

Remaining items to be indexed: 116    [ok]
WD php: Exception: Invalid field name given: field_accreditation is not a Field Collection field. in FieldCollectionItemEntity->__construct() (line 101 of /var/www/vhosts/lipid.org/httpdocs/sites/all/modules/field_collection/field_collection.entity.inc).                                                                                [error]
Drush command terminated abnormally due to an unrecoverable error.
Indexing stalled with 116 items remaining.     [error]
The search index has been built.

I'm running Drupal 7.69, everything is current, with no beta or alpha stuff running

There is in fact a field with that name (field_accreditation). It's of type long text. It is not a field collection, it is not a member of any field collection and it is not referenced anywhere as a field collection (that I am able to find.

This stops my site at 96% indexed, which is generally indiscernible right now; but I expect it will become a problem shortly. Any thoughts on how to track down the source of this error?


texts: Views contextual filter from custom taxonomy field

texts: I have added a custom field to taxonomy vocabulary. Now I need to use contextual filter from Views to display items that matches that custom field value in URL, e.g. /my_page/custom_field_value . Is it possible with Drupal 7 and Views 3.x ?


texts: I have to show all the tags and sort based on count. I am able to get the count of tag used by pages through views but not able sort based on count as this option is not available in views. Any suggestions?


texts:
I have implemented a custom login module and I want to keep it on general purpose state.

This module have been developed because users can be authenticate against an internal LDAP Server (Sun Microsystems' LDAP directory server). So in this module I want to keep only the authentication and retrieve data from the LDAP directory. That's fine, I have it, within the PHP API (LDAPc) we have available.

There are situations where the link to log into the application comes with extra querystring parameters, and I have the thought to add a hook to my custom login module, so from other module I can implement that custom hook, retrieve these querystring and do whatever we need to do... add them in an extra table linked with the user table, for example.

I could do this inside the custom login module, but if so, my module will not be valid for other drupal sites with other needs.

My first thought, following this post: http://tylerfrankenstein.com/code/drupal-create-custom-hook-for-other-modules

has been to add the lines:

    $params = $_GET;
    drupal_alter('retrieve_login_extra_params', $params);

to my current development state

/**
 * Implements hook_menu().
 */
function psaldaplogin_menu()
{
    $items = array();
    // Login Page to authenticate against PSA Ldap directory
    $items['user/psaldaplogin'] = array(
            // Every user can access to this page
            'access callback' => TRUE,
            // Define the function where implement the generation of the page
            'page callback' => '_psaldaplogin_view',
    );
    return $items;
}

/**
 * Authentication procedure
 *
 * TODO:
 *     Allow other modules implement this process as a hook,
 *     so more complex process on login step
 *     could be implemented outside this module
 *
 */
function _psaldaplogin_view()
{
    // Clear messages queue
    drupal_get_messages();

    // Check if the user is already logged
    if (user_is_logged_in()) {
        drupal_goto('home');
    }

    // Allow other modules process the querystring parameters
    // --> DOESN'T WORK
    $params = $_GET;
    drupal_alter('retrieve_login_extra_params', $params);

    // Authorized the user
    if ($username = _getAuthorizedUser()) {
        // Get the user information from PSA Ldap directory
        $userData = _getLdapUserInformation($username);
        // Register the user into Drupal
        if (_registerExternalUser($userData)) {
            // Redirecto to home
            drupal_goto('home');
        } else {
            // If the registration failed show access denied message
            drupal_access_denied();
        }
    } else {
        // If the authentication failed show access denied message
        drupal_access_denied();
    }
}

Figuring out I will be able from other module implement something like:

function slider_retrieve_login_extra_params($params)
{
    // check $params since they are unsafe data

    // test if the querystring params could be retrieve here
    file_put_contents('/tmp/genius/genius.log',
        "\n" . print_r($params, true) . "\n",
        FILE_APPEND);
}

But this chunk of code is never executed, so it is clear I have a miss understanding on how to allow other modules to implement a custom hook.

I'll appreciate if someone could point me to the right direction to achieve this solution. Otherwise I will have the module as template since for each development the login needs could be different.

Thanks for the reading.

Regards.


texts: How do (or should) two separate modules implement the same external library using the Libraries 2.x API?

texts:
The Libraries module exists to make it easier for multiple modules to use the same library, but how is this actually done?

Do Module A and Module B both implement the library using hook_libraries_info() and hook_requirements()? If so, how do they avoid conflicting with each other? In my experience (trying to use Masonry API and Manual Crop modules), they conflict, even when both use the same namespacing, etc.

Or should a new module (Module C) be created that implements the library, and then Module A and Module B depend on Module C and use libraries_load()?


texts: Show exposed pager as links instead of select box

texts: How to show exposed pager as links instead of select box in drupal 7 views ?


texts: Android submission: I get a "CSRF validation failed" error while using a cookie

texts:
The Drupal Version is 7 and the Services version is 3.4.

So, My login into Drupal goes like this:

Fetch a token. (POST)
Fetch a Cookie using the token. (POST)
Make GET Requests using DefaultHttpClient class to download data.
(GET). This uses a token and cookie

This all works fine. But when I try to post my submissions to drupal server, look at the code below

 DefaultHttpClient httpClient = new DefaultHttpClient();
        HttpPost httpPost = new HttpPost(submissionURL);
  SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(SurveyReviewActivity.this);
        String id = prefs.getString("sessid", "FAIL");
        Log.e("SRA", id);
        String name = prefs.getString("sessname", "FAIL");
         Log.e("SRA", name);
         //String token_test = prefs.getString("token", "FAIL");
        //Log.e("SRA", token_test);

          httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded");
         httpPost.setHeader("X-CSRF-Token", X_CSRF_Token);
         // httpPost.setHeader("X-CSRF-Token", token_test);
         httpPost.setHeader("Cookie",name+"="+id);  try {
             httpPost.setEntity(new StringEntity(message, "UTF8"));
         } catch (UnsupportedEncodingException e) {
             Log.d("Encoding Exception",e.toString());

        }
          try {
            HttpResponse httpResponse = httpClient.execute(httpPost);
             if(httpResponse.getStatusLine() != null && httpResponse.getStatusLine().getStatusCode() == 401) {
                 Log.d("Submission failed ", httpResponse.getStatusLine().toString());

             }

            HttpEntity httpEntity = httpResponse.getEntity();
            is = httpEntity.getContent();
            try {
                BufferedReader reader = new BufferedReader(new InputStreamReader(
                        is, "iso-8859-1"), 8);
                StringBuilder sb = new StringBuilder();
                String line = null;
                while ((line = reader.readLine()) != null) {
                    sb.append(line + "\n");
                }
                is.close();
                String json = sb.toString();
                Log.d("Response", json);
            } catch (Exception e) {
                Log.e("Buffer Error", "Error converting result " + e.toString());
            }
        } catch (ClientProtocolException e) {

            Log.d("Protocol Exception",e.toString());
        } catch (IOException e) {

            Log.d("Protocol Exception",e.toString());
        }

When I set the last header (the cookie header), I get a token invalid or CSRF Validation Failed Error to be specific. If I don not use a token the submission goes through, but submissions are shown as anonymous on the drupal CMS side. I thought that my shared preferences are crapping up my stored cookie, but they are not thats why I was verifying them by printing them to logcat. I can get a new cookie and even tried that, but its still the same error. Whats going on here? Here are my references to the previous posts I checked on various sites.

...so if you plan on giving a solution which says your shared preferences are giving you the wrong cookie back or your token is coming down with a new line....tried that all...not working. But its working great on the iOS side, the exact same logic and actions.Please also note that, my cookie was working in fetching the data (bolded that part on step 3), but not while uploading data, its giving me a CSRF validation failed or token failed error . Please help me out on this issue.....and yes for testing the current cookie lifetime is 2 years..


texts: How do I add a cart form to the product view?

texts:
With Drupal Commerce 8.x-2.0-beta5, I created some products and a view that lists all products with their variations.

I wanted to add the cart form to any variation, but I was not able to do so.

How can I achieve it?


texts: A disabled module has a schema version of -1, how can I enable the module and then run DB updates using hook_update_N?

texts:
The problem is, it seems when I enable a disabled module, the module's schema version in the system table is automatically updated to the latest version supplied by hook_update_N.

So my current module with the schema version -1 is modified to 7106 when I enable the module, and no hook_update_N functions are run.

So when I come to the next step of running database updates, no hook_update_N functions are run because the module thinks it's already the correct version.

The only method I can see is to manually set the module version in hook_enable, however I'll then need to update the module code to remove the hook_enable to make sure it doesn't run if the module is ever re-enabled in the future, so obviously this approach is a bit dirty.

I'm hoping there's a better solution?


texts: Drupal 7 to drupal 8 Migration - field collection fields

texts:
I have been trying to migrate my Drupal 7 site to Drupal 8.25. I have more than 20 contents type, and all are using field_collection module.

I have successfully migrated to drupal8, but as field collection module not supported for migration, I am unable to make the movement successful.
Is there any way to do it manually or any other solution?


texts: Use body field for views nivo slider instead of title field

texts: I'm implementing a Views Nivo Slider on a Drupal site.  It's currently taking the title field for the caption and using the whole text as a link.  How can I configure it to use the body field for the caption so I can just have specific words for links instead of the entire field?


texts:
The command drush @sites status doesn't do anything.

The full command obtained for the process is:

  /usr/bin/php /home/myuser/.config/composer/vendor/drush/drush/drush.php --php=/usr/bin/php --php-options= @sites status

This is my enviroment:

Drupal:  8.2.4
Drush:  8.1.7

The "drush site-alias" command says me:

@site1
@none
@site2
@self
default
site1
site2

I have a setup for Drupal multi-sites with subdirectories, the aliases file is:

~/.drush/aliases.drushrc.php

<?php
/**
 * @file
 * Site alias for all sites
 */
$root = '/var/www/html';

$aliases['site1'] = array(
    'uri' => 'multisite.local/site1',
    'root' => $root,
    'path-aliases' => array(
        '%dump-dir' => '/tmp'
    ),
);
$aliases['site2'] = array(
    'uri' => 'multisite.local/site2',
    'root' => $root,
    'path-aliases' => array(
        '%dump-dir' => '/tmp'
    ),
);

The full output of the drush status command is:

 Drupal version                  :  8.2.4
 Site URI                        :  http://default
 Database driver                 :  mysql
 Database hostname               :  localhost
 Database port                   :  3306
 Database username               :  db_user
 Database name                   :  db_name
 Database                        :  Connected
 Drupal bootstrap                :  Successful
 Drupal user                     :
 Default theme                   :  bootstrap
 Administration theme            :  seven
 PHP executable                  :  /usr/bin/php
 PHP configuration               :  /etc/php.ini
 PHP OS                          :  Linux
 Drush script                    :  /home/myuser/.config/composer/vendor/drush/drush/drush.php
 Drush version                   :  8.1.7
 Drush temp directory            :  /tmp
 Drush configuration             :
 Drush alias files               :  /home/myuser/.drush/aliases.drushrc.php
 Install profile                 :  standard
 Drupal root                     :  /var/www/html
 Drupal Settings File            :  sites/default/settings.php
 Site path                       :  sites/default
 File directory path             :  sites/default/files
 Private file directory path     :  private/default
 Temporary file directory path   :  /tmp
 Sync config path                :  sites/default/files/config_BrLQsjBr6VkcTEyCkzkY-es-hzISWg4d3oV2EEEoqh-UZMLBJWDiDaq78TIWm-lBbVi-aPHISw/sync


texts: How to set a specific taxonomy with Rules during feeds import?

texts:
Using Feeds, Drupal creates automatically a Rule "before saving a content imported by feeds".

In my XML file I've got a unlimited value field that goes into one unlimited value field in my content type and I would like to create a rule that populates another field in my content type with one specific term grabbed from the XML field.

i.e
One item in the XML file has got terms:

Fruit, Sicily, Oranges

Another item has got other terms:

Nut, Sicily, Chestnuts

From here I need to grab just Fruit or Nuts.

So I've created two Rules:

The first one checks if the field contains the term Fruit.

Event: Before Saving a node from xml feed
Condition: Data comparision TRUE with term ID of Fruit.
Action: Here I would like to grab Fruit.

The second Rules is similar to the first one, but it checks if it contains Nut.

I've tried to set the Action with Set data value -> Target field node:field-type:Taxonomy(Name) -> Set a fixed value. It does not work.

I would like to know how to set the Action. If it's not possible using Rules, how do I achieve this aim?

Thanks in advance.


texts: How to add value in to multiple value field (entity reference)?

texts:
Im inserting into user field reference to other users. This is my code, but it is overiding all values of field, i just want too add value and keep values added before.

<?php
global $user;

$user->field_profile_access['und'][]['target_id'] = 34;
user_save($user)

?>


texts: I can rsync with drush but not `drush @remote status`

texts:
I know it's not equivalent, but I can drush rsync @local @remote but not drush @remote status -v.  So my ssh keys are in place, I'm on the right port etc.

I get:

Loaded alias @remote from file /Volumes/Users/blah/.drush/aliases.drushrc.php
Begin redispatch via drush_invoke_process().
Calling proc_open(ssh -p 22009 BLAH@xxx.xxx.xxx.xxx 'env COLUMNS=238 drush  --verbose --root=/home/REMOTE/d7 --uri=d7.REMOTE.co.uk  core-status 2>&1' 2>&1);

env: drush: Permission denied

What do I need to set on @remote to make it work?  Drush is installed there (same version) and works happily.

Is there are Drush error log or will I need to get the hosting company to have a look through logs?

Here is my alias:

$aliases['REMOTE'] = array(
   'root' => '/home/REMOTE/SUBDIRECTORY',
   'uri' => 'http://REMOTE.co.uk',
   'remote-host' => 'xx.xx.xx.xx',
   'ssh-options' => '-p 22009',
   'remote-user' => 'SSH_USER',
   'path-aliases' =>
   array (
      '%drush' => '/home/REMOTE/.composer/vendor/drush/drush',
      '%site' => 'sites/default/',
      '%dump-dir' => '/home/REMOTE/drush.dbdumps',
   ),
   'databases' =>
   array (
      'default' =>
      array (
         'default' =>
         array (
            'database' => 'xxx',
            'username' => 'xxx',
            'password' => 'xxx',
            'host' => 'localhost',
            'port' => '',
            'driver' => 'mysql',
            'prefix' => '',
         ),
      ),
   ),
);


texts: Message not being sent in the body of the mail

texts:
I am using the code below and the mail gets sent but without the body of the message, but the subject is correct am I sending the body in thee wrong parameter?

 function mailMessage($msg){
 $mailManager = \Drupal::service('plugin.manager.mail');
 $module = "mymodule";
 $key = 'uploaded files';
 //$to = \Drupal::currentUser()->getEmail();
 $to="diana@me.com";
 $params['message'] = "THIS IS my body of the message";
 $params['node_title'] = "File Upload Report";
 $params['subject'] = "File Upload Report";
 $langcode ="en";
 $send = true;
 $result = $mailManager->mail($module, $key, $to, $langcode, $params, NULL, $send);
 if ($result['result'] !== true) {
   drupal_set_message(t('There was a problem sending your message and it was not sent.'), 'error');
 }
 else {
   drupal_set_message(t('Your message has been sent.'));
 }
}


texts: Javascript added via drupal_add_js() does not get aggregated

texts:
I have a couple custom modules that I add javascript via drupal_add_js(). I have all the Bandwidth Optimizations options checked in the performance page (/admin/config/development/performance).

Since I have Aggregate JavaScript files checked, should all my javascript files be aggregated into one file? Is this normal behavior?


texts: Problem dynamically populating a select field based on the selection of another select field

texts:
I have seen quite a few questions on here about the "Illegal choice has been detected" error when trying to load a select field with AJAX in Drupal 7. I have not yet been able to find an answer to solve my issue though. I have 3 select boxes Year, Make, and Model. When I select a year the makes populate fine. When I select a Make, I get the Illegal choice detected error and the models do not populate. But if I choose another make everything works fine. Can anyone help me figure out why the first attempt doesn't work? Here is the code that I have

function formblock($form, &$form_state) {
  $form = array();

  $form['year'] = array(
    '#type' => 'select',
    '#options' => _load_years(),
    '#ajax' => array(
      'callback' => 'formblock_make_loader',
      'wrapper' => 'make_div',
    ),
  );

  $makes = array('empty' => 'Select Make',);
  if (isset($form_state['values']['year'])) {
    $makes = drupal_map_assoc(_load_make($form_state['values']['year']));
  }

  $form['make'] = array(
    '#type' => 'select',
    '#options' => $makes,
    '#prefix' => '
',
    '#suffix' => '
',
    '#ajax' => array(
      'callback' => 'formblock_model_loader',
      'wrapper' => 'model_div',
    ),
  );

  $models = array("empty" => "No Model");
  if (isset($form_state['values']['make'])) {
    $models = drupal_map_assoc(_load_model($form_state['values']['year'], form_state['values']['make']));
  }

  $form['model'] = array(
    '#type' => 'select',
    '#options' => t($models),
    '#prefix' => '
',
    '#suffix' => '
',
  );

  if (isset($form_state['values']['make'])) {
    $form['model']['#options'] = _load_model($form_state['values']['year'], $form_state['values']['make']);
  }

  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Submit'),
  );

  return $form;
}

function formblock_make_loader($form, $form_state) {
  // The form has already been submitted and updated. We can return the replaced
  // item as it is.
  return $form['make'];
}

function formblock_model_loader($form, $form_state) {
  return $form['model'];
}

function formblock_submit($form, &$formstate){

}

function _load_years(){
  $thisyear = date('Y');
  $years = array();

  foreach(range(1990, $thisyear) as $year) {
    $years[$year] = $year;
  }
  return $years;  // array
}

function _load_make($year) {
  $makes = array();

  // Make API call and get an array of makes

  return $makes;  // array
}

function _load_model($year, $make) {
  $models = array();

  // Make API call and get an array of models

  return $models;  //array
}


texts: Views exposed filter autocomplete weird function() code

texts:
Should one worry when a Views exposed filter autocompletes a function for certain words?

Type fbn on the exposed filter field for Users. This is an autocomplete field.
RESULT: The autocomplete list offers two options starting with function(..). See image.
Choose the first option, function (E, F) ...
RESULT: The word filter is filled in.
Type again fbn in the field, then choose the secons option, function (B, C) ...
RESULT: The word indexOf is entered.

Inspecting the elements doesn't work very well, as soon as the focus leaves the field the autocomplete vanishes. I'll try some more with a network sniffer or Firefox instead of WebKit, maybe I'll have more luck.

This could be an XSS injection attempt. Should I worry?


texts: How to know which users voted on a node?

texts:
I am using Rate module and I've set it to allows only authenticated users to votes . Recently I've seen some nodes have had unusual high votes and want to investigate that. I am wondering how can I see the voters of a particular node?

Also, I'd like to know if there is any loophole that allows a user to vote more than once?


texts: How to include the AddThis sharing buttons on the home page of a site?

texts:
I'm using the AddThis module to expose sharing features for nodes to users.

Is there a way to include these buttons on the home page of a Drupal 7 site?

For nodes it's easy enough to add this as a field for each content type and have it show for each content type-based node. But I'm unsure how to add this for the home page.


texts: On a module Issue page, how do you tell what version the patch has been applied in?

texts:
Much of the time, take this field collection migration issue for example, when I find an issue with a drupal module, there has already been an issue filed, and in some cases the issue has a status of Closed (fixed).  In the sidebar there is a version mentioned.  It seems likely that that version is the one you set when you file the issue, specifying which branch of the code you saw the issue in.

When the issue has been Closed (fixed), does that mean that if you grab the specified version, that the code will include the patch?  Is there any way of knowing when a fix has reached the stable branch?


texts: Add a form between shipping method selection and order review

texts:
I'm coding a custom module to make shipping by a delivery enterprise which is not having a module compatible with Drupal commerce.

So, I give the customers a choice between 2 shipping methods:

colissimo (a French official delivery method) using an existing module
exapaq using the custom module I am trying to create

This is working, but exapaq doesn't deliver to customer's home; it delivers to stores where customers can have their order.

So, after customers select the shipping method, I would like to test which is selected and, if this is exapaq, add a new form to allow customers select the store to take the order.

The problem is that I don't have any idea on where can I do this test and how I can insert a new form before to go on order review page.


texts: How can I add custom fields to Commerce Discounts?

texts:
We would like to add a long text description and an image to each Commerce Discount which we will display to Users.

How do I do this, since the Discount data structures are not available in the Admin?


texts:
I'm using this piece of code to programmatically alter a node field:

    $node_wrapper = entity_metadata_wrapper('node', 93);
    $node_wrapper->field_field4->set("text");
    $node_wrapper->save();

This code works when I'm testing with hook_init: Eg:

    function cust_init()
    {
        $node_wrapper = entity_metadata_wrapper('node', 93);
        $node_wrapper->field_field4->set("text");
        $node_wrapper->save();
    }

But it does not work when being called via hook_node_update or hook_node_presave or from a form submit handler. For example, after running this code:

function cust_node_update($node)
{
        $node_wrapper = entity_metadata_wrapper('node', $node->nid);
        $node_wrapper->field_field4->set("hello");
        $node_wrapper->save();
}

I'm expecting to see a change in my node, but I don't.

Is the hook_node_update the right place where this code should be added? What I need to do is to update a field of a node after a node is being updated.

Thank You.


texts: Duplicate Meta description on shared node across multiple subdomains

texts: I have a drupal site with multiple subdomains which share a single node. I installed Yoast SEO for Drupal and added title / description etc. for each node. Now the problem is that it shows same meta title and description for all sites (subdomain). Any idea on how to resolve this issue.


texts: Best method for multi-page user registration form?

texts:
I am trying to set up a multi-page user registration form, and I would ideally like to use the Webform module to do so. Can webform fields be mapped to user registration or user profile fields?

Here's how I would like it to work:

User tries to access content page; they cannot because they are not registered, so they are prompted to create a new account.
They enter their name, email, password and are logged in. They are then redirected to "page 1" of the multi-page form.
After they go through all of the pages, they save the form. The info they entered into the pages of the form is saved in their user profile. They can go back in and edit it at a later date if they wish.

Is this possible with existing modules?

Thanks!


texts:
I have a content type for news. All my news nodes use the pathauto path: "node/[title-raw]". However, when I click to go to view any of my news items, instead of displaying the news item, the page displays a newsletter that was created using Simplenews. None of the normal Drupal content codes is being added. It's like it's just viewing a basic HTML page of the newsletter. Something is going wrong with the paths.

It seems like this newsletter has taken over all paths beginning "news...".

I'm not sure where to start looking for the problem. I would be grateful for any suggestions anyone has.

To see what I mean you can see the website at www.signamic.co.uk, and then click on any of the news items near the bottom.

Thanks in advance,

Ben


texts: Drupal 8 hide meta tag fields in node form

texts:
I am just wandering is there a way to hide some of the input fields in MetaData while creating/editing a node.

For example, I want to hide,

Geographical place name and Geographical position,

that is in MetaData->Advanced, in node form, so that user doesnt have access to it while creating a node.

Anything like hook form alter?


texts: Modify a custom block field value with hook_form_alter and validate

texts:
I'm trying to modify a custom block form with hook_form_alter .In its validate function I have a case where one of the field value needs to be unset. For modifying its value I tried with

$form_state->setValue('field_name', '') /

$form['field_name']['#default_value'] = '' /

$form['field_name']['#value'] = ''

But none of these approach seems to work.
Below is my code -

function coolmodule_form_alter(&$form, FormStateInterface $form_state, $form_id) {
    //create or edit form
    if('block_content_coolblock_form' === $form_id || 'block_content_coolblock_edit_form' === $form_id) {
      $form['#validate'][] = 'coolblockvalidate';
    }
}

function coolblockvalidate(array &$form, FormStateInterface &$form_state) {
    //trying to unset the field value here, which is not working.
    $form_state->setValue('field_mycoolfield', '');

    //tried these approach too with no luck.
    //$form['field_mycoolfield']['#default_value'] = '';
    //$form['field_mycoolfield']['#default_value'] = '';

}

I'm very interested in knowing why the field value can't be changed. I tried the same with a custom form alter and it works.

Any ideas/ suggestions would save me.
Thanks.


texts: How to generate a styled image with out actually creating it?

texts:
There is a content type in my website called image and it has an image field. There are about 16GB images in my website and people have uploaded very high quality images.

There is an image style in my website which uses the original image plus a watermark. This causes double space consuming. People are only allowed to download this version. The number of images in my website is growing very fast and it needs lots of space.

I need to show the styled version to the user with out creating it in \styled directory.

Is there any way to handle this problem? Is there anyway to keep the site working like now, but instead of creating a separate copy of the original image, display the styled image and generate download link to the user in any other way?

Thanks.


texts: Override image dimensions set by image style

texts: I am trying to override the image dimensions set out by image style and can't seem to do that unless I select no image style for the field. I need that image style on another pages but I would like to override it only on the front page. The images the front page are from nodes loaded from simple view configuration. I tried theme_image_style to override the dimensions but it stops images from rendering on other pages. I tried theme_preprocess_node and even though the image['width'] and [height] were changed it still loaded the image style dimension. Would really appreciate some help thank you.


texts:
I have a custom content type in Drupal 8.6.x. I want to be able to change the text used for a field label based on the value of a taxonomy term reference in the node.

For example, I want to change the field label used for the body field, to display "Description" or "Definition" or "Introduction", etc. based on the value in the taxonomy reference field. This is when rendering the node - I don't need to change the field label on the form. I'll need to alter the label in the full and teaser display modes, and just for the custom content type. I don't need to change any of the text in the body field, just what label is shown above it.


texts:
I'm trying to add an exposed filter for an age range with the Views module.

I made a select age field for age 18 to 80, but I can't find how to add a filter range in views.
For Example, I would add a filter saying "from age__ to age__".


texts: How can create a block that get a field value and render it?

texts:
I'm trying to create a simple block that have some link fields. those links have some predefined values and after get any new values from the admin replace with values and then render that values to the theme:
my_module\src\Plugin\Block\MyBlock:

<?php

namespace Drupal\my_modules\Plugin\Block;

use Drupal\Core\Block\BlockBase;
use Drupal\Core\Block\BlockPluginInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;

/**
 * @Block(
 *   id = "my_block",
 *   admin_label = @Translation("My Block"),
 *   category = @Translation("My Block")
 * )
 */
class MyBlock extends BlockBase {

  /**
   * {@inheritdoc}
   */
  public function defaultConfiguration() {
    // set default link field value.
    return array(
      'default_LinkA_url' => ('http://www.LinkA.com/'),
      'default_LinkB_url' => ('http://www.LinkB.com/'),
    );
  }

  /**
   * {@inheritdoc}
   */
  public function blockForm($form, FormStateInterface $form_state) {
    // Add a form field to the existing block configuration form.

  $form['block_LinkA_url'] = array(
    '#type' => 'url',
    '#title' => t('Link A:'),
    '#size' => 60,
    '#default_value' => $this->configuration['default_LinkA_url'],
  );
  $form['block_LinkB_url'] = array(
    '#type' => 'url',
    '#title' => t('Link B:'),
    '#size' => 60,
    '#default_value' => $this->configuration['default_LinkB_url'],
  );
    return $form;
  }

  /**
   * {@inheritdoc}
   */
  public function blockSubmit($form, FormStateInterface $form_state) {
    // Save our custom settings when the form is submitted.
    $this->setConfigurationValue['default_LinkA_url']
      = $form_state->getValue('block_LinkA_url');

    $this->setConfigurationValue['default_LinkB_url']
      = $form_state->getValue('block_LinkB_url');
  }

  /**
   * {@inheritdoc}
   */
  public function build() {
    return (
      '#markup' => $this->configuration['default_LinkA_url'],
      '#markup' => $this->configuration['default_LinkB_url'],
    );
  }
}

whatsoever I try I cant get any result, I would be happy to hear what the problem is.


texts:
In my drupal site, it has been working fine for a while, but recently users have not been able to log in to the site (including me as admin). I am seeing the following error in my php logs:

[28-Jul-2018 20:07:02 UTC] Uncaught PHP Exception RuntimeException: "Failed to start the session" at (webroot)/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php line 145

I went to look at the code and i see it corresponds with the following lines:

    if (!session_start()) {
        throw new \RuntimeException('Failed to start the session');
    }

I have tried clearing the sessions tables as well as the cache using core/rebuild.php and nothing seems to be working. Another note for this I had to add this line temporarily

$settings['rebuild_access'] = TRUE;

in my settings.php to get it to work also, because the token generator script was throwing another error like below:

[28-Jul-2018 20:39:01 UTC] PHP Fatal error:  Uncaught ArgumentCountError: Too few arguments to function Drupal\Core\Site\Settings::initialize(), 1 passed in (webroot)/core/scripts/rebuild_token_calculator.sh on line 22 and exactly 3 expected in (webroot)/core/lib/Drupal/Core/Site/Settings.php:108

Not sure if this is related to the main error or not, but thought it may be worth mentioning.


texts: How to change the target of a file for a multiple file field in drupal 8?

texts:
I have a content type with a file field: field_document.

It contains multiple files.

I chose Generic file as display format in manage display setting.

I need to change the target attribute of the files that drupal generates for me. How can I do that?

So instead of this

OUTPUT from 'core/themes/stable/templates/field/file-link.html.twig'

  Test Document

I would need this: target="_blank"

  Test Document


texts: Show specific field(s) from created content-type

texts:
Question might be easy, but I have a problem. I created a content-type (page), made it as a block with Node Block module, put this block in content. But it prints all stuff: title, authored by, date and so on. But what I nead is to print only body. But there might be another case, when I want to print also a title.

So the question is in general, how to print fields that I want from content-type,  maybe there is a module for this or a more convenient way.

I'm using latest Drupal 7.

Thanks!


texts: Bypass comment validation for SOME anonymous users, based on the provided email address?

texts:
In the case of a low traffic blog (for instance), that only accepts anonymous comments (no user registration) and manually validates them before publishing them, would it be possible to have a sort of internal white list for trusted email addresses (in the comment "email" field)?

The idea would be that comments using one of those addresses would be published immediately, without requiring validation.

(Obviously the email addresses of the commenters are not visible to the visitors.)

Is there a module for that?


texts:
I am writing this Drupal 8 module. I am setting up some configuration settings here

But when I retrieve it here using $this->config()->get() it is not giving anything. Any idea what am I doing wrong?


texts: I understand how to use /etc/drush/drush.ini; however, I don't know what exactly to put in there in order for Drush to use a different temp directory when creating an archive-dump.


texts: Change style for the reply link in comment.tpl.php

texts:
How could I style the "reply" link in comment.tpl.php?

I have this line of code inside:

<?php print render($content['links']) ?>

With this I get something like the following:

reply

I manage to get the exact URL with <?php print render($content['links']['comment']['#links']['comment-reply']['href']) ?>, but for some reason it doesn't work perfectly: It loses the "/?q=" part.


texts: I am porting a Drupal 7 module to Drupal 8; it has a call to file_transfer($uri, $headers). What's the equivalent Drupal 8 code for this?


texts:
On a production site, I don't want admins to be able to perform many tasks at all, to limit the risks the site is exposed to, so modules like "Views UI" will be turned off.

However, I still want a number of administrators to have access to Views and similar functionality, so they can perform changes without a developers help.

Thus I would like to see the ability to have some features "auto-export" themselves, a script that commits them to the VCS, and then deploys to a stage-server where they can be tested and approved.

Is there any public work at all on this type of functionality, or would I need to start from scratch? Is the idea entirely in-sane, and if so, what other options should I pursue?


texts: Ignore parts of the url or dynamically rewrite/alias the url

texts:
I am having a problem and have been wrecking my brain over it...

I feel I might ohh how did I not think of that moment once I find the solution...

Basically, what I need to do is:

For any url containing a string like "abcmytrack" show the page/view/drupal url that is before it in url and ignore the rest. So if I go to node/1/abcmytrack/some/other/stuff/abc then just show node/1, if I go to nodeone/alias/page/abcmytrack/some/other then again just show nodeone/alias, but keep abcmytrack/some/other in the url.

What am I trying to do:
there is some referral tracking that I am trying to implement in the form of.

/some/drupal/url/[trackid]/some/other/track/ids/even
/any/drupal/url/[trackid]/any/even/number/of/arguments
/[trackid]/some/other/set/of/arguments

basically for any url with [trackid] which is a string. It should just ignore anything starting with [trackid] and load the path before it as if [trackid] was not there.

The result is that they basically get converted to a cookie, but the site is behind varnish and akamai caching so on production the code does not run and cookie is not written.  Best option at the moment is to use JS to write a cookie, but problem is that adding /[trackid]/some/other/set/of/arguments to some of the site urls like aliased node paths, homepage, etc. breaks the pages.

It might be possible to do it as url rewrites in .htaccess but this is a last resort.  I would like to see if there are other options I am not considering.

I have attempted to do use hook_url_inbound_alter but it seems to do redirects and I loose the string from the url or otherwise it url encodes the string.

I have been wrecking my brain on this and cannot make this work. Granted I have some interesting requirements but it is one of those things that should be straightforward but it is not.


texts: How to have individual auth users import their own calendar feed

texts:
I am creating a site for some local musicians, and each of them, I want to be able to import their own personal gcal as nodes.  I know that drupal has methods of doing this in the abstract - I've played around with this some:

( http://websmiths.co/blog/drupal-7-feeds-tutorials-importing-ical )

and gotten it to work on my site by just importing through the admin interface.  Basically, what I want is for the musicians to each be able to fill in a field that would have their ical/gcal information, and then on cron runs, the site updates their personal calendar of events (imported as individual nodes, displayed with views). Then I can also have a global calendar on the front page that shows all the events.

Anyone have any thoughts or advice on how to accomplish this goal?


texts:
I am creating a custom module. I have a form that I would like to add some HTML to, but I don't know what the best way to do this.

In this example, I have a page with a textbox, dropdown list, and text area. I want to add a a div between the dropdown list and text area.  But, I'm not sure how to add raw html to a web form.

Here is what I have:

function myModule_add_form($form_state){
  try{
    $form = array();
    $form['myModule_title'] = array(
      '#title' => 'Title',
      '#type' => 'textfield',
      '#size' => '30',
      '#weight'=>1,
    );

    $form['myModule_type_list']=array(
      '#type'=>'select',
      '#title' => 'Type List',
      '#options' => $someArray,
      '#multiple' => false,
      '#attributes'=>array('size'=>1),
      '#weight'=>2,
    );

    $form['myModule_description'] = array(
      '#title' => 'Description',
      '#type' => 'textarea',
      '#size' => '255',
      '#weight'=>3,
    );

    $form['submit'] = array(
      '#type' => 'submit',
      '#value' => 'Submit',
      '#weight'=>4,
    );

    return $form;
  } catch(Exception $e){
      $errrmsg = "Error with creating form: " .$e->getMessage();
      throw New Exception($errrmsg);
  }
}

Thanks
jason


texts:
I am not very familiar with Drupal modules.

I am using Drupal 7, and installed the Flashcard module. I enabled it, the flashcard-cycle module, and the libraries module; I also added the jquery plug-in as \sites\all\libraries\jquery.cycle\jquery.cycle.min.js.

I am getting the flashcard content type in structure/content types, but I don't know what else I have to do.

I need further instructions about what I need to do in order to use the flashcard module.  What is my next step?


texts: Insert a countdown in each node based on a pre-existing date field

texts:
I would like to put a countdown for each node using a field expiration date (whose values users have already entered).

I explain you my case:

My user publishes an event that have an expiration date (I already have many values for this field inserted by the users and some of them are of events still in progress).
I would like to insert a countdown in each page of the events, based on the expiration date inserted by the user and the date when the user has published the event on my website.

I tried with this module: field timer but I don't know how to do the connection between this module and the expiration date.

Thanks in advance for your help.


texts: How to allow users to attribute accumulating points to nodes?

texts:
I would want to make a thing in priori simple: allow users to attribute (grant) a selectable amount of accumulating points to nodes.

I tried various modules (Fivestar, etc.), but these modules are about a note (or a score like '4/5') and not of a number of accumulative points.

It would be necessary from a field (for example list of selection), make increase or decrease the value of another field.

Anybody has an idea?

Notes:

Fivestar allows to give a note (for example: 4 on 5), while I wish to give points which accumulate. Points: simple value. Give X points to this node. For example: I give 5 points to this node because I find this a good node.
Multiple users could give a different number of points. The functioning would be close to Fivestar, except that instead of having an overall average there would be a total number of points.
There would be a field of a node which stores the accumulation of points, and possibly one other to give points.


texts: How do I pass query string parameters on Drupal affiliate links?

texts:
I am using the drupal affliate module. I wanted to pass a query string along with the affiliate link the module provided, but every time a user visits the link the string gets ignored and redirects to the node without passing the string.

My link looks similar to www.example.com/aff/1/node|34?name=ibo. What I expected was the sting being passed along, and the node being www.example.com/node/34?name=ibo. The string is lost on redirection to the node, and I am only left with www.example.com/node/34.

Can you guys show me how I can achive this?


texts:
I was doing a custom code for a custom page that I have created through my controller where I set a user field named MyChoice and I add a role "freeaccess" for the user who opens this page. However , I noticed that when I opened this page anonymously, the user whose ID is 0 which is supposed to be the anonymous user, has gained this new role and had his field set . in fact I obtained Anonymous and freeaccess when I printed the Roles array like so :
$uid = \Drupal::currentUser()->id();
     $user = \Drupal\user\Entity\User::load($uid);
     $roles = $user->getRoles();
print_r($roles);

After setting a condition to stop anonymous user from accessing this page , I tried to do this to undo what i previously caused by messing with drupal user ID 0 :
$uid = \Drupal::currentUser()->id(); //which is zero
 $user = \Drupal\user\Entity\User::load($uid);
 $user-> RemoveRole('freeaccess');
 $user ->save();

And I unset the field MyChoice.
Is there something else I should do (in the database for example) to reset the user whose ID is zero to his initial state ? Is the drupal user #0 just like any other user ? It has fields and roles ..?


texts: What's difference between "attributes", "title_attributes", and "content_attributes"?

texts:
Is there any difference between writing CSS classes directly to Html tags and using the Attribute class?

Is there any difference between attributes, title_attributes, and content_attributes? What is the usage of each of them?

I read Using attributes in templates, but it doesn't explain that clearly.


texts: How to know the "name" of an input field of a commerce checkout form?

texts:
I need to find the name of an input field of a commerce checkout form to use in:

form_set_error('NAME-HERE', t('Field cannot be left blank'));

The html of the field is:

             CIF/NIF/ID *
             <input class="text-full form-text" type="text" id="edit-customer-profile-billing-field-cif-nif-id-und-0-value" name="customer_profile_billing[field_cif_nif_id][und][0][value]" value="" size="20" maxlength="20">

I tried with all of these, but it didn't work.

customer_profile_billing[field_cif_nif_id][und][0][value]

customer_profile_billing_field_cif_nif_id_und_0_value

customer_profile_billing-field_cif_nif_id-und-0-value

customer-profile-billing-field-cif-nif-id-und-0-value

customer_profile_billing_field_cif_nif_id

If I use

dpm($form_state['values']);

I get this:


texts: Commerce Product Title translation in views

texts:
So i have Entity Translation working properly on the actual products, but in the views displaying a list of these products translation just does not work.

Entity traslation is enabled
Title module is enabled and configured

View advanced options configured correctly (won't let me add another pic
The actual custom text that displays in the list

yet in the list the products only display in the original language (greek) and not in the translated english one. Any idea what I might have configured wrong? Anything else I should add?


texts: Supressing "Undefined variable: variables in module_block_view()" without hiding the notice

texts:
I tried to create a simple custom block inside a custom module. there is a notice that inform me about undefined variable, but the block rendered properly. I am not sure where the mistake in the code is, but any nudge in the right direction would be highly appreciated.

I know I can hide the error message by accessing admin/config/development/logging or by modules such as Disable Message, but that isn't what I desire since it essentially just hiding the problem under the rug and hiding other notices that I might be interested to look at.

mymodule.module

<?php
/**
* Declare what blocks are provided by this module
* Implements hook_block_info().
*/

function mymodule_block_info() {
  $block = array();

  $block['myblock1'] = array(
    'info' => t('Block number 1'),
  );

  $block['myblock2'] = array(
    'info' => t('Block number 2'),
  );

  return $block;
}

/**
* Define what our block is going to look like.
* Implements hook_block_view().
*/

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

  switch ($delta) {
    case 'myblock1':
      $block['content'] = theme('myblock1', $variables);
      break;

    case 'myblock2':
      $block['content'] = theme('myblock2', $variables);
      break;
  }

  return $block;
}

/**
* Implementation of hook_theme().
*/

function mymodule_theme() {
  return array(
    'myblock1' => array(
      'variables' => array(),
      'template' => 'templates/block--myblock1',
    ),

    'myblock2' => array(
      'variables' => array(),
      'template' => 'templates/block--myblock2',
    ),
  );
}

?>


texts: How to implement the two categories of the same content type to automatically generate a new aggregation page?

texts: example: there are two taxonomy fields of each article, a taxonomy is regional, another is the attribute，I want to achieve the "regional + attribute = regional attribute" automatically generated such a new aggregation page.


texts: What is the right way of loading a service?

texts:
when trying to use a service in drupal actually there is 3 ways , what is the preferred way to use a service and why :

passing dependencies directly through the constructor:

public function __construct(AccountProxyInterface $current_user) {

}

passing the dependencies through the create() method wich look to me the same as injecting it through the __construct(), with the only difference , an instance will be created eah time (no singleton design pattern - not same instance will be reused)

      public static function create(ContainerInterface $container)
  {
    //1.getting service from the service container.
    $Door = $container->get('custom_service.door');
    //2.create a new object of current class, and Inject the dependency  object into the constructor
    return new static($Door);
  }

  //constructor receive the dependency set by the create() method
  public function __construct(Door $Door)
  {
    kint($Door);
  }

just get get the service from the service container and no need to inject it using :

$Door = \Drupal::service('custom_service.door')


texts: How to delete all translations when deleting a node using default language?

texts:
I'm trying to delete all translations when deleting a node using default language?

For that purpose, I am using the hook_node_delete, but I am not able to invoke node_delete() from it. It cause a fatal error and the process can't terminate. Even the first node I am deleting isn't deleted preoperly.

 function hook_node_delete($node){
        $translation_list = translation_node_get_translations($node->tnid);
        $default_language = language_default()->language;

        if($translation_list!=""){
           foreach($translation_list as $translation_list_item){
              if ($translation_list_item->language!=$default_language){
                  node_delete($translation_list_item->nid);
              }
           };
        };
    }

So I am forced to simply unpublish the translations by doing something like that:

 function hook_node_delete($node){
                $translation_list = translation_node_get_translations($node->tnid);
                $default_language = language_default()->language;

                if($translation_list!=""){
                   foreach($translation_list as $translation_list_item){
                      if ($translation_list_item->language!=$default_language){
                          $node_translated = node_load($translation_list_item->nid);
                          $node_translated->status = 0;
                          node_save($node_translated);
                      }
                   };
                };
            }

Why can I not invoke node_delete() from hook_node_delete()??


texts: Rules Scheduler Component parameter is empty

texts:
I created a rule for scheduling a action component after 48h. The rule gets triggered correctly and the task shows up at the "Workflow" tab in rules.

The problem is that the scheduled component gets an empty parameter and so can execute the actions. Drupal log shows an "The variable or parameter node is empty." warning.

Here is the rule:

{ "rules_set_submission_status_to_archived" : {
    "LABEL" : "SUBMISSION: Set submission status to archived",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "TAGS" : [ "archived", "submission" ],
    "REQUIRES" : [ "rules", "rules_scheduler" ],
    "ON" : { "node_insert--submission" : { "bundle" : "submission" } },
    "IF" : [ { "entity_is_of_type" : { "entity" : [ "node" ], "type" : "node" } } ],
    "DO" : [
      { "schedule" : {
          "component" : "rules_times_up_for_submission",
          "date" : "+2 days",
          "identifier" : "Archive submission [node:nid] \u0022[node:title]\u0022 after 48h.",
          "param_node" : [ "node" ]
        }
      }
    ]
  }
}

Here is the scheduled component:

{ "rules_times_up_for_submission" : {
    "LABEL" : "Times up for submission, archive and pay back credits",
    "PLUGIN" : "rule",
    "OWNER" : "rules",
    "TAGS" : [ "archived", "submission" ],
    "REQUIRES" : [ "rules", "commerce_credits", "php" ],
    "USES VARIABLES" : { "node_to_archive" : { "label" : "Node", "type" : "node" } },
    "IF" : [
      { "node_is_of_type" : {
          "node" : [ "node-to-archive" ],
          "type" : { "value" : { "submission" : "submission" } }
        }
      },
      { "entity_has_field" : { "entity" : [ "node-to-archive" ], "field" : "field_status" } },
      { "data_is" : { "data" : [ "node-to-archive:field-status" ], "value" : "submitted" } },
      { "entity_has_field" : { "entity" : [ "node-to-archive" ], "field" : "field_use_free_credits" } },
      { "data_is" : { "data" : [ "node-to-archive:field-use-free-credits" ], "value" : "0" } }
    ],
    "DO" : [
      { "commerce_credits_add" : {
          "entity" : [ "node-to-archive:author" ],
          "credit_type" : "credit",
          "number" : [ "node-to-archive:field-submission-price" ]
        }
      },
      { "data_set" : { "data" : [ "node-to-archive:field-status" ], "value" : "archived" } },
      { "entity_save" : { "data" : [ "node-to-archive" ], "immediate" : "1" } },
      { "php_eval" : { "code" : "watchdog(\u0027schedule\u0027, $node_to_archive);" } }
    ]
  }
}

So basically, the node is not passed to the scheduler component. Is there something broken in my system or do I miss something?


texts: How can I make downloads available only to authenticated users?

texts:
With Drupal 7, I created a content type with a field to attach files. I am using private file uploads. When viewing the node, the list of attached files is visible to every user, including anonymous users.

I want that logged-in users are able to click on a file link to download the files attached to nodes; anonymous users should be able to see the list of files, but clicking on a file link should show them the login page, forcing them to log in, and them download the attached files.

How can I achieve this?


texts: Determining permissions issues for REST APIs

texts: Is there a way to determine what permission/s has caused an REST end point in Drupal 8 to throw a 403? This would really help when trying to debug my API.


texts: How to set default reply-to address in webform?

texts: I am using Webform Reply to module to set Reply to address for mails sent from webforms. This feature works fine but for each webform creation I have to set Reply to address because by default it will select  Default: No Reply-To address option. But I want to select a default address as xyz@mail.com . So how can i achieve that?? For reference see image below:


texts: Force redirect from HTTPS to HTTP in Drupal 7 Multitsite?

texts:
I'm trying to serve a Kaltura video running on CentOS 6+ on one server, by plugging the Object code for embedded video inside a node body (or even using the Kaltura Drupal module), running on a Drupal 7 multisite on Ubuntu 10.04LTS.

Most browsers accept it but Chrome, which denies the request as being insecure content. We serve all our D7 sites on HTTPS, forced redirect. But now I want to only serve ONE of the multisite as HTTP so that it could show this Kaltura video, and not have Chrome hiccup.

Here's what I have in the .htaccess file of the D7 parent directory.

RewriteCond %{HTTPS} off
RewriteCond %{Request_URI} !^(/mysite/user)
RewriteRule ^(/.*) http://%{HTTP_HOST}%{REQUEST_URI} [NC,R=301]

I've tried the Secure Login module, as well as the very close suggestions here - Redirect /user/login to HTTPS, all other requests to HTTP, to straight mode rewrite on apache - https://stackoverflow.com/questions/1816119/using-mod-rewrite-how-do-i-force-https-for-certain-paths-and-http-for-all-othe - and nothing makes sense.

Note: Not a mod-rewrite expert, but I now feel this is somehow attributed to not doing something correctly with Drupal. Currently, when you visit http://mydomain.com/mysite/user - I get this message:

You are accessing <mysite> using an unencrypted connection. For your
security, <mysite> only supports account logins using
a secure protocol such as HTTPS.

I believe this is a very popular question, but didn't really see anyone else trying to go from secure to insecure on multisite. Please advise. Thanks,!


texts:
I use hook_url_outbound_alter to change my url to /q=anything, but the url in browser is shown as /q%3Danything. How can I avoid that Drupal encodes the url?

Other choice would be to send q=anything as query, but then hook_url_outbound_alter includes the "?" character, and I can't include it.

if (preg_match('|^search/node/(.*)|', $path, $matches)) {
  $path = 'q=' . $matches[1];
}

Any idea? Thanks in advance.


texts: Is there any way to allow user only one product in cart. I used uc_restrict_qty but After that i can add more than one products also.


texts: can't import sql dump to new database for backup

texts:
i have a site on drupal. I want to make a copy of that site so as to be able to make changes to the site without the fear of loosing something.

I have problem with the database. I export it in spl format. The size is about 100 MB. When i try to import it to the newly created database it says it is in progress but nothing is happening. The import is not proceeding.

I tried to transfer each table separately but when i reach a table that it is 36 MB (locale_sources) it shows it is in progress but nothing is happening.

Everything is done through phpmyadmin.

Can anyone suggest anything?

Thank you.


texts: Search API Views only displaying one result

texts:
I've just cloned a production site into a staging environment. I copied core and contribute, cloned the repo containing custom modules and themes, cloned the database and copied the solr configuration to a new core. Bringing up the database I configured a new search server pointing to the new core, repointed the index and reindexed the site.

All my old search API Views, and all new ones I create, only show one result. However the pager can tell that there are more. Jumping to other pages works. However no content is shown. If I do a search in solr admin I get many results.

I'm at a loss for where to start looking. As far as I can see all configuration is the same in the database and in the files. Google doesn't seem to think this is a thing.

Is this likely to be a Views issue, a solr issue or a search API issue?

EDIT: I've called the URL directly as @Eugene suggested. It looks to me like only one result is returned by Solr. However as you can see it things that a larger number has been found.

Query string:
http://example.com:8983/solr/core2/select?fl=item_id%2Cscore&start=0&rows=10&facet=true&facet.sort=count&facet.limit=10&facet.mincount=1&facet.missing=false&facet.field=sm_field_domains%24name&facet.field=im_field_regions&facet.field=im_field_topics&facet.field=im_field_sources&facet.field=im_field_domains&f.sm_field_domains%24name.facet.limit=50&f.im_field_regions.facet.limit=50&f.im_field_regions.facet.mincount=0&f.im_field_topics.facet.limit=50&f.im_field_sources.facet.limit=50&f.im_field_domains.facet.limit=50&f.im_field_domains.facet.mincount=0&group=true&group.main=true&group.field=ss_field_source_url%3Aurl&wt=json&json.nl=map&q.alt=%28ss_type%3A%22article%22%29%20%28bs_status%3A%22true%22%29%20%28index_id%3A%22solr_local%22%29%20%28hash%3Agpsxif%29

Response

  "response": {
    "numFound": 197180,
    "start": 0,
    "maxScore": 2.0000253,
    "docs": [
      {
        "item_id": "1646",
        "score": 2.0000253
      }
    ]
  },
...
}


texts:
I have just began re-themeing a client website with a Zen STARTERKIT.

I noticed the drag'n'drop handle for grabbing and moving blocks is not showing up.
This of course means I can't reposition blocks.

I scrapped the theme and started again with a fresh install of Zen but I got the same problem.

Can anyone help me?