texts: How to display the user's preferred language in a User profile page

texts:
In a Drupal 8/9 site, I can select the User's preferred language.
In the "Manage form display" page (for user's fields), there are two rows which are about language:

Language settings (settings = --no settings available--)
Language code (settings = "language select" as the only option)

Question 1 : What do these two options produce?
In the "Manage display" page, I can display only one item about the language : Language code
As a result, if I visit my user profile page, I can see:

Language code: French

But if I change my preferred language in my user edit profile page into Dutch, there is no effect in my "User view" page: it is always "French"
ok, I can preprocess something and adapt the twig template to display my preferred language but this is not the answer I would like to have.
Question 2: I would like to understand this behavior because, as always in Drupal, I am sure there is a good reason for that.


texts: How to hide nodes in a VIEW where the user is not referenced?

texts:
This is a follow-up to How to show nodes where the user is (not) in the reference field with Views?

I have a node with multiple user references and need a node VIEW that hides all nodes where the current user is NOT referenced. So, if the current user is not referenced, the node should not show up. The problem I just can't solve is that the node still shows up when other user are referenced (using exclude, it only excludes the current user from display, but it still displays the nodes for each other user that is referenced). I have unsuccessfully tried views_distinct module and VIEWs own "distinct" query settings.

If the user is referenced, the node should show up (this works from the above mentioned question)

CLARIFICATION:

Basically, it’s for a simple pay-per-view site. I need 1 (or 2, whatever works) VIEWS that shows the videos where the user has purchased access to (where he is referenced) and where the user has not purchased access to (where he is not referenced). After 48 hours the references are removed using rules scheduler.

Ideally in one VIEW, when the user is referenced, the link should be „watch“, where the user is not referenced, it should read „buy“ using VIEWS conditional and rules link. But two separate VIEWS are also ok.

Right now I have a content view (also tried it with a user view unsuccessfully, but this might be a saner approach?!). All of that works well with the notable exception of showing the nodes with multiple user references.

UPDATE:

Added a screenshot using the views argument substitutions.

UPDATE 2:

I tried it with regExpressions and views substitutions. The UID of the currently logged in user is passed as !1, but what is the correct regEx syntax to show only the nodes, where this user is not referenced?

This does not work as value of the operator on the useraccess field filter:

^***!1***

SOLUTION

Oh boy, this was a ride. Finally figured out a solution. Posting it if someone needs it. Basically, I added the username in the url and do a contains text comparison using views conditional. ID from the logged in user did not work as contains also shows user ID "13" or "14" when the user "1" is logged in. Simply excluding did not work in those cases where other users are referenced as well.


texts: How to get the "field" value of config entity, with bundles, that is defined in a bundle while creating content

texts:
I am creating a custom entity (WebsiteType) with bundles (Website), where I want to define a URL, among other configurations, that all content in a given bundle should inherit.

I created the fields in the config entity type and managed to show and save these fields while creating a new bundle. Nevertheless, I couldn't manage to get these values in HOOK_entity_presave.

here is a sample of the code:

src/Entity/WebsiteType

Notation:

 *   entity_keys = {
 *     "id" = "id",
 *     "label" = "label",
 *     "uuid" = "uuid",
 *     "service_endpoint_url" = "service_endpoint_url",

Class:

class WebsiteType extends ConfigEntityBundleBase implements WebsiteTypeInterface {
  /**
   * The Website type Service Endpoint URL.
   *
   * @var string
   */
  protected $service_endpoint_url;

}

 /**
   * {@inheritdoc}
   */
  public function getServiceUrl() {
    return $this->service_endpoint_url;
  }

WebsiteTypeForm:

public function form(array $form, FormStateInterface $form_state) {
  $form = parent::form($form, $form_state);

  $website_type = $this->entity;

  $form['endpoint_settings']['service_endpoint_url'] = [
    '#type' => 'textfield',
    '#title' => $this->t('Argir Endpoint URL'),
    '#maxlength' => 255,
    '#description' => $this->t("The location of your service."),
    '#required' => TRUE,
    '#default_value' => $website_type->getServiceUrl(),
    '#attributes' => [
      'placeholder' => $this->t('https://XXXXX.com'),
    ],
  ];
}

WebsiteTypeInterface:

interface WebsiteTypeInterface extends ConfigEntityInterface {

  public function getServiceUrl();
}

I followed the documentation of Drupal of Entity API

Checked the answer here: enter link description here

also went through this outstanding tutorial: enter link description here

Tried to work with EntityTypeManager

All of that with no luck. Any advice is highly appreciated.


texts: AJAX autocomplete based on other field value

texts:
I'm trying to implement an auto complete form with a little twist. I want its auto complete options to be limited by another field (text field to be more specific).

I understand how AJAX API works and should able to create an auto complete filter for a field based on it's own values but I have no idea how to create a an a auto complete filter based on another field in the form.

From what I have found only this question is similar to my problem, it is unfortunately unanswered. I don't want the code, just hint where to look would be useful.

BTW: I have came up with a solution but it's unbelievably dirty hack that requires going into database twice. I could implement AJAX callback for the field I want the filter to be based on, store the value of the field in the callback to custom database table and then in the callback of the field I want to filter get the value and make it work.

BTW2: The field I want to base the filter on will be text field, the other one custom entityreference.

BTW3: I'm almost sure it is possible somehow since the entityreference option limit module does something like that. (It does it with a help of one other field which I don't want (And I didn't understand it at all even though I tried anyway :) ))


texts:
I've created a view with a page display, filtering on a specific node type. The view's URL is /admin/poi.

Now I want to create a local task, linking to this view, for all nodes of type poi. The local task is showing, but it is visible when viewing/editing any node type, not just my POIs.

wt_poi.routing.yml

wt_poi.admin_list:
  path: '/admin/poi'
  requirements:
    _permission: 'access administration pages'
    _custom_access: '\Drupal\wt_poi\Controller\WtPoiController::isAllowedPoiAdminList'
  options:
    _admin_route: true

wt_poi.links.task.yml

wt_poi.list_overview:
  route_name: wt_poi.admin_list
  base_route: entity.node.canonical
  title: 'List all POIs'
  weight: -9999

src/Controller/WtPoiController.php

<?php

namespace Drupal\wt_poi\Controller;

use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Access\AccessResult;

/**
 * Controller for the POI node type tasks.
 *
 */
class WtPoiController extends ControllerBase {

  /**
   * Used to limit visibility of local task "List" to POI node type
   */
  public function isAllowedPoiAdminList() {
    $bundle = false;
    $node = \Drupal::routeMatch()->getParameter('node');
    if ($node instanceof \Drupal\node\NodeInterface) {
      $bundle = $node->bundle();
    }
    return AccessResult::forbiddenIf($bundle !== 'poi');
  }
}

Why is my _custom_access check not hiding the local task on other node types?

UPDATE: There seems to be an access check, but it is coming from "Access" in views module "Page settings" and my own access check is completly ignored. Best case would be my access check in addition to the view's access check, in a pinch I would prefer my own custom check replacing the view's access check.


texts:
I've just moved my drupal site from it's development server(just a VM on my home pc) over to it's new home, and all except the URLS are working.

I've setup the new server exactly like the development server, installed mod_rewrite, copied .htaccess, apache2.conf and httpd.conf word for word, yet, regardless of which page/node is displayed, the only thing in the URL is the domain name.
And if I try to navigate to a specific node via the URL, it loads the front page instead of the intended node.

I'm not sure if this is related, but when drupal provides a link to a node, like the Welcome email for first time login, it uses the server's IP address in the URL, instead of the domain name.

Any help with this would be greatly appreciated!

Cheers,

Matt


texts: Print multiple files field links, descriptions and file extensions in Twig

texts:
I have a content type with a field field_file_attachment that allows uploading multiple files with txt, pdf, gif and img extensions.

I would like to get links, descriptions and extensions of all these files printed in my Twig file node--page--full.html.twig.

Is this possible? Should I create a preprocess function for page?


texts: Import images from RSS with Feeds module without Feeds Image Grabber

texts:
I'm passing all the sites from D7 to D8 and so far so good. But one of my sites gives me a couple of problems.

I was populating the RSS site in Drupal 7 using Feeds Image Grabber. Now, Feeds Image Grabber for Drupal 8 is not there. So how do I get RSS images then?

I read that maybe you can do it with the Feeds extensible parsers module.

Any advice?


texts:
I have two custom content types, Speaker and Presentation. Each speaker can have many presentations. I am using the EntityReference module to attach a Speaker to a Presentation.
Using Views, I would like to create a page of Presentations that also lists the Speaker associated with the presentation such the page would look something like:

Presentation 1
details
Attached speaker details

Presentation 2
details
Attached speaker details

Presentation 3
details
Attached speaker details

How do I do that in Views. I followed the EntityReference documentation but it only talks about creating a block for a single node. I want to be able to show multiple Presentation nodes on one page using Views and EntityReference. Thanks in advance for any help anyone can provide.


texts:
I have a custom form which can be accessed from different places inside the website. The form itself is inside the admin overlay.
When the form is submitted, I want the user (administrator) to return to the place where he accessed the form. The form can also be accessed from within the overlay.
Inside the submit handler I use a form redirect to return but I don't have a clue how to determine the url of the previous page to return to.

// $_SERVER['REDIRECT_URL']?
$redirect = 'set redirect url'
$form_state['redirect'] = $redirect;


texts: 301 redirection doesn't happen in redirect module when we save path alias of a node in Source

texts:
I installed Redirect module in Drupal 8 and here during adding redirect it accepts and save the data for all valid value.

But when I try to save the path alias of a node in source, it saves successfully, but the redirection does not happen; the same happens when I save node/{id} in source redirection happen properly.

Why isn't the path alias redirected in case of saving it in to the source?

Wildcard is also not working.


texts: How to configure Wysiwyg + Ckeditor Library not to breaks source code lines

texts:
I'm using WYSIWYG Module with ckeditor as an editor.
I use it with the full_html format

My problem is that when switching from the rich-code to the source code view all the line breaks are removed.

So this portion of code :

Nemo enim ipsam voluptatem quaerat voluptatem.

Doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.

transforms into something like this :

Nemo enim ipsam voluptatem quaerat voluptatem.

Doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.

Is there a configuration that prevents this from happening ?


texts:
What module should I use to make a tabbed block bringing views, custom content or forms?

For example I want to have a
News | Twitter | Facebook | Feedback

Which would have a list of news (or a news block), twitter updates etc.
Feedback would have a form.

Any suggestions?


texts: jdrupal entity_index success function not called

texts:
I have an ionic 1 app with jdrupal. In a controller i query a remote api with this code:

// If logged in:
console.log('Hello ' + Drupal.user.name);

// Get the Contacts list.
var query = '';
var options = {
   'service': 'rest/basic',
   'resource': 'contact'
};

console.log('before entity_index');

entity_index('contact', query, options, {
   success: function (result) {
      console.log(result);
   }
});

the success function is never called. With Drupal.settings.debug = true; i can see the result is returned from the server. Status is 200, response contain my array of objects, but no success function call.

If someone has an idea?

thx,
david


texts: How can I customize the node/add form for a content type?

texts:
How can I add some help text above the form used to create a node of a specific content type?
What is the best way to do it in Drupal 7?


texts: How do I dynamically add og:image meta tags in drupal multisite

texts:
I have drupal 8 multisite setup, where I am creating multiple site using some script technique and rendering the data using domain name via twig files by fetching from dynamodb records.

So my question is how do I add /update meta tags dynamically in my theme template files to preview thumbnail when I share any node on social media.
I want to display the site logo after fetching it from dynamodb records. As of now it is displaying some random image from network of the website page.


texts: Same drupal webform is showing error messages in two different way, on different palces in the same website

texts:
I am using drupal webform for my website, I am using single Contact Us form on multiple places in my website.

But the problem is on different places the way of showing error message is different, its not uniform through out the website.

Here is the image that shows the first way that how error messages comes-

and here is the image that shows the second way to show error messages-

I want first type of error messages which is in red box.

Please help me that how can I achieve this.

Thanks


texts: Conditionaly display fields of another node on a node page

texts:
I am a Drupal beginner, have some CMS and PHP knowledge. I am strugling with a case which intuitively seems like a thing that had to be been solved many times.

I have these content type:

Product with 2 fields description and company.
Company with various fields but the ones that matter here are company_intro, company_address.

When I create a product page, I fill in the description and choose a company from a list. When I present the product page to the user, I want it to start with "company_intro" from the selected company, followed by the description and ending with the address.

Is that possible?


texts: Nodes appearing but when clicked "page not found"

texts:
I recently migrated a site and some nodes don't appear in the content list but they do appear in Views I've created. When they're clicked however (example.com/node/123) it just returns a Page not found.

The node is in the database, both in the node table and the node_revisions as well as the relevent CCK tables.

What could possibly be causing this?


texts: How do you change the default value on a CCK text field that is part of a field group via hook_form_alter()?

texts:
I'm trying to programmatically set the default value (#default_value) on a textfield added via CCK. This field is in a field group. Here is my code:

/**
 * Implements hook_form_id_form_alter().
 */
function EXAMPLE_form_profile_node_form_alter(&$form, $form_state) {
  // We need to jump into a CCK field, so say we all.
  $form['#after_build'][] = 'EXAMPLE_form_profile_node_form_after_build';
}

function EXAMPLE_form_profile_node_form_after_build($form, &$form_state) {
  $form['group_company_profile']['field_pro_name']['#default_value'][0]['value'] = t('test');

  return $form;
}

I've tried various other points in the array and nothing seems to work. Both CCK and my module are weight 0. I must be missing something super obvious...?

UPDATE: One mistake was the field name. It should be field_pro_name. Updated above. It's still not working. Interestingly, I can use the after build to change the field title with:

$form['group_company_profile']['field_pro_name'][0]['value']['#title'] = 'ttt';

However, none of these changes the default value:

// In form alter:
$form['group_company_profile']['field_pro_name'][0]['#default_value']['value'] = 'ttt';
$form['group_company_profile']['field_pro_name'][0]['value']['#default_value'] = 'ttt';

// In after build:
$form['group_company_profile']['field_pro_name'][0]['value']['#default_value'] = 'ttt';
$form['group_company_profile']['field_pro_name'][0]['#default_value']['value'] = 'ttt';


texts:
Okay so I have a headache trying to figure this one out. I am working in Drupal 7 with the Omega theme. Trying to get a js file to work.

I have a js file that is set up through the .info file and is showing in view source. The file contents are below. I can get this to work when I place in the wysiwyg on the page however it won't work when I set it up properly as a .js file.

 (function ($) {
// All your code here
  $('#block-menu-menu ul.menu').removeClass('menu').addClass('sub-menu');

// Create the dropdown base
  $("<select />").appendTo(".menu");

  // Create default option "Go to..."
  $("<option />", {
     "selected": "selected",
     "value"   : "",
     "text"    : "Go to..."
  }).appendTo(".menu select");

  // Populate dropdown with  items
  $(".menu a").each(function() {
   var el = $(this);
   $("<option />", {
       "value"   : el.attr("href"),
       "text"    : el.text()
   }).appendTo(".menu select");
  });

  $(".menu select").change(function() {
    window.location = $(this).find("option:selected").val();
  });

})(jQuery);

My issue is it works when placed in the page, but when I place in the .js file and call it through .info it won't work. Again the file shows up in the view source so it is there. I have to be missing something. NOTE * I am not a developer.

Any thoughts?
Thank you!


texts: How to override taxonomy page with users view?

texts:
When I enable provided views, it works all right. But for one taxonomy dictionary (let's name it dictionaryname), I want to display users in that taxonomy, not nodes. So I disabled default view again and then:

I created "show users" view with path taxonomy/term/% and it fails to replace taxonomy page.
Then I changed path to dictionaryname/% - as path alias is set. But it fails as well.
I changed path to aaa/% and it works, so I know view on it's own works. It just fails to override default pages.

Any idea what am I doing wrong? And how can I get dictionaryname/% path to work?
It looks like Drupal's router give original term pages precedence over my view.


texts:
I want to use views supertable with views bulk operations but when I choose the format "jQuery Supertable" the bulk views operations doesn't work.
Any body has face the problem,or is any other solution because I need to use the jquery filter to select multiple users from the table of the view.


texts: Manual ajax callback on saved dropdown value

texts:
Normally the #ajax property of a form item launches a ajax callback. So when you select an item of a drop-down menu it will be triggered.

In this case I use variable_get() to see if the drop-down menu value has already been saved on that admin page. If it is I use it as the default value. But in that case what does not happen is the ajax call that is associated with that value.

So this is what I would like to have:

if(isset(variable_get('dropdown_value'))) {
  // Manually call ajax callback function, just like the one in $form[item][#ajax][callback].
}

Does anybody know how to do this? I would prefer to use php instead of JavaScript.


texts: Alter form to have single radio button term reference checked by default

texts:
I have a taxonomy reference field and in the node creation form there will be only one value allowed and I guess I use a radio button and I want it to be enabled by default.

I thought I can do it with form_alter but on inspection in krumo I see the default values are set to the concrete term id.

If I would want to set that id (which I do not know) it could look like:

 form['field_abteilung'][LANGUAGE_NONE]['#default_value'] = 12345;

For various users and their roles there will be other another allowed option in this form and I just want to do sth like

 form['field_abteilung'][LANGUAGE_NONE].... My-single-radio-button = checked;

Update

I saw I can find out the single option by looking into

$form['field_sektion'][LANGUAGE_NONE]['#options'][2]

I tried it but get an error about missing index 'field_sektion' which confuses me.

update 2
It takes some time, I maybe should have mentioned that the field in the end should be the access control field of https://drupal.org/project/workbench_access , that module also alters the form; I disabled the field's access function first and now need to rebuild all


texts:
How do I get the domain name so that I can put an absolute path for images in my theme? I'm developing on a development server and want to move it live eventually.

I can't figure out a way to get the domain.


texts: Exposed Form Block results on another Panel page

texts:
Using Drupal 7.16 and Panels 7.x-3.3: I have created a View and exposed it's form in a Block. Then I have created two Panel Pages:

/search which displays the Exposed Form Block
/results which displays the View's Content Pane

Now whenever I submit the Exposed Form Block, it redirects to the root page (/). I am aware of the "Inherit Path" setting, but that changes nothing to me. As far as I understand, this setting isn't what I'm looking for, anyway.

How do I get the Exposed Form Block to submit its query to the page where the corresponding View Content Pane is placed? Is modifying the code the only way to achieve this?


texts:
When installing Drupal for different sites I find myself frequently installing the same modules over and over again.  In the interest of DRY, how can I create a kind of custom site "template" which would allow me to install drupal and have the basic modules I install already installed, basic theme set, and possibly some other common configuration options set?

I've read a little about Drupal profiles and I've seen the Drush tool and perhaps there are other tools besides these.  I'm wondering what's the best way to do this?

UPDATE

Ok so it seems Drush make and Drupal installation profiles are the correct tools for the job.  I found these blog posts which talk about them:

Overview

Drush make

Installation profiles

I feel like I've got almost all the puzzle pieces.  What I'm still not clear on is how to combine the drush make process with the profiles?  How do you get your profile files into the profiles directory of the drupal install that drush make creates?  Or should I just do this via a shell script?

UPDATE 2

I found this video:

http://chicago2011.drupal.org/sessions/zero-distribution-using-features-profiler-and-drush-make

which explains using drush make with profiler.  Seems like the connection between drush make and profiles is you have one drush make file which downloads only drupal and your profile.  Then inside your profile "module" you have another drush make file which will download all your module components.

The video also talks about features which is another level of drupal setup automation.

I'm not sold on this work flow.  It all seems a little convoluted.  However this was my first exposure so maybe I will appreciate it more later.  I like drush make but I'm thinking I can use drush to enable modules instead of messing with profiles.  I think I will make a bash shell script that runs drush make and then uses plain drush to enable modules.

Next step would be how to do some configuration of the modules in a repeatable way.  I guess this might be features?  Or maybe I should look further into profiles.


texts: How do I completely unpublish a node (not just change revision state) when using Workbench Moderation with rules?

texts: I am attempting to use rules scheduler to automatically 'archive' content after a set period. Essentially, I want the content to disappear for everyone except administrators. Ordinarily, I would just use the standard 'unpublish node' action, but I have installed workbench moderation and this does not unpublish the node. If I attempt to simply change the revision state to Draft, the state changes but the node is not unpublished. Is there any way I can unpublish the node programatically? Should I look at some kind of access control module instead?


texts: How do convert mysql query with sub queries to a db_select version?

texts:
Below is a mysql query that returns a proper result set. How can I convert this into a db_select() version?

SELECT p.id, u.name, pa.field_address_2_value, pa2.display, pa3.field_company_value
FROM ms_order_products p
LEFT JOIN ms_orders o ON p.oid = o.oid
LEFT JOIN users u ON o.uid = u.uid
LEFT JOIN
(
    select *
    from field_data_field_address_2

) pa
ON u.uid = pa.entity_id
LEFT JOIN
(
    select *
    from ms_order_adjustments

) pa2
ON o.oid = pa2.oid
LEFT JOIN
(
    select *
    from field_data_field_company

) pa3
ON u.uid = pa3.entity_id
WHERE p.id = 'RM11'


texts: How can I make db_query SELECT LIKE case insensitive?

texts:
I'm querying for an email address where I can't force the case of the search term or the data in the table. It's an API thing.

How can I convert this query to be case insensitive?

$results = db_query(
 'SELECT email_address
  FROM email_address_table
  WHERE (email_address LIKE :mail)',
  array(':mail' => '%' . db_like($mail) . '%')
)->fetchAll();


texts:
I have an uploaded file my_cat.jpg
Upon upload, the file-entity's name is by default populated with the file's filename.

Try one: In views, adding a field file:name to my view first looks like the correct answer.
But that's the file-entity's name, which can, even after the upload, be changed to eg. My cat, while the filename on the disk will never change.

Try two: If i add a file:path field, i can decide if it should output the Download-URL or the internal Filestream-Adress.
But no way to leave out the path completely...
From the field's name, that's not a big surprise.

So, how can i get just the filesystem-filename my_cat.jpg?


texts:
I want to get the record ID for the last inserted row in a database table. I am trying to use db_last_insert_id(), but it is throwing an exception.

  Call to undefined function db_last_insert_id()

How do I get last inserted record ID?


texts: My module adds a CCK field to an existing content type. How do I then modify an existing view to sort using the new field?

texts:
I am building a new module ('best_answer') that builds on the functionality an existing module ('answers').

The new module adds a new CCK field ('best_answer_p') to a CCK content type ('answer') that was defined in the original module.

The original module also defined a view ('question_answers') which lists answer nodes, sorted by several factors. I'd like to modify this view so that it also sorts by the new field 'best_answer_p'.

I could do this by simply overriding the view, using the Views UI. However, what this means is that if any other module also wants to override the view in some way, my 'best_answer' sort will be lost.

So, I'd like to do this in a way that programmatically alters the existing view instead of overriding it. I am trying to do this using Hook_views_query_alter. But I run into an error.

Could anyone point me in the right direction?

Here is my code:

function best_answer_views_query_alter (&$view, &$query) {

  if ($view->name == 'question_answers') {

    // add the best answer field to the query
    $query->tables['node']['node_data_field_best_answer_p'] = array(
      'count' => 1,
      'alias' => 'node_data_field_best_answer_p',
    );

    // sort answers so that the best answer is displayed first
    $new_orderby[0] = 'node_data_field_best_answer_p_field_best_answer_p_value DESC';
    foreach ($query->orderby as $key => $value) {
      $new_orderby[$key+1] = $value;
    }
    $query->orderby = $new_orderby;

  }
}

Here is the error:

  user warning: Unknown column 'node_data_field_best_answer_p_field_best_answer_p_value' in 'order clause' query: SELECT node.nid AS nid, votingapi_cache_node_points_vote_sum.value AS votingapi_cache_node_points_vote_sum_value, node.created AS node_created FROM node node LEFT JOIN votingapi_cache votingapi_cache_node_points_vote_sum ON node.nid = votingapi_cache_node_points_vote_sum.content_id AND (votingapi_cache_node_points_vote_sum.content_type = 'node' AND votingapi_cache_node_points_vote_sum.value_type = 'points' AND votingapi_cache_node_points_vote_sum.tag = 'vote' AND votingapi_cache_node_points_vote_sum.function = 'sum') LEFT JOIN content_type_answer node_data_field_answer_question ON node.vid = node_data_field_answer_question.vid WHERE (node.status <> 0 OR (node.uid = 1 AND 1 <> 0) OR 1 = 1) AND (node.type in ('answer')) AND (node_data_field_answer_question.field_answer_question_nid = 2) ORDER BY node_data_field_best_answer_p_field_best_answer_p_value DESC, votingapi_cache_node_points_vote_sum_value DESC, node_created DESC LIMIT 0, 10 in D:\xampp\htdocs\drupal\sites\all\modules\views\includes\view.inc on line 771.


texts:
In my website, users can connect, see their profiles, update their profiles and visit other users profiles

So for each users, I created a profile page user-profile.tpl.php

But I've some troubles when I'm visiting other users account.

For example in my account profile page, there is a link who's redirecting me to the edit page.

I wrote this code for showing the edit link :

<?php
  global $user;
  print l(t('Update my profile'), "user/{$GLOBALS['user']->uid}/edit");
?>

When I'm visiting a random user page, this link appears. But I want it to appear only on my profile page

And it's the same for my profile picture, when I'm visiting a random user page, my picture is always showing.

<?php
    $user_item = user_load_by_name($user->name); // or user_load( $user->uid )
    print theme('user_picture', array('account' =>$user_item));
?>

I have no idea how to fix theses problems, that's why I need your help (I'm new to Drupal btw)

(I'm using Profile2)

Thanks


texts:
I have a created a content type in Durapl7, and now I want to customize the validation for the add form on the website.

Please see attached image for what I got so far,

But my main problem is Validation, in durapl the validation (see the validation message in attached image) is showing all at once at the bottom, but I want it differently, see the bellow image

Now, here I want each field to be validated separate on each field change, and it will show valid or invalid message with each field.

I really appreciate your help!


texts:
I want to upload mulitple image at a time , for more clarification i have mention below link

http://www.olx.com.pk/posting.php?categ_id=378

when you click on add photos , you can upload 20 picture at a time.


texts: Content not displaying formatting - removes HTML despite settings

texts:
On any content I create the formatting shows in the WYSIWIG editor but does not show up on the rendered page. I have tried to put it into each filter format ( Full HTML, Filtered HTML, Plain text ) with no change. So to make it really clear what is happening: I create and article with the body set as

Test Content

More test Content

or

Test Content

More test Content

and save it. Upon viewing the rendered page at the node url all of my content is pushed together and the HTML tags are gone completely when viewed in the inspector

Test ContentMore test Content

Would be what I get out. The weird thing is that if I go into the editor for the content the HTML tags and/or line-breaks are still there.

url of node with issue:

http://cafemam.b.fgqa.net/node/3575


texts: How to send mail with third party domains?

texts:
I'm using mailsystem and Swift Mailer. Instead of paying for a professional service or self-hosting, I'd like my site email to be sent using my hotmail or another domain I control.

Eg let's say my Drupal domain is mydomain.com. I want the site mail address to be somethingelse@hotmail.com or me@somethingelse.com

Is this possible and does it need special configuration?

All my attempts to send mail using Outlook's STMP server or myother domain's SMTP service have led to refused connections.


texts: How do I rewrite a facet item label using facetAPI bonus?

texts:
I am looking at the code example provided by Facet API Bonus module in the section Rewrite facet items via callback function

function HOOK_facet_items_alter(&$build, &$settings) {
                        if ($settings->facet == "YOUR_FACET_NAME") {
                          foreach($build as $key => $item) {
                            $build[$key]["#markup"] = drupal_strtoupper($item["#markup"]);
                          }
                        }
                      }

How would I modify that to override the label of a specific facet item?


texts:
So my client has been populating the site with content, but their images aren't optimised for the web.

Can I just download all the images, and then upload new versions to overwrite them ? Or are images linked more carefully to the DB?


texts: How to rearrange EVA fields in profile2?

texts:
I augmented a profile2 profile with two Eva views.

Now, I would like to re-arrange them. For that, I would like to see those fields in the Manage display tab. I tried to explicitly create those missing fields, looking in vain for an Eva view type.

Anyone having met this problem ? Thanks.


texts: $base_url and the mystery of broken feed images

texts:
I recently upgrade my Drupal6 site to Drupal7 and migrated to getpantheon platform, I am hand-coding absolute image url's in nodes like this :

Despite using full absolute url's, images in feedburner are getting broken : http://feeds.feedburner.com/TheBestInternetNews as it's source http://www.megaleecher.net/rss.xml is outputting relative images.

Strangly, using $base_url = 'http://megaleecher.net'; (without www) in settings.php fixes the issue but using $base_url = 'http://www.megaleecher.net'; (with www) makes them relative again.

I have hired two drupal dev's from oDesk (https://www.odesk.com/o/jobs/job/Fixing-relative-image-paths-Drupal-rss-feed_~~0c48e61824bc3263/) and also asked for support from getpantheon but no solution.


texts: Why my Content Page node breadcrumbs do not override the ones set for this content type (panelizer)?

texts:
I use a fresh Panopoly distrribution (on Drupal 7) set up 2 weeks ago.

I set breadcrumbs for the content type "Content Page" (Full page override / Breadcrumbs). It works fine.

I created a few Content pages and want to modify breadcrumbs (to display them for these particular nodes). I turn breadcrumbs on for Full page override, modify, press SAVE it saves, but the breadcrums remain the same (in the fields on the settings page, as well as on the content page) - so it does not save changes.
So in single node settings it shows settings set for the content type and does not allow to modify (it says modifications saved, but settings remin the same).

I did it many times in other cases - all worked fine, but somehow it does not work in this case.

Probably there is some check box somwhere that I missed.
Thanks.


texts: Timeout in sites, perhaps related to cron

texts:
I have been struggling with a timeout error in a couple of Drupal 8 sites, which I have not been able to reproduce. When I deploy them into my colleague's production server (a Mac machine), all the Drupal 8 sites are experiencing a page lock up (the browser waits indefinitely). I have not been able to reproduce the error in my machine (running Debian), neither in testing instances in other servers (e.g. a free Pantheon instance). The only clues I have for the moment are:

The error seems to not occur so often once I disable cron in the Drupal sites. However, if I run cron manually, I have not been able to reproduce it neither.
This only affects Drupal 8 sites. The rest of the sites (Drupal 7 and many others) are not affected at all.
The error disappears rebooting Apache. However, only when I do the following combination: "/opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper stop" & "/opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper start"
My colleague suggested me to use "/opt/local/apache2/bin/apachectl graceful" , but in that case, the error does not disappear.

Any ideas on what the issue could be? I am running different versions of Drupal in the sites (8.0.2 and 8.0.5). At https://github.com/CRESS-Surrey/erie_website_code/issues/31#issuecomment-172512374 I have attached as well some captures of the http headers in a successful and unsuccessful request . I am trying to document the issues as well (more information) at that issue and https://github.com/drozas/cecan/issues/23 for the other site.

Thanks a lot!

David


texts: Programmatically alter taxonomy term tree options

texts:
I have a taxonomy term reference field in a form. This field has many options and I'm using the term_reference_tree module to display them.
I'm trying to add a filter to this form so it only displays certain options depending on some factors (the value of a different field).

The problem is editing this field's options. I can't find a way to programmatically alter a taxonomy term reference field's options when using the term reference tree widget.
I've tried using hook_field_widget_properties_ENTITY_TYPE_alter but this doesn't allow me to alter the actual options.

Any suggestions would be very welcome. Thanks in advance.


texts: Populate dropdown with data from database in Drupal7 using jQuery

texts:
Error is seen when i made a drop down list to populate data from Database.
Database : dtable
File in the template of hook_theme named : myModueForm_theme.tpl.php
<?php
$sel = "<select  name=\"select1\" id=\"select1\">
        <option value=\"\">Select...</option>
        <option value=\"data1\">data1</option>
        <option value=\"data2\">data2</option>
        <option value=\"data3\">data3</option>
        <option value=\"data4\">data4</option>
    </select>";
echo "$sel";

?>
Script :
jQuery("#select1").change( function(){
if( jQuery(this).val() == "data1" ) {
jQuery.ajax({
    type: "POST",
    url: "<?php echo $base_url;?>?q=search/data1",
    error: function(returnval) {
        alert("Failure");
    },
    success: function (returnval) {
        alert(returnval);
        alert("Sucess");
    }
})
}
});

The Module file which handles the database connection named: myModule.module
$items['search/data1'] = array()
'title' => 'Add data', //page title
'description' => 'form',
'page callback' => 'search_data1',
'page arguments' => array('access content'),
'access callback' => TRUE

);
// In the search_data function
function search_data1(){

$options="<select  name=\"select2\" id=\"select2\">";
$result = db_select('dtable', 'c')
    ->fields('c')
    ->execute()
    ->fetchAll();
foreach ($result as $record) {
$name = ($record->dt1);
    $options.="<option value=\"$name\">".$name."</option>";
    //alert(node);

}
$options.= "</SELECT>";
return $options;

}
What I want is

please tell me where is the error & how to solve

I want to return the page back to the theme PHP page with the query result, but when I display back the return value from the module file, I get the whole HTML.
Please help & treat me as a beginner.Thanks in advance...


texts: How to customize the homepage title without creating new pages?

texts:
I can set up my page like this and it works fine:

somepage:
  path: '/my_page'
  defaults:
    _title: 'My custom page title'
    _controller: '\Drupal\my_module\MyController::content'
  requirements:
    _permission: 'access content'

BUT I need the path to be empty, so I tried this: path: '/' - not working. What I need is to be able to customize default homepage title of drupal 8 (without having to create new pages).

Tried path: '/' path: / path: ''. No success.

Any suggestions?


texts: How to target and remove a given fieldset

texts:
I am very new to drupal and have been playing around with lots of different modules and core features. I have now come to an issue I have been trying to solve for the pass 48hrs without finding the right solution.

I am building a forum, using the core module, but my problem is when users post a new topic / comment, they are given the option of selecting which 'text format' they want to use. I want drupal to take it as given that filtered HTML is the only option and not offer the use a 'plain text' format.

I can just target the fieldset's id with 'display:none' in CSS and that does work, will not display any more, but I would like to know how to remove the fieldset code itself.

I have tried this,

function THEMENAME_form_alter(&$form, $form_state, $form_id)  {
  unset($form_id('edit-body-und-0-format');
}

The 'edit' id is the id on the fieldset for the text options, but all this does is give me the white screen of death....

So what I am doing wrong?

Many thanks for any help given....

Glenn.


texts: Recoverable fatal error after form submission in drupal7

texts:
Iam new to drupal.I have created a custom module named firstmodule .I have created a form using the tutorials section of drupal 7
when is submit i want to store this details in the registration which is present in db.

firstmodule.module

function firstmodule_form1_submit($form, &$form_state)

{

$firstname = $form_state['values']['name'];
    $username = $form_state['values']['username'];
    $password = $form_state['values']['password'];
    $year_of_birth = $form_state['values']['year_of_birth'];
    $email = $form_state['values']['email'];
    $file = $form_state['values']['file'];

I am using the insert query in the following way:

        db_insert('registration')->fields(array(
          'firstname' => $firstname,
          'username' => $username,
          'password' => $password,
          'yearofbirth' =>$year_of_birth,
          'email' => $email,
          'file' => $file,))
          ->execute();
}

it is showing me the error

  Recoverable fatal error: Object of class stdClass could not be
  converted to string in DatabaseStatementBase->execute() (line 2168 of
  /var/www/drupal-7.22/includes/database/database.inc).

please help with it


texts: Programmatically Change Administrative Area in AddressField

texts:
I have some external data that I have introduced to Drupal for a users address (not in an address field). I am setting it so that when a user loads the checkout page in commerce their info is populated as the default field values.

How do I change the State (administrative area) to match the country that is set? Right now, if I have it set to Australia for instance, the State field is still set to United States relevant states.

Code Example:

    $form['customer_profile_billing']['commerce_customer_address']['und'][0]['#address']['first_name'] = $firstname;
    $form['customer_profile_billing']['commerce_customer_address']['und'][0]['#address']['last_name'] = $lastname;
    $form['customer_profile_billing']['commerce_customer_address']['und'][0]['#address']['thoroughfare'] = $street;
    $form['customer_profile_billing']['commerce_customer_address']['und'][0]['#address']['locality'] = $city;
    $form['customer_profile_billing']['commerce_customer_address']['und'][0]['#address']['administrative_area'] = $state;
    $form['customer_profile_billing']['commerce_customer_address']['und'][0]['#address']['postal_code'] = $zipcode;
    $form['customer_profile_billing']['commerce_customer_address']['und'][0]['#address']['country'] = $country;
    $form['customer_profile_billing']['commerce_firstdata_billing_phone']['und'][0]['value']['#default_value'] = $phone;


texts: Delete nodes if URL is called via Wget Command

texts: How can I delete the nodes if i am calling my URL via wget command. Because the anonymous user haven't permission to edit/delete.


texts: Runtime Exception - no weight or dimension field after importing

texts:
Drupal 8 - Commerce 2 has its import from Ubercart now in the Commerce Migrate module.  Field text data was left behind, and it is its own issue - see below
At admin/commerce/config/product-variation-types for what did import was the product types and products themselves, and if I try to edit the imported "Product", Product_kit" or "uc_recurring" variation to make it shippable with dimensions a Runtime Exception error is thrown that no "dimension" or "weight" field exists.

RuntimeException: The field "dimensions" does not exist on bundle "product" of entity type "commerce_product_variation". in Drupal\commerce\ConfigurableFieldManager->hasData() (line 119 of modules/commerce/src/ConfigurableFieldManager.php).
Drupal\commerce\EntityTraitManager->canUninstallTrait(Object, 'commerce_product_variation', 'product') (Line: 77)  . . . . more (for Product)

and

RuntimeException: The field "weight" does not exist on bundle "product_kit" of entity type "commerce_product_variation". in Drupal\commerce\ConfigurableFieldManager->hasData() (line 119 of modules/commerce/src/ConfigurableFieldManager.php).
Drupal\commerce\EntityTraitManager->canUninstallTrait(Object, 'commerce_product_variation', 'product_kit') (Line: 77)  . . . . more (for Product_kit)

For "uc_recurring" it throws the first one listed.
I did try adding the fields at /admin/commerce/config/product-variation-types/product_kit/edit/fields it took them for "products" but stated duplicates could not be used for the others, so I stopped.
However, with Devel / product generate it does not work. The default variation works fine, but these are tied to the imported products and I personally don't know what to edit to add the missing values to get the form to work and the only way to try now anything else is to start over with a new database and import again via upgrade using Commerce Migrate - which never worked right in the first place - because it left the text data field behind and is a bug it appears in in itself.
See https://www.drupal.org/project/commerce_migrate/issues/3044987.
Reference https://docs.drupalcommerce.org/commerce2/user-guide/shipping/enable-shipping-products
Does anyone know if there is a way to manually add these fields to these entities or otherwise fix this ??


texts: Term reference list with a field for extra information

texts:
For a site I'm working on I have a functionality in mind that I simply cannot wrap my head around as to how I would set it up.
When creating content of a specific content type I want to have the option to select multiple items using checkboxes from a list of about 30 items, and have the option to add a short piece of text (less than 20 characters) to each of these items if I want to.

Currently I have no real idea on how to set this up. I'm planning on adding the 30 or so items to a vocabulary so I can easily reference them, but how would I be able to select these items and add the piece of text so it's linked to these items as well?

Basically what I'm looking for is the following:

I hope someone is able to shed some light on this for me, any help is appreciated.


texts: how to change the keyword for URL search with new search

texts:
I have a problem with the search API function. The first time I enter the keyword into the search field which will show the results and the URL like this for example:
www.avc.com/avs/search/search-content?keys=city
If I enter the new keyword to search (ex: search for "water", it will show the result, but the URL does not change the keyword. When you click on any result and then click go back it will go to the first search (city).
How can I make the URL change the keyword?


texts: How to upload multiple images to Ubercart product pages via FTP?

texts:
I have a few thousand products that I plan to upload to a D7/Ubercart website and each one will have two or three images associated with it. Is there a way I can just dump all of those images onto the server and have them somehow be associated with their correct products? Or am I stuck uploading each one individually via the node edit fields?

Thanks!


texts: Disable ajax from exposed form filter only

texts: Is it possible to disable the Ajax from the exposed form filter only and not the whole view action [sorting - paging] !?


texts: Multiple aliases, context and menu items (Drupal 7)

texts:
I have a site with 2 sections of content, A and B. I have a node, 'Z' that needs to appear in each area. I also have a different menu for each area, e.g.

Section 'A'
link 1
link 2
link Z -> should show menu 'A'

Section 'B'
link 3
link 4
link Z -> should show menu 'B'

I am using context to load the correct menu block, depending on which section a user is viewing (each node is either in an Organic Group, or the Group has a taxonomy term identifying the section which is the ultimate source of the section).

How can I display the content in node Z and also show the correct menu?

I've tried Node Hierarchy and it doesn't appear to be able to do what I'm looking for (it's also left some menu entries I can't delete).

Update: taking a step back and looking fit aaa simple solution, I think that the patch here will allow me to append a simple query string to my URL and thus avoid having the appearance of duplicated content. Assuming of course that I can add the query string to the menu item.


texts: Cache problem in Drupal 6  when updating node

texts:
When I update a node programmatically the node is updated successfully, but it doesn't display updated content. It only display the previous content.

How can I make the node display the updated content?


texts: Stopping Drupal 7 spammers registering at mysite.com

texts:
I have a new Drupal 7 site at mysite.com (address changed) - a CentOS 5.5 Linux machine in my full control.

By reading registration mails (they run through my Gmail account) I've noticed, that Drupal spammers seem to refer to my site via the address forum.mysite.com. Since any requests to a subdomain.mysite.com are redirected by my hoster to mysite.com, this works for them.

I wonder, if anyone has noticed same pattern (seems to be some common spammer tool behaviour) and what have you done? I'm thinking of using mod_rewrite to block access to forum.mysite.com, but maybe there is a better way? (Because I'm not sure if that spammer tool will go away if I close access to forum.mysite.com).

I've also thought of maybe changing my httpd.conf somehow:

NameVirtualHost 11.22.33.44:80

<VirtualHost 11.22.33.44:80>
    DocumentRoot /var/www/html/mysite.com

    ServerName mysite.com
    ServerAlias mysite.com *.mysite.com

I'm not asking about Mollom or Captcha modules, because they seem to be not-up-to-date for Drupal 7 yet. And the spam users aren't a too big problem for my site anyway, because it has a card game embedded at the front page and I have a cron job deleting users not playing that game.


texts: How to change the date on which a user was created?

texts:
I'm creating users on my new website that were active on my previous website and I'd like to point this out on there profile pages by displaying the correct date in the "Active since" field.

Is there a possibility to change the user-creation date?


texts: A way to determine where a URL is being generated?

texts:
I'm a drupal noob, and one of the most frustrating things for me is finding where a specific page is being generated from. The fact that it could be a block, or created via a module, or through a view, I so far can not figure out how I can easily determine where the page is being created.

Is there an easy way of finding the 'culprit' that is generating any given url?

For example: www.example.com/catalog/something

How can I quickly tell what is generating /catalog/something?


texts: Make field required if entity reference field is filled

texts:
I'm trying to make some fields required if an entity reference field is filled.

This is the code I currently have:

$form['node'] = [
  '#type' => 'entity_autocomplete',
  '#title' => $this->t('Node'),
  '#target_type' => 'node',
  '#default_value' => $node ?? '',
];

$form['image'] = [
  '#type' => 'managed_file',
  '#title' => $this->t('Image'),
  '#description' => $this->t('Override the node\'s image.'),
  '#upload_validators' => [
    'file_validate_extensions' => ['gif png jpg jpeg'],
    'file_validate_size' => [25600000],
  ],
  '#theme' => 'image_widget',
  '#preview_image_style' => 'medium',
  '#upload_location' => 'public://hero-images',
  '#default_value' => $config['image'] ?? '',
  '#states' => [
    'required' => [
      ':input[name="node"]' => ['filled' => TRUE],
    ],
  ],
];

It doesn't seem like this line ':input[name="node"]' => ['filled' => TRUE], has any effect on the entity_autocomplete field.

Is is possible to do like this with entity_autocomplete fields?

The code is in a block configuration form.


texts:
I want to search in one text field on 2 values. I'm using the Views Filters Populare module for this. This works perfectly. But how can I have an autocomplete on this one text field and show both the fields that are searched for?

This is what I have now in my View:


texts: How do I add custom order fields for users to fill out at checkout

texts:
Drupal 7 - Commerce

I have 2 fields related to the order. one is radio button where user selects Pickup, Delivery. the other one I won't mention as it might confuse some people. I want the user to select which one they want at checkout. How do I do this?

I've added the fields the order. admin/commerce/config/order/fields. They don't show up on the checkout, but they do show up when the admin tries to edit the order.

I tried setting the fields as required, but the order gets created with these fields blank (this is a bug).

There are no options to add these fields on Checkout Settings admin/commerce/config/checkout.

I am not looking to add fields inside Billing Information nor Shipping Information.


texts: How to setup reCaptcha to appear on the registration form?

texts:
reCaptcha is ported to Drupal 8. I've set up captcha and recaptcha. I've read Readme.txt from recaptcha, I've registered my site and got the API key and paste it, also I've looked at Readme.md from captcha module.

But it does not appear in the user registration form.

All I can see is this

So please, what to do? Where should I set up captcha appears on regform?


texts: using drush for upgrade drupal 6 to 7 - create alias problem

texts:
I want to use drush for upgrade my drupal 6 to drupal7. i read this document. i have a problem with create alias. i have been doing this

1- create a subdomain in my plesk (create sub.domain.com)

2- go to /var/www/vhosts/domain.com/httpdocs and download this file and rename this to "aliases.drushrc.php"

3- remove aliases.drushrc.php content and replace with

<?php
$aliases['sub'] = array(
  'root' => '/var/www/vhosts/domain.com/sub',
  'uri' => 'sub.domain.com',
);
?>

4- run command: drush @sub status and i get this error:

The drush command '@sub status' could not be found.  Rundrush cache-clear drushto clear the commandfile cache if you have installed new extensions


texts: Deploy to production with git using Acquia like localserver

texts: I'm using Acquia to export my local proyect to production proyect but when I did git push just the code was saved, the changes that I did in UI was not saved for example I created a user in local UI but it did not reflect in production UI, do I have to use drush to do that?


texts: How can I make my entity controller class fetch the fields that have been programmatically attached?

texts:
I've created a field, an instance of it, and attached it to a bundle that I've defined in hook_entity_info().

When I call up a new entity using entity_get_controller('module_content')->create($type), it doesn't have any field attached.

I've heard that I have to call field_attach_load(), but that requires an ID for the entity. I'm wondering how to fill out the data for the fields that I've attached to my bundle with a newly created instance of that bundle.

The create() method is the following one:

  /**
   * Create a default module_content.
   *
   * @param $type
   *   The machine-readable type of the module_content.
   *
   * @return
   *   A module_content object with all default fields initialized.
   */
  public function create($type = '') {
    return (object) array(
      'cid' => '',
      'type' => $type,
      'crc' => '',
      'class' => '',
      'conid' => '',
    );
  }


texts:
I have a batch function that is called when the user has submitted the webform.
Is there a function where I can assign the task to a specific user or role using a batch function?
function maestro_hook_is_draft($processID, $queueID) {
  $sid = MaestroEngine::getEntityIdentiferByUniqueID($processID, 'submission');
  if ($sid) {
    $webform_submission = \Drupal\webform\Entity\WebformSubmission::load($sid);
    if ($webform_submission) {
      if ($webform_submission->isDraft()) {
        //if webform is draft, assign task to user
        /* NEED HELP HERE */
      }
    }
  }
  return TRUE;
}

The closest method Maestro uses to assign functions is productionAssignments() in MaestroEngine.php.
/**
 * Using the queueID, the task's machine name and the template machine name, we assign the task
 * using the appropriate method defined in the template.
 *
 * @param string $templateMachineName  Machine name of the template
 * @param string $taskID Machine name of the task
 * @param int $queueID  The ID of the queue entity this task belongs to
 */
protected function productionAssignments($templateMachineName, $taskID, $queueID) {
  // ...
  $assignments = explode(',', $assigned);
  foreach($assignments as $assignment) {
    $thisAssignment = explode(':', $assignment);
    // [0] is user, role etc.
    // [1] is how such as fixed or by variable.
    // [2] is to whom or which variable

    if ($thisAssignment[1] == 'fixed') { //assigned by fixed name
      $values = array (
        'queue_id' => $queueID,
        'assign_type' => $thisAssignment[0],
        'by_variable' => 0,
        'assign_id' => $thisAssignment[2],
        'process_variable' => 0,
        'assign_back_id' => 0,
        'task_completed' => 0,
      );
      $prodAssignments = \Drupal::entityTypeManager()->getStorage('maestro_production_assignments')->create($values);
      $prodAssignments->save();
    }
  }
}


texts:
I need to display part of the exposed form in my page's sidebar, and the rest of the form and content in the $content area. There's really no good way that I can find to do this. I sort of got it to show up in a way by making a "block" view with "exposed form" set and then trying to only show the part that i needed through .tpl files. The problem is that then, when the submit button is clicked (the submit button is in the $content area), then the filters that are in the sidebar are not taken into account.

Ideas?


texts: Share same database tables with multisite instances

texts:
What I'm trying to do is to make 2 sites one for developing and one for live using which share same instalation and database. I want to see same content like on live site when I developing theme or module when the changes ready I want to push them via git to live server. Is it possible to make something like this.
example.com - live
developing.example.com -developing

I also found this http://drupal.org/node/22267 but I'm not sure how to setup :)

cheers


texts: CKeditor adding an extra  tag when a  tag is encountered

texts:
I am experiencing a very annoying problem with ckeditor 4.4.7.3. Everytime a
 is entered into the editor, it displays the next line right below the existing line as one would expect. However, when you view the page, an extra
 tag appears along side the original
 tag. You can see this when looking at the source for the page.

Rendered output

  Age

  24

Looking at the source html while in ckeditor reveals that there is only one
 there.

Source as seen in ckeditor

  Age

  24

This would seem to indicate to me that Drupal is adding line breaks while rendering the output. I have tried disabling the option: Convert line breaks into HTML (i.e.
 and
) in the text format, but that doesn't change anything. I have also disabled JavaScript to see if some JavaScript file is doing this - but that makes no difference either.

I have googled this issue and have not found a solution yet (other people have been experiencing as well but no solution given). I would appreciate any suggestions in fixing this problem.


texts: Custom block created with GUI stripping some  tags, not all of them

texts:
I am creating a custom block in D8; the block includes the following HTML:

  Donate Now
  Connect With Us
  Menu

I have saved the block using the Full HTML format and placed it into the header region, here is a screenshot of what is added to the page:

I have disabled JS and re-loaded the page to make sure nothing else was happening.  Here is a screenshot of the edit screen:


texts: How can I make CCK field labels display differently on the node display page as opposed to the node add page?

texts:
I have a custom content type with form labels like this:

"Would you like to upload photos?"

That's appropriate for uploading data, but when displaying data to the world I'd just rather have:

"Photos:"

I see that there is a module for this, but it doesn't seem to be very well supported or used that much https://www.drupal.org/project/field_display_label. As well, this module doesn't seem to support 3rd party CCK field modules like Link.

Are there other modules out there? Also, I'm happy to approach it by creating module if someone would like to suggest how to get started or if you think a programmatic approach would be a better solution.


texts: How to make form update/rebuild every page load?

texts:
Part of my custom form that gathers petition signatures includes some markup saying "last signer: Bob, 3 minutes ago", looked up from a database.
But if the user does not submit the form, eg they reload the page, or look elsewhere then come back to the page, the form is rendered from cache and so it still says 3 minutes ago.
What can I do?
Notes:

I am not using varnish or memcached or anything else fancy that might interfere with caching. It's a very simple sure. The behaviour is seen for anonymous users. The form is used in a block, and the block is defined with DRUPAL_NO_CACHE.

The form has AJAX submission (although it must work for non-js-enabled browsers, too). I have since learnt that:

cache: ... ajax_process_form() enables form caching for all forms that include an element with the #ajax property. (The Ajax handler has no way to build the form itself, so must rely on the cached version.)
no_cache: If set to TRUE the form will NOT be cached, even if 'cache' is set.

So the question seems to point to: how can I force a form cache reset for a page load that is NOT ajax-related, e.g. in hook_block_view()? As this would mean caching was ON (required by ajax), and can stay there for form submissions, but a page load without user input will regenerate the form?


texts: Change User Profile Fields from modules - $form fields not available - Ubercart Roles

texts:
I have been attempting to change various fields on the user profile to make it more user friendly, most of it going well. However, when I try to access $form for the main user profile via dpm($form) in MODULE_NAME_form_alter not every field rendered onto the page is available. I have been trying to alter the profile forever with no luck!

function admin_dashboard_form_alter(&$form, &$form_state, $form_id){
    if($form_id == 'user_profile_form'){
        //change main user profile "Ubercart Roles" form field
        $form['uc_roles']['#title'] = t('Member Expiration');
        $form['uc_roles']['#collapsible'] = FALSE;
        $form['uc_roles']['#collapsed'] = FALSE;
    }
}


texts: How do I create a view with a 'Content pane' display type?

texts: I would like to create a new view that that I can use as a Content (panel) Pane. I cannot find how to do this. Would anyone know?


texts: Drupal 7 How to find Nodes, tagged with Broken Taxonomies?

texts:
In Drupal 7, some Taxonomy Terms were deleted (by force from direct DB Query, for some reason). So some Nodes left remained by still tagging this deleted Taxo Terms. Then the problem is arising at the Site Indexing stage. The process is getting broken.

So i believe i need to find the Nodes which are tagging to these no longer existing/broken Taxonomy Terms, to un-tag those.

Which is the best way to do it?
What will be the best Query for it?

Thanks.


texts: Is there a number field with + and - feature?

texts:
I am working with Form API to create a customized form shown in a block. Most of the fields are textfields.

I need a +/- feature for a numeric textfield, i.e.:

Is there an existing field like the above I can use?


texts: What may be causing "fails the check integrity"?

texts:
I need some help with the Rules fails the check integrity issue. I am running the Rules version 7.x-2.7. It works most of the times and appears to be suddenly.

When I checked on the dblog it has error message like so:

  the action Set a data value () fails the integrity check and cannot be
  executed

After clearing all the Drupal caches, it will start working again. It had a message like  Action was marked dirty, but passes the integrity check now and is active again.

This is a screenprint of the issue.


texts: Dealing with compressed JSON string from external API

texts:
I'm trying to call the Stack Exchange API but it sends compressed JSON strings and I can't uncompress it.

$request = drupal_http_request('https://api.stackexchange.com/2.2/users?order=desc&sort=reputation&site=stackoverflow');
$uncompressed = gzinflate($request->data);
$json_response = drupal_json_decode($uncompressed);

I'm getting an error like this: Warning: gzinflate(): data error in adventure_profile_profile() (line 104 of /home/justine/www/adventure/sites/all/modules/custom/adventure_profile.module). (where line 104 is $uncompressed = gzinflate($request->data);).

Am I doing something wrong?


texts: How to know when a node is going to be deleted when using Rules Event "Before saving content"?

texts:
I'm using a rule with Rules Event "Before saving content", but this rule is also executed when I delete the node.

I'm recalculating some fields, I don't need to do this when the node is going to be deleted.

How can I know when the node is going to be deleted? I'm coding the rule with hook_rules_action_info.


texts:
I'm developing a website in Drupal 6, and I've employed Dynamic Display Block for a slideshow that displays in a panel.

Unfortunately, even though the images show in the slideshow, they are not rendered in their full size as I described in the configuration page of the Dynamic Display Block settings.

I used firebug, and I realised that a class called ddblock-processed has been added which is the cause of the issue i'm facing, as it has different dimensions compared to the one I specified.

I've tried overriding that effect in the style sheet - css, but to no avail.

Someone should kindly help me hack this stuff under the hood.

Thank you.


texts: Archive old content data in different database

texts:
How can i make archive my old content and save in different db with my cron job.

I want to store in different DB because i want to increase my site performance.

In drupal 7 what's the best way to do it ?


texts: Set parameter for internal or external traffic based on IP

texts:
We want to block external traffic in Google Tag Manager and I am trying to do something like shown here.

I created this:

/**
 * Implements hook_init().
 */
function myfunction_init() {

  $internal_ips = [
    'x.x.x.x',
    'x.x.x.x',
  ];

  $internal_traffic = 'no';
  if (in_array(ip_address(), $internal_ips)) {
    $internal_traffic = 'yes';
  }

  $data_layer = [
    '#type' => 'markup',
    '#tag' => 'script',
    '#markup' => "<script>
                    var dataLayer = [];
                    dataLayer.push({ 'internalTraffic': '$internal_traffic'});
                  </script>",
    '#weight' => 100 ,
  ];

  drupal_add_html_head($data_layer, 'data-layer');
}

It would work but the problem is I have cached pages so this will not be correct.  I did try hook_boot but that did not work because drupal_add_html_head() is not a valid function (I'm assuming it wasn't initialized yet).


texts:
I'm planning on upgrading the WebForm module in my Drupal 7 site. The current WebForm version is 7.x-3.19 and I'm upgrading to 7.x-4.2.

Question: Is it as simple as uploading the new version? Do I need to run update.php afterwards?

Somehow I seem to remember that updating the WebForm module is not as simple as other modules and can cause existing webforms to break.


texts: How to move the "Main navigation" in the Bartik theme?

texts:
In Drupal 8, with the Bartik theme, I want to put the "Main navigation" tabs of the "Primary menu" region, on the top right, beside the "Site branding" block.

If I just move the "Main navigation" to the Header region, the tabs are lost.
I want to preserve the tabs.

How do I do it?


texts: Get relationships between tables when no foreign keys are present

texts:
How can tell the relationships between tables when no FKs are being used?

Just started working on a (partial) data export from Drupal MySQL database with ~1000 tables that contains hardly any foreign keys. Forgive my ignorance but I don't even know whether this is standard modus operandi in Drupal or some sort of anomaly. I have been expecting FKs as on most RDBS that I ever worked on FKs were present.

Entity API is being used extensively and so is data versionning if that makes any difference.

I know I could capture all the SQL queries hitting the database at runtime and then, assuming all the queries were run, I could tell how joins are made.

But looking for simpler way to tell relationships between tables similar to the one below.


texts: How to asynchroniously load remote content with BigPipe & Lazy Builder

texts:
I need to show volatile data from a remote JSON endpoint on some of my nodes. I know I could do this entirely with JS, but I hoped I can do the same with BigPipe & Lazy Builder, so I can use Twig to render the JSON data.

Editors can make minor adjustments to the query, so I've created I custom field and added the #lazy_builder in the formatter of my custom field:

class RoomRateFormatter extends FormatterBase {

  public function viewElements(FieldItemListInterface $items, $langcode) {
    $element = [];

    foreach ($items as $delta => $item) {
      $element[$delta] = [
        '#lazy_builder' => [
          AjaxController::class . '::getRoomRates',
          [ $item->uri, $item->option1, $item->option2, $item->option3 ]
        ],
        '#create_placeholder' => TRUE,
      ];
    }
    return $element;
  }
}

My controller fetches the remote data and then should asynchroniously insert the data.

class AjaxController extends ControllerBase {

  public function getRoomRates($jsonEndpoint, $option1, $option2, $option3) {
    $json = dummy_get_json_content_with_guzzle($jsonEndpoint);
    // in the final product this should be build with a #theme rendering my $json data instead of a #markup
    $build = [
      'json' => [
        '#markup' => '
Fetching data for ' . $jsonEndpoint .'

' . json_encode(json_decode($json), JSON_PRETTY_PRINT) . '
'
      ],
      '#cache' => ['max-age' => 0]
    ];
    return $build;
  }
}

The callback works, but my page loading is not progressive at all. It takes ~10sec (because of the remote JSON) and then comes with a single big flash. In all the BigPipe demo videos, the page is almost instantly rendered, with uncacheable parts updated afterwards. Without the field my pages renders in about one second. What am I missing to get the asynchronious, progressive page rendering?


texts: Entity Reference: Filter by an entity reference view not working as expected

texts:
I am attempting to get a taxonomy reference field select widget that shows a list of taxonomy terms, including some extra data from their fields. I have attempted to use the "Reference method" = "Views: Filter by an entity reference view" and then select an entity reference view I created, then in my entity reference view I have done the following:

However, this gives me only the taxonomy term name despite the settings indicating it might show all the fields inline ("Note: In 'Entity Reference' displays, all fields will be displayed inline unless an explicit selection of inline fields is made here.").


texts: Views exposed filter resets to first selected value

texts:
I have a view on this site's homepage (at the bottom, under Recent Watsits).
http://wats.it/

When you filter by category (term id), it works great - once. After that, it just resets to the first selected filter's value.

If I for example, load the page and then select "Animal" from the exposed category filter, it shows contests in the Animal category. But if I then go to select "Mineral," it just reloads the view and displays the contests in the Animal category again, and resets the filter drop down back to "Animal." I can however, select "Any" at any time

How do I fix this problem?


texts: adding input format for CCK fields in drupal

texts:
Is there any way by which I can add a input format for the CCK added Text Fields ?
By default its only there for Body field in any node/add , I want this for other fields to evaluate PHP Code.


texts: Instantly upload image when selecting when creating new content

texts:
Possible Duplicate:
  How can I automatically upload images on file selection rather than pressing the upload button?

What I need is for my users to attach a picture and a video to their nodes. I'm using CCK and ImageCache (among others), and I know that there is an image and video upload field for them; my problem is that I want it somewhat difference with a bit "cleaner" design.

Right now it looks like this:

But what I want is something like the following (Sleeker More "Web 2.0" onChange Use)

The idea is that the image automatically uploads when selecting and then displaying, maybe a small preview or otherwise just the image name with an possibility to delete it and upload a new.

Are there any module, hack or suggestion on how I can do this within Drupal?


texts: Why does the "Registration List" tab not appear for my events for users with adequate privileges?

texts:
I'm using the RNG events module in D8 - when a user with adequate privileges clicks the event tab, they can see and edit all fields, but the "Registration List" tab doesn't show, and they can't see the list of current registrants without the use of a custom view.

This may or may not be connected to the problem I'm having here - How do I limit permissions to manage an event?


texts: Views Infinite Scroll progress Indicator

texts:
I am using the Drupal 8 Views Infinite Scroll module on my website.

I have a button at the bottom of my view that when clicked, loads more nodes into the view.

How can I manipulate the view to show a progress indicator or loading icon whilst the Infinite Scroll Ajax is making the request?

Currently, there are no options in the pager settings, but I am confused by the documented project as the Animated gif shows the indicator at the top of the view appears once you've clicked the load more button.

Is this only in place for Drupal 7?


texts: How to add autocomplete to text_format element?

texts:
How can I add autocomplete functionality to a text_format field? I want to do this because I'm trying to create a field which has both autocomplete functionality (auto-suggesting certain configured entities) and an Input Filter on it to manipulate the same entities.

I have a custom widget for the field and have tried adding #autocomplete_route_name and #autocomplete_route_parameters to the formElement(), but since the text_format element is a RenderElement, not a FormElement, it seems like autocomplete cannot be added in this way. I've also looked into Autocomplete Deluxe, which doesn't work for Text Format fields.

The code below works only for textarea, since the autocomplete states don't work with text_format, but I include it to show what I've tried.

/**
 * Plugin implementation of the 'text_textarea' widget.
 *
 * @FieldWidget(
 *   id = "text_textarea",
 *   label = @Translation("Text area (multiple rows)"),
 *   field_types = {
 *     "text_long"
 *   }
 * )
 */
class TextareaAutoWidget extends StringTextareaWidget {

  // ...

  public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
    $main_widget = parent::formElement($items, $delta, $element, $form, $form_state);

    $element = $main_widget['value'];
    // $element['#type'] = 'textarea';
    $element['#type'] = 'text_format';
    $element['#format'] = $items[$delta]->format;
    $element['#base_type'] = $main_widget['value']['#type'];
    $element['#autocomplete_route_name'] = 'textarea_autocomplete.autocomplete';
    $element['#autocomplete_route_parameters'] = array('clue' => $this->getSetting('clue'));
    $element['#process'] = [
      [Textarea::class, 'processAutocomplete'],
    ];
    $element['#attached'] = [
      'library' => [
        'textarea_autocomplete/autocomplete'
      ],
    ];
    return ['value' => $element];
  }

  // ...

}


texts: FunctionalJavascript tests fail with InvalidCookieDomain error

texts:
If I run a FunctionalJavascript test, it fails with:

WebDriver\Exception\InvalidCookieDomain: invalid cookie domain

Does anyone know would could be causing this or how I could get it to output what the invalid domain is and what is invalid about it?
I am running the test like this:
vendor/bin/phpunit -v -c core/phpunit.xml.dist core/modules/system/tests/src/FunctionalJavascript/FrameworkTest.php
(phpunit.xml.dist has to be suitably configured.)
I see the same result using run-tests.sh.


texts: Get a dropdown for Views: Filter: Taxonomy Term Name

texts:
I'm using taxonomy term name to filter views based on their taxonomy. I've tried basic or Better Exposed Filters and setting a relationship but still no option for a drop-down select menu.

I can't use filter by "Taxonomy Term: Term" because this uses the TID not Term Name in URL.


texts:
I have a Boolean field on a content type. Possible values are completed and not completed. The default rendering is not satisfactory though since it doesn't include any CSS class to represent the boolean state (true, false) so I cannot act on this using CSS or JavaScript.

Completion status:&nbsp;

completed

What's the best way to add such a class on .field or .field-item?

What I've tried so far:

hook_field_display_alter but this doesn't provide me with data nor field type
hook_node_view but I cannot iterate fields by type. I'd need to pinpoint the specific field instance I need to modify but I don't know that in advance.
by providing a custom node template, but this solution is not generic for all occurrences of a boolean field


texts:
Can somebody explain to me what the difference is between an object and context within the advanced action setup please.

I understand what an object is but am failing to understand what context is.

Thanks.


texts: Problem with JS linked to an Ajax loaded page

texts:
I am trying to load a form via ajax, the PHP callback that send the data to the Ajax request looks like this :

function group_form (){

        $node_type = 'group';
        $form_id = $node_type . '_node_form';
        $node = new stdClass();
        $node->type = $node_type;
        $node->title = 'helllooo';
        $node->language = LANGUAGE_NONE;
        $node->path = '';
        node_object_prepare($node);
        $return=drupal_get_form($form_id,$node);

    echo render($return);
}

I use to have a problem when using return instead of echo as mentioned in this Q, where the whole page was being sent via Ajax instead of just the form element. However now that i use echo all the script attached to that form do not get reloaded, witch cause problem as my form uses the date module with a jQuery popup calender, and infinite value fields witch need some Drupal JS in order to add multiple values without page reload.

So i wonder if there is a way around that, if not, anyone has anyidea of what script i should reload on the ajax succes callback in order to have my date module popup calendar and the drupal "Add more" function for infinite value field working ?

EDIT: I found that using Drupal.attachBehaviors(jQuery('#LoadedContent')); seems to be helping as it brings me from this

to this ,

though clicking on the "Add another item" Button still reload the page and i end up with this :

Thanks a bunch for the help.


texts: Cache rebuild causes an error with missing plugin

texts:
On rebuilding the cache, a Drupal 8 website goes down and displays the message "The website encountered an unexpected error. Please try again later." I used drush cr to rebuild the cache, which shows the following error message.

  The "field_item:boolean" plugin does not exist.

I also tried to rebuild the cache right after installing a new Drupal 8 site without any additional module, and it shows the same error.

How can I get the site back to working?


texts:
I've got a view and one of the fields is displayed as a link. (Output this field as a link is cheked). But now i want those links to have target=_blank attribute.

How can i achieve this?


texts: Scheduler module not working even after cron run

texts:
Installed 'Scheduler module' and try to publish a content on specific time. But it seems like it is not working.

I tried with  'Run cron manually' also, But it doesn't ,While trying with Scheduler light weight cron it is working.

Why is it not working?


texts: Dynamic query with pager not working with filter values

texts:
I have a dynamic table with a form and a pager.
Table and form filters work fine.

But the pager ALWAYS retrieves ALL the records.  It does not consider the "post" value of the form filter.

function modulename_people_search($form, &$form_state) {

    // BUILD FORM
    $form['filter'] = array(
      '#type' => 'fieldset',
      '#collapsible' => TRUE,
      '#collapsed' => FALSE,
      '#title' => t('Filtres')
    );

    $form['filter']['filter_mail'] = array(
      '#type' => 'textfield',
      '#title' => t('Email'),
      '#size' => 15,
    );
    $form['filter']['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Filtrer'),
      '#submit' => array('modulename_people_search_submit'),
    );

    // BUILD HEADER ARRAY
    $header = array(
        array('data' => t('Nom'), 'field' => 'nom.field_profile_nom_value'),
        array('data' => t('Prénom'), 'field' => 'prenom.field_profile_prenom_value'),
        array('data' => t('Email'), 'field' => 'u.mail'),
    );

    // BUILD QUERY
    $query = db_select('users', 'u')->extend('PagerDefault')->extend('TableSort');

    $query->leftJoin('field_data_field_profile_nom', 'nom', 'u.uid = nom.entity_id');
    $query->leftJoin('field_data_field_profile_prenom', 'prenom', 'u.uid = prenom.entity_id');

    $query->condition('u.uid', 0, '>');

    // GET CONDITIONAL FILTER VALUE
    if(isset($form_state['filters']['mail'])) {
      $query->condition('u.mail', '%' . db_like($form_state['filters']['mail']) . '%', 'LIKE');
      $exportMail = $form_state['filters']['mail'];
    }

    // FIELDS
    $query->fields('u', array('uid', 'mail', 'login', 'status'))
    ->fields('nom', array('field_profile_nom_value'))
    ->fields('prenom', array('field_profile_prenom_value'));

    // GET RESULTS
    $result = $query->limit(30)->orderByHeader($header)->execute();

    // BUILD DATA ARRAY
    $rows = array();
    foreach($result as $data){
        $rows[] = array(
                    $data->field_profile_nom_value,
                    $data->field_profile_prenom_value,
                    $data->mail,
                );
    }

    // ASSEMBLE DATA IN TABLE
    $form['table'] = array(
      '#theme' => 'table',
      '#header' => $header,
      '#rows' => $rows,
      '#empty' => t('Aucun résultat.')
    );

    // ADD PAGER
    $form['pager'] = array('#markup' => theme('pager'));
    return $form;
}

function modulename_people_search_submit($form, &$form_state) {
  $form_state['filters']['mail'] = $form_state['values']['filter_mail'];
  $form_state['rebuild'] = TRUE;
}

Any advice would be much appreciated.
Thank you.


texts: Why are users seeing edit pages outside of Admin UI

texts:
I just tested the editorial process for authors on our new web site.  For some reason, although admins and editors see pages in the normal Admin UI (using the Seven theme) when editing a page, members of the author role see it in the public UI that displays for non-logged-in users browsing the web site.

At /admin/appearance I have Administration theme set to Seven, and I have 'Use the administration theme when editing or creating content' checked.

Why would this setting take effect for admins and editors, but not authors?


texts: Voting API + Fivestar Voting - Restricting votes to user and not to IP

texts:
I want Fivestar rating to be restricted to the logged in user and NOT to the IP they are using.

I want two (or more) logged in users using the same IP being able to have their own votings. At the moment it is possible to influence each other votings.

Am I missing something?


texts:
I have a Drupal 6 site that contains hundred of thousands of node and bunch of custom and contributed modules. My problem now is how can I upgrade this correctly in Drupal 7. I tried to steps presented in DrupalCon Denver which is a good steps for me, but I have a problem in converting the data when running update.php which stops the process.

Is there any good way to handle this case?


texts: How to use hook_views_query_alter to catch last DELTA of a multivalue date field?

texts:
I need a View that should list only past events.

Events have multivalue date fields, so an event can have multiple "start" and "end" dates.

Date's API assign a DELTA value to every group of "start" and "end" dates.

In my configuration, an event is consideret "past" if its very last (= last delta) end date is < of "now" (= today)

With default Views UI it seems impossible to catch LAST delta of group of dates for a record.

(see some answers by Merlinofchaos here: https://www.drupal.org/user/26979)

My UI views provides the following query:

SELECT field_data_field_period.delta AS field_data_field_period_delta, field_data_field_period.entity_id AS date_id_field_period2, field_data_field_period.delta AS date_delta_field_period2, node.created AS node_created, node.nid AS nid
FROM
{node} node
LEFT JOIN {field_data_field_period} field_data_field_period ON node.nid = field_data_field_period.entity_id AND (field_data_field_period.entity_type = 'node' AND field_data_field_period.deleted = '0')
WHERE (( (node.status = '1') AND (node.type IN  ('exhibition')) AND (DATE_FORMAT(ADDTIME(field_data_field_period.field_period_value2, SEC_TO_TIME(7200)), '%Y-%m-%d') < '2014-07-16') ))
ORDER BY node_created DESC
LIMIT 10 OFFSET 0

With some tests with pure SQL directly on DB, I noticed that I can obtain the results I want with the following changes to the query:

SELECT MAX(field_data_field_period.delta) AS field_data_field_period_delta, field_data_field_period.entity_id AS date_id_field_period2, field_data_field_period.delta AS date_delta_field_period2, field_data_field_period.field_period_value2 AS field_data_field_period_field_period_value2, node.created AS node_created, node.nid AS nid
FROM node
LEFT JOIN field_data_field_period ON node.nid = field_data_field_period.entity_id AND (field_data_field_period.entity_type = 'node' AND field_data_field_period.deleted = '0')
WHERE (( (node.status = '1') AND (node.type IN  ('exhibition')) ))
GROUP BY nid
HAVING MAX(DATE_FORMAT(ADDTIME(field_data_field_period.field_period_value2, SEC_TO_TIME(7200)), '%Y-%m-%d')) < '2014-07-15'

In the above please notice:

field_data_field_period.delta becomes MAX(field_data_field_period.delta)
Added clause "GROUP BY nid" and "HAVING MAX(DATE_FORMAT(ADDTIME(field_data_field_period.field_period_value2, SEC_TO_TIME(7200)), '%Y-%m-%d')) < '2014-07-15' "

After hours of research I understood I have to use hook_views_query_alter to alter my views query, but the modification I need are very complex and I don't know where to start...

Please help me.


texts: What is causing Drupal to return a 404 HTTP header, but correctly return the page?

texts:
I have a Drupal 6 site that is correctly returning site content (like the home page), but if you look at the response headers every page has a 404 header, instead of a 200.

Things I've tried:

Rebuilt the node access table (/admin/content/node-settings/rebuild)
Cleared the cache
Run update.php

Do you have any idea on what might be causing this?


texts: How to create Omega 4 subtheme with new "default" libSass based starterkit?

texts:
I am trying to install omega 4, now at 4.4, which uses liBsass for the default starterkit.
How do I proceed about this - I understand I need now npm and gulp instead of the previous Ruby stuff required for Omega 4.3?
Everything installs fine, but drush omega-guard complains about gemfile (which it should not use, as I understand).


texts: How to remove the tags from appearing in exposed filter textfield

texts:
I've a view in Drupal 8, in which I've an ajax auto complete field, which contains tags. I've not checked Unformatted dropdown, and Unformatted suggestion. In this case, I'm getting the autocomplete dropdown as plain text, when I select any one of it, it is showing tags in the field.

Can I remove it?? I don't want my use to see the tags in the search field once they select it


texts: Using Entity Metadata Wrapper to set/get value from custom field added via Field API to custom entity type

texts:
My question is related to: Using entity metadata wrapper with custom entity type

I know that I should inform EMW how to work with entity properties via hook_entity_property_info_alter

but what about custom fields added via Field API to custom entity. I'm trying to set value of that kind of field via EMW but after entity save, field (db table) is always empty.


texts: Why does the favicon sometimes not show up and generate "page not found" errors, and other times does show up

texts:
As the question implies, on occasion Drupal's log is showing that the favicon is not found. Indeed, it does not show in the browser tab or address bar. At other times, even within the same surfing session, it does show up.

Why does it do this and how can I prevent it so that the favicon will always show?

I am using version Drupal 7.22. with a custom subtheme and an admin theme (Stark).

My favicon is set in the subtheme theme configuration at sites/default/files/images/favicon.ico and that is located there as I have checked via FTP.

The log shows the browser is looking in example.com/favicon.ico.

The custom subtheme I use has <link rel="shortcut icon" href="http://example.com/sites/default/files/images/favicon.ico"; type="image/vnd.microsoft.icon" /> in the source code and the admin theme (Stark) uses <link type="image/vnd.microsoft.icon" href="http://example.com/misc/favicon.ico"; rel="shortcut icon"> and this file also exists in that location (not actually using example.com, of course).

Drupal is using clean URLs.

The web server is Apache on Debian Linux.

Thank you.


texts: Permission tmp problem: Change of tmp directory

texts:
I recently installed one new Drupal (7.32) on a server that doesn't belong to me. Since then, I have a permission problem, I can't edit CHMOD rights and when I try to add new content (with image(s)), I can't. Here's the mistake returned by Drupal:

Warning: move_uploaded_file(): open_basedir restriction in effect.
File(/home/tmp/php/phpBKRRLYL) is not within the allowed path(s): (/home/tmp/sessions/:/home/XXX/public_html/:/home/XXX/shared) in drupal_move_uploaded_file() (line 1639 of /home/XXX/www/public_html/YYY/drupal-7.32/includes/file.inc).

Warning: move_uploaded_file(): open_basedir restriction in effect.
File(/home/tmp/php/phpBKRRLYL) is not within the allowed path(s): (/home/tmp/sessions/:/home/XXX/public_html/:/home/XXX/shared) in drupal_move_uploaded_file() (line 1639 of /home/XXX/www/public_html/YYY/drupal-7.32/includes/file.inc).

Warning: move_uploaded_file(/home/tmp/php/phpBKRRLYL): failed to open stream:
Operation not permitted in drupal_move_uploaded_file() (line 1639 of /home/XXX/www/public_html/YYY/drupal-7.32/includes/file.inc).

Warning: move_uploaded_file():
Unable to move '/home/tmp/php/phpBKRRLYL' to '/home/XXX/www/public_html/YYY/drupal-7.32/sites/default/files/anime.jpg' in drupal_move_uploaded_file() (line 1639 of /home/XXX/www/public_html/YYY/drupal-7.32/includes/file.inc).

As we can see, Drupal apparently uses the server's tmp directory (in which I have no rights) and I would like it to use another tmp directory in "/home/XXX/www/public_html/YYY/drupal-7.32/" so that I can add/edit content properly.
How could I do this? By editing the "/includes/file.inc" file (if so, which line(s) shall I modify to do this?)? Something else?

NB: The system administrator is unavailable for an extended period so he can't change my rights for now. That's why it's important that I could change this tmp directory.
Thank you!


texts: Prevent page creation for a published custom content type

texts: I have a Drupal 8 custom content type that is used in views only.  I would like to prevent this type from creating a web page for content that is published.


texts:
I use a View to show search results (core Search module). In the view I have grouped the grid on the field "Content type". This works fine, each content type is shown under it's own title.

But under "Sort" in the View I can only sort the content types by ASC or DESC. But I would like to use a custom sort order like "node type = product", followed by "node type = accessories" and so on.

How to do that? I have tried using hook_views_query_alter() and hook_search_api_query_alter() and a few other tings, with no luck.


texts: How to allow Infinite Scrolling through "Views Load More" module with waypoints?

texts:
I am trying to achieve infinite scrolling for my view results in Drupal.

Now It could have been easier if I could use Views Infinite Scroll module but I couldn't use as it doesn't allow Views Ajax. Since I am using filters that heavily rely on AJAX, I am out of luck for using this module.

As I read, there is another option through Views Load More module, but it can only allow infinite scroll through Waypoints. This is where my problem lies as I am unable to understand how to use waypoints with Views Load More module.

I'll be super grateful if you could assist me in this.

This is Waypoints code from their site:-

var waypoint = new Waypoint({
  element: document.getElementById('#waypoint'),
  handler: function(direction) {
    console.log('Scrolled to waypoint!')
  }
})


texts:
I'm using Drupal 7.

I've an Article content type, when it gets published it needs to be posted into my Facebook Wall. How can I implement this process? I've searched the drupal.stackexchange.com but I couldn't find the right way to do. Can you put me through?


texts:
I'm trying to fetch each individual field of an items array. here is the image of the kint result

here is what i have tried.

{{items[0].content}} -- this one prints the whole thing in the items array.
{{items[0].content['#context'].value}} ---- does nothing
{{items[0].content['#markup'].getValue()}} ---  does nothing

Have looked for documentation, couldn't find one. Any explanation or url to documentation or example will be appreciated.


texts: How do I get the host paragraph when a paragraph is referenced in another paragraph?

texts:
I have referenced Paragraph B in Paragraph A and in preprocess of Paragraph B I want to access host paragraph A. Is this possible with ease. As in case of paragraph references on node we can do paragraph->getParentEntity() ?
 I had tried same but it still get the parent node :(


texts: Overview & help with drupal files and folders on Win 7

texts:
I am a newbie. Please forgive me if this is a dumb question.

I'm trying to wrap my brain around what is Drupal and how it works.

I installed Acquia Dev Desktop successfully on my Win 7 computer. I want to make sure that I backup all files and folders, but have discovered that Drupal/Acquia is scattered just about everywhere on my hard drive. I found the following (where "Sam" is my Win 7 username).

C:\Program Files (x86)\DevDesktop
C:\Users\Sam\Sites
C:\Users\Sam.acquia
C:\Users\Sam.drush

Have I missed any locations? Why is everything not consolidated in one folder? It would make life much easier!

If this is not the proper forum for dumb questions please tell me a better place to post.

Thanks!


texts: How to change documents to another category painlessly

texts:
I have 4 content types eg Parts, Service, Marketing, and Sales.

I've now created one category with 4 content types sub-categories instead.

Is there a painless way of changing each documents category?

I've experimented with [Node_export][1] but that did not allow me to import into a different category.


texts:
Possible Duplicate:
  Path alias tokens and node references

I'm having some difficulties setting up url patterns for my drupal project.

The site has 3 different content types, Main category, sub category and products.
All of these are linked together by entity references.

So a sub category is linked to a main category, and a product is linked to a sub category.
But now I want my urls to look like: main_category/sub_category/product
Or for a sub category it should look like: main_category/product

How would I be able to achieve this? I've installed path auto, but can't seem to figure it out.

EDIT: And another question would be, what would be the easiest way to create a menu out of this?