texts:
Following [this][1], I have  done migration for users from Drupal 7 to Drupal 8, but I got stuck with assigning roles to the specified users.

In user.php file, my code for mapping roles to assigned users is the following.

public function prepareRow(Row $row) {
    $uid = $row->getSourceProperty('uid');
    // user_role

    $result = $this->getDatabase()->query('
      SELECT
        r.rid, r.name, ur.uid
      FROM
        {role} r, {users_roles} ur
      WHERE
        r.rid = ur.rid
      AND
        ur.uid = :uid
    ', array(':uid' => $uid));
    foreach ($result as $record) {
      $row->setSourceProperty('roles', $record->name );
    }

    // local_market field of type entity_reference
    $result = $this->getDatabase()->query('
      SELECT
        fld.field_local_market_target_id
      FROM
        {field_data_field_local_market} fld
      WHERE
        fld.entity_id = :uid
    ', array(':uid' => $uid));
    foreach ($result as $record) {
      if (!is_null($record->tids)) {
        $row->setSourceProperty('local_market', explode(',', $record->tids) );
      }
    }

    return parent::prepareRow($row);
  }

Except roles and custom field, field_local_market, all users migrated from Drupal 7 to Drupal 8.

destination:
  plugin: entity:user

process:
  uid: uid
  name: name
  pass: pass
  mail: mail
  status: status
  created: created
  changed: changed
  access: access
  login: login
  timezone: timezone
  langcode: language
  preferred_langcode: language
  preferred_admin_langcode: language
  init: init
  field_local_market: local_market
  field_user_role: user_role

What's the right way to assign roles to the users?

Migration of roles is done from Drupal 7 to Drupal 8 by using drush migrate_upgrade; the only task left is assigning/mapping these roles to certain UIDs or users.


texts:
I want to publish a node to a custom menu page like "people" rather than the front page "Home." I tried many ways, but I cannot deal with this matter.

Could somebody tell me how to do it?


texts: Is there a token I can use to display a node's view mode?

texts:
I am trying to use Rules to send an email with the results of the submission of a node. Is there any way to place the entire contents of the node using a token?

e.g. [node:teaser]


texts:
I have this issue:I have on a product display a "Featured" checkbox.
I want when this "Featured" checkbox be selected,the price of the product to be increased by some amount when being added to the cart.
So:Normal product will cost 100$ ,if Featured is selected the price will be +50 (150$).
Can this be done with a rule?If so,how?
thanks


texts: The return property of exclamation in front of array

texts:
I am learning the drupal 7 by the example module.
In the render_example, I don't understand the usage of the exclamation mark (!) in front of the !array and !alter.

I am sure that it is not related to the "boolean" nor "negation".
Please kindly advise how can I find the detail of the usage.

function render_example_info() {
  return t('The render example provides a

demonstration of of render array usage

using hook_page_alter() to make various changes on a page.

', array('!arrays' => url('examples/render_example/arrays'), '!alter' => url('examples/render_example/altering')));

}

When I edit the "!array" to "$array",

function render_example_info() {
return t('The render example provides a

demonstration of of render array usage

using hook_page_alter() to make various changes on a page.

', array('$arrays' => url('examples/render_example/arrays'), '!alter' => url('examples/render_example/altering')));

}

the message was changed
from:
demonstration of of render array usage
(with hyper link "http://www.example.com/drupal/?q=examples/render_example/arrays"
to:
/drupal/?q=examples/render_example/arrays">demonstration of of render array usage
(with hyper link "http://www.example.com/drupal/&5cem&nbspclass=" )


texts: Should I keep the '#theme_wrappers' => array() for form fields?

texts:
I am migrating a few custom modules from Drupal 7 to drupal 8 that contain a lot of forms built using the form api and contain fields like this one:

$form['type_document'] = array(
    '#type' => 'select',
    '#title' => t('Type de document'),
    '#options' => $types_document,
    '#required' => TRUE,
    '#attributes' => array('class' => array('form-control')),
    '#theme_wrappers' => array()
);

I am not sure if I should keep the '#theme_wrappers' => array() or not and also the form-control classes.

Thanks for your help.


texts: 'hook_entity_operation_alter', but for users

texts:
I'd like to customise the Operations dropdowns on /admin/people

The documentation for hook_entity_operation_alter() says the second parameter should be:

\Drupal\Core\Entity\EntityInterface $entity:

However when I do:

function mymodule_entity_operation_alter(array &$operations, EntityInterface $entity) {
    kint( $entity );
}

I get:

  Argument 2 passed to mymodule_entity_operation_alter() must be an instance of EntityInterface, instance of Drupal\user\Entity\User given

Is there anything else I can use?


texts: t() function doesn't translate strings inside node fields

texts:
I built a rule using rules module to create a node of a certain content type which inserts a text of full_html format inside a body field when follow flag is flagged. This is the rule

$values = array(
        'type' => 'notification',
        'uid' => UID_OF_A_USER,
        'status' => 0,
        'comment' => 0,
        'promote' => 0,
        'language'  => 'en'
);
$entity = entity_create ('node', $values);
$ewrapper = entity_metadata_wrapper('node', $entity);
$url = "PROFILE_URL_OF_A_USER";
$uname = "USERNAME_OF_A_USER";
$link = l("$uname","$url");
$body_content = t("!link started following you.",array('!link' => $link));
$ewrapper->field_body->set(array('value' => $my_body_content ,'format'=>'full_html') );
$ewrapper->save();

When a user uses Follow flag to follow another user, a message is sent to the followed user which says, !link started following you.

This rule works perfectly but the problem is with translation of the !link started following you.. My website supports three languages. This is the problem:

If a user (flagging user) flags another user using Follow flag and he is in a certain language, say french, The above message in french language will be sent to the followed user, no matter in what language the followed user is viewing his profile, he will see this message in french language and by switching language it will not be translated.

I need this message to be translated in the current language of flagged user when he is viewing its profile but the message is sent in the language of the flagging user and in the profile page of the followed user will not be translated even if he switches the language.

How can I make this message translatable?


texts:
I've added a custom field to my view using hook_views_data:

/**
 * Implements hook_views_data().
 */
function homepage_views_data() {
  $data['homepage']['table']['group'] = t('Recency field');
  $data['homepage']['table']['join'] = array(
    // Exist in all views.
    '#global' => array(),
  );

  $data['homepage']['recency_field'] = array(
    'title' => t('Recency'),
    'help' => t('Display a calculated recency date'),
    'field' => array(
      'handler' => 'views_handler_recency_field',
      'click sortable' => TRUE,
    ),
    'sort' => array(
      'handler' => 'views_handler_sort_date',
    ),
  );

  return $data;
}

Right now, my field is simply returning the value of node_created. In my field handler:

/**
   * Render callback handler.
   *
   * Return the markup that will appear in the rendered field.
   */
  function render($values) {
    $output = $values->node_created;
    return $output;
  }

I can add my custom field to a View no problem. But after adding it as a sort field, I get:

  SQLSTATE[42S22]: Column not found: 1054 Unknown column 'recency_field'
  in 'field list'

The query looks like this:

SELECT node.title AS node_title, node.nid AS nid, node.created AS node_created, recency_field AS recency_field
FROM
{node} node
WHERE (( (node.status = '1') ))
ORDER BY recency_field ASC

Does views_handler_sort_date need to work with a real database value?


texts:
I have a Drupal site that I am currently developing on a local environment. Recently I uploaded my site to a "live" environment and everything seems to load fine except for all admin functionality. My local server runs with http, while the "live" server configuration runs securely with https. I have noticed that I cannot get into the Drupal admin pages and forms with the Drupal site when running https on the "live" server. Both the overlay and regular admin pages wont load. When clicking a toolbar menu item I get the following javascript console errors: Empty string passed to getElementById(). 5 times, and Error: permission denied to access property "document". Weird... I cant 100% say that this is an https problem, but it seems to be the case.

With more research involving http vs https with Drupal sites, I learned of the securepages module. I have since installed it but cannot enable it on the "live" instance of the site due to none of the admin pages working. I also tried enabling it via drush and it wasn't working for me. So then I figured why not try to enable it on the local version and then upload the database and modules to the live site. I couldn't do that either because my local connection is http and the secure pages module will only allow enabling when its detected SSl. See the conundrum? Has anyone ever seen this before?


texts:
I am trying to create a page which lists the users who are an author of a node type of article.

I figured I would approach it by creating a view based upon article. So the view started out listing all articles. Then I set up a relationship to users where the user is the author of the article, and in the fields, I just have it output the author's name (user name).

Now I have a list of all of the authors, but it repeats. So you see John Smith a hundred times, if he wrote 100 articles.

How do you make it so that John Smith only shows up once? If I could edit the mysql, I would just use group by uid (so the user only shows once), but in drupal views, it will list that author as a heading for a group, and then list all the articles he was in (so in my setup, it would show his name followed by a listing of his name many times).

This is in Drupal 7


texts:
excuseme if this question can (seem to) be stupid, but I don't figure how to solve...

Shortly, my custom module:

exposes a node type
exposes an entity type
attach to that node a field containing a set of these entities (by using entity_reference)

I would like to customise how those entities are visualised in the node view page: I would like to show more info instead of just the entity label.

I read something about hook_field_formatter_info(), that seems to be the best solution, but my debugger suggests that is not invoked (neither after a cache clear)... on the other I can't find any info about how to explain this to hook_theme().

The ideal behaviour should be to tell to Drupal:

use a specific template file to render all fields belonging to a given field instance
allow a theme to override that representation in a new template file

Do you have a snippet of code or a web resource explaining how to instruct my module to do this?

Thank you


texts: Show title of article instead of date in a Views block

texts:
I'm using the Views module to show a list of the 3 most recent articles posted on a site. I've set the filter granularity to the specific date of posting and it shows three dates with bullet points in the block. What I would I like to do is get rid of the Bullet points, have the date formatted MM/DD/YYYY and then on the line below the date have the link to the article where the link is the title of the article.

I want this to look like this, where TEXT is the title of the article it links to.


texts: Filter views slideshow of fields by nth newest node

texts:
I've seen variations of this question posed over the years but am yet to find a solution that works for my situation.  I have a view slideshow block of fields that rotates through all the field content of a node type.  The pager is set to "0" to include all content of each field.  I wish to limit the content shown in the slideshow fields to the nth most recent node.

For example, three slideshow view blocks are placed on a page.  One is filtered as the most recently published node of a given type, one filtered as the second most recent node of that same type, the last is filtered as the third most recent of that type.  Each slideshow view rotates through all field content for its node.  So, for the second most recent node, if there is a text field labeled "foo," and four entries for "foo" entitled "bar1," "bar2," "bar3," and "bar4," that slideshow will only rotate between "bar1," "bar2," "bar3," and "bar4" without moving to the next "foo" entry of the third or first or any other node of that type.

Currently, I am able to filter by date or limit/offset the pager number, but these are imperfect solutions for me.  The date solution is limited because it assumes a regular publishing schedule, while the pager solution is limited because it addresses fields in my setup and assumes a constant number of entries for the relevant field of each node.  I can explain these limitations in my situation more completely if necessary.

I've been assuming I was overlooking something simple, but still searching for a solution, so maybe it's a less common issue than I thought.  I've tried working with contextual filters and relationships within views, but have not come up with anything yet.  Any ideas/guidance is appreciated.


texts: Cannot block access to nodes with hook_node_access_records

texts:
I have written a module which adds a node access record. The workflow module is also installed which adds two other records to the node_access table.

Here Author says that:

  Drupal is a “deny-based” access control system. In other words, if
  anybody denies access to a node, then the node is blocked.

But when I deny access to a node in my module, it is still accessible for all users.(workflow module grants access for both anonymous and registered users)

A solution would be setting the record priority higher than workflow's access records, but I don't want to change the priorities.

/**
 * Implements hook_node_access_records()
 */
function mymodule_node_access_records($node) {

   $user = field_get_items('node', $node, 'field_recipient');
   $uid = $user[0]['uid'];

   if ($node->type == 'contact') {
      $grants[] = array(
         'realm' => 'contact',
         'gid' => $uid,
         'grant_view' => 1,
         'grant_update' => 0,
         'grant_delete' => 0,
         'priority' => 0,
      );
   }
   return $grants;
}

/**
 * Implements hook_node_grants()
 */
function mymodule_node_grants($account, $op) {
   $grants['contact'] = array(1234); //1234 is for test and doesn't exists in node_access table
   return $grants;
}

Is anything wrong?


texts: Can I prepopulate an exposed filter text field?

texts:
I want to get some value from session and put it into one of the exposed filter text fields of my view as default. Later the user can change the value and filter again.

Is there any way to do it? My session variable will be taken with:

<?php return $_SESSION['ip_geoloc']['location']['city']; ?>


texts: How to search on date ranges using apachesolr module?

texts:
I have a drupal site which have some events.

I am using apachesolr module for searching the site. Currently two fields are used for searching "keywords" and "location". Now I want to add the date field and when I click the search button it also query the search based on the date selected in the date field.

Suppose If I selected a 10/01/2011(m/d/Y) in the date field It should display the events with date 10/01/2011 or greater.

Any Idea?


texts: What is the best workflow to migrate a site using domain access?

texts:
i have a site with 20 subdomains using the domain access module on a dev server and i want to migrate them to a production server.

There is only a change from

  subdomain.maindomain.eu

to

  subdomain.maindomain.de

What is the best to do it ?


texts: How does DrupalGardens.com setup a new website?

texts:
How does drupalgardens.com creates a new website?

It creates a separate directory for Drupal, containing all core files(modules, themes, includes, ...)

OR

It shares the themes, modules and core files, and just creates a sub-site in drupalgardens.com

The second one is more reasonable, But When I read the source HTML I saw the following line:

<link type="text/css" rel="stylesheet" href="http://[mysitename].drupalgardens.com/modules/acquia/gardens_client/gardens_alert.css?lva62a" media="all" />

That, in my opinion, says that my website is outside of drupalgardens and has a separate directory instead of being a sub-site in drupalgardens.com


texts: I am using i18n module. How can I programmatically create node translation?


texts: How is the node revision ID getting updated?

texts:
I have a question related to _node_save_revision function in drupal 7. I just want to know how I can get the new revision ID after saving a revision using this function

It is mentioned in the documentation here.

  The resulting revision ID is available afterward in $node->vid.

But how does this happen? Where is the new revision ID assigned to the node object?


texts: How to filter filenames in views based on a match to currently logged username?

texts: I am quite novice to Drupal. I am trying to figure out how to create views listing files such that only those files are listed where filename contains currently logged username?


texts:
I am in the process of setting up a listing and review type scenario.  I have set up the separate entity types, one for the listing, and three for the types of reviews.  I kind of get how (from here and other sites) to set up these relationships using entity reference.

What I don't understand, is when I have a published listing, and I want the user to navigate to one of the three reviews, how do I make this happen?  ie what do I do to set up this link and in what module?  Is there a 'link' field to the review type, and the 'entity reference prepopulate' will take care of it?

So when it comes time to publish, I will have the listing and three columns for the different types of reviews.

Any help is much appreciated, new to drupal, having trouble connecting all the dots...


texts: Crontab to trigger scripts with drush commands

texts:
I've read this question and the answers links through to Jenkins. Looked into it but was way over my head to install and set up.
The other answer links to this page which talks about running cron tasks with drush commands. What I want obviously is the opposite.

With the endgoal in mind of just doing backups and updates, it seemed pretty straightforward the I could create a crontab that triggers a php or sh script with drush commands in it. The only thing I can't seem to find is a way to construct such a script.

I did google this, but I keep getting information to do the opposite thing being trigger cron with drush.


texts:
I have site with thousands of user and logins each day. I need to track each page views of each user to generate a report.

If a user 'A' visits a page 'P' today, a new entry daycount is added
to the DB. If the same user 'A' visits the same page 'P' on same day,
the daycount will increment by one. If a user 'A' visits page 'P'
tomorrow, a new entry daycount is added to the DB.

I am using drupal 7. The insert and update works properly if there is no date comparison. Once i added  if($TimeNow > $UpdateTime), the page load never ends. Can anyone help me to fix this.

if(db_query('SELECT daycount FROM {report_page_view} WHERE id = 9999999990 AND uid = :uid )', array(':uid' => $GLOBALS['user']->uid))->rowCount() == 0) {

    $ChQry = "(SELECT timestamp FROM {report_page_view} WHERE id = 9999999990 AND uid = :uid )', array(':uid' => $GLOBALS['user']->uid)"; // Get the previous timestamp
    $ChResult = db_query($ChQry);

    while ( $ChGetResult = $ChResult->fetchAssoc() ) {
       $TimeStm = $ChGetResult['timestamp'];
    }
        $UpdateTime = $TimeStm + 86400; //Get the next day
        $TimeNow = time();
        if($TimeNow > $UpdateTime) { // Compare current time and tomorrows date
        // insert if condition works
        $insert_page = db_insert('report_page_view')->fields(array('title', 'memberorg', 'id', 'type', 'timestamp', 'daycount', 'uid', 'fname', 'lname'));
            $insert_page->values(array(
            'title' => $Title,
            'memberorg' => $MemberOrg,
            'id' => 9999999990,
            'type' => 'views',
            'timestamp' => REQUEST_TIME,
            'daycount' => 1,
            'uid' => $UserId,
            'fname' => $FName,
            'lname' => $LName,

          ));
        $insert_page->execute();
    }
    } // else update
    db_update('report_page_view')
    ->fields(array(
            'title' => $Title,
            'memberorg' => $MemberOrg,
            'id' => 9999999990,
            'type' => 'views',
            'timestamp' => REQUEST_TIME,
            'daycount' => 1,
            'uid' => $UserId,
            'fname' => $FName,
            'lname' => $LName,
    ))
    ->expression('daycount', 'daycount + 1')`


texts: Get node count for each value of a CCK Options Widgets field

texts:
Lets say I have a CCK options widget field with 4 options like
1
2
3
4

If I want to get the node count for these values how could I do that?

Also, how would I do it if I would like to put this result in a View and sort on it? Use a computed field?


texts:
I am trying to find a way of creating a view of both a custom entity type and a node. I was following this as a guide: https://drupal.org/node/748844 (see the way end for the D7 implementation, I have quoted it below, but for some reason, its not fully displaying...)

I am trying to understand this line

$query2->addExpression(':the_group_type', 'Type', array(':the_group_type' => 'Group'));

I see from online documentation that addExpression adds an expression to a list of fields, which I would assume means something like SUM(quantity). But I don't understand what the addExpression lines (there are actually two of them) are doing in this code.

Code listed below:

/**
 * Implements hook_views_pre_execute()
 */
function YOUR_MODULE_NAME_views_pre_execute(&$view){
    if($view->name == 'YOUR_VIEW_NAME'){
    //extracts my nodes
    $query2 = db_select('node', 'node');
    $query2->leftJoin('location_instance', 'location_instance', 'node.vid = location_instance.vid');
    $query2->leftJoin('location', 'location', 'location_instance.lid  = location.lid');

    //created and nid are the same fields used by my_view query
    $query2->addField('node', 'title', 'users_name');
    $query2->addField('node', 'nid', 'uid');
    $query2->addField('location', 'latitude', 'location_latitude');
    $query2->addField('location', 'longitude', 'location_longitude');
    $query2->addExpression(':the_group_type', 'Type', array(':the_group_type' => 'Group'));

    //set some conditions if necessary
    $query2->condition('node.type', 'group', '=')
           ->condition('node.status', 1, '=');

    $query1 = $view->build_info['query'];
    $query1 ->addExpression(':the_user_type', 'Type', array(':the_user_type' => 'User'));

    //union custom query with my_view default query
    $query2->union($query1, 'UNION ALL');

    //in order to prevent Cardinality violation errors i have to make a "total" query
    $total_query = db_select($query2,'total')->fields('total');

    //update views query and count_query with my new query.
    $view->build_info['query'] = $total_query;
    $view->build_info['count_query'] = $view->build_info['query']; //count_query is necessary for the pager
  }
}


texts:
In my web application, I would like to prevent accidental or unauthorized deletions or modifications (e.g. a student steals teacher's credentials and deletes or changes bad marks). But, at the same time, I'm trying to keep the interface as easy and straightforward as possible.

I've already enabled node revisions, so if a mark is changed we can restore the previous state, but I also hid the revision message, because it confuses non-techie teachers.

The next step would be transparently prevent mark deletion. The user should see and use the "Delete" button and the deletion confirmation page, but when confirming, Drupal should not delete the node and just unpublish it. Is this possible to do?

(I would then create a view to see/administer the revised/unpublished nodes, to check unauthorized modifications)


texts: How to create a Default Argument based on Tags

texts:
I need to create a view block where users who have entered a specific tag on their personal profile page are displayed. I have the page set and it works properly. I just need to know how to set up the default argument based on context when associating that specific tag.

There are 2 types of profiles:

business (has a tag field X)
employee (has same tag field X)

Business owners have personal and a business profile access. Employees just have access to the personal profile.

For those employees that have a matching tag with the business profile I need them listed in a block as employees on that company/business profile page.


texts: How to make fields required for one type of user but not others? (registration and profile forms)

texts:
I would like to know what is the best way to handle this scenario using Drupal 7.

The issue I am facing is that the Join (registration) forms, and Profile forms are different for all 4 types of users I am working with. The registration and profile forms are all connected to one master profile form. This means that if a field is required for one, it will be for all of users, how can I avoid this? What is the best way to go about it?

Thanks!


texts: Translate custom field in countries module

texts:
I am using the Countries module in a multilingual site and I added a custom field to it.

The countries itself support translation for its own field, but is there a way to translate content for the custom fields added to it?


texts: How to change the output field date in a view?

texts:
I want to alter a field 'Date' in the view to display only year using 'hook_views_query_alter', so that I can display only Year in the date field.
I'm trying below code, which is not working. Can anybody help me?
I'm not sure about assigning new value to the field in the code.
function alb_jobs_views_query_alter(&$view, &$query) {

  if ($view->name == 'test-archive') {
  $query->where[0]['conditions'][0] == array('field'=>"field_data_field_issuu_date.field_issuu_date_value","value"=>'%YEAR(STR_TO_DATE(field_data_field_issuu_date.field_issuu_date_value,"%Y"))%',"operator"=>"LIKE");

  }
}

Here is my date field screenprint:


texts: How to tell if the current language is written RTL or LTR

texts:
I'm looking for the function – if that exists – for asking Drupal about the current language direction (RTL/LTR).

I check the global language variable but it doesn't contain that information.


texts: Overriding system.site.uuid with an environment variable

texts:
I have a need to have separate sites behave as if they are clones of each other; that is, they each need to have the same site UUID.

Due to the environment I am operating in, I am unable to change the site UUID via drush config:edit once the site is installed as I have no SSH access to the environment. Likewise, the only way I can create a new site in this environment is to upload the files, create an empty database and then run the install script. This creates a new site, with a new UUID, and therefore is no longer a clone. Once sites are installed in the environment, my only way of interacting with them is through the administration UI.

Any site I create in this environment will have the same code base; it is not a matter of messing things up by importing the wrong config.

I can import the same database  into the new site once it is installed using Backup and Migrate, thereby changing the UUID (I assume). However, this does not quite solve the problem because it may be the case that I need to create sites via scripts in our continuous integration system.

My initial solution is to add a line in settings.php to override the configuration item in question, ie:

$config['system.site']['uuid'] = 'this is the site uuid';

However, when I export the configuration, the override value is not respected and configuration is exported using the original value. I can test this by exporting the configuration from a clone and trying to import it. If the UUID was being overridden 'fully', then I would expect the configuration import to fail.

Ideally, I would like to set the site UUID through an environment variable or service, so any site with access to the variable or service would be able to use the same UUID, and therefore be considered clones.

Has anyone had any success with something similar?


texts: Programmatically creating paragraphs is extremely slow

texts:
I am adding paragraphs from xml file programmatically but it is extremely slow. for example I'm basically creating paragraphs like this:

$row = ['field_title' => 'title', 'field_id' => 'id' ....];
$paragraph = \Drupal::entityTypeManager()->getStorage('paragraph')->create($row);

I have at least ten paragraphs for node and it is taking approximately 2-3 minutes to create for one paragraph.

What can be the problem?


texts:
I'm using the Drupal 8 version of the Rules module. How do I add a role to new users with a rule?

I created a rule.

Name: New user role
Events: After saving new user
Action: Add user role
Data selector: user.roles

I don't know what to set for value. Is my rule correct?

I want to add the particulier role to users.


texts: Database error when creating entities using hook_update_N

texts:
I'm trying to create an entity (using entity->save()) in a hook_update_N function. The errors appear at the mysql insert query in the entity's insert function; the insert strings are wrapped in mysql_real_escape_string().

I get a series of warnings:

mysql_real_escape_string(): A link to the server could not be established mod_person.entity.inc:402

mysql_real_escape_string(): Access denied for user 'xxx'@'localhost' (using password: NO) mod_person.entity.inc:403

Followed by the error:

SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'val' at row 1

When I remove the mysql_real_escape_string() from the mysql insert query code it works! However now I'm worried that leaves the server vulnerable.

My questions are:

[1] Why does using mysql_real_escape_string() work in normal site operation and not through hook_update_N?

[2] Do I need to use mysql_real_escape_string() with Drupal 7 database queries or is there another way?

I suppose I could remove the mysql_real_escape_string() for the update and then put them back but that feels like I'm missing the point somewhere.

Many thanks for any help.


texts: How to delete paragraph when uninstalling the module?

texts:
I have been creating the custom module which have the paragraph configuration, when installing the custom module, the paragraph config will be stored in the database and then It will be available in the paragraph types.(/custom_module/config/install)

When uninstalling the custom module, the paragraph types are not getting uninstalled. By Manually, I am deleting it after the uninstalled.

Is there any possible way to delete the paragraph types when uninstalling the custom module?

Because of this, we are unable to fix some issues

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'field_example_ch_hero_video_target_id' in 'where clause': SELECT 1 AS expression FROM {paragraph_revision__field_example_ch_hero_video} t WHERE field_example_ch_hero_video_target_id IS NOT NULL

I have replaced the hero video field with some other machine name. then I could not delete the paragraph or install the module.

Can anyone give some valuable advice?


texts: Views not found on disabling Page Title module

texts:
I've  Views 7.x-3.7 and Page Title 7.x-2.7 installed. Since many months I'm using Meta tags and Page Title module but now I want to remove Page Title module as I don't need it since Metatag module provides equivalent functionality.

But on disabling Page Title module I'm getting page not found(404) for the Views Page display URL. Also when I go to edit that display in the View from Structure->Views I get the following screen:

When I go to view the Page url of the View Display I get this :

There is no information in the dblog except for this when I access the View Page url:

What should I check to start debugging this?


texts: How to add title of node (where order form was placed) to custom line item order in commerce

texts:
Alright I added a custom line item order form to a node. I read that somewhere the link to the node on which the order form was used gets saved within the order, but I need the title of the node where the order form was used to place the order. Currently I added a entity reference field which uses a view to just display the title of the actual node and the user needs to select the value manually. But I want this to be automatic and hidden if possible, how could I go about it?

Actual try: I tried to setup a rule to make this possible, but I am not able to do it since I am not able to access the data of of my content node and the form at the same time. I tried it with a simple rule, a component and last but not least through the rules forms module


texts:
I have a view who display several nodes (more than 10 000), and I display 100 nodes by pages.
With a HOOK_views_pre_render(&$view) I browse all the results $view->result and I unset the nodes which I haven't access with a personnal function like this :

if (!empty($view->result)) {
    if ($view->name == 'vdocuments' && $view->current_display == 'page') {
        foreach ($view->result as $key => $lineView) {
            if (!empty($lineView->nid)) {
                $lineAllowed = _isNodeAllowedToUser($lineView->nid);
                if (empty($lineAllowed) || !$lineAllowed) {
                    //$counter++;
                    unset($view->result[$key]);
                }
            }
        }
    }
}

My first question concern this code. Is there a better method to remove some results in my wiew (I need to use my check function) ? I tried to alter the query of the view and check the NID allowed in a filter, but there is too much NID to remove for certain users.

So, the code above remove all the bad nodes in the page i'm viewing, but all the pagination is destroyed, on several pages I have empty results.

I found this page https://www.drupal.org/node/953072#comment-6317230 but the update_page_info doesn't work really good.

Is there a solution to get all the nodes "allowed" and calculate the pagination with the rest of the nodes after the unset ?

thanks


texts: How can I set up Protected Pages so users only have to log in once?

texts:
I'm using the Protected Pages module to make an area of the website - which is about 13 pages - password protected. The problem is that users have to enter the password to view every page rather than being able to enter the password once and then being able to see the entire section of the website (the members portal).

I had only one thing in the list of password protected pages which was /members which is part of the url. Every page that is supposed to be password protected has a url of website.com/members/pageName but that didn't work because anyone could just put the url straight into the browser and the page would should up without having to enter the password.

So, i added all 13 pages to the list of password protected pages but now users have to enter the password on every page.

We have two menus on the site. The public menu and members menu. When a user logs in to the members portal the menu changes and when you select a page from the menu, you have to enter the password every time, but we want it so users only have to enter the password once and they can see all the pages in the members portal.

How do I set that up?


texts: Call multiple node forms using multiform_get_form()

texts:
I am trying to call multiple node forms using multiform_get_form() a utility function by multiform module.Here is the code I am trying with

function custom_multiform_menu() {
  $items = array();
  $items['add/multiform'] = array(
    'title' => 'Add Spread',
    'page callback' => 'multiform_get_form',
    'page arguments' => array(array('article_node_form'), array('page_node_form')),
    'access callback' => TRUE,
    'type' => MENU_CALLBACK,
  );
  return $items;
}

I am not seeing any node fields on page add/multiform


texts: How do I get clean output (without menus, header, footer, etc.) in Drupal?

texts:
I need only processed content of particular theme file (mytheme.tpl.php) using the theme() function.
How do I get rid off header, footer and other stuff on the page?
And it will be good not to touch main theme page.tpl.php or anything else except module internals.

Probably there is something like:

return DRUPAL_CLEAN_OUTPUT(theme('my_theme',array('html' => $html))); ?


texts: Access Denied when Sellers add new product

texts:
We created a store with Drupal 7 Commerce. Because we wanted to let specific users create new products on our store, a user role Seller was also created with the following permissions:

Create, edit, delete own product display
Create, edit, delete own products

We have also created a block with views that allows those users to access their own product listing and edit the products with the following settings in views:

Contextual filters: (Node referencing products from field_product) Content: Author uid
Relationships: Commerce Product: Referencing Content

A link to Add new product has also been created in that block, although I'm not sure this is the safest way to do it: /admin/commerce/products/add/product

We also use the following modules to make life easier:

Auto product display
Commerce AutoSKU
Automatic Entity Labels

Everything works as should. When a Seller wants to add a new product, the add product form is shown in the front end (not admin overlay). But once the ADD PRODUCT button is clicked, it shows Access denied page - probably because it wants to redirect to the admin products list.

Is there a way to redirect those users to their own listing or any other page on our website once they add a product, so they don't get that error?


texts: GTM container in block appears as regular text even though set to be Full-HTML

texts:
I have opened a block at the header of my site and have putted the GTM-container code inside while at Full HTML input-format.

Yet, the container code appears as regular text (<p>&<a>) in this block.

I could solve it by giving "Display:none;" to it's region with CSS, but I would prefer to find the root cause of this problem rather than using CSS.

If there is any module that deals with this service I would prefer not to use it since I'm looking for a none-modular why of doing it.


texts: How do you add Meta-Description with Metatag?

texts:
In the Node's options for Metatag, I have a token for the metatag "Description", i.e.: [node:summary].

If I want to write the description, should I delete it? Or write it in where the "summary" appears?


texts: Add new existing field for existing content type

texts:
I have a development site (let be site 1) and a site where I check my code (site 2). My goal was to add a new existing field to a paragraphs type (/admin/structure/paragraphs_type), so I did the following:

On site 1:

I re-used an existing field in one of the paragraphs type
I exported the configuration
I deleted uuid and _core.default_config_hash from the configuration files (from those which was relevant for me)
I wrote an update hook which will create the same config file (except order), when my module will be updated on other sites, where it was previously installed my module
I put the exported 3 files to my module's config/optional dir

Than I moved this module to the site 2 where I run the update hooks. But the newly added field wasn't showed up on the paragraphs type's page under the correct paragraphs type. All the configuration's dependencies are right and enabled. Configuration file is same except the order. If I want to add the field on site 2 manually again, after config import I get this error: There was a problem creating field : 'field_config' entity with ID 'paragraph.text_boxes.field_text' already exists.

Note: before I added the new field, I had a configuration export under git, so after I added a new field and exported the configuration I saw exactly which configs was touched.

What am I doing wrong? How can I add a new existing field to a paragraphs (or a content type)? What's missing?


texts: Generate unique form ID based on context

texts:
When you try to build the same form twice on a page, the submit handler of the first form gets executed.

In order to overcome this issue you need to generate a unique form ID.
How do you generate a unique ID based on some pass context.


texts: How do I use this module which depends from a module that is not available for the core version I am using?

texts:
I'm trying to install the Juicebox HTML5 Responsive Image Galleries module to the Drupal 8 site but the system doesn't allow me to do so because the Libraries API module is missing. The modules page shows the following.

Is it possible to use the Juicebox HTML5 Responsive Image Galleries module even if there is no Drupal 8 version for the Libraries API module? Could it work with the 7.x-2.3 version?

The project page for the Libraries API module shows the following message:

  This module is currently being ported to Drupal 8, but is not usable yet. Help us by following this issue.

Does it mean I can't use this API module for the Drupal 8?


texts: Is there a way to make aliases as short as possible?

texts:
For instance, if you have three tokens, let's say [city], [state], and [country]
is there a way to do this:

/[city]-[state]-[country]

and then let's say there are three cities, Venice, in different places
the first, Venice, Florida, United States would get this url

/venice

the second, Venice, California, United States would get this url

/venice-california

the third, Venice, Italy would get this url:

/venice-italy

Notice that it does not cut an individual token, only cuts off the extra tokens as they are not needed (in the case of Italy, there is no state so pauthauto automatically skips this token).
From reading the documention, it looks like Pathauto's default behavior is to do this:

/venice

/venice-1

/venice-2

and so on... when what I want to do is make the first one the "venice" and any additinal ones get additial tokens as needed, so if Venice, Italy is first then they will get /venice

If there's a way to do this with pathauto, how would you do it?
If not, what's the best way to make a module that does this?
Can a module modify how pauthauto works without modifying pathauto itself?

thanks!


texts: How do I create a page (with a url) that displays only views blocks

texts: I have been using views to create all of my pages.  I am wondering if there is a way to set up a page (with url) that is initially blank.  I want to use context to place view blocks on this page based on user roles.  If a context is not matched, then the url should act as though the page does not exist (would I need a rule for this?)  How can I build this?


texts: Is there a way to show a node's comments when displayed in teaser format on the taxonomy term page?

texts:
Is there a way to show the first page of a node's comments when the node is displayed in teaser format, e.g. on the taxonomy term page? I am building a site with 'posts' (a node type) which have comments, but I want users to be able to read comments, and leave comments from the taxonomy term page.

Is there a way to do this programmatically?


texts: Need help modifying the OG "add user" form to replace the user search box with first and last name searches

texts:
I could really use some guidance with an OG related task. I'm needing to modify a form used to add existing users to organic groups. The path is "/group/node/1/admin/people/add-user". I need to remove the user search box and instead implement a couple of name searches: "Firstname, Lastname", and "Lastname, Firstname".  Not sure what I should be modifying via a hook_form_alter, or other hook. Any thoughts?

Attached is a before and after view of the form. I appreciate any guidance anyone can provide.

Thanks!


texts:
I'm working on a site where someone did a lot of security updates. After reviewing the site, we found a bug. When you try creating a node with a file upload, when you click the save button, instead of saving it actually downloads the file to your computer. I'm not really sure where to start looking for this issue.

Has anyone had this issue before?


texts: Facebook Autopost. Why I still receive download library message?

texts: I want to use Facebook Autopost. I have downloaded the facebok-php-sdk library and I have copied it to sites/all/libraries, but in status report I still receive this message. What should i do?


texts: How to print a message when a Pane is empty?

texts:
I've rewritten the node pages on my website with a Panel page (using node_edit) and added the node's comments as a Pane. When no comments have been published yet, the Pane is hidden. However, I'd like to still display the Pane's title and a sentence underneath that says something like: Be the first to react.

I already have a template panels-pane--node-comments.tpl.php and added some lines under if(!$content}{print t('Be the first to react.');}, but as the Pane isn't displayed, the template isn't activated. What should I do?

I know that I could create a View that shows all the node's comments and set a value when there aren't any, but maybe that's overkill?


texts: Is this snippet modification correct? (php snippet in a drupal commerce rule)

texts:
I´ve read about the possibility to use this snippet to hide a specific checkout pane (in Drupalcommerce), according to the cart contents.

Could I use this somewhat modified to hide a pane when the user completing the order is registered?

<?php
function hook_commerce_checkout_pane_info_alter(&$checkout_pane) {
    foreach ($checkout_pane as $pane_name => & $pane_data) {
        if ($pane_name == 'customer_profile_shipping') {
            $order = commerce_cart_order_load($user->uid);
            if (!empty($order->data)) {
                    unset($checkout_pane['customer_profile_shipping']);
}}}}
?>

I understand that I should change this if (!empty($order->data)) { maybe to something like this? if ($user->uid > 0) {

Is that correct? I want tu hide the pofile2 pane:

So it would be like this:

<?php
function hook_commerce_checkout_pane_info_alter(&$checkout_pane) {
    foreach ($checkout_pane as $pane_name => & $pane_data) {
        if ($pane_name == 'customer_profile_shipping') {
            $order = commerce_cart_order_load($user->uid);
            if ($user->uid > 0) {
                    unset($checkout_pane['commerce_p2cp_profile']);
}}}}
?>

I´m not sure how to add that into a rule set...


texts: How can I let users create new drafts for *existing* content?

texts:
We have two roles of user: Admins and Content Creators (basically Authenticated with a few more permissions to create content). We'd like to have Content Creators be able to create new drafts from existing content and let the Admins approve to publish.

While this approach sounds straight forward, I've hit a number of road blocks and have tried multiple approaches:

Workbench Moderation: I've failed to install this to any working degree. Each time an admin approves a piece of content it's permanently unpublished. I describe the issue better here. If an Admin tries to publish their own content it falls into an endless cycle where WB sees the item as published but Drupal reports otherwise. Others seem to have similar problems.
Draft: Looked promising but there is no D7 release
Save Draft: Works nicely on new content, but doesn't offer to create a new draft of an existing item.

Other things we consider:

Workflow: I'm hopeful but there is a lot of configuration to set up for such a seemingly simple work flow. Also it appears a bit overwhelming. I hoped Workbench to be a simplified version of this.

We see that this feature is built into D8. Infact, this very ticket explains what we're trying to do:

  Ideally, I should be able to assign an arbitrary state to any revision. I could have a published revision, a revision pending approval, and a draft revision beyond that.

Is there a way to make this happen in Drupal 7?


texts: Default Paragraph Config Per Content Type

texts:
We're using a paragraph for the hero/header of our site.  Within the paragraph are a number of different toggles to define various options for the hero.

I'd like to have it so that if the user is creating content in one content-type - the default configuration for the paragraph differs from if they're entering content for another content type.

Can I have create unique configurations of a paragraph type based on the content type it's inserted into?


texts: Discount based on a field in product display node in Drupal Commerce?

texts: I want to create a pricing rule based on discount entered in a field in the product display node? Is it possible? I have been trying to do it but i can't see the discount field in the dataselector. I tried entity has field but there only line-item entity appears and no node entity?


texts: Using swiftmailer, how to check if an email was sent successfully?

texts:
For example, when Drupal core contact forms fail to send an email for any reason, swiftmailer throws an exception and logs a message. However, I am trying to hook into the process to display appropriate information for my enduser after a contact attempt fail.
For more information drupal contact form does the following to send a message in MessageForm.php:
 $this->mailHandler->sendMailMessages($message, $user);

This trigger the  mailManger->mail method which only throws an exception if the mail system had any issues. Here is the relevant code in swiftmailer
Is it possible to determine if the mail failed within the the save method of MessageForm.php?


texts: How to get rid of "The %field_name field needs to be uninstalled."

texts:
I have a message in the /admin/reports/status page regarding some fields.

FYI, those are custom fields that I have deleted

Here is the message:

The %field_name field needs to be uninstalled.

To solve this, I ran cron, I drush cr and finally  drush entup =>but this last step display the following error:

In DiscoveryTrait.php line 52: The "field_item:mwd" plugin does not exist.

mwd is the id of custom field type for which there is a message in the status page...

Here is the Plugin definition and the Class definition of this custom field

 * @FieldType(
 *   id = "mwd",
 *   label = @Translation("Days of week in a Month for a user"),
 *   description = @Translation("Store all days of week in a month for a user."),
 *   category = @Translation("Calendar"),
 *   default_formatter = "mwd_ds_formatter",
 *   default_widget = "mwd_ds_widget",
 * )
 */
class MWDItem extends FieldItemBase implements FieldItemInterface{...

I have created an instance of this field type (with the GUI of drupal) and added it to a content type. This is this field which needs to be uninstalled if I conforms to the status page message.

Unfortunately I can't get rid of it: impossible to remove this warning in the /admin/reports/status page


texts: How to make an uploaded video visible on the node page in drupal 7

texts:
I have created a CCK named sample with a field name VIDEOS of type file. I have added a video of CCK type Sample. But it only showed a url after the node is saved.

Instead of displaying the file name how to make the video playable on the same page.

I installed jwplayer in libraries. I tried changing display type From Generic to JWplayer

Was trying since past 2 days using video module, VideoJS. But did not succeeded. Please help.

UPDATE

here is the result which i got when working with Video module

It is returning empty data with Play button on it. No video is displayed

UPDATE

A small progress,Tried Flow Player  flv videos are able to play. but mp4 is not playing. It simply shows a black screen.


texts: banner image showing on all pages except forum and views result pages

texts:
My image is showing on all pages except the forum and classifieds result pages.

How can I make sure it shows on all the pages?

In the block I have selected all pages and not checked any of diff types so that it should show site wide.


texts: How to change to another image when mouseover using Views?

texts:
I need to change the big image "A" to "D" when mouseover thumbnail "D" in a view (using Views).

How can I do this? Preproces page or jquery in a custom text in view?


texts: Glossary option in Search API indexed nodes

texts:
Does anyone know how to add glossary for search index nodes? In Views+Search API you dont get glossary option in contextual filters as you get in Views with content nodes.
Currently I am using grouped filter with each alphabet equal to title (trimmed to one character) but not very efficient way. Looking for a better approach.
Thanks.


texts: I am using Webform module and I used main menu to display the form on Login page. I want to display menu only on Login page but Main menu is also displaying on front page. Is their any way to hide displaying main menu on front page.


texts: Standard practice for adding new fields to a table created by a contrib module

texts:
I have to add a field to the webform table generated by the webform contrib module.

I was thinking about implementing the enable hook in the .install of a custom module in order to do this:

function mymodule_enable( ) {
  db_query('ALTER TABLE webform ADD COLUMN is_valid int') ;
}

But I don't know if this will generate problems if the module is disabled and enabled again in the future and tries to add the field (which would be already created by then).

Is this correct or is there a better way to do this?


texts: Should I include arguments in views_embed_view or in a hook_views_pre_view function?

texts:
I have a tonne of views across my site and pretty much all of them need to have their arguments passed programmatically.

I'm wondering which method is best assuming I'm using views_embed_view to print all of them.

Thanks.


texts: Redeclare issue user_has_role following upgrade from Drupal 7.34 to Drupal 7.36

texts:
Precise error is "Fatal error: Cannot redeclare user_has_role() (previously declared in /usr/home/adpca/public_html/adpca.org.736/modules/user/user.module:863) in /usr/home/adpca/public_html/adpca.org.736/modules/php/php.module(80) : eval()'d code on line 23"

This is in an eval statement I've been through through code base looking for any duplication of the function user_has_role and can't find any. Also been through the databases looking for anything that might trigger the duplicate eval but no joy so far. Anybody got any pointers on what to look for?


texts: Migrating to XAMPP local install - Configure the temporary directory

texts:
I have copied a site I have on a VPS down to run from XAMPP on my local machine. When I restore the site using Backup and Migrate I get the error message on all pages of the site:

  The specified file temporary://filemy1oSK could not be copied, because the destination directory is not properly configured.

I have clean installs of drupal running fine on XAMPP. On the File System configuration page (admin/config/media/file-system) they use '/Applications/XAMPP/xamppfiles/temp/' so I have tried using this and '/Applications/XAMPP/xamppfiles/private/' but this doesn't fix the error.

There is a similar Drupal Answers Question, about moving a site from local up to a VPS I have tried to work through the suggestions there to no effect. The top answer recommends advice from this site. Following this to avoid starting the file paths with a forward slash I tried using 'sites/default/files/private/' and 'sites/default/files/temp/'but this doesn't fix the error either.

As this is a local install, security is less of an issue. I have been setting the above directories to 777 to ensure that there are enough permissions. I have also made 'sites', 'sites/default' and 'sites/default/files/' 777.

Possibly incidentally, clean URLS weren't working on the the local install, even though they work fine on the fresh installs of Drupal. This stopped the links on the site working. I disabled them by going to http://localhost/sitename/?q=admin/config/search/clean-urls and the site links now work without clean URLS

Also possibly incidentally, I got an error message when I used the site files I downloaded to install with a clean database. I did this so I could install the backup migrate module and restore the site properly. At the end of the install I got the error:

  Deprecated function: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in _acquia_profile_create_node() (line 158 of /Applications/XAMPP/xamppfiles/htdocs/sitename/profiles/acquia/acquia.profile).

I don't have any admin menu and the overlay admin screens aren't working. I am assuming this is a result of the temporary files error.

Any advice?


texts: Fixed number of columns in Views Responsive Grid

texts:
I have installed Views Responsive Grid and I am on the way of replacing my old normal "views grid" in a couple of pages. But there is one thing I can't really understand. In the settings for Views Responsive Grid I am supposed to set a fixed number of columns. So if I go with 4 columns for example, and make it look good on a wide screen, the class "views-row" will continue on the next row if I make the screen more narrow. I must be missing something here. If for ex. I want to have a border under each row, no matter how many "cells" or "column divs" there are on each row... how to accomplish that? Am I supposed to set the number of columns to 1?

I should mention also that I have set the class .views-column to float:left in order for each column DIV to act responsive.

.view-id-taxonomy_term .views-column {
    padding-bottom: 15px;
    padding-right: 15px;
    float:left;
}
.view-id-taxonomy_term .views-row {
    border-bottom: thin solid #d6d6d6;
}
.view-id-taxonomy_term .views-responsive-grid .views-row-1 .views-column-1, .view-id-taxonomy_term .views-responsive-grid .views-row-1 .views-column-2,  .view-id-taxonomy_term .views-responsive-grid .views-row-1 .views-column-3,  .view-id-taxonomy_term .views-responsive-grid .views-row-1 .views-column-4, {
    padding: 10px 10px;
    vertical-align: top;
    max-width: 160px !important;
    min-height:320px !important;

}

Any hints would be much appreciated.


texts: How to access individual items in $form_state['values'] post-submit

texts:
Question

After a user has a submitted a form how do I determine how to reference individual form field values in $form_state['values'] ?

Examples

For example, I have several fields in my form, such as 'field_organization' that would normally be accessed (for CSS) purposes, like so:

$form['customer_profile_billing']['field_organization']

I have others in my form that have even more convoluted paths such as

['und'][0]['another-name']['a-fourth-name'], etc.


texts:
I'm having problems with arranging elements in a Views Table and I hope you can help me with it.
Instead of rendering each field in a separate column, I'd like to group some of them together in the same column as  shown below:


texts: Flexslider only showing to logged in users

texts:
My flexslider is only showing to logged in users. I'm using a view in a block and I've checked that the block is showing for all user roles.
The View "Access" permissions are set to anyone that can view published content. Changing the Access value to "none" didn't seem to make any difference. The admin user still sees it, but anonymous users don't... Any suggestions ?


texts: PDOException: SQLSTATE[42000] Implicit conversion from data type nvarchar to varbinary(max) is not allowed

texts:
I got this problem with my drupal 7.24, Windows server 2012, IIS8 and the sql server 2012.
I'm using the last dev version of sqlsrv which is suppose to fix a similar bug, but I still have this one.

PDOException: SQLSTATE[42000]: [Microsoft][SQL Server Native Client 11.0][SQL Server]Implicit conversion from data type nvarchar to varbinary(max) is not allowed. Use the CONVERT function to run this query. in dblog_watchdog() (line 160 of D:\inetpub\website\modules\dblog\dblog.module).

I've migrated my DB from a mysql to the sql server through the migration tool and using the drivers 5 and 3.51 to convert the schema. (got the same error in both case)
BTW I have hexadecimal data sometime instead of normal data.
function dblog_watchdog(array $log_entry) {
  Database::getConnection('default', 'default')->insert('watchdog')
    ->fields(array(
      'uid' => $log_entry['uid'],
      'type' => substr($log_entry['type'], 0, 64),
      'message' => $log_entry['message'],
      'variables' => serialize($log_entry['variables']),
      'severity' => $log_entry['severity'],
      'link' => substr($log_entry['link'], 0, 255),
      'location' => $log_entry['request_uri'],
      'referer' => $log_entry['referer'],
      'hostname' => substr($log_entry['ip'], 0, 128),
      'timestamp' => $log_entry['timestamp'],
    ))
    ->execute();
}

On the dbo.watchdog I have a column call variables which is a varbinary(max) (used to be a LONGBLOB on mysql) and got hex data now. I think the problem is coming from here.
When I comment those lines (insert query), it works, but with a lot of warning like:

Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 173 of D:\inetpub\website\includes\entity.inc).
Warning: Cannot modify header information - headers already sent by (output started at D:\inetpub\wendy\includes\common.inc:2700) in drupal_send_headers() (line 1216 of D:\inetpub\website\includes\bootstrap.inc)
PDOException: SQLSTATE[42000]: [Microsoft][SQL Server Native Client 11.0][SQL Server]Implicit conversion from data type nvarchar to varbinary(max) is not allowed. Use the CONVERT function to run this query. in variable_set() (line 975 of D:\inetpub\website\includes\bootstrap.inc).

Anyone got an idea how to fix that?


texts: I am using hook_node_access() to deny users access to some nodes based on a custom criteria. However, I do not want this content to show up in a view that lists it if the user does not pass the criteria. Is there any way to have views respect hook_node_access() implementations?


texts: Rotating image background in a div using Background Field

texts: I have successfully added background graphics using the module BackgroundField module with the help of this previous question. We've had a feature creep in that we need to have a rotating image from a preset pool of images. Does anyone know of an module to facilitate this request?


texts:
I need some help to customize my events list with Drupal 7. I am a newbie to Drupal, css and php, but I am used to programming. I guess I need some help with css syntax here.
What I want is an event list from an event calendar with customized format of the titles, which link to the respective event. I got to the point where I can tell the Views structure in Drupal that I want a customized html format for that field and where I can enter a name for a new css class. Now I take it, that I can edit the theme's css file to format the titles. Embarrassingly, I don't get the code right, my experience with css is not sufficient. Can someone help me, please?

I entered "pretty-event-title" as new css class, the resulting page's source code looks like this:

 Test event
]

"Test event" shows up as blue link of 100% font size. I'd like to change size and especially the color (size was just fine by using h3 tags or something in the view).

How would the css snippet look I have to put into my css file?

Any help appreciated!
Best,
Verena


texts: How do I programmatically get a field's value?

texts: I copied node.tpl.php and I pasted it to node--my_content_type.tpl.php. My content type has a price. How can I get its value as a string?


texts:
I have a terrible problem: I have written rubbish within the .htaccess file, in order to break my web site, and cause an error 500. Result: nothing, nothing happens, the web site continues to be online.

That is, the .htaccess file is ignored completely. Why does this happen? I understand that this only has an answer: the Apache server is misconfigured. This is absolutely correct? Or are there other possible causes?

My file system: image 1 and image 2.

Originally the website was hosted on a folder within a server (mydomain.com/folder), and everything worked fine. Now I am migrating the website to another server, but within a subdomain. The features of the new server:

Subdomain: domain.company.com
Apache: 2.4.7 (Ubuntu)
Port: 80
phpinfo: Open phpinfo

UPDATE.

1) DNS. I checked my subdomain with http://whois.domaintools.com/ and http://mxtoolbox.com/SuperTool.aspx. I found no problems.

2) .htaccess. The file contains RewriteEngine on. RewriteBase is commented, because I don't know what to put when a subdomain. Anyway, no matter what I put in the file, it is completely ignored.

3) My settings.php has:

$ Base_url = 'http://domain.company.com'; // NO trailing slash!
There is not $base_path. Does not exist.

I cleared the cache Drupal. I cleared the browser cache. I truncate all tables that start with cache_.

It does not work. The file .htaccess remains ignored. This, I can not enable friendly URLs.


texts: Modify existing block programmatically by block id

texts:
I have a block with the id 'block-block-8'. In my template.php I would like to have a function that changes that block's content so I am able to add a dynamic "back to category link" (category needs to come frome the url) on my products page back to the category page.

Something like this:

function ga2012_block_view($delta = '') {
  $block = array();
  switch ($delta) {
    case 'block-block-8':
      $block = array(
        'content' => 'Back to $_GET["category"]',
      );
      break;
  }

  return $block;
}

Does someone has a working implementation of this code? Please ask me questions if I haven't been clear enough, thanks!


texts: how do I display both a term view and parent terms view on the same taxonomy term page

texts:
I am using search api views to override core taxonomy term pages. I would like to create a view that displays parent term content as well like a related content block. Or as a view I can use when results are empty.

I am not able to achieve this so far. I have tried the Parent terms (indexed) filter using every default argument combination I can think of. I have tried the indexed taxonomy terms filter also using every default argument I could imagine. What I assumed would be a very simple views has turned out to be rather complicated. I am starting to wonder if it is actually not a configuration problem at all but related to search api and might not even be possible in the first place.


texts: How to check in a rule if the data from a field collection has changed?

texts:
I want to add a rule (using the Rules module) for printing a message after changing a field in a field collection.

The field collection consists of the following three fields:

Reference to Version (type: Entity reference)
Related Entities (type: Term reference)
Related Properties (type: Term reference)

What I am using for Rule (I have attached a print screen from the rule

EVENT: "Before saving content of type X"

CONDITIONS: Here I am using NOT Data comparison, but it is useless...

ACTION:"Show a message on the site"

How can I check if the data from a field collection has changed?


texts:
Our server tech moved a site (www.ontario-internet.com) and now clients can no longer add items to the cart.

If I log in as an admin, I can add items to the cart and the site works perfectly.  I'm not sure what permission might have been turned off or if there is a damaged file somewhere.
I have gone through the permissions and turned on anything to do with the cart.  As well, I went into the views and it looks like the Master Access Permissions are set to none.

When I try to search content I receive these errors:

  Notice: Undefined offset: 606 in user_node_load() (line 3662 of
  /home/ontariointernet/public_html/modules/user/user.module). Notice:
  Trying to get property of non-object in user_node_load() (line 3662 of
  /home/ontariointernet/public_html/modules/user/user.module). Notice:
  Undefined offset: 606 in user_node_load() (line 3663 of
  /home/ontariointernet/public_html/modules/user/user.module). Notice:
  Trying to get property of non-object in user_node_load() (line 3663 of
  /home/ontariointernet/public_html/modules/user/user.module). Notice:
  Undefined offset: 606 in user_node_load() (line 3664 of
  /home/ontariointernet/public_html/modules/user/user.module). Notice:
  Trying to get property of non-object in user_node_load() (line 3664 of
  /home/ontariointernet/public_html/modules/user/user.module).

Can anyone help?  Should I supply any extra information?
Thank you in advance!!


texts: Quantity change after page change in Views with ajax

texts:
I'm showing products using Views and there is Ajax enabled, so I have ajax pager. Add to cart form with quantity is added in View as Product Reference field.

Everything is ok until I change page, after that + and - button doesn't work, but add to cart button working as usual.

I'm using Commerce Extra module in order to get + and - for quantity field.

Does someone had any experience with this or maybe idea how to resolve this problem?


texts:
Possible Duplicate:
  Quickest way to reimport menus and blocks (D7)

I need a way to easily transfer the block configuration from my staging site over to the live site.

I've been working on implementing a new theme for my client and showing them my progress using a staging site, which is basically a clone of the live site. The staging site's blocks configuration is completely different from the live site.

I've heard about the Features module, but unless i'm mistaken, it doesn't work with Blocks. Maybe I need to use Chaos Tools?

I'm just trying to avoid having to manually place each block in its correct position when it's time to go live, which would be very time consuming. Using exportable blocks sounds like a good idea, but I am unsure if it is a safe procedure.


texts: After creating separate user registration form in Structure > Display Modes > Form Mode and creating those forms in Configuration > People > Manage Forms, how do I use these forms? I want different roles on my site to use different registration forms to register different users.


texts:
I am using the built in blog module with Drupal 7, and I don't like the fact that "Every user gets a personal blog."

For instance, if a user with administrative privileges (Joe Schmoe from our company) makes a blog entry, within the blog entry, you will see a link for "view Joe Schmoe's blog." I would much rather it say "view (company name here)'s blog" or show nothing at all.

Unfortunately, I cannot find any settings for this. Is it possible to disable this feature or get this feature to work the way I would like?


texts:
Is it possible to transfer the content of a site that I develop locally with SQLite as a database to the live site which uses MySQL or PostgreSQL when it is finished?

I don't want to have to install MySQL or PostgresSQL locally on my laptop. Can backup_migrate module do it or does it export raw MySQL instructions?


texts: internal server error after deleting thumbnails image-style

texts:
I have an internal server error on my drupal site only when I log in, when logged out everything is fine.

I was having problems with the default image-styles, they would not work (no thumbnail preview) so I created a new style (thumbnail2), deleted the default thumbnail style and replaced it with thumbnail2 style.

Any ideas how I recover from this?

So 2 problems:
1. get access to admin again
2. get default images styles to work

Server log:
Symfony\Component\Routing\Exception\RouteNotFoundException: "Route "view.media.media_page_list" does not exist."


texts: How to enforce minimum height and width for image while resizing anything larger?

texts:
We have a requirement where the minimum and maximum image resolution 480x480 for an image on upload. The reason is that we want the image to be resized to be exactly 480x480.

However, whenever we upload an image that is larger than 480x480, we are constantly getting the following error message. Even when i modify the maximum to be 640x480 i still get the error message for an image that is 1200x968.

Need some help figuring out what could be the issue as i have tried to modify the maximum image resolution to be slightly larger than the minimum image resolution, but still get the error message.


texts: Whats wrong with my drush script when using sql?

texts:
Im running the following via drush scr

$query = db_query('select node.nid AS nid from {node} node where (type="feed_item") AND (status="0") limit 1');

i am getting this error:

  WD php: PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown
  column 'feed_item' in 'where clause': select node.nid AS nid from
  [error] {node} node where (type="feed_item") AND (status="0") limit 1;
  Array ( )  in include() (line 5 of
  /home/quickstart/websites/xc.dev/deleteme.php). [4.77 sec, 97.55 MB]
  PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column
  'feed_item' in 'where clause': select node.nid AS
  nid from {node} node where (type="feed_item") AND (status="0") limit
  1; Array ( )  in include() (line 5 of
  /home/quickstart/websites/xc.dev/deleteme.php). Drush command
  terminated abnormally due to an unrecoverable error. [4.79 sec, 97.55
  MB]

Whats wrong?


texts: Tags not rendering in the correct location

texts:
I have tags after body in article but its not rendering in the correct place.
Instead it displays at the end.

I have included the screenshot below.


texts: pass custom variable for image field from preprocess node to twig

texts:
I have a content type (gallery) with an image field which is unlimited: field_picture.
I have a logic which calculates custom css classes to their HTML containers, like: grid-item--width1, grid-item--width2, grid-item--height1, grid-item--height2.
I store these in the grid_class.
I can't merge these classes with the item class, because I want to style different HTML containers by them.

I tried to add this new variable (grid_class) to the image elements from the mytheme_preprocess_node__gallery and I thought drupal8 will pass them to the twig template.

function mytheme_preprocess_node__gallery(&$variables)
{
  foreach (Element::children($variables['elements']['field_picture']) as $key) {
    // here is my logic which calculates the classes for the image elements' containers
    $grid_class = "grid-item--width1 grid-item--height1";
    $variables['elements']['field_picture'][ $key ]['grid_class'] = $grid_class;
  }
}

but in my twig template (themes/custom/mytheme/templates/field/field--node--field-picture--gallery.html.twig) when I loop through the items, the grid_class isn't available.

{% for key, item in items %}

    {{ (dump(item)) }}

{{ item.content }}

{% endfor %}

I also tried to add it from mytheme_preprocess_field(). I saw the array of the field_picture element, but I didn't find the items in there.

any help or hints?


texts:
I'm currently developing a module for Drupal 6 to output my webform entries to a table that can be filtered and searched.

I've got an AJAX callback function that returns my sql query but I can't figure out how to add line breaks as the data from each form field is in different rows in the database as per the webform module.

This is my callback function so far

function web_form_table_get_table($arg1){

$query =    "SELECT nid, sid, cid, no, data " .
            "FROM webform_submitted_data " .
            "ORDER BY sid desc, cid, no";

$queryResult = db_query($query);

while ($webformTable = db_fetch_object($queryResult)) {

    $items .= '<td>' . $webformTable->data . '</td>' ;

}

if ($items == '') {
    $items = "Your search yeilded no results.";
    }

    return drupal_json(array('products'=>$items));
    exit;

}

I've attempted to add some if statements to check if 'sid' (form reference) has changed and if so to add a line break but this just causes the site to crash.

My jquery is as follows:

 // $Id$
 Drupal.behaviors.web_form_table = function (context) {
 $('a.getTable:not(.getTable-processed)', context).click(function () {
 var updateProducts = function(data) {
  $('#divProducts').html(data.products);
}
$.ajax({
  type: 'POST',
  url: this.href,
  success: updateProducts,
  dataType: 'json',
  data: 'partNo=' + document.getElementById("partNo").value +
        '&worksNo=' + document.getElementById("worksNo").value +
        '&serialNo=' + document.getElementById("serialNo").value +
        '&transType=' + document.getElementById("transType").value
});
return false;
}).addClass('getTable-processed');

}

Has anyone got any ideas on how this should be done?

Help! Thanks.


texts:
I am quite new to theming, and I am trying to figure out the right way of theming Quicktabs in D7. I would like to output the tabs as divs instead of as a <ul> list. Looking at info from Theme Developer tells me that the Quicktabs are defined by qt_quicktabs_tabset which in turn calls theme_item_list() .

I could override theme_item_list() in my template.php file, but it would require a lot of tweaking because the theme_item_list() is designed for outputting a list. So for the moment my approach is to make a new theme function available in a custom module  like this

function mymodule_theme() {
  return array(
    'mymodule_hook' => array(
      'variables' => array ('parameter' => NULL),
    ),
  );
}

function theme_mymodule_hook($variables){
  //here I can output my tabs as divs
}

and calling this in this way in template.php:

/**
 * Theme function to output tablinks for classic Quicktabs style tabs.
 *
 * @ingroup themeable
 */
function mytheme_qt_quicktabs_tabset(&$vars) {
  $variables = array(
    'attributes' => array(
      'class' => 'quicktabs-tabs quicktabs-style-' . $vars['tabset']['#options']['style'],
    ),
    'items' => array(),
  );
  foreach (element_children($vars['tabset']['tablinks']) as $key) {
    $item = array();
    if (is_array($vars['tabset']['tablinks'][$key])) {
      $tab = $vars['tabset']['tablinks'][$key];
      if ($key == $vars['tabset']['#options']['active']) {
        $item['class'] = array('active');
      }
      $item['data'] = drupal_render($tab);
      $variables['items'][] = $item;
    }
  }
  //normally theme_item_list() is called: return theme('item_list', $variables);
  return theme('mymoduletabs_hook', $variables);
}

function mytheme_mymoduletabs_hook($variables){
  //here I can finally output my tabs in divs
}

It's the first time I try this approach and would appreciate feedback. The intricacy of my solution worries me a bit - am I on the right path here?


texts: Commerce Cart is empty after adding an item to it until the cart page is reloaded

texts:
We have a strange issue where when an item is added to the Commerce Cart the cart is empty and the cart page says that the 'cart is empty'. However, simply reloading the cart page then show the item(s) in the cart.
This issue only occurs the first time an item is added to the cart. If the user then adds another item to the cart it works correctly (until the cookies are cleared)
Drupal 8 / Commerce 2 (latest).
Seems to only be for anonymous users.
We've disabled related custom module and the problem persists.
We've verified that the cart form View is standard and matches a new Commerce installation.
We've tried turning off the Cart View caching and turning on Ajax.
We've tried forcing no caching on the cart form view hook_form_alter
The site is always non-www and always https so there's no bouncing around occurring.
Please help!


texts: Do 'edit node' redirect via custom PHP code?

texts:
I have a rule for returning users to finish creating a cck form. I need to 'Do' custom PHP code to redirect the user to editing/finishing their cck form (node limiter limits user to only one PPE content item). The following does not work:

function ppe_edit_user_login(&$edit, $account) {
  global $user;
  $nid = db_query('SELECT nid FROM {node} WHERE uid = :uid', array(':uid' => $user->uid))->fetchField();
  drupal_goto('node/' . $nid . '/edit');
}

What am I missing?


texts:
I had added date field to webform. Is there a way to detect this date field to compare current date. If correct, it will send email.

I had download date reminder module, however it seem does not link with webform. Any solution?

Please note: This is totally not related to webform submission date.


texts: How do you handle long runtime updates needed in hook_install()?

texts:
I have a new module that includes a series of hook_update_N()s. I had written these without knowing that during module install the modules schema value is set to the highest value of hook_update_N() defined while the hook_update_N()s aren't actually run.

Several of the hook_update_N()s take advantage of $sandbox (Batch API), as they are lengthy database changes. As far as I know Batch API does not appear supported in hook_install().

What are my options to get these to run during module installation/deployment?


texts: Why aren't users able to post on Facebook while I can as administrator?

texts:
I am getting the following message while submitting a post.

  Refresh your session by visiting "admin/config/services/publish-away"
  and disconnect the Facebook app and reconnect it. OAuthException An
  active access token must be used to query information about the
  current user.

I have set all the setting correctly, and I can post from admin account but my users can't although I give them the right permission. What's wrong?


texts: show/hide a menu item based on specific user role

texts:
I have a certain number of main menus which need to showcased based on logged in user role.
for example user with the role, A can sees few menus and user with the role B, sees another set of few menus.


texts: How to recover datas from a class of service in a custom plugin?

texts:
So to be a little clearer, I'm creating a source migrate plugin that extends SourcePluginBase and not SqlBase. I get my data from a class of service, but I would like to know how to bind them to the fields () and prepareRow() methods in the documentation example? Since I do not have the query () method.

Any help?


texts: How to find which block is causing PHP errors?

texts:
I'm cleaning up a Drupal 7 site and currently its spitting out a bunch of PHP syntax errors pointing to some block that is causing it. It doesn't say which block but only says php_eval() error. So I'm assuming its in a block somewhere.

How would one find the culprit of which block it is that is causing this php error?

http://i.imgur.com/KJk1jr4.png


texts: How to send mail for every X months using rules?

texts:
In my user profile there is date of orientation(date field) from date(current date) and end date.

When user fills the date field, it should generate an Mail for every X months.
                  example-according to screen shots i have two date field when user have given from date(current date or future date)based on that date for both date fields should trigger a mail every X months.


texts:
I am quite new in developing in Drupal.

My problem is this, I want to change the URL sent in the email when the someone registers to my website. My website is in 192.xx.xx.xx/mywebsite.

How can i change the verification link from 192.xx.xx.xx/mywebsite/user/reset/some-hash-code to www.mywebsite.com/user/reset/some-hash-code.

I tried changing the $base_url in the settings.php but it crashes my site.

Thank you very much!


texts: Identifying drupal installation on windows

texts:
I don't want a google custom search to be shown on my development system which is on windows but it should be visible when on production system which is on Linux.

How do I check it?

This isn't working out. I've placed this code in the block "Pages on which this PHP code returns TRUE (experts only) " but it does not work in my Windows installation:

<?php
if(  file_exists("C:"))
{
return false;
}
return true
?>


texts: Why are my 'views' pages no longer displaying?

texts:
The two pages on my Drupal site that are created by the 'views' module are not displaying. They have displayed with no problem for over a year; this problem started today, as far as I can tell.

/directory  /allmembers  are displaying as completely blank (white) pages.  They are both 'views' modules.

When I go to /admin ,  I see this:
One or more problems were detected with your Drupal installation. Check the status report for more information.

Following the Status Report link to here  /admin/reports/status
I see a warning (yellow triangle) for Drupal core update status;  a red X for MS Core and Messaging PHP Mailer; and also a red X with the Unicode Library error:
  Unicode library Error Multibyte string input conversion in PHP is active and must be disabled. Check the php.ini mbstring.http_inputsetting. Please refer to the PHP mbstring documentation for more information.
(MS Core and Messaging PHP Mailer both appear to be items that we do not use on our site.)

I have checked in with my hosting provider; they restored an old version, but there is still the same issue.

I don't know enough about PHP to understand the Unicode error message, nor do I know why that would have changed at all in the past 24 hours.

Thanks for any assistance.


texts:
I am getting some type of timing out error and not sure how to fix it or even where to begin, the error looks something like this http://pastebin.com/M8Wz4KEY

/**
 * Block info
 */

function zillow_block_info(){
    $blocks['zillow_block'] = array(
        'info' => t('Zillow Block'),
    );
    return $blocks;
}

function zillow_block_view($delta = ''){
    $block = array();
        switch ($delta){
    case 'zillow_block';
        $block['subject'] = t('Zillow Block');
        $block['content'] = drupal_get_form('zillow_form');
    break;
    }
    return $block;
}

/**
 * Form Info
 */

function zillow_form($form, &$zinfo){

    $form['description'] = array(
        '#type' => 'item',
        '#title' => t('Get your mortgage rates'),
    );
    $form['rates'] = array(
        '#type' => 'fieldset',
        '#title' => t('Mortgage Rates'),
        '#collapsiable' => TRUE,
        '#collapsed' => FALSE,
    );

    $form['rates']['state'] = array(
        '#type' => ('select'),
        '#title' => t('Choose One'),
        '#options' => array(
            'CA' => t('California'),
        ),
        '#required' => TRUE

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

/**
 * Api info
 */

function zillow_api_info($form, &$zinfo){
    $state_value = $zinfo['values']['state'];
    $zillow_id = 'Xx-xxxxxxxx-xxxxxx';
    $xml = file_get_contents('http://www.zillow.com/webservice/GetRateSummary.htm?zws-id='.$zillow_id.'&'.$state_value.'');

    foreach($xml->response->today->rate as $todays_rates){
        print $todays_rates;
        '
';
    }

    foreach($xml->response->lastWeek->rate as $lastWeeks_rates){
        print $lastWeeks_rates;
        '
';
    }

    return zillow_api_info();
}

/**
 * Submit Info
 */

function zillow_form_submit($form, &$zinfo){
        drupal_set_message(t('this is the info the form has submitted. zip=@zipcode, states=@states, todaysrates=@todaysrates',
        array('@states' => $zinfo['values']['state'], '@todaysrates' => zillow_api_info())));
    }


texts: How to custom theme Inline Entity Form (IEF) - using a .tpl.php file

texts:
Is there a way to theme the Inline Entity Form (IEF) for example creating a .tpl.php file for that form and just declaring it on the theme's template.php?

I wanted to create a .tpl.php specifically since I want to add in custom codes in the form like, views, a little html, jquery and css.

Any help would be greatly appreciated.


texts: How do I get $entity in hook_form_alter()?

texts:
hook_add_form() gets $entity_type and $entity as parameters, but hook_form_alter() does not have any of those parameters.

How do I get the entity type and the entity object in hook_form_alter()in Drupal 7?


texts:
I've path alias and taxonomy menu. Now menu displays taxonomy link as vocabulary_name/term_name.

For example, my vocabulary name is 'category'. I want to change into 'article'. I've to only for this situation. I've used path alias. Unfortunately my view link looks like same.

I've tired hook_menu_alter() and hook_menu_link_alter(). But there is no luck. I need your suggestions.


texts: Changing the layout of a Taxonomy Term Page

texts:
By default my taxonomy term page lists all articles using this term in 2-columns. I would like to change it to a 1-column layout.
(1) I have created a custom display layout for the taxonomy group:

(2) And selected the one column layout:

Still it doesn't work. Any other changes, like adding a field, do work though. What am I missing?
Note: I did clear the cache.


texts: Template files do not work when in "Templates" directory

texts:
I have a custom theme that I have created, that contains a .info file, and various .tpl.php files.  The problem is that these templates wont be recognized by Drupal (7).  I've tried clearing all of the caches and re-uploading the files with no avail, as well is restoring the database.

This theme works fine on a local server, but whenever the site is migrated to my staging server, the template is not recognized. The theme will show up in the admin interface under the appearance tab however and is enabled as default.

There are no errors in "recent log messages"


texts: Make a views listing of nodes in Search API with multiple parameters to sort and more

texts:
Facts:

I'm working on a classified ads (Cars and Parts) website that people can post their ads with the ability to make the ad Featured or Promoted (Using Flag module)

What is a featured Ad: if an ads is featured it will show up and stays at the top of the list and the design is a bit different (like any other websites with featured ads)

What is a Pormoted Ad: Users can promote their ad and boost the ad to the top of the list everyday so it stays at the top, wether it's Featured or not.

On the search results page, I'm using Search API, Search API Sorts and FacetAPI.

Requirements

Since there is a lot of options to filter the search results, I wanted to use Ajax for better user experience and performance, also I want to keep the result page in this order even if it gets sorted or filtered:

Featured Ads (Prioritized by Promoted date Featured Ads then
Submitted Date)
Promoted Ads (Prioritized by Promoted date and submitted date)
Free Ads (Prioritized by Submitted date)

So I want to be able to sort and filter my results but still keep the main priority.

so I tried Ajax Facets module but since it doesn't generate URL the rest of my website functionality kinda breaks!

Also tried Search API Sorts and Facet API for filtering and sorting, but it breaks my priority of displaying the ads (featured, promoted, free), even if I add some criteria in it's views.

Case Study:

A good case study is http://jobs.drupal.org, it has everything that I want except the Promoted part!

Thank you so much in advance.


texts: How can I add a Dismiss Button to a Webform Modal Conformation?

texts:
I added an extra close button to my webform confirmation modal in a Bootstrap 4 theme:
<button class="btn btn-primary" data-dismiss="modal" id="button-close-modal" type="button">OK</button>

Then I added a script to act on that button, but it doesn't seem to do anything:
(function($) {
  Drupal.behaviors.hideModal = {
    attach: function(context, settings) {
        $('#button-close-modal', context).on('click', function(e){
            $('.webform-confirmation-modal', context).modal('hide');
        });
    }
  };
})(jQuery);

Nothing in the console to give me a clue as to what may be happening. I tried .modal('toggle') and that didn't work either (although at least I could visually see a change).
I also tried $('.ui-dialog-titlebar-close', context).click();, but that didn't work either.
Note: I have the "Webform Bootstrap" module enabled.


texts: How to generate a stack trace upon errors

texts:
I am sysadmin trying to debug a Drupal site. In my server logs I can see Drupal making the same requests again and again to our Solr instance until PHP eventually runs out memory, and Apache returns a 500 error.

How can I configure Drupal to log a stack trace somewhere on the disk?


texts: How to sort view by a field that is part of a field collection?

texts:
I had searched solution for my problem, but I didn’t found anything good.

I have custom a node type Client with Field Collection Product.

My field collection has two fields:

name of the product
date value

In the view I can see Client fields name & surname and field collection Product & date value.

How can I sort by date value?


texts: D7 - Rules System Page Redirect not working at all?

texts: I've been trying to add action Page Redirect to my rule (after a coupon code is applied to an order), and it doesn't work in any scenario? I did a bit of digging and it seems this is common - anyone know why it's happening/what the fix is?


texts: drupal 7 is trying to get js and css via https and this breaks the site

texts:
For some reason, anonymous users see my site as broken, and I realised this happens because pages call js and css files with https. But I don't have ssl configured, so this breaks.

What could cause this issue? I have no clue why this is happening.


texts: When does Drupal load variables from the database?

texts:
I am writing a report module so that users can flag posts and write a description. This module has a block that shows the unwatched reports; every time this block is shown it gets the number of unread reports from a table.

Is it better to use the Drupal variable system to set the number of unread reports?
When does Drupal load the variables from the database? Does it load them when I call variable_get()?


texts:
I am trying to unpublish some content by going to admin/content and then checking the chechbox for those content and then in update options i do a Unpublish selected content but then i get an error: The website encountered an unexpected error...I check the logs i get the error:

PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value:
 '' for column 'field_time_to_finish_countdown_timer' at row 1:
 INSERT INTO {field_data_field_time_to_finish} (entity_type, entity_id,
 revision_id, bundle, delta, language, field_time_to_finish_countdown_timer)
 VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2,
 :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5,
 :db_insert_placeholder_6); Array ( [:db_insert_placeholder_0] => node
 [:db_insert_placeholder_1] => 135 [:db_insert_placeholder_2] => 174
 [:db_insert_placeholder_3] => challenge [:db_insert_placeholder_4] => 0
 [:db_insert_placeholder_5] => und [:db_insert_placeholder_6] => ) in
 field_sql_storage_field_storage_write()
 (line 448 of
 /home/qa/ypwb/public_html/modules/field/modules/field_sql_storage/field_sql_storage.module).

What is this and how can i rectify that?


texts:
I created some blocks, and I assign them to regions for specific layout using context (and context_omega). now I can't see these assigned block in the admin/blocks. but I can see them being rendered, and I can edit them via URL. is it normal for context? or there's problem somewhere?
BTW I cleared the cache :)


texts: Having problems with OpenLayers in Drupal 7

texts:
I had some issues with a site I'm building so I decided to start over with a fresh Drupal install... but when I install/enable OpenLayers I get this ugliness http://pastebin.com/XJYy76n1

I have absolutely no idea what can this be and it's been driving me a little crazy for the past couple of days.

Any ideas?

Edit: for some additional incomprehensible info, I just enabled the test suite and ran it against the openlayers module and got the following: http://pastebin.com/MHdtHxNm


texts: How do I check if a link exists in a page?

texts:
There is a form having a link clicking on which field set will be collapsed to show fields under it. HTML is shown as below.

    Hide
    Attach

How would I go about checking if this link exists (to click on it), and the fields under it are shown?