texts: Get all users with edit/view permission for a node

texts:
I'm working on a Drupal 7 project. And for this I need to get all the users that have a certain permission for a node. I need this info in the hook_node_update method, which means that I can currently get the $node object just fine but I'm unable to find a way to query a list of users that have edit rights to the particular node that's being updated.

Can anyone provide an insight? That would be great!

Thanks.


texts:
Always when I want to check another template on my online site I have to download it to a local server, fix the blocks in that template, and set it as default. Only by that I could check it without changing the looks of the site online.

Let's say I want to preview this template online, without a local copy of the site, but also without switching the default template. Is this possible?

My final aim is to fix all the blocks in my new theme, and then preview it without setting it as default (So if visitors come in the same time they will see the site with the "old" template).

Thanks,


texts: Drupal 6 Webform - Component rendered in wrong position

texts:
I'm adding a new component to a Drupal 6 webform. New 'select options' components are all rendered in the same area, no matter which position they are given in the backend. I've just added 'Area of Interest' as a listbox and as the first item of the webform. Check out where it ends up: http://enobia.cbstage.com/hcp/request-hypophosphatasia-information

The site was set up by another development team so I'm not sure what the heck they did to Webform. Anyone know what they could have done? I'm going to have to recreate the webform from scratch otherwise.

Pic of my setup screen: http://i.stack.imgur.com/Jq11q.png


texts: Service module user update request payload

texts:
I am using postman to update user. Please suggest me what headers need to be send and what should be the payload structure in JSON format.
Should I send user object in params OR in body in postman.


texts: Field collection with condition node tpl

texts:
I've been researching this for the last few days and I cant find a clear explanation of this issue im facing.  I'm receiving an error when a node has an empty collection with no values.

The collection field: field_window_shade
The fields within the collection: field_question, field_answer

Here is my code that is only looping thru the collection array within my node.tpl:

            $wrapper  = entity_metadata_wrapper('node', $node);
            $formtype = field_get_items('node', $node, 'field_window_shade');

            foreach($formtype as $itemid) {
                 $item = field_collection_field_get_entity($itemid);
                 print $item->field_question['und'][0]['value'];
                 print $item->field_answer['und'][0]['value'];
            }

I am after something like this:

            $wrapper  = entity_metadata_wrapper('node', $node);
            $formtype = field_get_items('node', $node, 'field_window_shade');

            if (isset($wrapper->field_question)) {
              foreach($formtype as $itemid) {
                 $item = field_collection_field_get_entity($itemid);
                 print $item->field_question['und'][0]['value'];
                 print $item->field_answer['und'][0]['value'];
              }
            }

I've seen this question asked about 5 different times with 10 different solutions and I can't seem to reach a solution here.

Thank you !


texts: Drupal behaviors has conflict with .load() jQuery method

texts:
I am using drupal behavior i need to reload a menu after any ajax request.

i have a jQuery function to reload the menu by .load() method.

menu items reload properly after any request. but when i click on menu items the page will refresh instead of loading ajax.(my site is full ajax)

every a tags in my site are ajax. but the part i load with .load() method is not ajax!

when i comment out the jQuery codes my menu a tags become ajaxified again.

what is wrong with my jQuery function?

i have 2 menu the first menu shows content types of the site
and second menu shows categories. when you click on a content type in first menu. in the second menu the categories of that content type will load by ajax.

jQuery function:

(function ($) {
    Drupal.behaviors.ajaxMenuCategory = {
        attach: function (context, settings) {
            var selector='#nav-category-wrapper';
            var content='#nav-category';
            ajaxBefore(selector);
            ajaxAfter(selector,content);
        }
    }

    function ajaxAfter(selector, content){

        $(selector).css('height', '');

        var pathname = window.location.pathname; // Returns path only

        $(selector).load(pathname+' '+content, function(){
        $(selector).fadeIn('fast');
    });

    }

    function ajaxBefore(selector){

        $(selector).css('height', $(selector).height() + 'px');

    }
})(jQuery);

i have edited my js file,by adding this line:

Drupal.attachBehaviors(content);

the Ajax works now but the menu items blink and change frequently.
menu items switch between current content type you clicked and the last content type that had been clicked frequently.
(menu shows the categories of current content type then changed and shows the categories of the last content type that have been clicked and it changes frequently)

edited js file:

(function ($) {
Drupal.behaviors.ajaxMenuCategory = {

  var selector='#nav-category-wrapper';
  var content='#nav-category';
  ajaxBefore(selector);
  ajaxAfter(selector,content);

}
}

function ajaxAfter(selector, content){
// Preserve the height of the current content to avoid the entire page
// collapsing.
$(selector).css('height', '');
var pathname = window.location.pathname; // Returns path only

$(selector).load(pathname+' '+content, function()
    {

Drupal.attachBehaviors(selector);

    });

}
function ajaxBefore(selector){
// Preserve the height of the current content to avoid the entire page
$(selector).css('height', $(selector).height() + 'px');
}

})(jQuery);

there is no error now.

Menu html code:

...

Any help would be much much appreciated.


texts: is there a way to use preprocess_page only for certain page templates?

texts:
I have a preprocess_page function in template.php that I need to use to pass a variable into a page (not node) template. The code works where I need it to, but it's also trying to run on EVERY page, which I don't want.

Is there a way to make a hook_preprocess_page() function run only on certain page templates, or a different function name (e.g. mytheme_preprocess_page_speaker())?

The preprocess function I am using is the following one.

function bluemasters_preprocess_page(&$vars) {

  if ($vars['node']->type == 'session') {
      $sess_type = field_get_items('node', $vars['node'], 'field_session_type');
      $sess_type_name = $sess_type[0]['taxonomy_term']->name;
      $vars['session_type_name'] = $sess_type_name;
  }

}

This works on nodes that are of the content type "session", but when I view other pages that use other content types, I get an error message telling me there's an undefined index of 0 on the line that's defining $sess_type_name. I need to make it so that the function ONLY runs on nodes of type session.

updated it appears the error is only occurring on a view with a page display that displays content type=session. So how can I avoid that?


texts:
I want use Lazy Load jQuery Plugin. So, I must change image src to data-original path.

And I added this code to my template.php:

function mytheme_preprocess_image(&$variables) {
   if ($variables['style_name'] == 'slides') {
       $variables['attributes']['class'][] = 'lazy';
       $variables['attributes']['data-original'][] = file_create_url($variables['path']);
       $variables['path'] = '/sites/all/themes/mytheme/images/grey.png';
   }
}

Yes, this code add data-original attribute. But not add grey.png image to src

What's problem? How can I fix it? Thanks.


texts:
This seemingly simple task proved more difficult than I imagined.. I'm trying to get a variable from themename_preprocess_html to my html.tpl.php.

The code I have in my template.php file:

<?php
function themename_preprocess_html(&$variables) {
  $variables['test'] = "Hello world!";
}

And in my html.tpl.php file I have:

<?php print($test); ?>

Unfortunately, the variable isn't displayed in the page. It says:

Notice: Undefined variable: test in include()

I'm trying to do this so I can use node fields to determine variables in my stylesheet.

Is there any way I can print all available variables in my html.tpl.php?


texts: How to see the individual fivestar ratings in a view?

texts: How do I design a view to see every user's fivestar rating? I want to see a node, and below that list all users' ratings (and not connect it to comments). The only thing I've been able to do is list every user that has rated a node and get the value of their vote (percent) but if I change the value to show the "rate widget", so that I can see the nice fivestar rating, it can either show me the logged-in user's rating or the average rating. It will not show me the actual user's rating.


texts: How to implement a Rules Condition like [account:last-login] = never?

texts:
Here is my contextual explanation:

I would like to redirect on a special page for first time after login. But registering system is using an email validation, so the path to the first login is "user/reset/uid/*", which brings the user to its profile page to save a password when the user clicks the one-time login button. This is fine and using a redirect after register of any kind is overriding it, which I don't want to. So I'm looking for a data comparison with the Rules module.

My question: How can I compare as a condition with rules [account:last-access] or [account:last-login] with something that would say never?

The rule would be this:

Rules Event : After updating account (because of the one-time login password change)
Rules Condition : [account:last-login] = never
Rules Action : redirect toward my special welcome page

These are the modules used:

rules
reference with user reference sub-module
ajax register (which usefully rewrite login to home)


texts: Php Error Media Library Add button not working?

texts:
I have imported config files of content types, paragraph from my site to other site. Media Library Config files are also available. Enabled the Media Library module and imported the config files.
Paragraph and Content types are imported correctly, but when adding a new content using any one of the imported content types. I could not choose the media library image (Add Image button not working).
I am getting an ajax error and php error like InvalidArgumentException: The opener ID parameter is required and must be a string.
I tired with creating a new media file but that was also not worked.. Can anyone guide me on this?
Current Core Version: 8.9.7


texts:
Can I have partial payments in Drupal Commerce 2.x?

For example, the customers need to make a deposit of 10% up front; when they pick up the bought items, they need to pay the remaining amount. They can pay using either cash or bank transfer.


texts: Mod rewrite enabled and working, urls contain index.php/

texts:
I have a strange issue: I have a drupal 8 instance on a subfolder in /var/www, I have enabled mod-rewrite in apache, I changed the apache.config file as in this post and the clean urls are working if I navigate directly to /drupal/admin for example.

I also added the RewriteBase /drupal in my .htaccess file.

The problem is that any link generated by drupal still contains the /drupal/index.php/ part and I don't know how to get rid of that /index.php part.

I worked with Drupal 7 since it was launched but I never had this problem.

Is there a setting somewhere in db or in the config file where I should 'tell' drupal to use clean urls?

My server runs Apache 2.4.7 and PHP 5.5.

Thank you.


texts: how to get the values from views in page template

texts:
I created a view (page name 'Archives') to load the following values from all the posts of a particular content type.
Year = field_year
Volume = field_volume
Issue = field_issue
By using views I couldn't get the desired output. So, I created a template file (views-view--archives--page.tpl.php) and wrote the following code. Please see the attached screenshot & code below. Please help me in correcting the code. This would be a great help. Thanks

 <?php foreach ($view->style_plugin->rendered_fields as $delta => $item): ?>

    <?php print $item['field_year']." (volume - ".$item['field_volume'].")"; ?>
    <?php print "Issue ".$item['field_issue']; ?>

 <?php endforeach; ?>


texts: Print Media CKeditor images correctly custom code

texts:
How can I show an image that I uploaded with de CKeditor Media browser on my page? Now I use this code:

    case 'black_box_with_image':
        $black_box_with_image_image = '';
        if (!empty($content['settings']['black_box_with_image_image'])) {
            $fid = $content['settings']['black_box_with_image_image'];
            $file = file_load($fid);
            if ($file) {
                $image = array(
                    'path' => $file->uri
                );
                $black_box_with_image_image = theme('image', $image);
            }
        }

        $black_box_with_image_title = !empty($content['settings']['black_box_with_image_title']) ? $content['settings']['black_box_with_image_title'] : '';
        $black_box_with_image_link_name = !empty($content['settings']['black_box_with_image_link_name']) ? $content['settings']['black_box_with_image_link_name'] : '';
        $black_box_with_image_link = !empty($content['settings']['black_box_with_image_link']) ? $content['settings']['black_box_with_image_link'] : '';
        $black_box_with_image_description = isset($content['settings']['black_box_with_image_description']['value']) ? $content['settings']['black_box_with_image_description']['value'] : '';

        $black_box_with_image = '

' . $black_box_with_image_title . '

' . $black_box_with_image_description . '

                    ' . $black_box_with_image_link_name . '

                    ' . $black_box_with_image_image . '

        ';

        $content['content'] = $black_box_with_image;
    break;

The variable $black_box_with_image_description is the field with the CKeditor Media browser image.

Now it shows like this:

  [[{"fid":"8","view_mode":"default","fields":{"format":"default","field_file_image_alt_text[und][0][value]":"field_file_image_title_text[und][0][value]":"","field_folder[und]":"6"},"type":"media","attributes":{"height":"480","width":"388","style":"width:
  150px; height: 186px;","class":"media-element file-default"}}]]

In the editor, the image is displayed, but when I save the node it shows the plain HTML.

  Convert Media tags to markup

I checked the covert media tags to markup in the format section. When I use a default CCK field the images shows correctly, but not with my custom code..


texts: Webform A partially-completed form was found. Please complete the remaining portions

texts:
I'm seeing this message on my webforms:

  A partially-completed form was found. Please complete the
  remaining portions

How can I suppress this message for Webform version 7.x-4.10?


texts:
I've a drupal website with a custom theme based on Zen.

In a specific page of my website, I've a form rendered by the Finder module (which uses the Drupal Form API).

I want to modify the way Drupal render the checkboxes of this particular form.

Let's say Drupal render my checkboxes like this :

<input type="checkbox"> Choice 1

I want to modify the html into something like :

<input type="checkbox">
    Choice 1

This could allow me to better adjust the layout using CSS.

Can someone point me the right direction to achieve this ?

Solution :

Since the finder outputs Checkboxes (and not many Checkbox), using #field_suffix didn't solve my problem.
Why ?
Because applying the following code :

$form['finder_form']['type']['#field_suffix'] = "
field suffix
";

Results in this :

        <input>

        <input>

So I ended up doing :

foreach ($form['finder_form']['type']['#options'] as $key => $value) {
    $form['finder_form']['type']['#options'][$key] = $value."

";
}

If a better approach is found, I will edit this.


texts: Is there a preeve of concept way to upload or display files translated in different languages. So for example if there is a site with German, English and Spanish. How to upload and display different files for different languages? Any Module suggestions? I use Media Librarie in D8 but only files in original language are shown.


texts:
How do I print the author details for a node? In particular, I am interested to the following values.

Author picture
Name
Description

In Drupal 7, I would use this code.

<?php print $author_data['picture'];?>
<?php print $author_data['name']; ?>
<?php print $author_data['description']?>

What is the equivalent in Drupal 8?


texts: How to give href links in custom modules for multilingual site?

texts:
I've created a custom module,having a href links like follows.

Let's say the following link appears on example.com/somepage/another-page/nid

t('
Back to My Page
');

The above links works by default but it won't work if user is in Spanish version (example.com/es/somepage/another-page/nid).

If user click on the link it redirects to default lang version (example.com/my-page)

I tried $GLOBALS['base_url'] but it doesn't work in this case.

So my question is how can I give href link for multilingual? Any ideas would be much appreciated.


texts: How Override taxonomy term width multi vocabulary

texts:
I have 2 vocabulary. number: number1 number2 number3 width link taxomomy/term/1 => taxomomy/term/3 category: category1 category2 width link taxomomy/term/4 => taxomomy/term/5

I want create 2 view width body other. How to I can override taxomomy/term/% for vocabulary?

P/s: If I create path 2 view is taxomomy/term/%. => view 1 show result. view 2 show Page not found. I don't know?


texts: View: show title of field where user is entity-referenced

texts:
I've got a content type of "Course" with entity references to users for Professor, TA, and Designer. Each user can be any of the three roles for any course.

I've got a View that shows, for the logged-in user, what courses they are the professor, OR TA, OR designer for.

What I'd like to add to that View is a column that tells the user which role they play in the course - or, in Drupal terms - which entity reference field their account is referenced in. I'd like to do this with exactly one column in the view.

The view already has Relationships from the Course to each of the referenced entities - but I am not sure how to get the conditional into a single column.

Is there a way to accomplish this with the Drupal 7 Views features, or do I need to re-write a column...?


texts: How to retrieve a term tree for a specific vocabulary given the machine name?

texts:
Retrieving a term tree for a specific vocabulary  in Drupal 8 requires the vocabulary ID. I can find no function/method/service that will return the vocabulary entity given the machine name, in order to get the vocabulary ID.

How do I get a vocabulary ID from its machine name?


texts:
I've found node_load_multiple() which allows me to get all the nodes, but I need to specify some parameters, e.g. the type of node that I'd like to fetch.

I'd like to get all the nodes in the system without the criteria. How can I do that?


texts: limitation on "add more" button: Drupal 7

texts:
I am using add more for a field which provide only maximum limit But I want to add by default two fields with "add more" button up to a maximum number of 10 fields.

How can I achieve this ?


texts: Search query for node content join taxonomy term

texts:
I am creating a form that searches the FAQ with the search term typed and the taxonommy term selected, i.e., the form will contain a search field and a select list of taxonomy terms associated with the FAQ. So I needed a sql query to achieve this.
I need some modifications on this  db_query("SELECT question, nid
  FROM {faq_questions}
  WHERE question LIKE :term
  ORDER BY question asc", array(':term' => '%%' . $term . '%%'));  so that taxonomy term associated with question is also searched. The above code just searches FAQ with keyword only, not combined with taxonomy term selected


texts: I'm kind of new to Drupal and I have to work on an already existing site using Drupal 8. In the main menu, when the links are hovered, they take the color of the background which is caused by some inline css tagged !important and I don't know how to find the file containing that line. Any idea on where to start?


texts: Justify buttom not showing in CKEditor 4.6.2

texts:
I am using CKEditor 4.6.2, Wysiwyg 7.x-2.4 also I have download justify plugin 4.6.2 from https://ckeditor.com/cke4/addon/justify and added

jQuery(function() {
    CKEDITOR.config.extraPlugins = 'justify';
});

to ckeditor.js. From the list of Wysiwyg profile, I have selected Align left, Right and Justify but then also Alignment button is missing from Wysiwyg toolbar.


texts: How can I assign this description to every image when saving?

texts:
I am trying to display description field for every picture that is uploaded to the image gallery, at the moment I am able to upload as many pictures as I want and I display them with a description textarea using form like this:

  foreach($pictures as $key => $item){
    //dpm($item);
   $variables = array(
      'path' => $item,
      'alt' => 'Something went wrong',
      'title' => 'Image',
      'width' => '200px',
      'height' => '200px',
      'attributes' => array('class' => 'some-img', 'id' => 'my-img'),
    );
   //dpm($variables);
   $form['image-entry'][$key] = array(
    '#type' => 'fieldset'
    );
  $form['image-entry'][$key]['image'] = array(
      '#markup' => theme('image', $variables),
    );
  $form['image-entry'][$key]['description'] = array(
      '#type' => 'textarea',
      '#attributes' => array(
        'placeholder' => t('Describe this picture'),
      ),
    );
  }
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => 'Add more photos',
  );
  $form['#submit'][] = '_image_gallery_photos_add';
  return $form;
}

My question is, how can I save description to the corresponding image? Is there some kind of indexing that I can use? Maybe use $key variable somehow? I am kinda new to this, so please bear with me and thank you in advance!


texts:
I created a region into mytheme.info

regions[list_user_poke] = List User Poke

I put a block in it. Then I want to print this region user-profile.tpl.php.
I wrote this chode :

<div class="list-user">
   <?php print render($page['list_user_poke']); ?>
  </div>

But it does not appear.

Thanks for your help !


texts: If I save created view and visit the view page it showing only filter field

texts:
I am new to drupal and I am trying to create view for my content type, I followed the steps using a tutorial but I am not able to see the preview of the created content view if I save and visit the view page it showing only filter field. Please help me.

I have used the following method to create the view.

1) click on view and Add new name.

2) enter the name and in the show field selected the content then i specified my created content in type of field, and newest first in the sorted by field.

3) selected the table format.

4) added the fields of specified content with the help of search box where in i have given the content name so all related fields show up.

5) added the filter field from specified content.


texts:
I want to alter a query for sorting a field. I read the documentation, it says

  This hook should be placed in MODULENAME.views.inc and it will be
  auto-loaded. MODULENAME.views.inc must be in the directory specified
  by the 'path' key returned by MODULENAME_views_api(), or the same
  directory as the .module file, if 'path' is unspecified.

I used to implement all hooks inside my sites/default/realia/template.php so I first went stright and implemented the hook in sites/default/realaia/template.php which obviously didnt work.

function realia_views_query_alter(&$view, &$query) {
    print "
I am in alter query
";
    var_dump($query);
}

After reading doc carefully which says the hook needs to be placed inside the specific file and in a specific place I totally feel lost. Because I don't see any .module file in my sites/default/themes/realia. This is where my all files provided by realia (3rd party) are placed there is only .info file but no .module file.

There are also other related modules inside sites/all/modules/realia but looks like this folder is not a module itself becuse there are no .info or .module files inside the root but subfolders/modules has it. I went and created a file reala_submodule.views.inc with the implementation and placed one in each of the modules but I still dont see it really got executed ever.

Of course I did drush cc all every time whenever I doubted there could be caching issue. I will have followup questions related sorting once I get this implementation working. Please help.


texts:
I want to add a field on each node which links to a particular page where module's controller will act. I want to actually add a link at bottom of node, and I want to do this programmatically. But I am not able to start, and I am very new to this.

Any ideas or suggestions to get me started? Or give me some reference in Drupal core modules or some other type of sample code to do so?
I have done this till now to add the link:

function module_entity_view(array &$build, EntityInterface $entity, EntityViewDisplayInterface $display, $view_mode, $langcode) {
if (TRUE) {
  $entity->content['links']['module'] = array(
      '#theme' => 'links__entity__module',
      '#links' => $link_builder->buildLinks($entity),
    );
 }
}

but till now got no success. Am I using correct hook?Also I think that now the question makes sense.


texts: Running two Drupal sites off the same database: Is it possible?

texts: Is it possible point a second Drupal site to an existing Drupal database, if that second site is only used to browse the content, no logins, registrations or content add/edit/deletes?


texts: We have written some custom blocks that render dynamic content; unfortunately, the caching defaults cache the first render of this block (and don't refresh for anonymous users). Cache control seems to only work for authenticated users. Are we missing something obvious? Is it possible to control anonymous caching on a block (or page) basis?


texts: Can users disable email notifications sent to them by Rules?

texts:
One of my Drupal sites has a bunch of Rules set up to send email notifications to various roles when certain things happen on the site (new content added, etc.)

Is it possible for one of the site users to change a setting in their profile so that they won't get sent these notification emails?

I know that in the user account profile, you can uncheck the box for the personal contact form - but does that have any effect on getting emails sent by the System or by Rules processes?

Clarification: I actually don't want users to be able to opt out. I'm trying to investigate if they have a way to do that because I don't want them to.


texts: Adding a bulk discount to ubercart without adding a new module

texts:
I have multiple sites using the same ubercart module. One of the sites has a new discount that I need to add. If you buy 25 or more you get a 25% discount, if you buy 100 or more you get a 35% discount for example. I don't want to add a new module to ubercart as I don't want to mess with everything that's already working. Plus it's just this one discount on one specific item.

In going through the ubercart documentation, it looks like there are several hooks that may be useful. hook_add_to_cart, hook_line_item_alter and hook_order which are defined here. Am I travelling down the right path or is there another better way or already laid out example that would make piling through this a bit simpler?


texts: How to make a popup appear on the side/bottom of the page instead of the center?

texts: I'm still very new to Drupal and I've been trying to get a popup to appear on my page in a specific location. Popup on load (https://www.drupal.org/project/popup_onload) does pretty much everything I want, except that it appears in the middle of the screen. Anyone know what I can do so that it'll appear on the side or bottom of the screen? Or know another module out there that has this kind of configuration?


texts:
I'm attempting to allow a user to add text fields by clicking a button in a configuration form for a block plugin. I'm currently populating the form like so:

public function blockForm($form, FormStateInterface $form_state) {
    for ($i = 0; $i < $this->configuration['linkNum_submit']; $i += 1) {
        $form['link'][$i] = array(
            '#type'          => 'textfield',
            '#title'         => 'Link',
            '#default_value' => '',
        );
    }

My form is populated using a for loop that takes into account a configuration field noting the amount of textfields that should be displayed.

I also have a button that's meant to add another $form['link'] textfield by doing an ajax callback.

$form['add_link'] = array(
    '#type'     => 'button',
    '#value'    => $this->t('Add link'),
    '#ajax'     => [
        'callback' => array($this, 'Drupal\my_module\Plugin\Block\LinkList::addLink'),
        'event'    => 'click',
        'progress' => array(
            'type'    => 'throbber',
            'message' => t('Adding link...'),
        ),
    ],
);

Below is the ajax function that is called. It attempts to increase the configuration field the for loop in bockForm is based on.

public function addlink(array&$form, FormStateInterface $form_state) {
    $response = new AjaxResponse();
    $this->configuration['linkNum_submit'] += 1;

    return $response;
}

I believe my issue is that the form isn't being rebuilt, but I'm not sure how to force it to. I found documentation on the rebiuldForm() function here https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Form!FormBuilder.php/function/FormBuilder%3A%3ArebuildForm/8.2.x but I'm not sure how to implement it in this case.


texts: node--view--[machine-name] ignored in production

texts:
On my development, local site (twig debug enable, cache disable), I create node template for specific view block by Drupal suggestions:

<!-- THEME DEBUG -->
<!-- THEME HOOK: 'node' -->
<!-- FILE NAME SUGGESTIONS:
   * node--view--promoted-content--block-promoted-content.html.twig
   x node--view--promoted-content.html.twig
   * node--7398--teaser.html.twig
   * node--7398.html.twig
   * node--news--teaser.html.twig
   * node--news.html.twig
   * node--teaser.html.twig
   * node.html.twig
-->
<!-- BEGIN OUTPUT from 'themes/custom/anime24/templates/content/node--view--promoted-content.html.twig' -->

And exactly: node--view--promoted-content.html.twig, and all seams to work perfectly:

But when I move site to production (standard hosting, disable twig debug, enable cache), Drupal ignore my node--view--[machine-name].twig.html templates, and load node--teaser.html.twig:

It looks like some weird cache issue, because, when I reload one of Block with AJAX filter, it loads an proper twig template:

And after click:

Has anyone encountered this error and is able to help me with the solution?

Thanks!


texts: empty optional fields: saved node contains the token name instead of an empty section

texts: I have created a content type that has some tokens within the read-only body section so that other custom fields that the user enters when they create content based on this content type are mapped to its associated token within the body section.  If the user enters information within a optional field then that entered information replaces the token when the node is saved.  The problem is for optional fields when they don't enter a anything within it then the saved node contains the token name instead of an empty section which is what we want.


texts:
http://drupal.org/project/flashnode
The module that I found only works for drupal 6.
Is there a module for drupal 7?

Also, there seems to be no tag label called Flash... Maybe an advance user would want to add that?


texts: How to add new OPERATION in VIEWS 3.x using DRUPAL 7

texts:
I'm looking for the Drupal way to add a new custom Operation in the list of OPERATIONS available at the Views admin/structure/views

PS: This is not at all related to VBO


texts: How do I limit the number of nodes posted by a user to an entity referenced node?

texts:
I have created a content type (Reviews). I am referencing another content type (Books) using the Entity Reference module. How do I limit the number of reviews posted per book to 1 per user? Is there a module for this?

I have already experimented with the node_limit module but that doesn't work in this particular context. It restricts the user from posting content per content-type but not per node.


texts: Dynamic default values in WebForm Drupal 8.x

texts:
We are working on our web projects with Drupal 8 and WebForm. Now we have a small problem ...

We have a webform that allows people to sign up for a workout. We would need to provide dynamic dates, so that the exercisers can register at that time.

Starting position: There are different groups that have a workout at different times. There is a fixed number per workout group. That can not be exceeded. People can sign out or sign in.

When a workout group is full, no one can register. Therefore, we must provide a selection of possible dates. This must be reprocessed every day.

Our problem: How can we create a dynamic ad on WebForm before viewing? Using element types, templates, preprocess or any else? Any hints or tips?


texts: Webform validation with multiple conditions

texts:
I am wondering if it's possible to verify a webform with the following type of condition:

If a text field contains "stringA", then a numeric field must also have a value of at least 20.

Or, if that same text field contains "stringB", then the numeric field must have a value of at least 19.

So - I need a validation pattern of (("this and this") or ("that and that")).

I have Webform Validation installed as a module - can it do this kind of thing?


texts:
Another developer has sent me a completed Drupal 7 website. When I installed it, the home page uses clean URLs, which don't work; example.com/index.php?q=/node/123 does work.

When I go to example.com/index.php?q=admin/config/search/clean-urls, there is not a check box to turn clean URLs on. Is there a way to disable the clean URLs, and start the process again?


texts: Avoid a revision is automatically published

texts: I currently have new revisions created whenever a page is edited, but I don't want it to be automatically published. Instead, I want to have to go into the revision tab and click revert for the latest revision. Is this incorporated in Drupal 7 or do I have to download a module?


texts: Add data to JSON generated by views_datasource

texts:
I'm using "views datasource" to output a view as JSON - for each views row it's creating a JSON object with the fields as string/value pairs - all those objects are in an array which is the value to a string specified by the "Root object name" in the view's format settings. It looks like this:

{
  "nodes":[
    {
      "nodeid":"1",
      "title":"foo"
    },
    {
      "nodeid":"2",
      "title":"bar"
    }
  ]
}

Now I need to add another string/value pair to the main JSON object so it looks like this:

{
  "nodes":[
    {
      "nodeid":"1",
      "title":"foo"
    },
    {
      "nodeid":"2",
      "title":"bar"
    }
  ],
  "total_nodes":"2",
  "some_other_stuff":"here"
}

In another question I found out how I could add elements to the view's results but now I need to add elements "next to" the view's results. I just don't know where I need to put my code. Can anyone point me to a hook that would do the trick?


texts: How to fix 'Cannot access empty property' when visiting admin/reports/databasereport?

texts:
Fatal error: Cannot access empty property in /home/public_html/sites/all/modules/dba/database/mysql.report.inc on
  line 44

I get the above fatal error on a WSD when clicking on /admin/reports/databasereport  (using Drupal version 7.22).

Any idea what it means and how to fix it?


texts: I want to show a checkmark besides a username for verified accounts. Users who belong to a certain user role will be assigned this checkmark. I know about the userbadge module, but do not know whether it is the right choice. If I had to give an example, I would say like twitter shows a check sign with verified users.


texts: IMCE 6.27 Missing Buttons to Upload to Editor

texts:
I'm attempting to correct my IMCE file browser issue where the images don't appear. I cannot click on the file names to select them, I am, however, able to move around the left hand navigation sitemap and choose different roots and folders.

I'm running on Drupal 6, and using IMCE 6.27 (non-dev). CKEditor is not installed, and TINYMCE is turned off. Turning it on didn't seem to solve any issues. There are no SSL pages, so that fix didn't resolve my issue by letting it ignore the IMCE files.

Any thoughts?


texts: Is it possible to create an auto-increment field in a content type?

texts:
If I am creating a database in MySQL, I can create an auto-increment field for a table.

But is it also possible to create an auto-increment field in a content type in Drupal 8?


texts: The best way to synchronize old host and new host when migrating a Drupal site?

texts:
I'm planing to migrate my live site from the current shared host to another shared host. I'm thinking to use Backup and Migrate module or importing/exporting mysql by phpmyadmin.

However I'm concerning about the new users who register on my site and their content profile node. Because on both old and new host users will be registered for some while (maybe 2 weeks?). And in this period there probably will be duplicated User ID and Node ID with different data on both hosts.

Is there any way to prevent this or synchronize both old and new site for some time?
Or is it safe to import eventually the data of discrepancy from the old one to the new one just changing uid and nid after name server propagation is completed?


texts: How can I set a message if db_delete deleted one or more rows

texts:
In drupal 6 my code worked like this:

if (db_query("DELETE FROM {,ymodule_fields} WHERE conid = %d", $conid)) {
  drupal_set_message(t("Deleted fields."));
}

Now I'm supposed to use db_delete.

Will this code work?  I know db_delete returns a DeleteQuery object so I'm assuming it's going to evaluate to true every time.  I can't test my module yet because I'm doing a lot of work updating the code that creates cck fields to use core fields.  Is DeleteQuery a PDO that has the rowCount method?

if (db_delete('mymodule_fields')
  ->condition('conid', $conid)
  ->execute()) {
  drupal_set_message(t("Deleted Fields."));
}


texts: Custom migration source plugin not enabled in source site error

texts:
I'm trying to write a custom source plugin for a d7-d8 migration. I want to extend the Drupal\node\Plugin\migrate\source\d7 Node.php plugin.
I'm getting the following error when I try to run the migration from the UI:

Migration my_node_page did not meet the requirements. The module
my_xtra is not enabled in the source site. source_module:
my_xtra.

When I run drush ms I get a different error

No database connection configured for source plugin variable

The database connection key is specified in the group yml and works for other migrations which don't use the custom source plugin.
Here's my yml file
id: my_node_page
label: Node Basic Page
audit: true
migration_tags:
  - Drupal 7
  - Content
migration_group: my_group
source:
  plugin: my_xtra_node
  node_type: 'page'
process:

Here's my custom plugin.
    <?php

    namespace Drupal\my_extra\Plugin\migrate\source;

    use Drupal\node\Plugin\migrate\source\d7\Node;

    /**
     * Drupal 7 node source from database.
     *
     * @MigrateSource(
     *   id = "my_xtra_node",
     *   source_provider = "node",
     *   source_module = "my_xtra",
     *
     * )
     */
    class NodeXtra extends Node {

      /**
       * {@inheritdoc}
      */
      public function query() {
        // Select node in its last revision.
        $query = $this->select('node_revision', 'nr')
          ->fields('n', [
            'nid',
            'type',
            'language',
            'status',
            'created',
            'changed',
            'comment',
            'promote',
            'sticky',
            'tnid',
            'translate',
          ])
          ->fields('nr', [
            'vid',
            'title',
            'log',
            'timestamp',
          ]);
        $query->addField('n', 'uid', 'node_uid');
        $query->addField('nr', 'uid', 'revision_uid');
        $query->innerJoin('node', 'n', static::JOIN);

        // If the content_translation module is enabled, get the source langcode
        // to fill the content_translation_source field.
        if ($this->moduleHandler->moduleExists('content_translation')) {
          $query->leftJoin('node', 'nt', 'n.tnid = nt.nid');
          $query->addField('nt', 'language', 'source_langcode');
        }
        $this->handleTranslations($query);

        if (isset($this->configuration['node_type'])) {
          $query->condition('n.type', $this->configuration['node_type']);
        }

        return $query;
      }
}

Thanks!


texts: Is it better to write hook functions in template.php (or a .inc in my theme folder) or is it better to put them in custom modules?  Or, does it matter?  Is it just a matter of organizational preference?  Does it depend?


texts: How to display the selected value from the drop-down box?

texts:
The following code is displaying the states, but when I click the submission button, I want to display the selected state and city. I am not able to display it. How can I achieve this?

$form['state1'] = array(
  '#type' => 'select',
  '#title' => t('State'),
  '#options' => $options_state,
  '#required' => TRUE,
  '#ajax' => array(
    'callback' => '_ajaxfunction',
    'wrapper' => 'divaroundseconddropdown'
  ),
);

$form['city_element_wrapper'] = array(
    '#prefix' => '
',
    '#suffix' => '
',
);

function _ajaxfunction($form, $form_state) {
  $key = !empty($form_state['values']['state1']) ? $form_state['values']['state1'] : 1;
  $query_city=db_select('city', 'c');
  query_city->fields('c',array('District_Code','District_Name','State_Code'));
  $query_city->condition('State_Code', $key, '=');

  $query_city->orderBy('District_Name','ASC');
  $city_results = $query_city->execute();
  $options_city = array();

  foreach ($city_results as $city_record) {
    // This is correct.
    $options_city[$city_record->District_Code]=t($city_record->District_Name);
  }

  // Render city setting.
  $form['city_element_wrapper']['city'] = array(
    '#type' => 'select',
    '#title' => t('District'),
    '#options' => $options_city,
    '#required' => TRUE,);

  return $form['city_element_wrapper'];
}

The following code is not working properly:

function form_test_form_submit($form, $form_state) {
  echo $prog_state = $form_state['values']['state1'];
  echo $data1 = $form_state['values']['city_element_wrapper'];
}


texts: Programmatically Create an Array of User Objects and Print in Twig Template

texts:
MYMODULE.module:

function MYMODULE_preprocess_node(&$variables) {

    if ($variables['node']->bundle() == 'content_type') {

        $currentUserUID = \Drupal::currentUser()->id();
        $recipients = $variables['node']->get('field_user_reference')->getValue();
        $userList = array();

        foreach ($recipients as $recipient) {

            if ($recipient['target_id'] != $currentUserUID) {
                $userList[] = \Drupal\user\Entity\User::load($recipient['target_id']);
            }

        }

        if ($variables['node']->getOwnerId() != $currentUserUID) {
            $userList[] = \Drupal\user\Entity\User::load($variables['node']->getOwnerId());
        }

        $variables['userList'] = $userList;

    }

}

FILENAME.twig.html:

{{ userList | render }}

I've also tried working with:

$recipients = $variables['node']->get('field_user_reference')->view('compact');

and tried to filter the UID in the if statement inside the foreach.

My goal is to gather all users referenced from field_user_reference, and add the owner of the node, while filtering out the currentUser() into a single array. I then need to render that array in a twig template file as a user display mode. In this instance, compact.

I am not sure if my impasse lies in twig rendering, or better preprocessing.

How do you render a preprocessed user object in a twig template file?

Notes:

$recipients = $variables['node']->get('field_user_reference')->view('compact');

does render out the referenced users in the compact view mode, however I cannot seem to filter out the current user with something like $recipient->uid[0]->target_id != $currentUserUID.


texts: How do I print an image field value in views-view.html.twig?

texts: It seems I'm able to print text field values with {{ view.field.field_example.getvalue(view.result[0]) }}, but this same method doesn't work for image fields. Please help.


texts:
In the 'Rewrite Results' section of the 'Configure Field' popup, there are several options to rewrite the results - but not in the way I need.  I want to substitute particular strings in the output.

How can I do that?


texts: Display a field 'Category' on the home page

texts: How do I display a field 'category' (so as 'tags') in the node.tpl.php?


texts: Need rule: if Giftcard used to pay order, then skip PayPal, if Giftcard not used then goto PayPal

texts:
My Drupal Commerce site allows customers to buy vouchers (each voucher is a product), which are paid for using PayPal and which gives them a code. The system then allows them to book classes, using a voucher rather than PayPal. Using commerce giftcard module, customers fill out the voucher (giftcard) code in the giftcard pane at checkout. Apply the voucher and the the total to pay goes to zero and the voucher value is reduced by the cost of the class. Checkout says no payment is required, all is well, class is booked.

However, when no voucher code is entered checkout still says no payment is required, even though the total is not zero. In this case I need a rule checking the total of the order, allowing no-pay-progress if total is zero (i.e. gift card has been applied) else require PayPal (i.e giftcard code has not been applied and total is > zero).And that is where I get stuck. Any help on how to formulate this rule much appreciated.


texts: How to get the original value of a field that is inside a field collection?

texts:
I can get the entity reference field node id from my field collection like this:

function mymodule_node_update($node){

    if ($node->type == 'article'){

    $node_wrapper = entity_metadata_wrapper('node', $node);

        $before = array();

        foreach ($node_wrapper->field_collection_ingredients->value() as $key => $field_collection_wrapper) {

          $before[$key] = $field_collection_wrapper->field_ingredient[LANGUAGE_NONE][0]['target_id'];

        }
  }

Doing:

$before[$key] = $field_collection_wrapper->original->field_ingredient[LANGUAGE_NONE][0]['target_id'];

Causes an error.

Basically I have an entity reference, which allows unlimited values, inside the the field collection.

When someone removes a value from the entity reference field, I need to know which value was removed as I need the Node ID to update that node that was removed from the entity reference.


texts:
I'm not very good with Javascript/Jquery, and I don't understand something.

I display a full size image when the user arrives for the first time on the homepage. If the user scrolls, the image disappears slowly and the homepage appears.

To hide the image, I use the jquery function .hide(). It works correctly, but I want another animation because the default isn't very elegant.

To do that, it seems I need to include core/jquery.ui, but even if I include it in my dependencies for my library, I get the following error:

  TypeError: r.easing[this.easing] is not a function

And if I include core/jquery.ui.effects.slide, I get this error:

  TypeError: g[i] is undefined

Here my code:

my_module.libraries.yml

home:
  js:
    js/home.js: {}
  dependencies:
    - core/jquery
    - core/drupal
    - core/drupalSettings
    - core/jquery.once
    - core/jquery.cookie
    - core/jquery.ui.effects.slide

js/home.js

(function ($, Drupal, drupalSettings) {

  'use strict';

  Drupal.behaviors.pre_home = {
    attach: function (context, settings) {
    $(window).scroll(function () {
      var popup = $('#pre-home');
      console.log("Hide"); // Display correctly when I scroll
      popup.hide("slide", {direction: "top"}, 1000); // Doesn't work in this case, work I remove all parameters but not with the effect I want.
        });
    },
  };
})(jQuery, Drupal, drupalSettings);

I don't know what I'm doing wrong.


texts: how to call handler on every ajax request

texts:
I have created a handler for every submit request using $form['#submit'][] = 'MYMODULE_form_submit_handler' now the problem is this doesnt works on Ajax submit, or page call backs functions. i want to log everything that is happening on every insert,update/delete in admin area
$form['button'] = array(
    '#type' => 'button',
    '#value' => t('Save'),
    '#attributes' => array(
        'onclick' => 'return false;',
        'class' => array('form-submit', 'rights-form-submit')
    ),
);

Where 'rights-form-submit' is a class that directs this button to AJAX call from javascript. i want to call hook on success / failure of request


texts: Where is the autocomplete function for user/addressfield/autocomplete?

texts:
I searched but I cannot find the autocomplete function for addressfield module.
The path of this autocomplete function is user/addressfield/autocomplete.

So I need the file that declare this function.
Thanks!


texts: Display a View of Private Organic Groups for 'Requesting Access'

texts:
Right now I have it set up so groups are 'Private' in OG 7.2.x on D7

When using og_extras there is a view that lists the 'Groups'. However, when they are set to private, because the og permissions module is enabled, the groups do not show when an anonymous user acceses the page.

With the correct permissions, non-members can request access to groups, and a URL like this will let users join a Private Group:

example.org/group/node/6469/subscribe

Now, the BIG QUESTION:

How can I get views to show the Group name, Group Description, 'Private', and 'Request Access links' in a public facing view, yet have the content/members of the group be private?

It seems like the idea of a 'Private Group' is that people can't even see the name of it. That assumption is irrelevant to my site, I just want them to not be able to access the groups homepage/content unless they are members, I want them to see the groups they 'could be a part of'.

Thanks! And apologies if this was too indirect.


texts: Display different form of user's name to different users?

texts:
Is it possible to render a user's username differently to different users?

Here's the use case: I have a username with a user's First + Last name (created using the Realname module). In the user's profile, I have a setting for 'name privacy' - if the user wants to keep his last name private, the name should show as just 'First' instead of 'First + Last' to anyone who is not a site admin.

Would hook_username_alter() work for this purpose? It seems that is not dynamically loaded, but rather is cached when the user object is cached... so it couldn't simultaneously display 'First' to one user and 'First Last' to another user.


texts: why does commerce pricing rule increase price before decreasing price?

texts:
I created this simple rule to give authenticated users 50% discount.  The individual line items are not being changed as I would expect, only the order total.  And before the order total is discounted 50% it's actually doubled in price, so the order total does not actually change from what it would be without the rule.

Subtotal, discount, and total are all double what they should should be.  I have no idea why.

Here's there rule:

{ "rules_wholesale_discount" : {
    "LABEL" : "Wholesale Discount",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "commerce_line_item", "commerce_product_reference" ],
    "ON" : { "commerce_product_calculate_sell_price" : [] },
    "IF" : [
      { "user_has_role" : {
          "account" : [ "site:current-user" ],
          "roles" : { "value" : { "2" : "2", "3" : "3" } },
          "operation" : "OR"
        }
      }
    ],
    "DO" : [
      { "commerce_line_item_unit_price_multiply" : {
          "commerce_line_item" : [ "commerce-line-item" ],
          "amount" : "0.5",
          "component_name" : "discount",
          "round_mode" : "1"
        }
      }
    ]
  }
}


texts: How to link a custom menu to a custom button in drupalgap?

texts:
I would like to put the pop-up main_menu written in the setting.js to my custom button. It seems that the path name I use is not correct.

l('Menu', 'main_menu', { attributes: { 'data-icon': 'star' } })

I also tried this and does not successful. The second parameter in l( ) link path is needed.

l('Menu', { attributes: { 'data-icon': 'star' }, popup: true, popup_delta: 'main_menu' })

So, what is the correct path name of the main_menu? or how do I link my custom menu to my custom button or link?

This is how I do my custom popup button:

var btn_setup = theme('popup', {
            content: theme('jqm_item_list', {
                items: [
                  l('View profile', 'user'),
                  l('Login', 'user/login'),
                  l('Logout', 'user/logout')
                ]
            }),
            button_text: 'Setup',
            button_attributes: {
              'data-icon': 'gear'
            }
        });

It does not popup anthing, even I just put a simple content, such as:

content:'
This is a test
'

nothing happen when clicking the button.

After several experiments, the popup function needs to set the page id.

var btn_setup = theme('popup', {
            content: theme('jqm_item_list', {
                items: [
                  l('View profile', 'user'),
                  l('Login', 'user/login'),
                  l('Logout', 'user/logout')
                ]
            }),
            attributes: {
              id: drupalgap_get_page_id() + '_this_page_hook'
            },
            button_text: 'Setup',
            button_attributes: {
              'data-icon': 'gear'
            }
        });

So the question is, when I put this button in the header or footer, I want it display in any page. How do I set the page id for any page?


texts:
I am a newbie to Drupal.

I have just installed display suite to increase layout control. I am now getting a lot of notices like this:

  Notice: Undefined index: title_value in link_field_update_instance() (line 1305 of  /var/www/vhosts/viovia.org/httpdocs/sites/all/modules/link/link.module).

What is even more of a nusiance is that I can configure customs fields for blocks and dynamic fields, but they will not display on my screen.

Can anyone tell me if this is linked to the index problem above, or is it anohter problem entirely?


texts: How to change value of a field in hook_node_view

texts: In hook_node_view() I want to rewrite some fields' values. The $node parameter is not referenced, so how can I rewrite a value?


texts:
I'm not able to retrieve the taxonomy_term on a certain server.

$term = menu_get_object('taxonomy_term', 2);

After this call, $term is NULL.

I have read about the different ways of getting the value in various comments, but none of those techniques work for me either.

The Taxonomy module is enabled.

Edit: This is in an AJAX call.  (current_path() is system/ajax.)  Which probably means I'm not on a taxonomy term page..?


texts: Show a different view mode depending on role

texts:
Using the Group module, when a user views a group, I want to use a different view mode depending on whether the user is a member of the group or not.
Conceptually, this is almost identical to showing a different view mode of a node depending on the user role.

I'd have thought it was easy, but I'm struggling. What I know:

The route is entity.group.canonical
I can modify the result of that route using alterRoutes() in a route subcriber

protected function alterRoutes(RouteCollection $collection) {
  if ($route = $collection->get('entity.group.canonical')) {
    // Do something.
  }
}

I'm not sure how to modify the route. Swapping in a whole new custom controller seems extreme.


texts: How to add support Views Infinite Scroll to Background Images module?

texts:
I try to add support Views Infinite Scroll to Background Images module.

It has function bg_image_add_background_image() that makes classes (with URLs to background images) for all visible rows on Views block (use Infinite Scroll pager). Also bg_image_add_background_image() function put that classes to head on HTML document.

I think I need alter bg_image_add_background_image() function and add listener like jQuery(selector).on("DOMNodeInserted", ..., function(){...}); to that section of code:

 // Add the css if we have everything we need.
  if ($selector && $image_path) {
    $style = "$selector {";
    $style .= "background-color: $bg_color $important;";
    $style .= "background-image: url('$image_path') $important;";
    $style .= "background-repeat: $repeat $important;";
    $style .= "background-attachment: $attachment $important;";
    $style .= "background-position: $bg_x $bg_y $important;";
    $style .= $bg_size;
    $style .= $background_size_ie8 ? $ie_bg_size : '';
    $style .= variable_get('bg_image_extra_css', '');
    $style .= "}";
    drupal_add_css($style, array('type' => 'inline', 'media' => $media_query, 'group' => CSS_THEME));
    return TRUE;
  }
  else {
    return FALSE;
  }

But I don't know how!.. Help me, if you can, please.


texts:
Taxonomy terms on my site are saved with the proper path alias assigned to them but attempting to go to the corresponding page results in a "page not found" error.

The core path module includes a test file (path.test.) Does anyone know how to use it?
Thanks. :)

I welcome any suggestion on how to fix that problem. :)


texts: How to control access of custom entities from contrib modules?

texts:
What is the better way to control the access of custom entities from contrib modules in Drupal?

I thought 2 diferents ways: hook_menu_alter access callback and entity_info_alter access callback.

Any suggestions?


texts: How get subscribe to user flag on a node

texts:
I have a node for example news
I have Message module installed
I've enabled the flag subscribe to user

I want people to be able to subscriber to
a user. To get updates on thier latest post.

I want to add the subscriber user flag to the node template for

This is what flag module suggests to do

Placing a flag link on a page

$account = menu_get_object('user');
print flag_create_link('fools', $account->uid);

How would I add this to a node?


texts: Responsive Views-Slideshow Json Cycle working good in Chrome not in IE or mozilla

texts:
In drupal I AT themes, views with slideshow of json2 and cycle plugin. I set the options for the plugin like this :
Make views slideshow responsive - remove inline styles

height auto  ,  width auto   , containerResize 0  ,  slideResize 0    ,  fit 0

Result:
- In chrome works perfect
- IE and firefox not responsive

Probably something to do with the html but how to find out where en how. Can it be sold with some CSS?
Any suggestions?


texts:
I tried using a custom template file for my theme, but using page--testpage.tpl.php (where testpage is the path alias for the page being shown) doesn't work. It just works with page--node--47.tpl.php

How could I fix it?


texts:
I created a custom date format j F Y at Configuration » Regional and language » Date and time » Formats. I'm pleased with the overall look, but I'd like the months to be written in Dutch instead of the default English. The month names should be translated everywhere they occur and it would be perfect if the days should be translated too (maybe I'll need them in the future).

How can I do this?


texts:
I am using the answers module. I suddenly observed that the body field text of the question and answer content type on my site is missing. When I go to the database, the information is intact.

The comment body  field is not affected.

Please what can be the cause?

Thank you.


texts: How can I be sure configuration is never changed on live system?

texts:
The documentation for the Drupal 8 configuration manager says:

  Making configuration changes on a live site is not recommended.

When managing a site used by dozens of content managers, how can I make sure that this really never happens? Is there a way to prevent this with permission settings? For me it's still not really clear which permissions to set, to make sure those users are never able to change the configuration.


texts: Style Sheet sometimes does not load Microsoft Edge Browser

texts:
I am using the Advanced CSS/JS Aggregation module to load css once the page has loaded:

<link type="text/css" rel="stylesheet" href="/sites/default/files/advagg_css/css__fQOpwieSv5u9MLUdCJW8AX3ysBkVaiLC0mNO9bCuF8c__FLUdFFsRYhU7NN2T4QA7b0pMyQP1W1hRmVlZ5H2Saxs__sq6B6dIZCxhnK6op34i0_MkLadmDDYLWNc-Y9yWUjsQ.css" media="all" as="style" onload="window.advagg_mod_loadcss = function() {if (window.jQuery) {if (jQuery.isFunction(jQuery.holdReady)){jQuery.holdReady(false);}} else {setTimeout(advagg_mod_loadcss, 100);}};setTimeout(advagg_mod_loadcss, 200);this.onload=null;this.rel='stylesheet'">

The problem is that sometimes only on Microsoft Edge, the stylesheet does not get loaded (I don't see the styles getting applied on my site).  Once I reload the page, it works fine.  It's hard to replicate because it does not happen all the time and it only happens one time per page.

I don't see any errors in the developer console.

When looking at the Network Tab it shows that it gets the file from cache.

I posted an issue here on Advanced CSS/JS Aggregation issue queue.

I had an older version of Microsoft Edge (14) and I could not reproduce the problem. It looks like it only happens in version 17.


texts: Print node URL in a custom block template

texts:
I have a custom block that loads multiple nodes from the database and passes it to the twig template.
Inside the template I loop the list printing some node details, but I need to create a link on the node title, possibly its clean (alias) URL. The problem is that with node.url I get a security error:

  Twig_Sandbox_SecurityError: "Calling "url" method on a "Drupal\node\Entity\Node" object is not allowed

I tried with {{ link(item.label, item.url.value) }} but I get the same error.

What is the correct way to create a link in twig using the node URL?


texts: Table creation in install module returns error

texts:
I am trying to create a table using a custom module in the install file:

function leave_tracker_schema() {
  $schema = array();
  $schema['leave_balance'] = array(
    'description' => t('The base table for employee leave balance.'),
    'fields' => array(
      'lid' => array(
        'description' => 'The primary identifier for a row.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE),
      'eid' => array(
        'description' => 'The tocken got from employee data.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => 0),
      'casual' => array(
        'description' => 'The casual leave balanace of employee.',
        'type' => 'int',
        'not null' => TRUE,),
      'sick' => array(
        'description' => 'The sick leave balanace of employee.',
        'type' => 'int',
        'not null' => TRUE,),
      ),
    'indexes' => array(
      'node_changed'        => array('changed'),
      'node_created'        => array('created'),
      ),
    'primary key' => array('lid'),
    );
  return $schema;
}'

but this returns an error when I install the module

  'PDOException: SQLSTATE[42000]: Syntax error or access violation: 1072
  Key column 'changed' doesn't exist in table: CREATE TABLE
  {leave_balance} ( lid INT unsigned NOT NULL auto_increment COMMENT
  'The primary identifier for a row.', eid VARCHAR(255) NOT NULL
  DEFAULT 0 COMMENT 'The tocken got from employee data.', casual INT
  NOT NULL COMMENT 'The casual leave balanace of employee.', sick INT
  NOT NULL COMMENT 'The sick leave balanace of employee.', PRIMARY KEY
  (lid), INDEX node_changed (changed), INDEX node_created
  (created) ) ENGINE = InnoDB DEFAULT CHARACTER SET utf8 COMMENT 'The
  base table for employee leave balance.'; Array ( ) in
  db_create_table() (line 2720 of
  /var/www/html/cybpedia/includes/database/database.inc).'


texts: SA-CORE-2013-003 - Files directory Not fully protected

texts:
I'm using Pressflow 6.38 and I'm trying to implement SA-CORE-2013-003 - Drupal core - Multiple vulnerabilities | Drupal.org inside of /etc/httpd/conf.d/pressflow.conf configuration file, like following:

<DirectoryMatch "^/(tmp|var/www/html/current/files)">
    # Turn off all options we don't need.
    Options None
    Options +FollowSymLinks

    # Set the catch-all handler to prevent scripts from being executed.
    SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
    <Files *>
        # Override the handler again if we're run later in the evaluation list.
        SetHandler Drupal_Security_Do_Not_Remove_See_SA_2013_003
    </Files>

    # If we know how to do it safely, disable the PHP engine entirely.
    <IfModule mod_php5.c>
        php_flag engine off
    </IfModule>
</DirectoryMatch>

however still getting following message in Status Report page:

  Files directory   Not fully protected

See http://drupal.org/SA-CORE-2013-003 for information about the recommended .htaccess file which should be added to the files directory to help protect against arbitrary code execution.

My environment:

# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.8 (Santiago)
# rpm -q httpd php
httpd-2.2.15-55.el6_8.2.x86_64
php-5.3.3-48.el6_8.x86_64
#


texts: Unban repeated attempts via command or mysql?

texts:
Natively, in Drupal 7 after repeated unsuccessful attempts a particular user would be banned after repeated offending logins.

Is it possible to programmatically unban a particular user? I heard if you truncate the flood table you can be unbanned. Is this true?


texts: Initialize form object properties based on url params?

texts:
I did see some form classes which set form object properties in the buildForm() method.

However, these property values are no longer available in submitForm().

Simplified/incomplete example:

class MyForm {

  private $arg0;

  public function buildForm($form, $form_state, $nid) {
    $this->nid = $nid;
  }

  public function submitForm($form, $form_state) {
    $nid = $this->nid;  // $nid will be NULL.
  }
}

Actually there are some callbacks where these property values are available. E.g. if you register a #process => [[$this, 'process']] callback.

But it is not really surprising that the values are gone in some callbacks. ::buildForm() is not a constructor.

In some other form classes, they use $form_state->set($key, $value) to make data available to submitForm(). This works, but it somehow seems ugly.

Another way would be to store these values in the $form array as '#type' => 'value', or as #_my_data' => .... Again, I find this ugly.

Is there a more reliable way to initialize object properties on the form object based on url parameters? E.g. to have these parameters sent to the constructor?

Also, depending how I do this, do I need to worry that the data will be serialized?

(To me this seems like a flaw in the form API. But maybe I am missing something. I might open an issue on drupal.org, if the answer does not change my mind.)


texts: Allow user to change term, for views and taxonomy

texts:
I have a view which displays a content type in a grid and is working fine.

The content type has a taxonomy field - so when a node is created the user selects a taxonomy term from a list (Hierarchy) - it is then displayed on the node once posted.

In my view I have added 'Content: Has taxonomy term' under 'Filter criteria' but i'm not sure how to get it to work. On the block the user sees I would like them to be able to type a term into an auto complete field which will then change the content which is displayed in the view. I have chosen 'Auto Complete' as the selection type in my filter criteria section and I have ticked the box which says 'Expose this filter to visitors'. The view is working and is displaying content but there is no option presented to the user to change the filter term.

How can I do this please?

Thanks


texts: How to enable comments on drupal default user profile page?

texts:
I am pulling my hair out trying to find an answer to my question. I am creating a community site and one of its main feature is to comment and rate other users. For some reason it seems this is not possible on Drupal 7 since I haven´t found a clear answer to this question. Could you please please please guide me on this?

Thank you very much.


texts: How to configure a view accessible on user's profile only by that user

texts:
I have a view listing the nodes a user created on /user/{user}/mycontent.

How should I configure the view so that other users won't have access it?


texts:
In Drupal 7 I could have a view with exposed filters that actually referenced content types as shown below:

The views filter settings looked like this (below), where I could select the drop down options from a list of content types, instead of having to supply arbitrary values to compare to...

I think this was part of entity reference in D7 where I would check-off "Render Views Filters As Select List"

How can I have a views filter in Drupal 8 that is a dropdown list populated with a field from a number of nodes?


texts: View listing element by date, exception for the first one

texts:
I have a view which list a content type order by date.
I just want to add a simple condition : the first element of the list must the one with ID = X, even if it was created long time ago.
How can i do that ?


texts:
I was successfully able to install the Nivo_Slider.
But I want to have proper understanding on how module installations work.

My question is:
Why doesn't the simple module installation of Nivo_slider do the job?
Why do I manually have to copy and paste something (look at the first step from here? Isn't that the whole purpose of module installation? Some other modules just get installed by copy and pasting the tar.gz file.


texts: How to duplicate a display (which is not the master) as a different display type?

texts:
Assume you used Views to build a page display (in Drupal 7). So you have the typical "master", and an additional display called (let's say) "MyPageDisplay". And assume that in this "MyPageDisplay" you "overwritten" various settings (fields, sorting, whatever) from your "master".

And then you want to create a block display that's exactly the same (same filters, etc) as the "MyPageDisplay". There doesn't seem to be any facility to copy or clone such "MyPageDisplay"-display.

How can you duplicate a Views display like "MyPageDisplay" as a different display type in D7? And is there any type of improvement in Drupal 8 about this?


texts:
I have a huge list (> 100 000) of files that need to be processed. I want processing to run in the background and continuously (when it has processed the last, it just restarts on the first).

I've tried to do it with hook_cron(). There is a limit on how long cron can run, so to prevent cron timeouts, I throttle cron to process about 1000 files each time it runs (that is about the max cron can handle without timeouts).

To keep track of things between cron runs I use two db variables:

$mymodule_huge_array_data = variable_get('mymodule_huge_array_data', array());
$mymodule_counter_index = variable_get('mymodule_huge_array_index', 0);

After setting things up, cron get these two variables, and use $mymodule_counter_index to know where to start in the list of files. After processing 1000 files, it does:

$mymodule_counter_index += 1000;
variable_set('mymodule_huge_array_index', $mymodule_counter_index);

My problem is that getting that huge blob of an array from the database at the start of each cron makes the site slow during cron runs - even if I throttle cron to process only a single file.

I've looked at various alternatives.  The core batch API (Batch operations) alone can not be run from cron. Job Scheduler just uses cron to schedule jobs, so I don't think it will improve anything here.

Should I replace the single db variable holding the huge array blob with a table (with one file per record)?

I am currently looking Background Process and its Background Batch submodule. Is it suitable for this use case? It doesn't look so, it runs in the background, but just like the core batch API (Batch operations) alone, you need to initiate the process manually.

The accepted answer to this also looks like an option: Do I need a cron task for processing a queue?

Are there other (better) ways to do this?

What is the right way to chop up a large job into smaller bits, keeping track of the state as it progress through operations?

(To prevent this from being closed as "opinion based", let me emphasis that I am not asking for opinions about this.  I am asking for the correct way to process a huge list of files with Drupal.)


texts: Collapsable, grouped field in View (Bootstrap, D8)

texts:
I am setting up a view in Drupal 8, but am stuck on a problem. I'm using a table view, where some of the fields are grouped. These fields can have from 0 to maany values. Therefore, I would like to "collapse" them, showing only the first value unless you click to show them all.

I found a javascript that seemed to be just what I wanted ( https://jsfiddle.net/z0qvv7tk/11/ ), however, I can't seem to be able to utilize it. I loaded the script in  and tried several things to get add the ul class to my list, including:

Editing the tpl-files for view, both under my theme and on views directly. In hindsight I suspect I was editing the list-style view, and not the list for the fields in one of my attempts.
Rewriting the fields - this also didn't yield any results since the field is grouped.
Adding css-classes to the field - of course this didn't work, since I need to add it to the list, not the item.

I am using lists to show the grouped fields. The view can be found here. The field in question at the moment is the field for members, but I would like the same effect for some of the others eventually.

Since I couldn't get the script working, I started looking for modules. I tried Views Accordion, Views Fieldset, Views fieldsets among other, with none of them working as I intended.

After this I discovered that Bootstrap has various collapsable options, and I tried rewriting/editing the .tpl again - with no luck.

Can any one help me in the right direction? As long as it is collapsible, preferably showing the first value, I am open to any solution.


texts: How do I set a specific image header for each page?

texts:
I am trying to have a header with a different image for each page of my site. I believe I should be creating a block. I don't want to create x blocks for x pages, and I prefer to do it programmatically.

So I developped a block using in SubheaderBlock.php.

/**
 * Provides a 'SLS Block' Block
 *
 * @Block(
 *   id = "subheader",
 *   admin_label = @Translation("slssubheader"),
 *   category = "custom",
 * )
 */

namespace Drupal\subheader\Plugin\Block;

use Drupal\Core\Block\BlockBase;

class SubheaderBlock extends BlockBase {
  /**
   * {@inheritdoc}
   */
  public function build() {
    $node = \Drupal::routeMatch()->getParameter('node');
    if ($node) {
      $nid = $node->id();
    }

    return array(
      '#title' => '',
      '#description' => '',
      '#nid' => $nid,
    );
  }
}

Then, I can use the node ID in the Twig template and change the picture accordingly.
The node ID is well passed to the Twig template, but it is cached! So, whenever the page change, {{ #nid }} outputs the same ID.

I have also tried to change Twig template suggestion and have a Twig template for each page, but still there are same caching problem.

The code below is probably not the perfect one.

/**
* @file
* Code for the example module.
*/

/**
 * Theme hook
 */
function subheader_theme_suggestions_alter(array &$suggestions, array $variables, $hook) {
    $twig = 0;
    // change the suggestion only for the block_id 'subheader'
    if(isset($variables['elements']['#plugin_id'])){
        if  ($variables['elements']['#plugin_id']=== "subheader"){
            // give the twig template the same ID as the NID
            $node = \Drupal::routeMatch()->getParameter('node');
                if ($node) {
                $twig = $node->id();
                }
    // suggestion pattern is 'block__subheaderID
    $suggestions[] = $hook . '__' .'subheader'.$twig;
}}
}

A


texts: How to Change the Format of the Email Template Sent with Webforms

texts:
Ok, so I have a customer that has a ridiculously long form that individuals need to complete to apply for funding, but the email that is getting sent to our customer as well as each individual is not easy to read at all.

I have already installed MailSystem and MimeMail, so it is set to send in Full HTML, but it's still not that clear.

Is it possible to change the format so that the answer/response to each field is located below the field label? If possible, is this something that is relatively easy to do?

What about adding a line break between each field (label and response) so they aren't all one long list without any space to help distinguish between each one?

Any assistance with this would be GREATLY appreciated! We have a ton of nonprofit customers that all have similar forms and it would be very beneficial to have this option.

If you need any further clarification, just let me know.

Thank You!!

Nicole


texts: Why is this extremely simple form not getting an upcast entity from its route?

texts:
I have a my_job_board.routing.yml:

my_job_board.user_register_form:
  path: '/my-job-board/register/{user_role}'
  defaults:
    _form: '\Drupal\my_job_board\Form\UserRegisterForm'
    _title: 'Register for My Job Board'
  requirements:
    _access_user_register: 'TRUE'

(this is nearly identical to the route defined at line 56 of User module's user.routing.yml),

and a src/Form/UserRegisterForm.php:

<?php

namespace Drupal\my_job_board\Form;

use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\user\RoleInterface;

class UserRegisterForm extends FormBase {

  public function getFormId() {
    return 'my_job_board_user_register';
  }

  public function buildForm(array $form, FormStateInterface $form_state, RoleInterface $user_role = NULL) {
    var_dump($user_role);
    return $form;
  }

  public function submitForm(array &$form, FormStateInterface $form_state) {
  }

}

(my buildForm() has an identical signature to that of Drupal\user\Form\UserPermissionRoleSpecificForm which corresponds to the route I mentioned above).

Visiting /my-job-board/register/employer gives me the following error:

TypeError: Argument 3 passed to Drupal\my_job_board\Form\UserRegisterForm::buildForm() must be an instance of Drupal\user\RoleInterface, string given in Drupal\my_job_board\Form\UserRegisterForm->buildForm() (line 31 of modules/custom/my_job_board/src/Form/UserRegisterForm.php).

If i visit the same path with string instead of RoleInterface as the 3rd typehint for buildForm(), I see the output of var_dump($user_role): string(8) "employer".

Why am I not getting a RoleInterface passed into buildForm()? What am I missing?


texts: Front page meta tags and multisite configuration

texts:
I have a multisite install with 4 different URLs. How do I setup the meta tags (keywords and description) for each URL?

It seems like the keywords and description are the same for all of the URLs.


texts:
What is corect way to use kint in  views-view-unformatted.html.twig

I do:

{{ kint(rows) }}

but I get this error.

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20794259 bytes) in /home/inatcent/public_html/core/lib/Drupal/Core/Render/Renderer.php on line 448

And for {{ kint(row) }} I get null what is ok. But I want more staff. :)


texts: When I run cron I get deleted nodes created again

texts:
I delete products and product displays nodes type (both powered by commerce module); then all these node are gone.

After this, I run cron and I get all those (deleted) node back in my site.

How can I trace this problem?


texts: How do I use Path Matcher for front page?

texts:
I have used the following code in a Drupal 8 theme file.

$current_path = \Drupal::request()->getRequestUri();
$path_alias = Unicode::strtolower(\Drupal::service('path.alias_manager')->getAliasByPath($current_path));
$visiblity = \Drupal::service('path.matcher')->matchPath($path_alias, $pages);

$pages contains values like '<front>' or '/blog'.

$visiblity is set to FALSE for /, but to TRUE for /node; Both are the front page.

What is the wrong with my code?


texts: Overwrite a specific field on a specific node

texts:
We have a content-type of 'offices' locations. There is a View that pulls all of them together and that view is used on a contact page, a buy and a representative page. It's also used on job postings as a field 'location'.

Now they want to post a job with at "TBD" location. If I add a "TBD" node type, it will then display in all of the places where that view display 'offices' is pulled.

So I need to tell Drupal "On this job posting only, show "TBD" in the location Field. That's the ideal thing ... to rewrite that field on a specific job posting. In this case, the node is specifically 11071, if that helps?

Can I use a page-node-11071.tpl.php and some function there?


texts: Any better popup modal framework in drupal

texts: I use the Chaos tool suite module for modal popup in Drupal 7; I am unable to open popup from within a popup using ctools. Can it be done using ctools, or is there any better popup modal module in Drupal 7 which can do this? (I am using forms in popups and not only pages.)


texts: Site migrated to the new server with PHP 7.2 and I can't log in

texts:
We're preparing to get our Drupal infrastructure moved from PHP 5.6 to PHP 7.2. In order to start testing, I migrated a Drupal 7.67 multi-site from our current production server to a test server running PHP 7.2 and got one of the sites configured. So far, everything about the web site appears to work fine (visual, navigation, etc). Except that I can't log in!

When I navigate to /user/login, type my username and password, and click submit, there's evidence in the database that the login appears successful (users.login timestamp updates), and I'm redirected to /users/myusername, but it says "Access Denied" and doesn't show the top bar to change config, content, etc.

Drush appears to work fine for changing my password (upwd), creating one-time login links (uli), etc, but the login link doesn't work, instead showing "Access Denied" again.

I've checked just about everything you're supposed to check when issues like this come up:

Verified mod_rewrite is enabled
Tried with and without Base URL setting enabled in settings.php
Tried with and without RewriteBase setting in .htaccess
Tried with and without cookie_domain setting in settings.php
Cleared caches and truncated tables like cache*, flood, semaphore, sessions, watchdog
Made sure no database updates are pending
Restarted Apache periodically
Checked Apache error logs, nothing of note there
Tried multiple browsers from multiple computers, with and without Incognito modes

I have no idea what else to try, and sadly I'm not even sure if this is simply related to migrating the site from one server to another or whether it's because we moved from PHP 5.6 to PHP 7.2. Where do I begin troubleshooting this? Thank you in advance for your help!


texts: How can I print the vocabulary name instead of the referenced term in a node template?

texts:
Let's say I have a content type article with a field "taxonomy".

The vocabulary is "fruits".

The terms are "apple", "orange", "bananas"

The article belongs to "orange".

I can easily print in my twig template the term of the article :

{{ content.field_taxo_fruit }}

Result is "orange".

But I don't find an easy way to print the vocabulary : "fruits".

On an other project, I used views field and I used "rewrite result". But here, I use twig template like node--article--teaser.html.twig


texts: Permission error while downloading file through IE8

texts:
I have one content type with file upload field. I am saving the files to drupal/sites/default/files/search/documents custom folder. The user can download the files from the site. The download works fine in all browsers expect IE8.

I am getting an error pop while downloading a file. Its only happening in IE8 on both windows XP and Windows 7. Once i click on download link this error is comming

"Unable to download 11820 from subdomain.domain.org" "Unable to open this internet site. The requested site is either unavailable or cannot be found. Please try again later."

Here 11820 is the node id. I am using SSL certificate in my site though the url is https://subdomainabc.domainabc.org/


texts: Link url paths change from within the 'user' area

texts:
I have made a block for a footer which contains 2 simple links. The html code is as follows:

PRIVACY-POLICY&nbsp;&nbsp; TERMS &amp; CONDITIONS

The links work fine as long as i click on them while being anywhere on the website BESIDES the user profile. BUT, as soon as i try to click the links while in my user profile, instead of the URL pointing to "/privacy" or "/terms", the system appends a "/user/" path before the link. So the link becomes as follows: "/user/privacy" and "/user/terms". If i try to access it i get a Access denied.
I cannot for the life of me! figure out why this is happening.....
What am i missing?
Drupal 7

Thanks for your help!!


texts:
I'm creating a View that creates a page based on filters.

Filters are:

Published AND
Content: Type (= Student Resources) AND
Content: Resources Tag (Both or Prospective)

In the end, this should retrieve "Student Resources" that are Published and that have been tagged as either "Prospective" or "Both".  It does this without problem.  However, what it also does is show the output multiple times:

Only one of each of these content exist, but each is showing up 6 times.

Please help me troubleshoot.  What other information can I give you?


texts: drush up fails with Unknown archive format

texts:
Today, I am getting an error message when I run the Drush download or update command.

drush up -y captcha

fails with

  Unable to extract /.tmp/drush_tmp_1582749966_5e56d90e14736/captcha-7.x-1.7.tar.gz. Unknown archive format. [error]

When I changed the Drush temp directory I still get the same error message. Also, same error message using php7.2, php7.3, php7.4

Why does this happen?


texts:
I've been trying to solve this problem for hours now.

I successfully installed Drush locally and it works fine when I'm using it within XAMPP's htdocs folder. However, I want to move the Drupal folder to a virtual host outside htdocs. When I run drush inside the new folder, it says:

$ drush status

PHP Warning:  pcntl_exec(): Error has occurred: (errno 13) Permission denied in phar:///usr/local/bin/drush/includes/startup.inc on line 359

Warning: pcntl_exec(): Error has occurred: (errno 13) Permission denied in phar:///usr/local/bin/drush/includes/startup.inc on line 359
Error has occurred executing the Drush script found at /Users/ivan/drush
(errno 13) Permission denied

Tried to change folder owner to admin group, chmod -R 777 - nothing worked. I am running on OS X 10.11.6 and XAMPP 5.6.12.

Thank you for any help.


texts: This Entity Reference View Isn't Working Right

texts:
Here's my situation:

I have a node type for "School" and node type for "Classroom." In the School node type, I have an Entity Reference field for "Classroom," and vice-versa (i.e. I have a "School" Entity Reference field in the Classroom node). I am using The Corresponding Entity Module to make sure everything's connected.

Further, in the Classroom node type, I have en Entity Reference field for "Teachers", which corresponds to users, and an integer field for # of students.

I am trying to create a view which would show me how many total classrooms, students, and teachers I have in each school.

I am able to get it working for the total number of classrooms and students. As soon as I add the "teachers" field into the view, though, my student count gets completely messed up (assuming I've selected teachers within at least some of the classrooms). After some experimenting, it almost seems like adding a teacher to a classroom via the Entity Reference field creates a duplicate of the classroom, so then in my aggregated view, the # of students gets over-counted.

In other words, if I have school A and classrooms A1 (10 students) and A2 (10 students) and no teachers in either classroom, it will show me school A has two classrooms, 20 students and 0 teachers. If I add two teachers to A1 and 2 teachers to A2, though, I suddenly have four classrooms, # of students will then jump to 40 and the # of teachers will be 4 (which is right).

I am at my wits end on how to fix this, or why it's even happening. Any ideas? It's really hard to explain.


texts:
I have tried the following code but nothing seems to be working. I have removed the other field just to make focus on status field.

$user = \Drupal\user\Entity\User::create();
$user->set("status", 0);
$user->activate();
// Save user
$saved = $user->save();

Another code is

$user = \Drupal\user\Entity\User::create();
$user->status= 0;
$user->activate();
// Save user
$saved = $user->save();

But none of the above code is working. Please guide how to set the user status.
Here is my full code

$lang = \Drupal::languageManager()->getCurrentLanguage()->getId();
    $user = \Drupal\user\Entity\User::create();

    $user_data = db_query("SELECT * from eberhard_users ORDER BY uid ASC limit 0,1");

    foreach ($user_data as $delta => $details) {
        // The Basics
        $password = user_password(8);
        $user->uid = $details->uid;
        $user->created = $details->created;
        $user->changed = $details->login;
        $user->access = $details->access;

        $user->setUsername($details->name);
        $user->setPassword($password);
        $user->setEmail($details->mail);
        $user->enforceIsNew();  // Set this to FALSE if you want to edit (resave) an existing user object

        // Optional settings  <-- Thanks to http://drupal8.ovh/ for these suggestions!
        $user->set("init", $details->mail);
        $user->set("langcode", $lang);
        $user->set("preferred_langcode", $lang);
        $user->set("preferred_admin_langcode", $lang);
        $user->set("timezone", 'Pacific/Wallis');
        $user->set("status", FALSE);
        $user->activate();
        // Save user
        $saved = $user->save();die;
    }


texts: How can I post webform block values to another form?

texts:
I have a capture form in a block on a panel, and I am trying to get it to post the values to another form, once it is submitted.

How can I achieve this?

First name, last name, and email get posted to example.com/page?fname=XXX&lname=YYY&email=ZZZ.

I am using Drupal 6, and the Webform module version 3.9.


texts: I am using mobile tools module. It asks for path of mobile website. Does it mean that i need to develop mobile based pages again? i.e one for mobile and another for desktop ?


texts:
For some reason i don't need customer email, but commerce (Commerce 2 on Drupal 8) can't send email (order receipt) only to admin...you need the customer email as well. I'm trying to set default email value for order at Commerce Checkout, but right now without any lucky.
My code:
function mytheme_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id){

     if ($form_id == 'commerce-checkout-flow-multistep-default') {
         $form['edit-contact-information-email']['widget'][0]['value']['#default_value'] = "my@email.com";
     }
}

Ty for answer!


texts: Use a field's values in database to populate an exposed filter's options

texts:
I have a content type with a field named year (integer).

In a view, I'd like to expose this field to the user as a filter.

Instead of the default text boxes, I want to populate select lists with the values in the database for that field. Then the user will just have to click to select.

My php code writing is on copy-paste level.

I am using D7.


texts: What do we hook in Drupal 6 for inbound URL rewrites?

texts:
Where conditional rewrite is desired, not supported by existing path modules, and where we'd prefer to stay out of .htaccess, where might we hook in Drupal 6?

Along the lines of Drupal 7 hook_URL_inbound_alter, I think.


texts:
I'm receiveing the warning

Strict warning: Only variables should be passed by reference in eval() (line 2 of D:\wwwroot\tixers\modules\php\php.module(80) : eval()'d code).

Everywhere I've looked tells me its a render error but I can't find anything wrong.  The form works and submits all my info to the database, but there warning still shows up.

If you need the code for the module let me know and I will reply to it.

THANKS!

I use

<?php
print drupal_render(drupal_get_form('sellTickets_form'));
?>

then in the form 'sellTickets_form

function sellTickets_form($form, &$form_state) {

$form['team'] = array(
    '#type' => 'textfield',
    '#title' => t('Team Name:'),
    '#size' => 30,
    '#required' => TRUE,
);

......break for forms.....

$form['total_points'] = array(
    '#type' => 'textfield',
    '#title' => t('Total Points Awareded'),
    '#size' => 30,
    '#required' => TRUE,
);
$form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Submit'),
);
return $form;

}

function sellTickets_form_validate($form, &$form_state){
}

function sellTickets_form_submit($form, &$form_state) {
    global $user;
    $uid = $user->uid;
    $team = $form_state['values']['team'];
    $price = $form_state['values']['price'];
    $section = $form_state['values']['section'];
    $row = $form_state['values']['row'];
    $seat = $form_state['values']['seat'];
    $quantity = $form_state['values']['quantity'];
    $opponent = $form_state['values']['opponent'];
    $date = $form_state['values']['date'];
    $location = $form_state['values']['location'];
    $description = $form_state['values']['description'];
    $total_points = $form_state['values']['total_points'];
    $organization = $form_state['values']['organization'];

    db_query("INSERT INTO ticket (
    `TEID`, `price`, `location`, `date`, `organization`, `section`, `row`, `seat`, `quantity`, `opponent`, `description`, `points`)

    VALUES ('".$team."', '".$price."', '".$location."', '".$date."', '".$organization."','".$section."', '".$row."', '".$seat."', '".$quantity."', '".$opponent."', '".$description."', '".$total_points."');"
);
}


texts: Exporting Site Configuration Settings into Features

texts:
This is on a Drupal 6 site, and we want to export several settings (like CSS aggregation) into features, however it doesn't appear like there's anyway to do this. Do we need to write a custom feature hook?

We installed Ctools and are going to install Features Extra, but nothing seems to support CSS aggregation - a basic site configuration setting - out of the box.

How can we accomplish this?


texts: How can I add a separate template for the user login form?

texts:
So I want to create a separate user login page for my website.

I create a twig file called page--user--login.html.twig which is great for the outer container. I still want to edit the form divand or the block div. But with debugger on It doesn't give me suggestions for creating a custom form or block twig file just for just the login form.

I can create individual form elements for the login but I want to edit the form div or block div itself without affecting anything else.

Any suggestions?


texts: How to change field label name in a view programmatically

texts: I want to change the views field label name programtically? I have written a views-view-field.tpl.php. but dont know to change the $output variable.


texts: How to include translations in custom install profile

texts:
I'm creating a custom install profile and want to be able to use drush make to quickly set up all files.

What is the best way to have drush make download the drupal core translation files into my install profile?

Drush make does exactly that (by copying all core translations into the profile's translations dir), but only for the 3 default install profiles.

The code doing that (drush/commands/make.project.php:462) includes the following comment:

        // If this is the core project type, download the translation file
        // and place it in every profile and an additional copy in
        // modules/system/translations where it can be detected for import
        // by other non-default install profiles.

Ok, this would make sense if I knew how to detect those translations and make drupal aware of them to be able to use them in the setup.

Any ideas what a working approach would look like?
Thanks a lot!


texts:
The apache solr search results object doesn't seem to be indexing one of the fields I've added, a field with the machine name of field_resource_type.

How do I add this? Is it in a configuration file?

The actual content type (resource) is being indexed, and several fields inside of resource are being indexed.

How do I index this one field?


texts: Convert View Pane Display to a Block Display

texts:
I have a view with a pane display. However, for the page I want to place it on, it turns out that I need a block display instead of a pane.
How do clone or convert a pane display to a block display?
It's not the master display, so creating a new block doesn't inherit the settings I want.


texts: Filter Images, Audio and video from Media in Views?

texts: I am using media selector module. I have a field collection item in my content type called media. I added a image field in field collection item. I created a view to display the images of a content. I uploaded 2 images and 1 youtube video. I dont want to show video in view result.