texts: Can I rewrite a view's query SQL directly?

texts:
Can I modify the SQL generated by the Views Query Builder? Views doesn't support subquery out of the box, so I'm just wondering if I can add the final line to my query manually?

Background info:
The query I'm trying to perform looks a little like this:

select full_name, email, users.uid
from
cloudsponge
inner join
`users` on users.uid = cloudsponge.importer_uid
where cloudsponge.email not in (select mail from users)

It's worth pointing out that all tables have millions of rows so performance is also important (I haven't checked this query on a large dataset yet).


texts: Why does swiftmailer doesn't use my HTML template?

texts:
In some form of my custom module, a condition triggers an email to be sent:

  public function save(array $form, FormStateInterface $form_state) {
    $entity = $this->entity;
    $status = parent::save($form, $form_state);
    $values=$form_state->getValues();
    if (($values['isurgent']['value']==1) && ($values['status']['value']==1)) {
      $iSeliste = \Drupal::currentUser()->id();
      $oSeliste = \Drupal::entityTypeManager()->getStorage('person')->load($iSeliste);
      $sSelite = $oSeliste->firstname->value . " " . $oSeliste->lastname->value;
      $sAction = ($values['action'][0]['value']==0)?"offre":"demande";
      $sDueDate = $values['duedate'][0]['value']->format("d/m/Y");
      _sendEmailForUrgentService($sSelite, $sAction, $sDueDate);
    }

in sel.module:

function _sendEmailForUrgentService($sSeliste, $sAction, $sDueDate) {
...some code...
  \Drupal::service('plugin.manager.mail')->mail('sel', 'emailforurgentservice', $sTo, 'fr',      $params);
  \Drupal::logger('sel')->info('Courriel pour service urgent : envoi effectué.');
}

my hook_mail:

function sel_mail($key, &$message, $params) {
  $sFrom = '[redacted]';
  $message['from'] = $sFrom;
  $message['headers'] = array(
    'Content-Type' => 'text/html',
    'bcc' => $params[3],
    'From' => $sFrom,
    'Sender' => $sFrom,
    'Return-Path' => $sFrom,
  );
  switch ($key) {
    case 'emailforurgentservice':
      $message['subject'] = '[Le Grenier à SÉL] Un service urgent requiert votre attention...';
      $sBody  = $params[0] . " a posté une " . $params[1] . " urgente qui est valide jusqu'au " . $params[2] . ".";
      $message['body'][] = check_markup(nl2br($sBody), 'full_html');
      break;
  }
}

The settings of mailsystem are these:

And in my theme templates folder (mysite/web/themes/contrib/mayo/templates/), there is my email template swiftmailer--sel--emailforurgentservice.html.twig:

                    Chers S&Eacute;Listes,

                    {{ body }}

                    Vous pouvez la consulter ici.";

                    Si vous ne la trouvez pas, c'est peut-être qu'elle a d&eacute;j&agrave; &eacute;t&eacute; satisfaite.";

                    --

                    Le Grenier à S&Eacute;L

The email is sent. Everything is OK (From, To, Bcc, Subject) except the body!
Instead what I defined in the template, I have only the content of $sBody as defined in function sel_mail().
Any idea what I am doing wrong?


texts: When does the user interface translation gets updated?

texts:
If you turn off  "Check for updates" in /admin/config/regional/translate/settings, on what occasion does the user interface translation actually gets updated?

As far as I know there're two ways to update it:

Installing modules. (Related PO files will be downloaded and imported)
Manually importing PO files from /admin/config/regional/translate/import

Is that all?


texts:
I tried to use 2 modules, FiveStar and Rate to put rating system on a new custom content I created but neither worked.

When I try to put FiveStar in a field of my content it shows me this error:

I don't know why but if I don't put any star on default rating it won't work..
So I have to put my products since they are created all by default with some rank (from 1 to 5 stars or 10 if I change the number or stars they can have)for this to work and that's kind of bad..

I wanted my products to come with no evaluation/rating when they are created.

EDIT:
Now with the rate module I manage to do this, but I now how I change from thumps up/down to stars (from the module or a costumized ones) ?


texts: Does using Views Aggregation break title field as node link?

texts:
I have a working View that uses aggregate to count members of Organic Groups that I modeled off of the View described here.

The title of the Groups is also included in the View; however, even though "Link this field to the original piece of content" is selected the View does not configure the Groups title as a link.

Does anyone know if this is because Aggregate is interfering with the link? Should the Aggregate settings on the title field be something specific? Or does it have something to do with the way the Organic Groups Views relationships are defined?


texts: how to use data of a text list field to draw a canvas image?

texts:
I'm working on a website, where some information has to be drawn like a graph on a canvas. I have the javascript to draw the picture, but for input I need the values of a field (List/Text) initialized by check boxes.

What I need is a way to get the values from the field of the node and draw a canvas image with the javascript code I have but I cannot figure out how..

Any ideas?


texts: How to change the path in which are stored the media modules files and images?

texts:
When using media entity reference fields, is it possible to change the path where are stored the files and how?
Is it possible to store them in the private folder?


texts:
I'd like to give a set of users the ability to manage certain fields, such as adding items to a list. Is this in any way possible with existing modules?

Example:
Editing a node
Try to select XYZ for field FOO
XYZ isn't an option
Go to admin page and add XYZ to FOO
Can now select XYZ from FOO


texts: Is it bad practice to add markup to title or label fields?

texts:
The title might not make sense because I'm not sure what the correct wording is. But here is the example that explains what I mean.

I am creating a block view to go at the bottom of a node page that links in extra info relevant to the node (a users blog post on their profile page).

I titled the block Blog Posts but it was small and smashed up against the bottom of the content above it. So I tried calling it
Blog Posts
 and it displayed as an
. So I got more creative and now the title is

Blog Posts
. It looks nice and works the way you would expect (with the html being rendered properly).

This method kind of seems like a bad hack, but inexperienced as I am with Drupal, I'm not sure why.

Is this bad practice, and why?


texts: Why is my table not automatically created at the time of custom module install?

texts:
I am writing a custom module for Drupal 7. For the table creation I have created the .install file, but the table is not getting created automatically, when the module is installed. I have already uninstalled and reinstalled the module many times. All the times I do it, I get the following error:

  Base table or view not found: 1146 Table 'drupal.drupalform' doesn't exist

This is the code in the drupalform.install file.

function drupalform_schema() {
    $schema = array();
    $schema['drupalform'] = array(
        'description' => t('A table for holding the drupalform data!'),
        'fields' => array(
            'id' => array(
                'description' => t('Auto increment of the ID'),
                'type' => 'serial',
                'unsigned' => TRUE,
                'not null' => TRUE,
            ),
            'name' => array(
                'description' => t('Person\'s first name.'),
                'type' => 'varchar',
                'length' => 64,
                'not null' => TRUE,
            ),
            'last_name' => array(
                'description' => t('Person\'s last name.'),
                'type' => 'varchar',
                'length' => 64,
                'not null' => TRUE,
            ),
            'email' => array(
                'description' => t('Person\'s email'),
                'type' => 'varchar',
                'length' => 64,
                'not null' => TRUE
            ),
        ),
        'primary key' => array('id'),
    );
    return $schema;
}

function drupalform_install() {
    drupal_install_schema('drupalform');
}

function drupalform_uninstall() {
    drupal_uninstall_schema('drupalform');
}


texts: Is it OK to remove field values or revisions by deleting individual lines from the field table in the database?

texts: I have been testing my site (with revisions enabled) for several days now and I have noticed that my field related database tables are filling up with revision info.  Can I simply delete these line items from the field table or are there other entries that I need to be aware of?


texts:
I created a new content type (News). I then added a new node.  After doing these, I created a 'view' of the node. In the view I added the "Add comment link" as a field.

I have the following issues:

In the "Add comment link" settings of the View, if I do not select the "Show teaser-style link" option, the link does not appear on the view page.
When I select the "Show teaser-style link", the "Add comment link" appears on the page as expected. However, the link redirects to the original node page.

What I would really like to do is show the 'full node form' on the view page without it redirecting to the original node.


texts: Error When Clicking - Add Another Item - An AJAX HTTP request terminated abnormally

texts:
On drupal 7, I have a problem with a form. Render content type form in drupal 7 everthing working fine but

I created a Field Collection, when I click Add another item
this error occurs

/************Error************/
An AJAX HTTP request terminated abnormally.
Debugging information follows.
Path: /system/ajax
StatusText: n/a
ResponseText: ShareEmailFacebookTwitterGoogle+PinterestLinkedInStumbleUponRedditGoogle BookmarksWordPressTumblrDeliciousDiggMySpaceYahoo BookmarksBeboMister-WongApp.netWaneloOrkutXINGBufferEvernoteWhatsAppMendeleyPocketVKPinboardSpringpadFlipboardArtoAIMYahoo MessengerPlurkDiasporaBlogger PostTypePad PostBox.netKindle ItBaiduNetlogCiteULikeJumptagsFunPInstapaperPhoneFavsXerpiNetvouzDiigoBibSonomyBlogMarksStartAidKhabbrMeneameYoolinkBookmarks.frTechnotizieNewsVineFriendFeedProtopage BookmarksBlinklistYiGGWebnewsSegnaloPushaYouMobSlashdotFarkAllvoicesJamespotTwiddlaLinkaGoGoNowPublicLiveJournalLinkatopiaBuddyMarksViadeoWistsSiteJotDZoneCare2 NewsBitty BrowserOdnoklassnikiMail.RuSymbaloo FeedsFolkdNewsTrustAmazon Wish ListPrintFriendlyTuentiEmailRediff MyPageGoogle GmailYahoo MailOutlook.comAOL MailAny email&nbsp;&nbsp;&nbsp;&nbsp;By AddToAny
We Are Working On Riley Drupal
The website encountered an unexpected error. Please try again later.
ReadyState: undefined
/************Error************/

function customurl_menu() {
   $items = array();
    $items['program/%/register'] = array(
          'title'            => t('Add @node_type', array('@node_type' => t('Node Type'))),
          'page callback'    => 'drupal_get_form',
          'page arguments'   => array('module_node_add_form', 'registration'),
          'access arguments' => array('administer nodes'),
          'file path'        => drupal_get_path('module', 'node'),
          'file'             => 'node.pages.inc',
          'type'             => MENU_LOCAL_TASK,
          'weight'           => 1,
          );
    return $items;
}
function module_node_add_form ($form, &$form_state, $node_type) {
    global $user;
    //if( !function_exists("node_form")) {
    module_load_include('inc', 'node', 'node.pages');
    //}
    //if( !function_exists("field_collection_item_form_validate")) {
    module_load_include('inc', 'field_collection', 'field_collection.pages');
    // }
    $node = (object) array(
    'uid' => $user->uid,
    'name' => (isset($user->name) ? $user->name : ''),
    'type' => $node_type,
    'language' => LANGUAGE_NONE,
    );

    node_object_prepare($node);
    $form_state['build_info']['args'] = array($node);
    form_load_include($form_state, 'inc', 'node', 'node.pages');
    $form = drupal_retrieve_form($node_type . '_node_form', $form_state);
    drupal_prepare_form($node_type . '_node_form', $form, $form_state);
    return $form;

}

i tryed this links https://www.drupal.org/node/1299074


texts: Require relationship and parent term in taxonomy - Drupal 7

texts:
I have a taxonomy term with hierarchy (two levels, mother and children). When I set a relationship and say "Require relationship", all items dissapear which do not fit the relationship (Content having this taxonomy). But the content is associated to a child of the parent taxonomy, so in some sense, it would have to show the parent term of the taxonomy. Example: I have Taxonomy: Fiction, with children: Sci-Fi, Terror, Romantic.

I associate a content (book) with Sci-Fi. I would like that in the listing, there would appear Fiction and Sci-Fi and not only Sci-Fi. Assigning the book to both Fiction (parent term) and Sci-Fi does not seem the best option and it is not elegant.

Note: there is a suggested solution, but I think that proposal does not fit my case, because I don't want the parent taxonomy to be repeated for each book. In fact, I print a listing of taxonomies, Fiction, then the children (Sci-Fi, Terror, etc.), and in each, the products (books). I don't want the word "Fiction" to be repeated over and over.


texts: How to allow a particular user to take quiz very next day in drupal

texts: I have gone through so many question asked here but not find exact answer. The main problem I have faced is to create a quiz using 7.x-4.0-rc2, I made some user who can take quiz. One user can take quiz only once, but I need that particular user can take quiz again very next day (After 12AM).


texts:
I have built a new form from scratch. I was examining a code example displayed on here earlier, but I am not sure if I fully understand the syntax.

So far I have the following code:

$items['user/register'] = array(
    'title' => 'a large ferrret',
    'page callback' => 'redirect_custom_reg_form',
    'page arguments' => array('user_register_form'),
    'access callback' => TRUE,
    'type' => MENU_LOCAL_TASK,
);

I looked at a similar example in my book, and it looks like the page callback is used to build the form. I have  used a similar example which uses the page callback.

Could someone please explain this function to me. I understand that this is a menu alter function. this should check to see if the user/register page is set

function redirect_custom_reg_form__menu_alter(&$items) {
  if (isset($items['user/register'])) {
    $items['user/register']['page arguments'] = array('mymodule_user_register_form');
  }
}

function mymodule_user_register_form($form) {
 $fields['legal_agreement'] = array (
    '#type' => 'fieldset',
    '#title' => t('Legal Agreement')
 );

 $fields['legal_agreement']['PL'] = array (
    '#type' => 'checkbox',
    '#title' => t('Legal Agreement')
 );

 $fields['legal_agreement']['decision'] = array(
    '#type' => 'radios',
    '#description' => t('By registering at %site-name, I certify that I am over 18 and have read and accepted the terms and conditions of the pravacy policy', array('%site-name' => variable_get('site_name', 'drupal'))),
    '#default_value' => 0,
    '#options' => array(t('I disagree'), t('I agree'))
 );

 return $fields;
}

I then made the assumption that I need a page callback method and this callback builds my page. It does not seem to be rebuilding anything.


texts: How can I find image style SRC from within twig template in view?

texts:
Why I can't use {{ file_url(node.field_image.0.entity.uri.value) }} in my custom view

The result not like /drupal-8.6.1/sites/default/files/2018-10/gen9C52.tmp.jpeg


texts: Does caching has to be manually disabled for ajaxified forms?

texts:
I switched on caching on my dev environment and it looks like ajaxified forms won't work* unless I specifically set max-age to them to 0. Is this normal? Or is this the case only when a form is displayed via lazy builder?

*they will work but submitting them will result in normal behavior where the form is submitted and the page is reloaded.


texts: How can I bulk delete Menu Itemes in Drupal 8

texts:
is it possible to bulk delete and bulk edit menu items in Drupal 8?

Question for Drupal 7: Any way to bulk delete menu items?


texts: How can I get header part from my drupal 7 site?

texts:
Hotelscombined(hotel information site) asked me "the header part" of my website so they can combine my website's header and their hotel list. My header part will be placed in their site.

Then it looks that my website services hotel information.
My site is developed using Drupal 7. How can I get header part only? It shouldn't be just copying and pasting. It should be something like link.
With that, it will be affected in Hotelscombined, even if I changed header part of my website like main menu.

Please help me.


texts:
I just moved a new drupal site onto a directory '/drupal_test' under my current site. So that I can test it while my current site is still running.

When I go to the directory www.mysite.com/drupal_test. I got this error:

**Internal Server Error**
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Apache/2.2.16 (Debian) Server at www.bromptontech.com Port 80

I used putty command line to access the error log on the server and I got errors like this:

/var/www/drupal_test/.htaccess:Options not allowed here

I searched around and it seems something to do with the Allow Override settings, some say it is in httpd.conf, but I can't find this file anywhere, I can only find relevant code here in /etc/apache2/sites-enabled/000-default, I can see the  tags.

Our IT guy gave me the root account to access the server, but he can't help me more than that, while I really have very limited knowledge about the server and these command lines, please can anyone help me with this? Thanks a lot!


texts:
I'm trying to customize my user login page in my custom theme using the template file page--user--login.html.twig, but am having issues accessing the different form elements. All aspects of the form are located in page.content, but I'd like to edit the content that's being outputted.
For a simple example, the base theme has Username and Password stacked vertically, where I'd like to adjust this to use bootstrap so that they are stacked horizontally on large screen and vertically on mobile.
In Drupal 7, we had a form element in the template file that allowed me to render certain form elements separately, like:

  <?php print drupal_render($form['name']); ?>

  <?php print drupal_render($form['pass']); ?>

Is there an equivalent for Drupal 8?
I attempted to create a template file for the form (form--user-login.html.twig and form--user-login-form.html.twig) to see if I could alter the form template itself instead of the page the form exists on, but didn't have any luck with that.
I'd prefer to override the current login theme instead of creating a whole new page and form and have to add all the necessary configurations so that a user lands on the correct login page, but have yet to find any way to do so, thanks in advance.


texts: Optimal Settings.php for Pressflow + Varnish + memcache

texts:
I am using pressflow having varnish + boost + memcache and also using cloudflare caching, I have seen some variable forms of settings.php file on forums and I am confused whether mine is optimal for best usage of all these caching mechanism :

# Varnish reverse proxy on localhost
$conf['reverse_proxy'] = TRUE;
$conf['reverse_proxy_addresses'] = array('127.0.0.1');

# Memcached configuration
$conf['cache_inc'] = './sites/all/modules/memcache/memcache.inc';
$conf['memcache_servers'] = array(
         '127.0.0.1:11211' => 'default',
         );
### END Mercury settings written on 2011-11-01T07:12:49-04:00


texts: Getting 'bool(false)' output before normal page HTML

texts:
I've seen this happen once or twice before, but can't remember where or why.

Basically, in one of my page's HTML output, the first line of HTML is returned as 'bool(false)' - On that particular page, I have a function in hook_init() that logs in a user using user_login_finalize(). Here's the HTML from the

page:bool(false)
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML+RDFa 1.1//EN">
<html lang="en" dir="ltr" version="HTML+RDFa 1.1"
  xmlns:content="http://purl.org/rss/1.0/modules/content/"
...

On the page as displayed, I get a blank line above my theme's header with this bool(false) appearing.

On refreshes, that goes away (basically, it only happens when I log in a user programmatically using user_login_finalize()).


texts: Cron is 403: forbidden with cron_key and through 'run cron' link

texts:
I'm getting a 403: You don't have permission to access /cron.php on this server.

This is whether or not I am logged in. Stranger thing is that it is happening on our development server, but not the live server (drupal 7)


texts: How to make Forena render my SVG Graph properly?

texts:
I am trying to create a bar graph using Forena's SVG Graph facilities. But it shows output like this:

As shown in the above image, it is not rendering the SVG Graph properly.

I am using this SQL statement (my "data block" related to the SVG Graph I try to create):

SELECT Type,count(*) as Number
FROM node
GROUP by type

Following is a screenprint of the related FRX file:

And here is a textual version of that FRX file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE root [
<!ENTITY nbsp "&#160;">
]>

<title>Graph Demo</title>
<frx:category>Sample Graph</frx:category>
<frx:options/>
<frx:parameters>
</frx:parameters>
<frx:docgen>
</frx:docgen>
<frx:fields>
</frx:fields>
<frx:menu/>
<frx:cache/>


texts: Filter to display articles from the last edition date only

texts:
I have a magazine type project but articles are grouped into editions(issues). So I have 2 content-types interconnected using node reference.

What I need is to create a view to display only the articles of the last edition on frontpage. I can use a criteria of edition date or edition number (need the last one). Unfortunately I cannot find how to do do it. What value of the operator to enter.


texts:
Right now my menu item will scroll to my anchor tag < front >#tag1, without a problem. However I do not like how "jumpy" it is. I would like a smoother scroll affect?

I found this module: https://www.drupal.org/project/scroll_to_destination_anchors .

I have jquery and javascript enabled, but I can't seem to get a smoother affect. Any Help? I am using Drupal 7 core.


texts: How do I check the image's view mode in the image.html.twig template?

texts:
I'd like to detect the custom view mode (Structure > Display Modes) selected for an media entity (image) and then be able to have html output based on the view mode. Specifically I have a custom view mode named 'top_banner' and would like to change the formatting of the default  element when this view mode is selected. Here is what I have in my image.html.twig template:
{% if view_mode == 'top_banner' %}
    <img{{ attributes.addClass(banner) }} data-cover/>
{% else %}
    <img{{ attributes }} />
{% endif %}

This however does not seem to detect the view mode. Currently the image is output in the default format <image {{ attributes }} />.
The image is a media entity field and is part of a Paragraph type named x_banner. The x_banner Paragraph is then referenced on the x_page content type.
I've searched and can't seem to find an instance where this is implemented in the field.html.twig
or image.html.twig template.
Any assistance with this would be greatly appreciated.


texts: Installing an alpha dev version with composer

texts:
Block class module has a 8.x-1.x-dev version.  Installing using the recommended command from the specific release page

composer require 'drupal/block_class:1.x-dev'

installs a versionless block_class.

Why is that and what are the implication on future composer update ?

UPDATE: when installing with drush

drush dl block_class --select

and choose latest dev version that version is 1.0-alpha1+10-dev
how can one install the latest alpha-dev ?


texts: How can I monitor for bot accounts accessing drupal paths without permission?

texts:
On my site, users do not have permission to create content.

However, looking through the watchdog logs, I found several accounts that were attempting to access

node/add/article
node/add/page

and so on.  In this case, all the accounts were registered from @ad.drupaler.org, so it was easy to eliminate them, but in case the same thing happens from a variety of domains in the future, I'd like to set up some way to alert myself that users are attempting to access these paths.

I am thinking about using the Rules module to do this, but I was wondering if there was already a "best practice" for this kind of thing-- since there are automated bots to attack Drupal sites, there might be an automated way to fight back.


texts:
This is in Drupal 8 still a really weird behavior.
When using the admin menu / tool bar or any menu really Drupal totally ignores the setup admin language. In frontend every menu is outputted in the content language - so in my case japanese for example...

This makes it so incredible hard for people to handle foreign content as they never can use any admin element in the frontend of the site.

Is there any solution? I already tried to hack the core toolbar menu as I though it was just a bug - content specific language selection instead of admin interface specific - but thats not the case.

Do I have to build my own admin toolbar with just english menu items?
Crazy stuff.

Thanks


texts:
For some hours now, I am trying to accomplish the following scenario:

I have a views_slideshow that uses the cycle plugin, it shows 3 slides at a time that each contain a title, body, image and read more button.
Read more button shows a modal window (twitter bootstrap) popup.

Since views_slideshow is not responsive out of the box, I am trying to create an AJAX mechanism that loads the correct view display, based on the width of the screen.

I have created 2 views displays in my slideshow view.

One showing 3 slides
One showing just 1 slide.

I created a small block that contains an AJAX wrapper (div) that I will fill with the correct view, based on the width.

My block:

function _topics_block_render() {
  drupal_add_js(drupal_get_path('module', 'my_module').'/js/topics_block.js');
return '

';
}

My JS file:

(function ($) {
  var checked = false;
  Drupal.behaviors.topics_block = {
    attach: function (context, settings) {
      var width = $(window).width();
      if (width <= 768) {
       var size = '1_by_1';
      }
      else {
        var size = 'default';
      }
      var url = Drupal.settings.basePath + '/get-topics/' + size;
      $.get(url, function (data) {
        $('#topic-ajax').html(data);
    });
    if (checked == false) {
      checked = true;
      Drupal.attachBehaviors();
    }
  }
 };
})(jQuery);

My AJAX page callback

function topics_get_topics($size='default') {
  $view = views_embed_view('topics', $size);
return print render($view);
}

As soon as I load the view into my page manager page without AJAX all is working perfectly fine.

Anyone ever tried to accomplish anything like this?

As a sidenote, I am not using owl carousel because of a JS conflict with the Bootstrap modal window popups...

Many thanks in advance

EDIT

The questions does not appear to be a duplicate of
How to load and display a view with Ajax in Drupal 7?

I have tried the proposed solution there, but the result is exactly the same.
The view is shown properly, but the slideshow does not work.

Some additional hours of debugging have led me to figure out that the Drupal behaviors are actually being reattached properly, but Drupal.settings.viewsSlideshowCycle[fullId]; is not being called properly.
When you investigate Drupal.settings.viewsSlideshowCycle, you will see that it contains all the view id's from slideshows on the page.
That is not being updated properly after the ajax event.

The only extra thing that is worth mentioning, is that somehow the Quicktabs module seems to manage to load the views_slideshow view via AJAX.


texts:
I wonder if, and how, the following would be possible to tag each uploaded file with one or more tags and show these files filtered on their tag(s).
I know it's possible to do this for nodes but have not found a way to tag single files.

The purpose of this would be the creation of an image bank in which the administrator can upload images or files (pdf, zip) and define each image/file as being, for example, 300dpi, print, high resolution, color, black & white, etc.


texts:
Trying to run cron tasks using 0 */1 * * * root curl -s http://site.name/cron.php?cron_key=secret_key >> /var/log/site-cron.log 2>&1 or 0 */1 * * * root wget -O - -q -t 1 http://site.name/cron.php?cron_key=secretkey >> /var/log/site-cron.log 2>&1 doesn't work.

Using 0 */1 * * * root curl -s http://site.name/cron.php?cron_key=secret_key >> /var/log/site-cron.log 2>&1 and 2 */1 * * * root curl -s http://site.name/cron.php?cron_key=secret_key >> /var/log/site-cron.log 2>&1, the second attempt works.

Access log shows both calls, but dblog shows only the second attempt.
There are no errors in nginx log, cron log, php-fpm log.

How do I fix this?

UPD: thanks @zhilevan. I was able to debug cron scripts with his help. This way drush --root=/usr/share/nginx/demo --quiet cron displays errors in cron scripts.


texts: qTips do not appear on content type create form

texts:
I have installed qTip (Stylish jQuery Tooltips) module v7.x-2.0-rc3, but I cant get it to work on a content type create form.

The steps I've followed are the following:

Install and enable qTip module along with Fields sub-module.
Create a new qTip instance with the default and simplest options.
Go to my content type and manage a Long text field with a text-area widget.
Enable the qTip Settings for it. Set it to Custom Text and fill in a sample text. Select my previously created qTip instance.
Press Save and clear all caches.

However when I go to the form (Content -> Add Content -> My_content_type) the qTips are nowhere to be seen. I've tried to hover over the label and the text editor. Nothing shows up.

On the other hand when I preview my instance the qTip appears normally:

Am I missing something here?


texts: Adding a Custom Solr Search Block that restricts search to one content type

texts:
I have Apache Solr search 7.x-1.1 installed and working as my main site search.

I would like to add a search block to one page that allows the user to search, but restricts the results to a single content type. The new search block should be placed in a different location to the main site search, and the two should be able to co-exist on the same page.

What is the simplest way of achieving this please?


texts: I am using https://www.drupal.org/project/download_file module to download any file. It is perfectly working on my local machine but on live site when I try to upload any file it gives me the following error


texts:
In Drupal\rsvplist\Form\RSVPForm->buildForm(), I wrote this to get the current nid:

$node = \Drupal::routeMatch()->getParameter('node');
$nid = $node->nid->value;

I get this error:

  Notice: Trying to get property 'nid' of non-object in
  Drupal\rsvplist\Form\RSVPForm->buildForm() (line 30 of
  modules\custom\rsvplist\src\Form\RSVPForm.php).

I am a new module developer. How to get the current nid in drupal 8?


texts: How to create a specific menu for specific users?

texts:
I'd like to know how can I create a menu like so:

Menu X which appears when a Member X performs a login, for example when a simple user login, a Menu with 4 sections appears
but when a Member Y (for example a user as manager) performs a login, instead of Menu X (= simple user menu), this time a Menu Y (menu manager with 7 sections) appears.

any suggestions?


texts: URL alias, tokens is replacing 0s and 1s with node and entity

texts:
Has anyone seen a case that url aliases or tokens end up replacing certain numbers in a url with the words node and entity. A UTC Timestamp in my url ended up replaced like this:

node4328522entityentity

I cannot find any errors in the watchdog table. It seems like it's trying to "encode" numbers, but those are numbers that shouldn't be encoded. Or another possiblitiy I've thought of is maybe it is trying to grab something out of a non-existent array at index 0 and 1?


texts:
I have a page with list of teasers. It contain links like 1 comment, 1 new comment, add your comment. I want to change 1 comment to 1 response, 1 new comment to 1 new response and add new comment to add new response.
I used string overrides module and tried to change the strings, but i was able to change only add new comment to add new response. How to change 1 comment and 1 new comment? please help.


texts:
How do I add input fields to the commerce products (in Drupal 8) in order to save the information of those fields when the user purchases the product?

For example, if I want to sell t-shirts I would like an extra field to add some text and print it in the t-shirt.


texts: Drupal logo is displayed with out the dimensions like width and height

texts:
My client raised an issue that when viewing the source the logo of my website does not have any attributes, but I saw many themes, and not all have those attributes.

How do I add these to the logo? Is it really required?


texts:
I am using Feeds and Feeds Tamper Find and Replace RegEx Plugin to import a few files to Nodes.

The importer has been mapped correctly, however, doesn't import any data. On each import I get the message, Imported Items, however, every node is empty.

I tried with UTF-8 encoding, ASCII as well as Auto, but nothing imports.

I am no developer and very new to RegEx, found out about it just last week, however, I tried to create a RegEx to pull in the just Title to see if it works. The RegEx code worked fine in Atom Text Editor, as well a couple of online RegEx Testing sites. Works alright. However, doesn't work in Drupal.

/^[A-Za-z]\w+\s[a-zA-z]\w+/

My Feeds Tamper Configuration -

REGEX to find: ^[A-Za-z]\w+\s[a-zA-z]\w+

Replacement pattern: $1

Limit number of replacements: 1

I did come across this question while searching for a solution, however, that didn't work either.

Please advice

Thanks


texts: How to skip step 1 on multi-step/wizard webform?

texts:
I need to skip step 1 and start on step 2 of a multi-step/wizard webform when a certain condition is true.

I found documentation regarding this, How to programmatically skip steps in wizard forms

The key part being in hook_form_alter putting

$form_state->set('current_step', $all_keys[$goto_destination_step_index-1]);

What this does is fool drupal into thinking you're currently in the previous step that you want to go to, when in reality you're not. But the problem with this solution, is that it only works when you click the "next step" button and not on page load. Thus, the above solution only works for all but the first step.

I have tried doing

$form['progress']['#current_step'] = 'step_2';

But all this does change the progress marker to step 2, but I still see step 1's form.

I need to find a way to fool Drupal into thinking that I have completed step 1.

I tried doing $form_state->set('form_field' $value); when I looked at form_state->getValues(); they were not set. I so I set them with $form_state->getValues()['form_field'] = $value; on all step 1 fields, but doing this alone does not trick Drupal.

There must be somewhere were Drupal stores that step 1 has been completed, but haven't been able to figure out where. My guess would be somewhere on $form_state, but I have not found it yet.

Update:

I don't really need the answer to this anymore, as the condition is no longer needed so it was decided to remove the question's step 1 altogether. But if you happen to know the answer, feel free.


texts: Can I route individual websites to a multi-site Drupal installation?

texts:
This isn't really Drupal-specific, but perhaps someone is already doing this with Drupal and can guide me. I host a few sites for my customers and several of those are Drupal-based, using a multi-site installation. No problems, except that those are not individual cPanel accounts, of course, and the customer cannot manage any part of their account -- I have to do it all.

Is it possible to set up my Drupal customers with individual cPanel accounts, yet route all their web traffic to the multi-site Drupal installation on my reseller account (typical reseller account on a shared host)?


texts: How to reference identical files on multiple nodes?

texts:
I have created two nodes that contain a File Upload.
Is it possible to reference files common to both nodes or do I have to create duplicates? I want to reduce the overhead of managing large number of uploaded files.


texts: How do I allow an entity reference to be null in my custom entity?

texts:
I am working on adding taxonomy to the poll module. This is my  BaseFieldDefinition:
$fields['category'] = BaseFieldDefinition::create('entity_reference')
  ->setLabel(t('Category'))
  ->setDescription(t('Section this poll is to appear on'))
  ->setSetting('target_type', 'taxonomy_term')
  ->setTranslatable(TRUE)
  ->setDisplayOptions('form', array(
    'type' => 'entity_reference_autocomplete',
    'weight' => -10,
    'settings' => array(
      'match_operator' => 'CONTAINS',
      'size' => '60',
      'autocomplete_type' => 'tags',
      'placeholder' => '',
      'options_list_callback' => 'my_callback',
    ),
  ))
  ->setDisplayConfigurable('form', TRUE)
  ->setRequired(FALSE);

However, I would like the category to be optional, but when creating a poll if it is left blank it returns an SQL error and this error appears on screen.

The website encountered an unexpected error. Please try again later.
Drupal\Core\Entity\EntityStorageException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'category' cannot be null: INSERT INTO  {poll_field_data} (id, langcode, uid, question, category, runtime,   anonymous_vote_allow, cancel_vote_allow, result_vote_allow, status, created, default_langcode) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1,  :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4,  :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11); Array ( [:db_insert_placeholder_0] => 3  [:db_insert_placeholder_1] => en [:db_insert_placeholder_2] => 1  [:db_insert_placeholder_3] => TEST poll [:db_insert_placeholder_4] =>   [:db_insert_placeholder_5] => 0 [:db_insert_placeholder_6] => 0  [:db_insert_placeholder_7] => 1 [:db_insert_placeholder_8] => 0  [:db_insert_placeholder_9] => 1 [:db_insert_placeholder_10] => 1442410281 [:db_insert_placeholder_11] => 1 ) in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 755 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

If ->setRequired(FALSE) doesn't allow null columns in the database what does?


texts:
I have a view that shows me a list of images on the front page. Each of those images has its category. Now i need to add exposed filter with categories that allow users to choose images by categories. BUT I want to show all images and just to highlight (by adding CSS class for example) the exposed filter results. Is it a way to do it?

I'm using Drupal 7.


texts: rules autotag module, bulk retagging existing nodes

texts: I am using the rules autotag module. It's working fine for adding new nodes. But what would I do for retagging existing nodes (approx. 40,000)?


texts: Autofill billing Information on checkout page in Drupal Commerce

texts:
I need to autofill the billing information on checkout with Drupal commerce.

I added to drupal user a field called 'field_commerce_billing' like a reference to 'Customer profile' entity and I want to autofill the checkout with the customer profile fields values if an user is logged in.


texts: How to redirect from confirmation page back to page of form?

texts:
Is it possible to have a form redirect the user after landing on the confirmation page back to the previous page (page of the form)?

Note: I'm using Webform for D8


texts:
I need to rewrite all image urls inside certain node types into custom-defined urls. For example, this image:

need to be rewritten to:

And I need to do that for all of the user-generated images. Obviously, the goal is to be able to off-load all images to a secondary file server.
How can I do that?

Thanks


texts: JSON through Services View- Authenticating through Parameters when accessing JSON through external app

texts:
My Drupal site is generating JSON through Views. I am using Services for that.

It is something like this:-

http://www.asite.com/api/views/all-date.json

Now the problem is that I want to restrict anyone from writing that URL in the any browser and retrieving all data.

Do you think there is a way to authenticate it?

Probably, in my external app, when I am accessing the data, I can add parameters to it so that it can only send data when it has right authentication.

Something like this:-

http://www.asite.com/api/views/all-date.json/?username=me&password=mine

I'll be grateful if you could help.


texts: How to secure ajax on automatically save field data

texts:
My custom module make ajax request on _node_edit form after input changed by user, and menu callback save this field's data (only this field, not all node object). Menu item is as "field-save/NID/FIELD_NAME", and the input val is on $_POST['field_data']. Menu item have own permission per role. Additionally each user have own randomly generated secure string and it is on the same ajax $_POST['secure_phrase']. Menu callback checking for permission per role and this secure string per user, if have access going forward to save field data.

The question: Is this enough security to prevent for unauthorised access to save field through this ajax request?

edit:
additional for this on "access_callback" i have

if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
  // checking permissions here
}


texts: Is there a reliable autosave function for nodes?

texts: We're working with dirty forms to at least warn users before they leave an unfinished page before they save. It kind of works.  Would enabling revisions control work? At least in that case an admin could recover the last version.  Is there an automatic autosave ... say every 30 sections -- to be sure work is properly saved even if the user forgets to hit save?


texts: Why are Drupal hosting providers using Solr 3.x instead of 4.x or 5.x?

texts:
As of April 2016,

Acquia offers Solr 3.5.
Pantheon offers Solr 3.6.
Platform.sh offers Solr 3.6 by default, with 4.10 as an option.

The current release of Solr is 5.5.0 (2016-2-20).

3.5 was released on November 25, 2011.

3.6 was released on April 11, 2012.

4.10 had its final release on October 14, 2015 (but it was first released on September 2, 2014).

Is there a reason to stick with 3.x vs. Solr 4 or 5?  Search API Solr supports all three versions.  Normally I would just use the latest version, but when major hosts that specialize in Drupal are on a version that is more than three years old, it makes me wonder.


texts:
How do you set an id for the menu's root <ul> tag?

I know about the module "Menu Attributes" but that doesn't let me add an ID to the root <ul>, or at least I do not know how.

Also, I've seen a solution which uses theme_menu_tree() and a regex check, but that's just too hacky for my taste.


texts: Parameter upcasting in Forms: buildForm works, submitForm doesn't

texts:
Route:

mymodule.applications.payment_form:
  path: '/payment/{submission}'
  defaults:
    _form: '\Drupal\mymodule\Form\PaymentForm'
    _title: 'Pay Fee'
  requirements:
    _role: 'applicant'
  options:
    parameters:
      submission:
        type: entity:webform_submission

This works:

public function buildForm( array $form, FormStateInterface $form_state, WebformSubmission $submission = NULL) {
    $submission_data = $submission->getData();

This doesn't (null):

public function submitForm(array &$form, FormStateInterface $form_state, WebformSubmission $submission = NULL) {
    $submission_data = $submission->getData();

Is it intentional that upcasting is only available to buildForm?
Is there a workaround?

(My logic being: the form, when submitted, still POSTs to /payment/123, so it's still convenient to load the object.)


texts: How to display all links of the Answers module on a single page?

texts:
I using the Answers module, which provide the various set of views as shown in the image below. But it does not provide anything where we can provide these views as a link. I mean I want all these four views in one line as a menu tabs on page,

So, it should be like this:

Main menu tab: Q&A
When this Q&A tab is clicked, it should show all these 4 tabs with first tab as default:

  All Questions | Unanswered Questions | Search Questions | Search & Add Page

I am surprised this option is not available by default.


texts: Adding a submit button in a themed table doesn't work

texts:
When I add a button inside the '#rows' key of a table element, the submit function is not called.
class MyForm extends FormBase
{

   public function buildForm(array $form, FormStateInterface $form_state)
    {
        $my_button = [
            '#type' => 'submit',
            '#value' => $this->t("Click"),
            '#submit' => [
                '::custom_submitForm'
            ]
        ];
        $form['my_table'] = [
           // '#tree' => TRUE,
            '#theme' => 'table',
            '#header' => [
                'Column 1','Column 2'
            ],
            '#rows' => [
                [$this->t("Blabla"), ['data'=>$my_button]]
            ],
        ];
        return $form;
    }
    // other stuff

What is the best workaround for this?
EDIT TO ADD:
As a first try to understand what is going out, I have allowed the children function to consider '#rows' as children (see   Drupal\Core\Render\Element::children)
  public static function children(array &$elements, $sort = FALSE) {
     ...
    foreach ($elements as $key => $value) {
      if (is_int($key) || $key === '' || ($key[0] !== '#' || $key=='#rows')) {
     ...

This is solving the issue (the handler is called), but of course, this change generate many other problems.. But now, we can understand why the submit handler was not called.
I have added an issue in the drupal queue: https://www.drupal.org/project/drupal/issues/3166899
I am not asking to correct this bug, but what would be the best workaround.


texts:
My website URL shows in browser https

But on https://test.com/admin/config/system/site-information

It's showing http.

What will be cause of this? Server configuration (apache)?

Does it relate to Base URL?


texts: Drupal + Simpletest + Class Autoloading = FALSE?

texts:
Just a quick question which I couldn't Google : is class autoloading not "enabled" when running tests using SimpleTest?

I'm using the Drupal SimpleTest module, and I'm trying to instantiate a class which I have defined in files[] (in the .info) file. However, I just keep getting a message saying that the class could not be found.


texts: Change default language from the database?

texts:
I have made a stupid mistake:

I installed the .po for another language and set it as default (instead of English) even though I did not install/configure all the prerequisites. Now, each time I try to access my website, it goes into an endless loop and I can no longer access its configuration panels.

How can I reset the default language back to English? Is there any file to configure or database entry to change?


texts: How to collapse and uncollapse (toggle) the body field in teaser display?

texts:
I have a list of teaser nodes. The body field is shown as trimmed with a read more link which leads to another page to view the full display of the node. So far so good.

I need to change this to: when the read more button is clicked all the content of the body field is uncollapsed (slidedown) and a less button is shown. Then f I click it the body field is collapsed again (slideup)

I think there must be a module to do this, since is a very popular practice.


texts: Access page.tpl.php variables from html.tpl.php

texts:
I've got a well-established theme that's building a lot of variables for the page template, ie. $variables['page']['stripe_color'] = $some_node_data; However, now I'd like to apply this variable to the body tag; so, it needs to be communicated to html.tpl.php

I know there's a bunch of ways to this, store it in a global, reevaluate in the theme_preprocess_html, but I'm wondering if there's a simple variable somewhere that's available that I'm not finding.


texts: Accessing the uri within the template_preprocess_image_formatter

texts:
I am using template_preprocess_image_formatter and I am trying to access the uri protected property inside the URL array (see screenshot)

does anybody know how to access it?


texts: How to find users with password same as their username

texts: How do I find users which their password is equal to their username in Drupal 7?


texts: Display suite fields visibility restriction

texts: Is there a way in DS fields visibility restriction with url pattern?


texts: Can't get the module quick edit to work (have some error screenshots)

texts:
I've successfully installed the module Quick Edit that let's you edit nodes in-place (in a similar way to Panels in-place editor) and might save time.

After installing the module I've yet to see any quick edit button (img1) So I tried to check permissions and they were seem fine, and I'm the admin (img2). Than I tried to clear cache and again there was no such button, so I went to ran cron and some errors appeared (img3+4).


texts: Search with Views not Saving Selected Filters when user tries to go BACK

texts:
I've created a search page using Views with exposed filters and the basic search module. The search only returns results for a specific node content type 'resource'. A typical use case would be the following:

User goes to search page, types some text into the exposed search terms block, and also selects some options from the exposed filters that are drop-down menus. They click 'search' and their results are returned on the same page. Pretty standard stuff and I have that all working fine.

A user then clicks a link to a resource node of interest to them and goes to that node's profile page. All fine and dandy.

The problem is when they want to go BACK. I went ahead and added a back button with the following code to my node--resource.tpl.php, which works as you'd expect (it bypasses the browser back button and takes user to main search page again):

<input type="button" value="Go Back" onclick="window.history.back()" />

What happens is it displays the search page again, but no longer with the search term they entered OR the exposed filters they selected. I'd like to change that so when they click the 'back' button the search page still shows their search results from before so they don't have to re-select all their options again.

This seems like pretty basic stuff, but I can't figure out how to do it in Drupal. I imagine it involves session cookies somehow...but how to combine this with Views I do not know.

Thanks for your help!


texts: Node update date changes when saving without changing anything

texts:
Why does the timestamp of node_revisions and changed of node tables are updated when I save a node without making any changes?

All I want to know if anything ever changed in a node (revision). Is there a way to find it?


texts: How to send an email once every 6 months using the Rules module?

texts:
How to send an email once in every 6 months at 12:00 am for a date field about user renewal which is there in user profile using the Rules module?

Its mail should send in cyclic form every once in 6 months to notify user, repeating the mail once in 6 months.

So far I followed the tutorial "How to Send Follow-Up Emails Using Rules Scheduler in Drupal 7", and I have created a Rules Component, I then created a Rule like so:

Rules Event: After saving a new user account
Rules Conditions: None
Rules Action: schedule the Rules component (which I created before), with Scheduled evaluation date:+6 month and User > Data Selector: account.

So this is what I have done so far and this email I want to send every 6 months once repeatedly same email


texts:
We are still on Drupal 6 which has worked fine for years, and I have not done any updates.
We have Date/Time boxes on our "Events" items with pop-up boxes (see image).
But since recently the when you 'Edit' an event the dates/times go blank, but they didn't use to.
We've done nothing to alter the setup at all!

It is not only annoying, but as the 'Front Page' is set to Chronological order, if the date is blank the event disappears (past it's date presumably), so the author can't even see it to notice & correct it!

There is another question similar "when using Scheduler......"
The only answer was "it must be a bug - report it"  BUT it used to work fine, and we have not changed or updated anything (I don't know how to!)
Apart from this the site works fine!

I am not a Drupal programmer so don't ask me to update any code!
I presume it must be a 'setting' somewhere, or could it be to do with lack of memory????

one image is date/time boxes as they appear on editing, the other image is how they look when the event is first posted (or when dates re-entered)

Mike


texts:
How to pass the custom validation after custom submission?

I have problem in getting a variable from a custom submit handler. Actually, the custom validation must happen in the last step in order to validate correctly.

Workflow is:

1.custom submit.

2.get a value from the API.

3.pass it to custom validation.

Since the custom validation step comes first, I am unable to validate it properly.


texts: Inspecting HTTP headers when requesting a route generated from Views

texts: I have a content view with a REST Export display, and I want to inspect the HTTP request headers and look for a custom header, denying access to the view if the header's value is not on a whitelist. I was planning to use a hook called early in the view, like hook_views_pre_view(), and maybe some of the tools provided by Symfony's HttpFoundation to grab the request headers, but I'm not sure how to put all together. Any suggestions?


texts: Including Part Template within a Custom Module

texts:
I am writing a custom module that uses several twig templates in my modules /templates directory. I want to use part templates (https://www.drupal.org/node/2634166) so that I could reference the following:

{% include directory ~ 'includes/spr_table_selectors.twig' %}

The problem is my include keeps referencing my main site theme (themes/mytheme/...). Is there an easy way I can reference my includes directory within my custom module?


texts: Drupal 7 check all solution for 2017, is it possible?

texts:
I looked online, tried the checkall module, nothing works, found info from posts in 2013...

Is there a way to provide a Select All / Check All checkbox for a field that displays multiple checkboxes in Drupal 7?

Nothing conclusive, just half baked hacks that might or might not work.

Any solution that works for 2017?

Even the Google chrome check all extensions are buggy...only thing that works in older versions of firefox for this...

Any suggestions?


texts: Is it possible/ feasible to convert ordinary nodes to Ubercart nodes?

texts:
I have a site that imports content from several XML and CSV feeds, which creates nodes for each item (the items are products, but the site does not directly sell each product).

I'm just wondering if it's i) possible and ii) feasible to convert these nodes to be usable with Ubercart? Although the site doesn't directly sell the products (each product links to the supplier's site), there are features in Ubercart that are attractive to use - in particular, an Ubercart theme that I would like to use on the site.


texts: How do I create a new heartbeat message variable?

texts:
There is a heartbeat message template like the following, which gets filled in whenever a user joins a group.

'!username joined the group !group_title'

Is it possible to create a new variable or change the value that is plugged in for a heartbeat variable?

I'm trying to do something like this to show the user's fullname:

'!userfullname joined the group !group_title'

Thanks,
Greg


texts: Adding js and css from a module but only to node view, not node edit

texts:
I'm adding js and css from a custom module and it works except for the fact that it also adds to the node edit page which I don't want.

I have this in my custom module:

function MYMODULE_preprocess_page(&$vars) {

// Global node.
$node = menu_get_object();
 if (!empty($node) && $node->type == 'my_node_type') {

// do stuff here like add_js, add_css

  }
}

... this works except that it also adds js and css files to the node edit page which I do not want. I've been playing around with this now for a while and any searches I've done have come up blank so I'm out of ideas for now. I suspect I need an extra argument to only add this to a node view and not node edit.


texts: Drupal 8, The file used in the Image field may not be referenced

texts:
I am using managed file type to upload image in my custom form (Drupal-8). I am able to retrieve the given image while editing by using the below code

$form['image_field'] = array(
   '#type' => 'managed_file',
   '#title' => t('Image'),
   '#default_value' => array($fid),
);

While i am trying to save once edit, i am getting the "The file used in the Image field may not be referenced." error.

Please let me know to over come this error and let me what this error trying to convey.


texts: Send multilingual emails notifications with Checkout Rules in Commerce module?

texts:
I have an on-line store using the Drupal Commerce module. When the checkout is done the buyer get an *email notificatio*n. So far so good.

My problem is that the website is multilingual (english, french and spanish) then I need to send the email notification in the correct language.

To accomplish with this I think of:

1) creating 3 different rules, one for each language at: admin/commerce/config/checkout/rules.

2) Each rule would have a condition to compare the user current language and an action to send the email notification in the correct language

3) Then when checkout is done the correct rule should be fired to send an email in the appropriated language

Is there any other way to do it?


texts: In twig_render_template(), I see this drupal_container()->get('twig')->loadTemplate($template_file)->render($variables). But I can not see where the twig service is defined.


texts:
I'm using Views RSS to generate custom RSS feed which includes georss

I have to content types Shops and Events I can get the location fine from Shops because it has dedicated location field, but Events uses Node Reference to generate drop down menu of all Shops and has no location field.

How can I access the location of the referenced Shop from the View? I understand I have to create a relationship, but I'm not really sure where to start.

I'd appreciate any advice.


texts: How can i configure the core search module to also show results for incomplete words?

texts:
I see that the results page only shows results if the "keys" parameter matches a complete word. how Can i configure the core search engine to also show results for incomplete words?

I am using core search module .


texts: Is the database table "field_revision_body" used in a core module or can I just drop it?

texts: I recently installed the revisioning module and now im cleaning it up and uninstalling it, but it seem to have created a bunch of field_revision_field_ tables in my database. Since it creates another table for every field you have, it creates alot of mess. I uninstalled the revisioning module, but these tables still stayed. I was wondering if I can just drop these? Also i see there is a field_revision_body table, but i dont know if it was generated by the revisioning module. So im asking if anyone knows what this table is used for? I tried deleting it, but i get an error when editing a node. So it must be used for something.


texts: How can i set an error message in the right place?

texts:
Using Webform with custom template, and this code.
I have code below for validation and validation errors, and it works fine. But errors always appear in wrong place.
I think the problem is with $element, but I'm not sure.
some example html
<form id="webform_client_form_226">

            // i need it here

            Your name
            <input name="submitted[vashe_imya]" value="" size="60" maxlength="128" class="form-text error">

            // and here

            Phone number
            <input name="submitted[nomer_telefona]">

    // always appears here right now

            <input name="op" value="send">

and template.php
function pkpro_uikit_form_alter(&$form, &$form_state, $form_id) {
    // Check the form id
    if($form_id == 'webform_client_form_226') {
    $form['#validate'][] = 'form_validate';
    }
    }

    function form_validate(&$form, &$form_state) {
    $message = "Field required";

    if(isset($form_state['values']['submitted']['vashe_imya'])) {
    $name = $form_state['values']['submitted']['vashe_imya'];
    if( condition ) {
    form_error($form['submitted']['vashe_imya'], $message);
    }
    }
    if(isset($form_state['values']['submitted']['nomer_telefona'])) {
    $name = $form_state['values']['submitted']['nomer_telefona'];
    if( condition ) {
    form_error($form['submitted']["nomer_telefona"], $message);
    }
    }
      // get all validation errors.
      $form_errors = form_get_errors();

      if (!empty($form_errors)) {                                //i think
        foreach ($form_errors as $element => $error) {           //the problem is here
          $form[$element]['#suffix'] = '
'.$error.'
';  //but not sure. Trying changing this for 2 days(
        }
      }
      // clear default error messages.
      drupal_get_messages('error');
    }

Help, pls)


texts: Is it considered bad drupal style to have a large number of 'static' pages scattered around the website?

texts:
I'm developing a website in Drupal 7 which has a large number of pages that are either A) static, or B) dynamic in some sense, but not abstractable into a node.

My first instinct would be to just add implementing menu items in a hook_menu() function, then add hook_theme(), theme files, etc. etc. The thing is, across my website, I'll have probably 15 or more of these pages - that's a lot of URL's that are hard-coded into this site, in a way that isn't necessarily obvious to content managers who will be maintaining it.

The thing is, all of these hard-coded pages are going to be in the context of a landing-page. I am toying with the idea of creating a landing page content type, where they can edit the basic pieces (pretty much just the title and a single sentence) and assign it to a menu item, but then allowing them to select from a variety of pre-hard-coded solutions for each of the possible necessary pages. This is also a very sloppy solution, but it will give the content manager a tiny bit of control.

The pages in question are all too different, with too specific of requirements to make use of any module such as Views - they all need to be one-off, server-side code.

Any thoughts?


texts: Constantly getting "The website encountered an unexpected error. Please try again later."

texts:
I wondered if I can get some advice regarding working with Drupal 8. I've tried installation after installation and sooner rather than later I'm effectively bricking the installs by just installing third party modules.

Can someone please advise how I can debug effectively? I'm not a dev but can do some basic dev tasks.

I used to use for Drupal 7 in settings.php:

error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);

However, I have no luck with this in Drupal 8.

It's getting incredibly frustrating when trying out new modules for this constantly to be happening.

Log file reads (which I've Googled) prior to asking.

  [proxy_fcgi:error] [pid 15594:tid 139919129229056] [client
  79.70.230.243:47902] AH01071: Got error 'PHP message: Uncaught PHP Exception
  Drupal\Component\Plugin\Exception\PluginNotFoundException: "The
  "file_type" entity type does not exist." at
  core/lib/Drupal/Core/Entity/EntityTypeManager.php line 125\n'

A second site outputs:

  [pid 15594:tid 139919154407168] [client 79.70.230.243:49570] AH01071:
  Got error 'PHP message: Uncaught PHP Exception
  Drupal\Component\Plugin\Exception\PluginNotFoundException: "The
  "file_type" entity type does not exist." at
  core/lib/Drupal/Core/Entity/EntityTypeManager.php line 125\n',
  referer: http://domainname/user/login

Despite me having the above information, I really don't know what is causing this. Furthermore, I never do as reading the log files and following those error messages (like the above ones) doesn't clearly illustrate which module is causing the problem.


texts: (Drupal 6.28) Blocks list suddenly doesn't show correctly

texts:
I realized today that blocks list (admin/build/block page) doesn't correctly show  all the blocks implemented in the site.
Most of the blocks are set as disabled and others are set in the wrong region, while fortunately the site displays every block still perfectly.
I have a custom theme (Zen subtheme).
The only "strange" thing I did recently was the installation of a new module which involved the assignment of a new block to a region.
Is there any way to restore the correct blocks list?
Maybe if I don't make any change to blocks system (and save the new configuration), my site will always display correctly, but I would prefer to have the correct blocks list restored.
Yes, I could draw a manual scheme of all blocks in the site (pages, views, etc.) and use it in case of disasters, but if I could restore it with a module it would surely be better
Thanks


texts: Block above content should be simple however

texts: I have a site where they are wanting to have a block above various pages without having a ton of blocks on the blocks layout page. For example they want a block above the login form on the user login page with a welcome message and or instructions that they can easily edit. They also want another "description block" above other pages that we cannot easily add blocks to without giving them admin access such as editing views etc. Does anyone have suggestions as to a way for me to go? I originally thought of using page manager however page manager does not let you use the main content block within itself when you override the path of an existing page.


texts: Complex Group Permissions for Users and Content

texts:
My application holds content about projects.  Projects have a number of entity reference fields including ones giving them both a team and a region.  Projects live inside of units (1-to-1 relationship) which hold a lot of taxonomy terms specific to that unit.  Users belong to units in either an unrestricted role or one of several restricted roles (referred to as "sub-roles").  Users with a restricted role belong to a specific team and optionally region, and are only granted access to projects which belong to that team and region.  Users can have multiple different restricted roles inside of a single unit, each with different teams and/or regions.  Each restricted sub-role is granted slightly different permissions to projects within the unit as well as some unit-level content that is not team or region specific.  One of the sub-roles restricts its users' access to projects on a user-by-user basis.
I'm tracking three solutions.  I'm looking for better ones, or improvements to these:

Use the group module.  Each unit is a group.  The group has two roles, unrestricted and restricted.  Various permissions are set on the group for these two roles.  Users with the restricted role have additional fields on their group membership entity to track the various levels of access they have in a multi-entity reference field; their sub-roles, teams, and regions.  This requires implementing a lot of custom content permissions, as well as the custom sub-roles and permissions for them.

Use the group and sub_group modules.  Each unit is a group.  It has subgroups for team+region (or 2 levels of subgroups).  The unit group has two roles, unrestricted and restricted.  The subgroup(s) have the restricted sub-roles.  Permissions are attached to each group type as expected.  This requires implementing custom code to add/edit/delete subgroups when the related terms change, add content to multiple groups and subgroups when its relevant fields change, and to manage the user membership to all the groups and subgroups.  It also makes the number of subgroups grow N^2 (a third permissions field is being considered, so perhaps even N^3) which makes me feel like it's the wrong approach and also I don't know what speed implications for content permissions there might be.

Unit is a node.  All content and taxonomy terms relate to the unit by an entity reference field.  Users have a multi-entity reference field to assign them to units, their custom roles, and if needed the teams and regions.  All entity permissions are custom hooks.  This feels like I'm declaring failure.


texts: Should I disable all UI modules once the site is in production?

texts:
Just wondering if I should I disable all UI modules once the site is in production?
e.g.: Context UI

Most of them are not required for any other module.


texts:
My goal is to import data of customers from a csv file to my custom entity. For that I wrote a migration with the migrate_source_csv module as source plugin. This works fine, but the problem is, that the import is just possible with drush. But it should work with an UI where a user can upload a file and run the import.

Is there any way to execute the import without drush?


texts: Exposing a single field to users to create new nodes from a page

texts:
I am researching if Drupal is the right choice for my project and so far it seems like it fits, except for one issue. I want to give my users ability to create new nodes from a page, let's say it could be something like creating a Facebook status and would reside at /statuses.

Then these nodes could be visible to other users from the same /statuses page. I don't want my users to deal with publishing and path and all those other options that are available via general Create New Node form - I just want to expose one field that they can fill out on /statuses, hit Submit and then have Drupal do the rest.

Is Drupal suitable for such tasks and what would be the most Drupal way to do it?

I am fairly new to Drupal but have tons of experience with other CMSs and frameworks.

Edit

I am not looking to create specific feed Facebook/Twitter functionality - it was just an example. The functionality that I am going to create will include much more than that. Feeds were just an example - sorry if I gave the impression that it's what I want to make.

The question is what would be the most Drupal-way to expose a single form field that will allow users to create a new node from a page.

Edit

Here's a mockup of the form and page that I want to make. So what would be the best way to proceed?


texts: How to pay with site credit in Commerce?

texts:
I would like to allow users to pay for products with site credit.

A field keeps track of how much credit a user has with us, and if they have enough of it to pay for an order they should have that option. Even better would be if they could dump the last bit of credit onto an order and pay the rest the regular way.

I have a few ideas; I'm just wondering if there's a standard or best practice in this situation. Thanks in advance.

Edit: Some of the ideas:

Using Rules, add a payment method if the user has more credit than the order total. If this payment method is selected, no validation is needed. The user clicks through and credit is deducted.
Add a checkbox to the checkout pane called ~"use site credit". If checked, subtract the user's credit from the price (up to the order total). This has the advantage that a user can pay with credit even if they don't have enough for the whole order, but seems much harder to do.
At the calculate price stage, automatically subtract credit from the order appropriately. Add some notification informing the user that this has been done.

I may update this more as I explore options further


texts: How to set in my own module dependency on a composer package?

texts:
I have some of my own modules written on Drupal 7 that use composer packages. These composer packages are downloaded with the module Composer Manager.

How can I set explicitly the dependency on a composer package on my own module?

Should I describe it somehow on my module's .info-file or should I do it via a hook?

It's because if I don't do it, the Composer Manager can remove these packages from the site on the next updating. Unfortunately, I couldn't find any example.


texts: Doctrine annotations for custom field formatters in Drupal 8

texts:
I am trying to port my Drupal 7 module, Views Hybrid, to Drupal 8. It provides a custom field formatter. In order to provide the field formatter, I am using the Doctrine annotation roughly following this tutorial provided by realize.be. However, I am getting PHP exceptions:

Uncaught PHP Exception Doctrine\Common\Annotations\AnnotationException:
"[Syntax Error] Expected PlainValue, got '>'
at position 168 in class
Drupal\views_hybrid\Plugin\Field\FieldFormatter\HybridFormatter."
at ~/core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationException.php line 41

If I remove the double quotes from the keys inside the settings array then I get a different error:

Uncaught PHP Exception Doctrine\Common\Annotations\AnnotationException:
"[Semantical Error] Couldn't find constant items_count, class Drupal\views_hybrid\Plugin\Field\FieldFormatter\HybridFormatter."
at ~/core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationException.php line 52

/**
 * Plugin implementation of the 'views_hybrid' formatter.
 *
 * @FieldFormatter(
 *   id = "views_hybrid",
 *   label = @Translation("Views hybrid"),
 *   field_types = {"entity_reference"},
 *   settings = {
 *      "items_count" => "5",
 *      "view" => "frontpage",
 *      "display" => "linked_title_only",
 *      "classes" => {},
 *      "view_mode" => "teaser",
 *      "arguments" => "",
 *   },
 * )
 */

I am not clear about the syntax that Doctrine expects for these nested arrays, or even on whether Drupal 8 expects the settings array to be included in the Doctrine annotations block when declaring a new field formatter, and my usually debugging techniques aren't very useful for debugging annotations since they're not exactly code. What is the expected syntax and content of a Doctrine annotation for defining a field formatter in Drupal 8?


texts: Bakery: Why do I get the "Logging out the user with the bad cookie"?

texts:
I am attempting a Single Sign On solution using the Bakery module.

My problem is each attempt to login results in the following error:

  Logging out the user with the bad cookie.

Those failing login attempts are to the master site which also means I can't login to the sub-sites.

All the necessary configurations are in place.

The master site is http://www.example.com/
The master site checkbox is enabled
http://sub.example.com/ is input as the slave site
Cookie age is set to 3600
Private key is examplesite
Cookie domain is .examplesite.com
Username and email are my enabled profile fields

I don't get why it's not responding with successful logins.
Please help if you can.


texts:
I'm using D6 but stole drupal_static() from D7 for a high demand site I'm currently working on.

I'm currently optimising some of the slower pages with XHProf which has been fine, but I'm getting a strange result with drupal_static().

It doesn't matter whether I use:

$registry = &drupal_static(__FUNCTION__, array());

Or the fast static method:

static $registry;
if (!isset($registry)) {
  $registry = &drupal_static(__FUNCTION__, array());
}

The number of calls to drupal_static() is given as the same in XHProf.

Am I missing something?


texts: How to change scheduler date format in *_node_form

texts:
When I go to fill a *_node_form I find that Scheduler module only have this date format "Y m d" "H:m:s" and I would like to have "d m Y" "H:m:s".

I'm looking to the module and I don't find anyway, also , I have make a dpm with $form, And I don't find anyplace to change the date format.

Can be done this?

Thanks

Oskar


texts: Override a pathauto alias display with a view

texts:
I have a magazine style site with a lot of content types and automated path aliases. For a section of my site I already have views that display the content in a manor in which I want it displayed - I show the view by using a title argument. I am redoing that section of the website so that the titles are semantically cleaner but I still want to use the view to display the content. However when I convert the nodes to the new path aliases the default template file from the theme loads instead of my view.

Is there anyway to using an automated path to display a view?

For example my current content type creates the url sitename/[title] but the actual url that loads in the browser when you visit that node is sitetitle/magazinetitle/[title] the view finds the title and loads correctly (the links are generated using javascript). I want to move the path's into Drupal native to make it easier to update for someone using content type and views with limited knowledge of scripting. So the new url will be sitetitle/magazinetitle/[title] within the url alias section but when you visit that url it loads the node template from the theme instead of triggering the view to load.


texts:
Is there a UI way to clone/copy image style?

/admin/config/media/image-styles

lists all styles. I wish to modify one of them but I don't want to override it and I don't want to start from scratch.


texts: Altering (adding) field value when is unknown

texts:
I have three content types (A,B,C). A and B have title, author, and field_version (a custom field), while C doesn't have field_version. Let's assume I have a method that gets the version value from a node. (The $node parameter is an entity object.)

function getLatestVersion($node) {
   $version = $node->get('field_version'); //for A, B is OK, but for C - field_version is unknown
}

How can I check the field exists for the node passed as argument without comparing the node type with an hard-coded list?


texts: How to show/hide login block on main page based on button in header?

texts:
I would like to ask the following:

My sections are lets say header, main page and footer.

I want to have a button in the header, and when it is pressed, another section comes up between header and main page showing the login form. (username and password fields must be displayed in parallel). In this section also I would like to have another button and when it is pressed, the section becomes bigger, showing the signup form.

For the show/hide functionality I will do it with HTML5, so no worries on this one.

But my question is a basic drupal architecture question that I do not know and I would need your help :)

What is the best approach to build the above? The steps below are correct?

Create a custom module to alter the standard login block it display it horizontally? Or this can be done with theming?
Create another block which will contain the 2 buttons and the login / sign up elements? If yes, in which section do I put this block? If I put it on header how then can I display the inbetween section?

Is there a drupal module that may help with the above?

Thank you!


texts: Reusing existing content types for very similar content

texts:
Let's say I have n categories of "means of transport" I need to display on my site (aircrafts, cars, bikes...). They share a lot of attributes like "name", "weight", "manufacturer" etc. But each of them also has a small number of distinct attributes that they do not share with others (e.g. only an aircraft has an attribute "wingspan").

I've addressed this myself and seen this issue in related questions here, here and here (and many more) and I do understand that opinions vary as there is (probably) no definite right or wrong answer.

However, I'm still wondering if there exist Drupal-based pros and cons (in terms of performance, maintainability) instead of pure personal preferences for planning your content model one or the other way.

Approach 1: My first thoughts were similar to the following approach, which does not appear to be the optimal use case for the paragraphs module:

1 content type "means_of_transport" with a set of basic fields (name, manufacturer, weight...) that are shared by all.
1 field that references a taxonomy X with terms "bike", "car", "aircraft"... to tag each piece of content.
n fields that each reference a different paragraphs type, containing all the fields that are specific to a certain piece of content (e.g. the "wingspan" & "call_sign" compound field for aircrafts)

This results in 1 content type with n paragraphs types. As Hudri and Kevin already pointed out there does not seem to be much benefit in just shifting the complexity from content types to paragraphs types.

Approach 2:

n content types "bike", "aircraft"... with all the attributes
(fields) that are shared between them being reused, so that you don't
need to create a new field for "name", "weight" etc. each time, but
also each content type having a few unique fields that are specific
to it.

Let's say I'll go with approach 2 and n=50 content types and each means of transport only has 1 unique attribute, all the other ones are shared and their fields could be reused. To me that seems very inefficient and often you read one should try to reduce the number of content types when planning your site. But maybe that's the Drupal way to do it and by reusing most of the fields you do not create too much overhead anyway.

Is there any other possible solution to "reuse existing content types with different fields" as also indicated in this answer by Jaypan?

Again, I'm interested in facts that support one or the other approach (and I'm aware they might not exist at all and it comes down to personal taste).


texts: I am newer in Drupal. I am using Drupal services. I want to insert user birthdate by Drupal rest services. I want How we do this, Any help would be appericiated. Thanks in advanced


texts: How can I index only active user accounts in a user index?

texts:
I'm setting up Search API Solr to make a user search on my site. On this site, when a user account is cancelled, we keep the data but block the account (set the status to non-active). This is necessary to prevent abuse of the system, but I want to eliminate the risk that data from these accounts would be exposed in Solr search, so I am looking for a way to index only active users.

I've been digging around but couldn't find any way to configure the index to not add blocked users. How can I do this?


texts:
I'm trying to get a union of a user's nodes and comments sorted by "post date".
This post links to sandbox projects for D6 but there is nothing for 7.

This post has an example of using hook_views_pre_execute() and a SQL UNION in D6. This doesn't work for D7 with views 3.

I came across merlinofchaos' comment

  Because we're now using Drupal's new query generator, the query is a SelectQuery object which you will have to modify or replace. Look up Drupal 7's new database layer for more information.

Does anyone have an example of how to do this or any other solution to combine two views?


texts:
Whenever an user saves a node I want to prefix it with table autoincrement-id so that the id is unique.

So if the title of node is "xyz" then it should be saved as unique id "299999-xyz". Ideally this id should be the node-id which is unique but it may not be possible to know the actual id until the node is saved in the table.

What is the best way to accomplish it?

I'm thinking of changing the title in the form validate function. This id can be numeric time() value.

*PS:*I'll have tons of such nodes so when linking them from other nodes (node-reference) this id will uniquely identify such nodes in "autocomplete textbox" in node forms.


texts: Body field data not showing in View or Edit mode but exists in database

texts:
This is very similar to this question, except there the asker answered with a solution that is not relevant.

Scenario: made a copy of a D7 site in order to apply new theme. All content types etc seem to be fine except one. In that case the body data shows in db in field_data_body table but does not show in View or Edit mode. The node has not been saved since the issue was noticed. There is only one value of revision_id for the node, and is same on both original and copy.

Body field is set to '1' but i believe that is correct, and is the same as on the site we duplicated.

The formats on original and live are both filtered_html and again this is working for all other content types

There are not field based permission modules involved. Thoughts?

here is row from original:

entity_type    bundle  deleted entity_id   revision_id language    delta   body_value  body_summary    body_format
node    committee   0   534 2416    en  0   George ...  filtered_html

here is row from copy:

entity_type    bundle  deleted entity_id   revision_id language    delta   body_value  body_summary    body_format
node    committee   0   534 2416    en  0   George ...  filtered_html


texts: Can we get EntityMetadataWrapper to fill out unsaved autocomplete values?

texts:
I have a preview step in my entity form and I'm trying to show values about to be saved with EntityMetadataWrapper. I use the code below in my form builder function when in the preview step:

$entity = entity_get_controller($type)->create($form_state['values']);
$wrapper = entity_metadata_wrapper($type, $entity);

I have a taxonomy term reference field that accepts multiple existing or new terms with an autocomplete/tagging widget. Existing terms can be iterated over with $wrapper->field_name but newly created terms will throw an EntityMetadataWrapperException.

Is there a way to force EntityMetadataWrapper to iterate correctly over newly created terms?


texts:
Is there a module that allows you to combine two taxonomies?

Lets say I have the two simple taxonomies listed below.

Award:

gold
silver
bronze

Year:

2012
2011
2010

Is there a module that allows me to add different deltas like "Gold+2012" and "Silver+2010" to the same field?


texts: View with a reference to a reference as filter

texts:
Here is the structure:

Content type: Document
Entity reference (multiple) to: Specialization

Content type: Specialization
Entity reference (multiple) to: Department

I have Entity Reference and Entity Reference Filter modules installed.

Is there a way to create a view of documents and let the users filter the view by both Specializations and Departments?

Thanks in advance for any help on that!


texts:
I am using two themes for my web and mobile site. And I'm using the ThemeKey module.

No matter what I try, the user edit page is always shown as in the theme of my web site and not my mobile site.

The following code doesn't work.

function mytheme_theme() {
  $items = array();
   $items['edit_profile_user_profile_form'] = array(
     'render element' => 'form',
     'template' => 'templates/user-profile'
   );

   return $items;
}

This only lets me theme the user profile page in user-profile.tpl.php. Also page--user--edit.tpl.php does not work.

How should I achieve this?


texts: Drupal private file system and possible sharing options

texts:
I have issues setting file system (private) for users as described here. I wonder what they ment by

"This setting is used as the preferred download method. The use of public files is more efficient, but does not provide any access control."

If i want let only user that uploaded file have access to the file, which setting should i choose, and what are drawbacks?

Moreover, could if i choose private system, could i control access by module (for exaple User relationships module, so the friends of user could download the file)

Thanks.


texts: How to compare current year with an integer field in Rules?

texts:
I would like to compare the current year with an integer field (let's say a "year of subscription" field) using Rules (if the field value is lower than the current year, the user has no access to a specific action on the website).

I have tried many different things, data comparison, text comparison, PHP custom etc. but I did not manage to create this "apparently" simple condition.

I guess I am missing something (a date/time comparison somewhere? the right PHP code to extract the year of the current date? echo date('YY')? strtotime? mktime?).

Could anyone help me?
Thanks in advance.


texts:
Is there an Input Filter without built-in restrictions? The built-in Drupal filters and some of the other filters I have checked seem to come with their built-in restrictions, eg

The Drupal's own HTML Filter format has its own built in restrictions; a list of HTML tags that can be used. JavaScript event attributes, JavaScript URLs, and CSS are always stripped.

The WYSIWYG Filter has built-in restrictions; the following elements cannot be whitelisted due to security reasons, to prevent users from breaking site layout and/or to avoid posting invalid HTML: applet, area, base, basefont, body, button, embed, form, frame, frameset, head, html, iframe, input, isindex, label, link, map, meta, noframes, noscript, object, optgroup, option, param, script, select, style, textarea, title.`

Is there any input filter module without built-in set of restrictions, or that allows the administrator to override them, for use with the Full HTML text format?


texts: How do I save the values for a custom fieldset?

texts: Relating to my question (here). I made a custom field set to toggle organic group visibility. The UI looks and functions as it should, meaning when I have both my fieldset and $form['group_access'] fieldset showing, I can toggle settings from either and the changes show correctly in both. When I hide $form['group_access'] with $form['group_access']['#access']=FALSE; the values do not appear to get written to the database when I hit save. Shouldn't I be able to set $form['group_access']['und']['#entity']->group_access['und'][0]['value'] to the values in my custom fieldset? Any ideas? Thanks


texts: How to send email confirmation mail to new user for custom role?

texts:
I have created a custom role i.e. Passenger. When user completes a custom form and submits the form, that particular user will be assigned Passenger role. Now my requirement is that when user completes the form, the user has to be notified with a confirmation mail for registration. How can I achieve that for other role (Passenger)?

In configuration of Account settings I can see only for administration role settings. How can do this for other role.


texts: How do I add attributes to a single menu's links?

texts:
I want to add some BEM classes to a single menu's links. I cannot find a way to do this in Drupal's GUI so I assume this must be done programmatically.

How would you go about this exactly? I've no idea what file any function would even go on...


texts:
I was trying to call drupal_add_js in the callback of a button. It seems, even with after_build, that this can be done successfully only you are working without cached data.

So, before i start the page, i run drupal_flush_all_caches, and the javascript is successfully added to the page.

The problem is I want to get some user input data from a form, pass to the javascript and exibit the result. The way i'm trying to do, it is getting a string that contains the processed values and concatenating with another string that contains the other part of the javascript (probably this is not a good practice), and calling this string with drupal_add_js. But, when if i call drupal_flush_all_caches, the form will be reset and i will not be able to get the data.

So, my questions are: How can i pass values from a form to a javascript?

Do i need to flush all caches every time to use drupal_add_js?

Is there different solutions to deal with this during development and production?

Thanks for the help guys. I found some answers:   How can i pass values from a form to a javascript? I had to name my variable as Drupal.settings.myModule.myVar in the javascript code. This way i can pass variables from php code to javascript. If you want to modify the javascript code you really need to flush caches. Until now, i have not found nothing about differences between production and development best pratices.


texts: PDO exception for Entity Reference Module

texts:
I have 2 custom content type 'Movie' and 'Director';

In the Movie type there is a field that refers to some Director type.

Now , when i try to create a Movie content type it generates the following error.But the site admin can successfully create Movies.

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'nid' in where clause is ambiguous: SELECT DISTINCT node.nid AS entity_id, node.vid AS revision_id, node.type AS bundle, :entity_type AS entity_type FROM {node} node INNER JOIN {node_access} na ON na.nid = node.nid WHERE (nid IN (:db_condition_placeholder_0)) AND (type IN (:db_condition_placeholder_1)) AND(( (na.gid = :db_condition_placeholder_2) AND (na.realm = :db_condition_placeholder_3) )OR( (na.gid = :db_condition_placeholder_4) AND (na.realm = :db_condition_placeholder_5) ))AND (na.grant_view >= :db_condition_placeholder_6) ; Array ( [:db_condition_placeholder_0] => 2 [:db_condition_placeholder_1] => writer [:db_condition_placeholder_2] => 0 [:db_condition_placeholder_3] => all [:db_condition_placeholder_4] => 32 [:db_condition_placeholder_5] => user_relationship_node_access_author [:db_condition_placeholder_6] => 1 [:entity_type] => node ) in EntityFieldQuery->execute() (line 1136 of /home/mysite/public_html/includes/entity.inc).

I solved the problem .In /public_html/includes/entity.inc I changed

$this->addCondition($select_query,$sql_field, $this->entityConditions['entity_id']);

to

$this->addCondition($select_query,"$base_table.".$sql_field, $this->entityConditions['entity_id']);

this statement should be somewhere near of line 1207


texts: file or image migrate from drupal 6 to drupal 7 using Migrate D2D module?

texts:
I am using migrate_d2d module to migrate my Drupal 6 website to Drupal 7, I succeed to transfer every thing except for images.

I read the new documentation sever times and I managed to migrate the files into the file_managed but I cant link them with the nodes any hints or examples will be greatly appreciated


texts: Has anybody added or know how to add tera wurfl to their drupal 7 site? I have tried to implement it on my test site with no success. For those of you who don't know, it is a mobile detection program. I'm also open to a good alternative. Doesn't seem like there is too much info on this topic in the forum. Any help would be great. Thanks


texts: How do I construct an authenticated HTTP request in Postman?

texts:
I have Drupal 7 installed locally on my computer with the domain set to http://drupal.local.

I am trying to prepare an external script in PHP or Python (or even in pure Bash using curl, if it does not require a lot of extra work), which will successfully execute an HTTP request by default available only for the logged in user.

To understand what such a HTTP request should look like, I am first trying to perform such a HTTP request using Postman, but all my attempts failed.

This is what I've done so far:

In the browser, I logged in as administrator of the Drupal 7 site
I opened the browser on http://drupal.local/en/node/add/article and I received status 200 (The page is displayed correctly in my browser.)
In Postman I set:

request method on: GET
URL: http://drupal.local/en/node/add/article
Headers: I set all headers identically to those in the browser including the current cookies containing the session key with its value

I don't have access to this page and I receive a 403 error

How do I construct an authenticated HTTP request in Postman that will work for Drupal 7?


texts: cant see the list of databases in Feeds Database module UI tab

texts:
I have installed the feeds module and Feeds Database module so i can migrate contents inside my non drupal datase to a drupal 7 one. But i cant see the list of databases in the Feeds Database tab. Anyone can help?

Here's a code of my database in settings.php

$databases = array (
  'default' =>
  array (
    'default' =>
    array (
      'database' => 'karljay',
      'username' => 'root',
      'password' => '',
      'host' => 'localhost',
      'port' => '',
      'driver' => 'mysql',
      'prefix' => '',
    ),

  ),
   'test' =>
  array (
    'test' =>
    array (
      'database' => 'joan',
      'username' => 'root',
      'password' => '',
      'host' => 'localhost',
      'port' => '',
      'driver' => 'mysql',
      'prefix' => '',
    ),

  ),
);

this seems to be the right code cause i can see the test database now in the database's list in drupal but i have a database error when i import something using feeds.
and here's my error

and to add more details here's my query

$q=msyql_query("SELECT subject from forumthreads");
$result=mysql_fetch_array($q);

and here's my mapping

i only have one field cause this is a test if i can really use feeds to migrate many data from other database


texts: How do I get an article's author email programmatically?

texts:
I would like to send an email to authors when their content updated. How can I get the email of author(s)?

I think $to = \Drupal::currentUser()->get('mail'); is not my friend.


texts:
i need to style the input[type="file"], the only way to really style them is to add a <label> which has the same for value as the input's id. Drupal does not provide a correct label in single input[type="file"] upload and even no label in multiples input[type="file"] uploads. Is there any way to solve this issue?

Thanks