texts:
I'd like to disable an option on a select field (based on a user role). I am doing this inside a form_alter hook. I got the user role condition working fine but I can't seem to disable a select option.

The following lines work but are not the ultimate behavior I'm looking for:

// I can unset a select option but this poses a problem
// in the case the value was already chosen by a permitted role.
// But at least I know I can target the option
unset($form['my_field'][und]['#options'][4]);

// I can disable the whole field.
// Again not quite what I'm looking for but I wanted to be sure the 'disabled' attribute syntax worked.
$form['my_field']['und']['#attributes']['disabled'] = TRUE;

but not anything along the lines of

$form['my_field']['und']['#options'][4]['#attributes']['disabled'] = TRUE;
$form['my_field']['und']['#options'][4]['#option_attributes']['disabled'] = TRUE;
$form['my_field']['und']['#option_attributes'][4]['disabled'] = TRUE;

Can anyone shed some light on how this might be feasible?


texts: Use rules to convert unix timestamp to number of days

texts:
I have two date fields. The standard Drupal 7 "Content: Post date" and "Content: Updated date" fields.

I want to calculate the difference in day's between those two date fields and update a third field with the calculated value in the same node when the node is updated.

Here is my Current Rule

(Convert first date field to Unix Time)

Convert data type
Parameter: Target type: Integer, Value to convert: [node:created]
Provides variables: Date Created (date_created)

(Convert second date field to Unix Time)

Convert data type
Parameter: Target type: Integer, Value to convert: [node:changed]
Provides variables: Date Changed (date_changed)

(Subtract the two timestamps from one another to get the number of seconds between each)

Calculate a value
Parameter: Input value 1: [date-changed], Operator: ( - ), Input value 2: [date-created]
Provides variables: Calculate Days (calculate_days)

(Divide calculated timestamp by the number of seconds in a day to get the number of days)

Calculate a value
Parameter: Input value 1: [calculate-days-variable], Operator: ( / ), Input value 2: 86400
Provides variables: Calculate Days in Seconds (calculate_days_in_seconds)

(Convert the value to an integer and round to get a whole number (if needed))

Convert data type
Parameter: Target type: Integer, Value to convert: [calculate-days-in-seconds], Rounding behavior: Always up (9.5 -> 10)
Provides variables: Conversion result (conversion_result)

(Add Calculaton to custom field)

Set a data value
Parameter: Data: [node:field-days], Value: [calculate-days-variable]

The output from this rule seems to be correct and is giveing me "166349"
which is 1 days, 22 hours, 12 minutes and 29 seconds.

What I am trying to do now is figure out how to convert that number "166349"  to the number of days which in this case should be 2 days when it is rounded up.


texts: How to make a thumbnail slideshow when hover over album cover?

texts:
Hi im thinking of making a gallery of photos.

On the front page Id like to display thumbnails of album covers for each collection.

What I want to achieve is when I hover over an image (Album cover) that image will turn into  a slideshow/ transition of images that are included in that album.

Whats the easiest and best approach to accomplish this?


texts: Use existing serial field with same counter across content types

texts:
how do I use existing Serial field in other content types with same counter db table?
Have 2 CCKs, cck-A has a serial field (auto increment) (ParticipantNumber), added same ParticipantNumber serial field (add existing field) in cck-B.
But the serial field value for both CCKs have independent auto incremental value.

How do I make the ParticipantNumber values be incremental (and Unique) across cck A and B? (just like node nid)


texts:
I have a field that is linked to a taxonomy vocab called tags when creating my "Article" content. When I show these tags on the node page, it links to: /tags/

I can't seem to find where I can change the view mode for this /tags/ page. Currently its on teaser view mode.


texts: Drupal 6: only displaying select vocabularies?

texts:
I use two vocabularies, one for tags and one which determines where a view will be displayed. Can anyone tell me how I could output the terms of my former category while hiding the ones in my latter category?

Thanks!


texts:
I need to put a field (field_names) inside of the body of the node.

I read that you could do something like:

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

The above code does not work for me, and just does nothing. Do I need to declare some variable beforehand, or do something else to make the field display? (yes I do have PHP enabled)


texts: Add Field to Custom Content Type Programatically

texts:
I'm trying to create a module that creates its own content types during installation. I understand that I need to use the Configuration API and the Entity API, but I'm having trouble adding Drupal-included fields to my custom type. From what I understand, I need to have a file for each field called field.field.node.content_type.field_type.yml. Am I correct in my understanding? If so, why are their two fields and where can I find the options to place in that configuration file? I have tried scouring through the API and I can't seem to find what I need.

This is the tutorial I'm following: https://www.drupal.org/docs/8/api/entity-api/creating-a-custom-content-type-in-drupal-8


texts:
There are two parts of a third-party module that I am trying to alter.

When the user clicks submit
When the user clicks reset

This is the function from that module.

function linkedin_user_settings_form($form, &$form_state, $account) {
  // Just fetch forms from submodules.
  $form['linkedin']['elements'] = module_invoke_all('linkedin_user_settings_page', $account);
  // We will need the account at submit
  $form['#account'] = $account;

  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => 'Save',
  );
  $form['linkedin']['reset'] = array(
    '#type' => 'submit',
    '#description' => t('Click here to unlink your LinkedIn account.'),
    '#value' => t('Unlink'),
  );

  return $form;
}

This is the code in my module.

function my_module_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'linkedin_user_settings_form') {
    $form['#submit'][] = 'my_module_form_submit';
  }
}

function my_module_form_submit($form,$form_state) {
  // on submit do this
  drupal_set_message(t('You Saved'));

  // on reset do this
  drupal_set_message(t('You Reset'));
}

How can I check which button on the form has been clicked from the users?


texts: Unable to add WHERE conditions as OR to query object

texts:
I'm attempting to override the query method for a node migration in the migrate_d2d module by adding two where conditions with "OR", and the first one is being added as AND instead of OR for some reason.  In this case, there is already one WHERE condition of node type, so I am adding two more, which means I'm trying to change

SELECT blah from {node} WHERE type = 'type1';

to

SELECT blah FROM {node} WHERE type IN ('type1', 'type2', 'type3');

It doesn't look like it is possible to override an existing WHERE condition without completely overriding the entire query method, so it seems that my next best bet is to add the WHERE conditions with OR so that the resulting query is

SELECT blah FROM {node} WHERE (type = 'type1') OR (type = 'type2') OR (type = 'type3');

To accomplish this, based on what I've found searching around (such as here), I used db_or():

$db_or = db_or();
$db_or->condition('type', 'type2')
  ->condition('type', 'type3');
$query->condition($db_or);

However, when I print out the resulting query what I actually get is

SELECT blah FROM {node} WHERE (type = 'type1') AND (type = 'type2') OR (type = 'type3');

and this is verified by the migration results, since the migration doesn't bring across any nodes (which makes sense, since one node can't be of two types).

I also tried it with separate additions to $db_or:

$db_or->condition('type', 'type2')
$db_or->condition('type', 'type3');

and even tried adding as one condition:

$db_or->condition('type', array('type2', 'type3'), 'IN');

but the result is still the same.

What it looks like to me is that no matter how you add a WHERE condition when there already is one, it automatically adds the next one as AND, even if you specify that it should be OR.

So my questions are:

Am I adding these conditions to the query object correctly (assuming I want them as OR)?
Is there a way to remove the initial condition so that I could just add my own WHERE condition from scratch?
Is there a better way to do this?

Thanks.


texts: How to display a timetable for reservable resources?

texts:
Is there a module that will allow me to display a timetable in a grid similar to the attached image?

Rooms are vocabulary terms, and each of the time blocks (e.g. Elementary, Junior) are nodes of a specific content type (Time Block) which contain a starting and ending time (date field) and the term reference field pointing to the room name.


texts: How to update header text in hook_views_pre_render

texts:
I have a view with a header of type "Global: Unfiltered text" that contains the string "Number of drivers: ".

In hook_views_pre_render I count the total number of drivers in each row, and now I want to append this number to the string in my view header.

I did a print_r on the $view object in hook_views_pre_render and found 59 instances of that string.

If it was only a few I would just try replacing each one until it had the desired result - but 59?!?! Too much recursion...

So how do I find which value to update in order to update the text in my view header?


texts: the menu is not being displayed when the first parameter is user

texts:
My problem is as follows the path user/%user_uid_only_optional/profile is not displayed.
If I try a variation of this and instead of having user, I replace user with usr the menu items is displayed. I know there was an issue with the page callback and I understand the issue of why it didnt work. That a boolean variable is not an expectable parameter for the page callback.

Line 1: line one is taken from the pro development book.
Line 2: line two shows the title (the title is displayed this line
works)
Line 3: description is correct i checked syntax
Line 4: the page callback seems fine unless this isn't the correct
format. I am quite sure that it follows what is in the
documentation.
Line 5: the number of arguments are needed is one. Since I have only
one %
Line 6: access arguments seems to be ok i checked the different
permission in drupal under users and that is the edit person that i
used.
Line 7: I looked at the menu type and it discusses at the parents
level if you want to use the local version of the menu you type

$items['usr/%currentuser/edit'] = array(
    'title' => 'Profile', // The link text
    'description' => 'My Profile',
    'page callback' => 'editprofile', // the function to be called when link is clicked [below]
    'page arguments' => array(1), // arguments for the callback function 'profile_use_page'
    'access arguments' => array('edit own profile'),
    'type' => MENU_NORMAL_ITEM,
    'menu_name' => 'user-menu', // You'll need to have a menu named my_menu for this to work
                              // If not specified, it will default to 'navigation'
  );

    function editprofile($user_id) {
      return 'user_id'. $user_id;
    }


texts: PDOException error - Google AdWords Conversion module

texts:
My Drupal site is having a serious issue. Whenever I try to add content, such as a Basic Page, I receive this error:

  PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'field_adwords_conversion_id' in 'field list': INSERT INTO {field_data_field_adwords} (entity_type, entity_id, revision_id, bundle, delta, language, field_adwords_conversion_id, field_adwords_conversion_language, field_adwords_conversion_format, field_adwords_conversion_color, field_adwords_conversion_label) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10); Array ( [:db_insert_placeholder_0] => node [:db_insert_placeholder_1] => 45 [:db_insert_placeholder_2] => 45 [:db_insert_placeholder_3] => page [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => und [:db_insert_placeholder_6] => 992249945 [:db_insert_placeholder_7] => en [:db_insert_placeholder_8] => 3 [:db_insert_placeholder_9] => FFFFFF [:db_insert_placeholder_10] => ) in field_sql_storage_field_storage_write() (line 451 of

I know things don't just happen without a reason, but I'm not sure how it happened. Looking at my change notes,  I did make a change on 01/27/2014: "Removed 'AdWords' from Webforms to work-around an error." Vague, I know. But this seems to be related to the "Google AdWords Conversion" module I am using (v7.x-2.0-beta). I went to their site and no one else appears to  be having this issue.

I tried to tinker with the field definitions, but every time I do I end up with a SQL error.

Unfortunately, I cannot remove the AdWords Conversion module from the admin panel; it is grayed out because it's in use. I tried removing it manually (from the file system), and that rendered the site inaccessible; I had to restore from back-up.

I could, in theory, restore to my 01/27 back-up... but I've made many cosmetic changes since then, somehow without noticing this critical SQL error. So my preference would be to fix this rather than back-out to 3 weeks ago.

I'm running Drupal v7.26. I'm at a loss on how to fix this. Does anyone have any suggestions?

Thank you very much!


texts: Is there a module for using Google Analytics to display popular content?

texts:
I'm actually looking to make a simplier version of the Radioactivity module.

I wonder if there are any modules out there that are using Google statistics to display content.


texts: Display shipping subtotal including taxes

texts:
I'm settings up a shop with VAT and shipping. All works well except just one thing fails, when I include VAT in the shipping rate the price component displays the amount excluding taxes. But I want the full amount including taxes to be displayed.
How can I achieve this?


texts: how to customize autocomplete TO field in privatemsg module - drupal 6

texts: Using the privatemessage module, users can send messages to each other as in facebook. The page displays a form with a TO field, subject and message. The TO field is an autocomplete field by default. Upon searching for a user name, it shows a drop down with only the names. How can i customize it to show the user's profile picture also in the drop down??? I dont know where to go and make the code changes.


texts: How can I setup Git/Drush dl/make caching of Drupal projects?

texts:
I'd like to setup the ability to have Drupal projects cached locally when I do a Git clone or Drush dl/make, so that if I happen to be offline or just to save bandwidth, when I Git clone/Drush dl/make a project that has previously been downloaded it will pull from the cache instead of from D.o., possibly after pinging D.o to see if there is a newer version (if online).

I'm sure I saw something about this once before, but haven't been able to track down the specifics.


texts: Render multiple values of a field in Drupal 7

texts:
I created a custom content type with a field with multiple values which I want to render as follows in my node--custom_content.tpl.php;

<div class="CLASS" style="background: url('<?php print file_create_url($node->field_creation_images['und'][0]['uri']);; ?>')">

However, this renders only the first value of the field. Is there a foreach solution to my problem?


texts:
I have used the taxonomy menu and auto path to create a url alias something like below. The reason is so that the taxonomy menu has the right path.

/my-alias/[term:name]

I then enabled the taxonomy view and modified the view page so that it is like url below.This view grabs the taxonomy term and then filters that term and displays the fields in the view this works fine when I test it in the view itself

/my-alias/%

My question is how do I get drupal 7 to look at the view url first and not send it to the taxonomy alias?


texts: Display star according to value in fivestar

texts: I have custom values of user rating eg: 20,30,40,..100. how can i display as star in fivestar.I am using fivestar and voting module.


texts: Entity Reference Autocomplete module: hook_entity_info definition?

texts:
I have tested the Entity Reference Autocomplete module by defining a form field of type entityreference (via hook_form) on the user entity - and it works as advertised.

When I try it on my own entity an AJAX error is thrown.

My form element definition:

$form['name'] = array(
  '#title' => t('Ground'),
  '#type' => 'entityreference',
  '#era_entity_type' => 'ground',
  '#size' => 32,
);

I can't imagine the problem is my entity's base table. So, the only thing I can think of, which may be the source of the error, is my hook_entity_info definition:

/**
 * Implements hook_entity_info().
 */
function scorebook_entity_info() {
  $return = array(
    'ground' => array(
      'label' => t('Ground'),
      'controller class' => 'EntityAPIController',
      'base table' => 'scorebook_ground',
      'entity keys' => array('id' => 'grid'),
    ),
  );
  return $return;
}

It contains the minimum keys. Do I need to add some other keys to my definition? If anyone knows of a working example of this module working with a custom entity that may help too. Thanks.

UPDATE:

Here is the correct hook_entity_info definition for anyone who doesn't want to read everything below. You need to define an access callback function, also, to return either TRUE/FALSE accordingly.

'ground' => array(
  'label' => t('Ground'),
  'controller class' => 'EntityAPIController',
  'base table' => 'scorebook_ground',
  'entity keys' => array(
    'id' => 'grid',
    'label' => 'name',
  ),
  'access callback' => 'scorebook_access',
),


texts: Is it possible to stop a webform form during submission?

texts:
The webform module is being used for a form that takes a payment. The data is validated as much as it can and then in a submit handler it is finally sent to the payment processor.

The result can be a failure (wrong card number, or no funds etc.), which should result in the form being re-presented giving the user the opportunity to check their fat fingers didn't type in the wrong card details, try another card etc.

In a vanilla Drupal form I could do a $form_state['redirect'] = FALSE; and it would return the form as-is, but this does not work when working within webform because it deals with that itself.

So this is a weird one because it's basically validation done in a submit handler. This is because we need to make sure everything's valid before submitting it to the third party, but there are clearly two ways to frame this question:

As the title says, is it possible for a submit handler to tell webform to stay on this page and not consider it complete?

or
If I move the submission code into a validation handler, how can I ensure my validation handler happens after all the others, and then check that there aren't any other validation errors before I proceed with the payment submission?


texts:
In drupal 8 we can get country list using following code.

$countries = \Drupal::service('country_manager')->getList();

But how can I programatically get the list of state of each country?


texts: How to completely wipe and rebuild drupal menus?

texts:
A while ago I found a cool blog post that detailed how to empty the menu tables, and rebuild the menu system with a drush php call, a necessity since the site will be unusable after emptying those mysql tables. This way, you could reset your menus like it was a new Drupal site.

Can anyone detail this technique or do you have the link for that blog?


texts: Sum of integer vaules of a multi value field using Computed Field Module

texts:
I have a field that is configured to have unlimited values.  (field_a)

How can i use Computed field to add all of the integer values of A?

A: 10, 5, 2

The computed field would then spit out 17

This code will add the last values of field_a and field_b together:

$entity_field[0]['value'] = array_pop(array_pop(field_get_items($entity_type, $entity, 'field_calories'))) + array_pop(array_pop(field_get_items($entity_type, $entity, 'field_calories')));

I just need to add all the values of A together.  Anyone know how?


texts:
I am interested in disabling-turning off taxonomy terms.I don't want to delete them so as to enable them later.
How is this possible to do?
thanks


texts:
I'm trying to create a path alias for a node type, where the first part of the alias is the url path of the organic group. I tried this

[node:og-group-ref:1:url]/[node:content-type]/[node:title]

but it didn't work. When I tried this

[node:og-group-ref]/[node:content-type]/[node:title]

it did create an alias, but [node:og-group-ref] refered to the node title, not the path alias of the node.

From here - https://www.drupal.org/node/2302879 - saw that there are tokens for [node:og-group-ref:url:relative], but thats not a valid token on my site. I am using Organic groups 7.x-2.7.

Is this a possible alias?


texts: Output Flexifield content as Excel file?

texts:
I'm using Drupal 6 and Flexifield to create an extensible CCK content type for doing various measurements. The content type is composed of three flexifield fields -- "levels", "rooms" and "fixtures", all of which can have new rows added to them via the "Add another..." button (no min/max to the number of rows in each flexifield sub-type).

The "levels" flexifield sub-type has two fields: level name and total area. The "rooms" flexifield sub-type has three fields: length, width, area. The "fixtures" flexifield sub-type is irrelevant for this part of the project.

What I ultimately need to do is output the "rooms" data as a table, then export that as an XLS file (which is then used by some CAD software somewhere down the line). I've been trying to do this via Views UI and Views Excel Export, but I can't see to make the latter module conform to the Excel template I've been given:

Each room's row in Excel should look something like:

Block Name  |  Roomname  |  Imperial  |  Metric

"Block Name" is the same string for all rows; "Roomname" has to be the name of the room as defined in the "room" flexifield sub-type. The values entered in each room are all either Imperial or Metric as per an option on the main content type, but I'll need some way to populate the correct column based on whichever type of data's been entered, plus convert those values to the other system.

Is Views UI (with Excel Export) the right way to go about this? If so, how do I interact with the "room" flexifield data insomuch that I can make each "Room" object a separate row in the Excel sheet?

Many thanks. This is the last part of a huge project I've been working on for months and will be grateful for any help.


texts: What is the best practice to upgrade Drupal core without breaking the Git repo and the production website

texts:
I've got a Git repository in which all my code is in the master branch, and I was previously just ignoring all the Drupal files, so that I kept a strict separation between code that I wrote (or modified or might modify) and code that could be generated with Drush or whatever.

This seemed like a good strategy until I had to upgrade Drupal.  I realized I want to be able to roll back if things went poorly, and what better tool to use than Git to do that.   I thought to myself this would be the perfect situation for a feature branch, so I made a drupal-7.14 branch, gave it its own .gitignore to ignore all my code and settings files and pay attention to only files that are part of the Drupal install which I wouldn't be touching.  I did an upgrade by hand (download, unzip, untar, copy), sorting through borderline cases like robots.txt and .htaccess, and overwriting Drupal's .gitignore with my own.  I fixed some settings that worked with 7.14 but not with 7.15, to recover from a 500 error, and then everything seemed perfect.  I renamed the branch to drupal-7.15 and was about to go happily on my way.

Until I realized what I had inadvertently done:  files that were previously untracked by my master branch but left in the working directory were now removed from the working directory when I checked out master, since they were no longer untracked files!  D'oh!

If I merge the drupal-7.15 branch with master I'll lose the separation of code.

There's probably some way to convert a branch to a submodule.  Assuming that's possible, that might be the best strategy.  I knew before I did this that submodules were the "right" solution, but since I didn't realize the side effect of using branches for previously untracked files, I decided to cut corners and go that route.  (Also, all the approaches I've seen to using submodules with Drupal assume that you're starting a new project and Drupal will be the master branch.  It is undesirable to me to make someone else's code the master branch, and I already had a repo with a master branch.  This looked like it would be unnecessarily complicated just to do an upgrade.)

There may be some other solution that I haven't thought of.

How can I best recover from this with the fewest possible downsides?

UPDATE: This is in development (in a Linux VM on my laptop), and has not gone to production yet.  By the time we go to production I plan to have everything wrapped up in feature modules, but that's not in place yet.

UPDATE 2: Submodules may not work.  According to Pro Git, "Submodules allow you to keep a Git repository as a subdirectory of another Git repository".  Drupal doesn't provide any such a nice separation.  Instead of all Drupal code being in a subdirectory, the relationship is more or less inverted, but there's still no clean separation, since you may be editing your .htaccess and robots.txt, so your code and the Drupal repo are mixed together.  I'm looking for a workaround to this problem.


texts: Ldap group configuration - Derive from attribute

texts:
I am using Lightweight Directory Access Protocol (LDAP) and I have a question about how to put Active Directory users in a certain role based on an attribute such as memberOf.

In version 1.0, you could say in drupal authorization under II.B. DERIVE DRUPAL ROLES that you could look for memberOf or ... and when the user that logs in, has the particular role in that attribute, he receives the role that is defined in part IIA.

For example, you can have this in section IIIA - Role Mapping:
CN=Head,OU=Roles,OU=Accounts,DC=Domain,DC=be|beheerder

How can we do the mapping in version 2.0?
My groups that I have, are stored in the active directory in extensionattribute14

Kind Regards


texts:
Whenever I clear cache from the admin panel (or hit the url directly) I receive an nginx error (but nothing specific is being logged).

There are no PHP error logs being created for this either.

I've narrowed it down to the /includes/menu.inc _menu_router_build function.

The strange thing is, that if I add an echo to line 2365:

// Apply inheritance rules.
foreach ($menu as $path => $v) {
   echo $path; // echo added
   ....
}

The cache clears, it doesn't error out, BUT it doesn't seem to complete because all the values are echoed but I'm never redirected. Completely lost on this one.


texts:
I know I could easily theme a webform using the webform-form.tpl template.

However, I want to do this on the module level where the tpl is located inside the custom module folder or coded directly into the .module file?

I tried looking in to these hooks and nothing seems appropriate for my need:
http://drupalcontrib.org/api/drupal/contributions!webform!webform.api.php/group/webform_hooks/7


texts: Multivalue entity reference synchronization

texts:
I have node type A with Entity Reference multivalue field that can reference other nodes of type A (existing). Is there a simple way/module/workflow/ruleset/other to do synchronization as follow:
after saving new node of typa A (ie. nid=112) referring two nodes (ie. nid 66 and 77) I want node 66 and node 77 automatically have references to 112.


texts: How can I add custom markup with a theme function?

texts:
I have a simple form as follows

function MY_MODULE_form($form, &$form_state) {
  $form['MY_MODULE']['message'] = array(
    '#type' => 'markup',
    '#markup' => 'My Heading',
    '#tree' => true,
  return $form;
}

But I want the markup to change depending on some factor which will be defined inside a function.

So how would I call a function to do this for the #markup ?


texts: How to properly specify context for Drupal behaviours

texts:
I have this code that does not work. I know why it does not work - first time page is loaded 'context' is all page and jquery easely finds '.view-SPECIFICVIEW .view-content'. After AJAX 'context' has changed and it is now just '.view-SPECIFICVIEW' and inside that there is no class '.view-SPECIFICVIEW' and therefore nothing happens. Script works if I remove '.view-SPECIFICVIEW' from find(), but then all views are selected.

(function ($, Drupal, window, document, undefined) {
    Drupal.behaviors.MYMODULE = {
      attach: function(context, settings) {
        $(context).find('.view-SPECIFICVIEW .view-content').masonry({
          columnWidth : 300,
          gutterWidth : 20
        });
      }
    }
})(jQuery, Drupal, this, this.document);

I would like to have this code to work with '.view-SPECIFICVIEW' and also I would like to know how code changes if multiple, different specific views should be targeted.


texts: Internal/External JS don't work with Drupal, but works fine in static HTML/JSFiddle

texts:
Continued from here Applied JS to Drupal theme doesn't work correctly, but it works fine outside Drupal

Working JSFiddle: http://jsfiddle.net/tbq8eo8b/10/ (it calculates total, in Drupal it calculates zeros - why?)

Raw:

$(document).ready(function () {
    var $selects = $("select").change(function (e) {
        var total = 0;
        $selects.each(function() {
            var val = this.value.match(/\$(\d+)/);
            total += val ? +val[1] : 0;
        });
        $(".total").val(total);
    });
});

Drupal:

(function ($) {
Drupal.behaviors.totalAmount = {
attach: function(context, settings) {

/*Add your js code here */
    var $selects = $("select").change(function (e) {
        var total = 0;
        $selects.each(function() {
            var val = this.value.match(/\$(\d+)/);
            total += val ? +val[1] : 0;
        });
        $(".total").val(total);
    });
}
};
})(jQuery);

2nd attempt with internal Drupal:

  <script src="http://code.jquery.com/jquery-1.9.0.js"></script>
  <script>
  $(document).ready(function () {
    var $selects = $("select").change(function (e) {
        var total = 0;
        $selects.each(function() {
            var val = this.value.match(/^\$(\d+)$/);
            total += val ? +val[1] : 0;
        });
        $(".total").val(total);
    });
});
  </script>

As you see the code is identical (except Drupal wrappings), so why it's not working on Drupal? Why it prints zeros in .total field, but in JSFiddle it works fine?


texts: How to create a views display that is not a block or a page?

texts:
I often use views_embed_view() in various places. I find myself creating views with multiple displays, each with slightly overridden settings for different purposes. I end up creating a lot of "Block" displays just because I need multiple displays. But I don't actually need it to provide a block, and I don't want all of those blocks cluttering up my system.

My question: is there a "generic" display (like Master) that I could use to create multiple displays without resorting to "block" or "page" displays?


texts: How to create a postponed action programmatically?

texts:
There's a task.

When user is registered he's assigned an advanced role, but in three month this role should be taken away.

Could you clarify me, is it possible to create this action programmatically using opportunities of modules rules and rules_scheduler ?

Or, is it possible to assign programmatically a postponed executing for some php function via modules rules and rules scheduler ?

I found a function rules_scheduler_schedule_task in the rules_scheduler.module file, but i can't understand how to create parameter $task.

Could you help me, how to do it ?


texts:
I have a table view output of node data. The node type has a list field called status.
Status is set to accept a single value. It has the following option to select from:

Inactive
Active
Submitted
Approved

They work in pairs. When a node is created it's Inactive by default. Someone reviews it and sets it to Active. Upon further work it is set to Submitted and eventually someone else will set it to Approved.

What I am tasked with is creating a toggle button against each row of the table output
containing [Inactive|Active] or [Submitted|Approved] which a user can simply click on and change it's status rather than go to the actual nodes' edit page.

I'm interested in ideas on how I can accomplish this or perhaps if there is a module that fully or partially does this.


texts: How can I use Composer with no Internet access?

texts:
I need to build and deploy a Drupal 8 site within an on-premise server with no internet access (developer machines have internet access, and access to a private repo).
I would like to avoid committing the whole vendor directory to the codebase, and use composer to build the site.
As far as I am aware, my options are:

Commit everything, including third-party modules and the vendor directory

Use something like Satis as a local repository and mirror all the necessary dependencies in there, and reference the private Composer repository

Any recommendations on this scenario?


texts:
Passing multiple array to drupal_json_output() is not giving correct output in jquery ajax.

I am using a menu_callback function and returning a multiple array like

function test_callback() {
   for($i = 0; $i < 10; $i++) {
    $arr = array('message' => 'test'.$i, 'data' => 'data'.$i);
    $arrs[] = $arr;
   }
 drupal_json_output($arrs);
}

Now, in the jquery, I wrote like this,

$.ajax({
url: the above url,
dataType: 'json',
success: function(data) {
$(data).each(function(key,val) {
  console.log(val.message);
});
})
});

The output in the console is giving an object.

I tried to use $.each for the val also, but the output it is returning as undefined. I tried in a lot of ways using $.get etc. but not getting the output. Can anyone help me here??


texts:
I am using acquia search on D7 site. By default I get all the search results as Title, Teaser with search info at the bottom. I am trying to alter this results to add some of the field data.

Eg: Content type is a product and there is a Date of arrival field and Stock availability field for all the Product node.

Now how can I add these two fields as part of every result on search results page?


texts: Download D7 module using Composer for D8?

texts:
I'm using Drush 10, and I can't use dl to download a module, since the command was removed to push Composer use. Is there a way for me to download a Drupal 7 module into a Drupal 8 site using Composer, so that I can use Drupal 7 to 8/9 Module Upgrader on it?

The project I want to download doesn't have a D8 version yet, and it has no composer.json.


texts:
I have a content type with text field (unlimited). Text field is limited to 250 chars and will be used to put names inside
User can choose as many fields as they want depending on how many names they have for this node.

What i would like to do is to let users upload image next to text field.. if they chose 15 text fields, then they can also upload 15 images, but each image connected to its text field.


texts: Dynamic query: count groups even if row is empty

texts:
I have a dynamic query like this:

$query = db_select('node', 'n');
$query->innerJoin('foo', 'f', 'n.nid = f.nid');
$query->leftJoin('bar', 'b', 'n.nid = b.nid');
$query->groupBy('b.nid');
$query->addExpression('COUNT(b.nid)', 'bcount');
$query->fields('n', array('nid', 'title', 'status'))
      ->fields('f', array('field1', 'field2', 'field3'));
$result = $query->execute();

I need to count the entries in the bar table for all nid's, which are in the inner joined table of node and foo. If one or more nid's are not in the bar table, I want to count them as '0'. My code only works for the first nid, which is not in the bar table.

What should I add to the code to count them all?

I would welcome every advice!

UPDATE:

I just grouped the wrong table I changed $query->groupBy('b.nid'); to $query->groupBy('n.nid'); and it works now...

Thanks,
Daniel


texts: When does drupal settings.php become read-only? I experienced the drupal encountered an error when I was just creating a view. Cannot see the error logs from the admin side. Thought will enable the php error reporting in settings.php and it is shown as read-only? Why does it happen? How can I find the error causing this issue?


texts: Checkboxes in Multistep: Form handler differences?

texts:
Using D7, and checkboxes that I've added via the normal 'manage fields' interface don't stay checked. When I navigate to the next page in the form or when I save it, the values appear to be lost. The values do not display on the node itself or the form when edited again later. They are simply not present in the $form array.

As Clive pointed out, this is a known bug but it looks like it hasn't been active in a while.

It looks like a submit handler problem, since among the options "back," "save," "next," and "done" it appears that "save" actually saves the values, but that "back," "next," and "done" not only fail to save values, but actually seem to clear out any values that had been entered.

What are the practical differences between these form handlers, other than just their redirect behavior? Is there something in the differences between these submit handlers that could be causing this problem? Am I even barking up the right tree here?


texts:
How to upload background images to blocks individually ?

Is there any contributed modules available uploading background images to blocks?


texts:
Please help me to add taxonomy terms from custom taxonomy into home page. I have no idea how to do this as I'm coming from WordPress. In WordPress it is easy as calling get_terms().
I have following file as my home page: mytheme/templates/page--front.html.twig

I have more than one taxonomy type and all of them are going to queried in the home page.

How to query the taxonomy terms?

UPDATE:

I have created a new region called home_content in my theme.info.yml and I have created a view(block) for getting the taxonomy terms, added it to region in back-end and display it as {{page.home_content}}. It works but I have few questions.

I have fields for logo and text in the taxonomy. I want to list them too.
I need to customize the html. How can I do that?

Thanks for the support.


texts:
In my custom module, I'm defining a menu_item with the type MENU_NORMAL_ITEM. In the default bartik theme, this adds a new navigation tab (next to the Home tab). This is great; however, I need nested tabs as well! Something like the following:

Home (default tab on Bartik)

Menu Navigation Item added via custom module

Nested Friend

With a structure similar to this, my frontend guys can theme around this and make a dropdown out of it. I've tried this:

$items['custom tab'] = array...
$items['custom tab/sub-item'] = array...

But there's no luck, and it's not even rendered when I clear my caches and do na inspect element, so I know it's not hidden or anything. I think I'm attempting to define a parent/child relationship purely through PHP. Any tips?


texts: Translation doesn't load other languages

texts:
I installed the Entity Translation and the Webform Translation modules. I enabled the webform translation from the entity translation configuration, and tried to translate a webform field. Only DEFAULT_LANGUAGE to DEFAULT_LANGUAGE appears in the edit section of that field.

Do you have any idea?


texts: How to display an attached file (jpg) in views-view--custom.tpl.php

texts:
So I am new to Drupal but just have been tasked with theming a drupal 7 site. I am finding it hard to find the info I need to do this, I think it is because I just don't know what to google... but anyways the current task I am trying to figure out is how to take an attached image from a node and display it in a view.

I post some screen shots of the info I have, as I am pretty sure I don't know the exact drupal words to express what I am needing.

I need the image from this node:

That is selected by this view:

and the view is currently using the file views-view--spotlight.tpl.php

I really hope this makes sense, I have been googling my heart out to find out how to do this, if I am barking up the wrong tree I would gladly take advice as to which tree I should bark up.


texts: Restrict users from creating certain title

texts:
I want to restrict the users from creating contents with certain title. I require the following functionality.

Example :

Prevent users from creating a content with title, say ABCD
Prevent users from creating a content which has the words, say ABCD in the title.

Is there a module for this purpose. I'm new to drupal and I searched drupal.org but couldn't find a module. Thanks in advance


texts: Date range or date with operation (greater than, etc.) contextual filter

texts:
I get date with contextual filter in views and i want set "greater than" my date. This option not exist in contextual filter. I cannot use argument in filter criteria.

In drupal 7 we can use "2017-01-01--2017-12-18" for range date with contextual filter, but in drupal 8, this trick not work.

Someone can help me, with date and contextual filter ?

Thank you


texts: URL aliases [node:language] repetition issue

texts:
I have an issue with URL aliases creation. I have set my configuration as following:

The default path pattern above is the only one configured. Yet, when I create my content type instances and translate them, I get the following:

http://mysite.localhost:8082/en/search-form
http://mysite.localhost:8082/fr/fr/recherche-de-mots
http://mysite.localhost:8082/ab/ab/dfghdf

EN is the default language, but why do I get double /fr/fr and /ab/ab? These are the links created in the language link available under node contents.

REM: Generate automatic URL alias is set on all node content translations.

Update

Of course, I would like to avoid repetitions (this is my real question):

http://mysite.localhost:8082/en/search-form
http://mysite.localhost:8082/fr/recherche-de-mots
http://mysite.localhost:8082/ab/dfghdf


texts: Converting JavaScript from Drupal 7 to Drupal 8 standards

texts:
I have a Drupal 7 module that contains a JavaScript file whose only contents are

Drupal.behaviors.InitializeMapplic = {
  attach: function (context, settings) {
    jQuery("#mapplic").mapplic(Drupal.settings.mapplic);
  }
};

I'm aware that Drupal 8 introduced a new JavaScript API and that this code needs to be updated. However, I'm confused as to what the Drupal 8 equivalent is. I have read and tried to dissect the change records at https://www.drupal.org/node/1793334 and I have reviewed the API documentation at https://www.drupal.org/docs/8/api/javascript-api/javascript-api-overview.

So my question is, exactly what needs to change here in order for this to play ball with Drupal 8? Will it just become

jQuery("#mapplic").mapplic(drupalSettings.mapplic);

all by itself or what? Any light that can be shed on this for me would be appreciated.


texts: Site aliases: Use a different PHP path on remote

texts:
The Problem:

For reasons I'm not gonna get into, the path to my php executable is NOT /usr/bin/php but is instead something else (let's say it's /local/path/to/php).

My staging and production servers do use /usr/bin/php, however; Moreover, the non-standard php path doesn't exist on those servers.

The problem is that whenever I run a Drush command for a remote site, I get an error:

$ drush @mysite.remote status
bash: /local/path/to/php: No such file or directory

Since /local/path/to/php definitely exists on my local machine (or else my local sites wouldn't work and drush would fail) I can only assume that error is coming from the remote server.

I know I can pass --php=/usr/bin/php to Drush, but there are some less Drupal-savvy devs on my team, so I want to get it configured for them so they don't have to think about it.

I also know about the $DRUSH_PHP environment variable, but setting that to /usr/bin/php breaks drush on my dev machine entirely, so that's not an option either.  It just straight-up breaks Drush.

The Question:

Is there a way to configure my remote aliases to use a specific path to PHP that is different to my local machine's PHP path?  (And why is a remote server trying to use a local path to PHP in the first place?)

If not, what workarounds are there? (I'm hoping I won't have to create a symlink at /non/standard/php to /usr/bin/php on my servers, because that feels fragile and hack-ish, but if there are no alternatives, it'll have to do.)

Drush 7.4.0


texts:
I uploaded a website to a Godaddy shared hosing account, but the home page never get fully render.

I checked the PHP version and the extensions, also checked the file/folder permissions.

The website reports page has no errors or warnings.

All other pages are working perfectly including the admin pages, FYI i uploaded the website on another server and it's working without that issue,

Here are the PHP extensions:

And the PHP options:

Any advice?
Thanks.


texts: hook_form_commerce_checkout_form_checkout_alter() changes are not reflecting on checkout page

texts:
I am trying to make the changes in commerce_checkout_form but I am facing some issues.  Here is my hook_form_FORMID_alter :

function MYMODULE_form_commerce_checkout_form_checkout_alter($form, $form_state, $form_id){
  drupal_add_js(drupal_get_path('module','MYMODULE').'/js/checkout_validate.js');
  $form['customer_profile_shipping']['#title'] = '
Shipping Information
';
  if(isset($form['account'])){
    $form['account']['#title'] = '';
  }

  if ($form_id == 'commerce_checkout_form_checkout') {
    $form['buttons']['continue']['#validate'][] = 'MYMODULE_form_commerce_checkout_form_checkout_validate';
    dsm($form['buttons']['continue']);
    $form['buttons']['continue']['#attributes']['class'][] = 'classTest';

    if (isset($form['buttons']['continue']['#value'])) {
        $form['buttons']['continue']['#value'] = t('Continue');
    }

    // $form['buttons']['continue']['#validate'] = array_reverse($form['buttons']['continue']['#validate']); // I tried this to give preference to my validate function
    dsm($form['buttons']['continue']);
    dsm($form_state);
  }
}

function MYMODULE_form_commerce_checkout_form_checkout_validate(&$form, &$form_state){
  // This is function is not getting called.
  watchdog('MYMODULE_form_commerce_checkout_form_checkout_validate','partner ID. Response details: @request_details',array('@request_details' =>  print_r($form_state,true)), WATCHDOG_DEBUG);
}

I am getting all the dsm on page, means MYMODULE_form_commerce_checkout_form_checkout_alter is getting called but I can see that, neither 'classTest' is added to continue button nor value of continue button is changed.

This is part of dsm($form_state) :

rebuild :  (Boolean) FALSE
rebuild_info :  (Array, 0 elements)
redirect :  (NULL)
temporary :  (Array, 0 elements)
submitted :  (Boolean) FALSE
executed :  (Boolean) FALSE
programmed :  (Boolean) FALSE
programmed_bypass_access_check :  (Boolean) TRUE

$form_state['rebuild'] value is false. Is this the reason, I am not abel to see the changes?


texts: Update same table using dynamic query in drupal 7

texts:
HiAll,

I want to execute below sql query using Drupal 7 PDO, But could not find a way to do,

SQL:

"UPDATE  `books`  AS a
  JOIN  `books` b  ON a.pid = b.pid
  SET  a. `status` = 'INACTIVE'
  WHERE   b.`pdays` * (36400) + b.`ptime_from` > 6546"

Drupal 7:

 $query = db_update('books','pb');
    $query->fields($update_values);
    $query->join('books', 'pc', 'pc.pid = pb.pid');
    //$query->condition("pc.pdays" * (36400) + "pc.ptime_from",$today ,'>');
   /* $query->expression('pc.pdays', 'pdays * :daytime + pc.ptime_from', array(':daytime' => '36400'),'>')*/
    $isbn_reds = $query->execute();

How can we write above SQL in D7 PDO?


texts: It's possible to export sub view and import it to another view? For example I have views "A" & views "B" and each one has sub views [blocks - pages - ...etc]. How to export sub view from A to B?


texts: enable dd() for drush - temporary://debug_drupal.txt call fails

texts:
If I included calls to dd() from code I run with drush, I see messages like this:

WD php: Warning: file_put_contents(temporary://drupal_debug.txt):      [warning]
failed to open stream: "DrupalTemporaryStreamWrapper::stream_open"
call failed in drupal_debug() (line 1624 of
/home/planetary/April/sites/all/modules/devel/devel.module).

How to make it so that dd('...') actually prints stuff to the drupal_debug.txt file?


texts:
I would like to make a field that is very similar to the group audience field but only displays certain types of groups.

As an experiment I hacked up:

og_field_audience_options

and I was able to remove the groups I didn't want but obviously this is not where this code belong.

Is there a way that I can create a new field that inherits most of the behavior of the group audience field and but has a slightly different way of picking which groups to display?  Or do I need to recreate the whole field from scratch?


texts: How to call a module in a block or give a module a block or put module form into a block?

texts: I have a module, and I would like its add form to be put into a block.  So my question is, how would you take a modules page (admin/build/mymodule/add) and give it a block?  So this module will now have its own block in the blocks admin page.  Do you do this by its url, by module, or by form id?


texts: How to restrict users to certain Content Types?

texts:
A site that I'm working on will have lots of users managing the content. Unfortunately their workflow dictates that certain people only have access to certain content types. There isn't a method to their madness, so using roles to do this will result in a nightmare to maintain really fast.

The Content Access module will not work for this. It mentions Authors, but there doesn't seem to be any configuration for this. And managing on a per node basis won't cut it.

I'm thinking the most logical way would be checkboxes on the edit user account page for admins to set. This should limit them to creating and updating content that they have been explicitly allowed to. And the admin menu should only show the content types they were assigned to.

Is there a way to implement this? Or any pointers in the right direction for the appropriate hooks?


texts: How do I change the dependencies of a library from another module

texts:
I have a Drupal 8 module with the following section in the file flot_d8.libraries.yml

flot:
  version: 1.x
  css:
    component:
      css/flot.css: {}
  js:
    lib/jquery.flot.js: {}
    js/flot_d8.js: {}
  dependencies:
    - core/jquery
    - core/drupalSettings

I have another module which is an optional dependency of flot. It does not need to be present, but if it is, it needs to be included in the dependencies section. So I need to add the line - timezone_js/timezone_js at the end...or, more likely, add the equivalent entry to the array that this yml file gets converted into.

Is there a way that one module can alter the assets of another module when it is installed?

I seems like I ~could~ just hard-code the line in myself, but I would like other people to be able to extend the flot module, without me having to add new dependency lines for every add-in.

Similarly, the Flot module has an element with a #pre_render function. Is there a way that a module can add an entry to the pre_render array of another module?


texts:
I've got a Select List, let's say Apple, Orange, Raspberry. TBD.

I need TBD to be sticky at top of the list, while the other items are sorted alphabetically.

Recommendations on how to approach this?


texts: Anonymous users email subscriptions to node updates

texts:
How can I achieve the following:

I want to be able to notify the anonymous user by email when I update a node.

Example: I have `mysite.com/cool-page. I want to have a block with an email field so users can subscribe basically to that page. And every time I update the content from that page, I want the subscribed users to be notified by email.

With Rules I managed to set something up so every time my node is updated it will send an email to users of a role. The problem is that I want to send an email to a list from the database (that I previously collected in a subscription block).

I use Drupal 7.


texts: Disable sticky table headers for field collection?

texts: I'm using a field collection on my node form and sticky table headers comes baked in with no way to disable it (that I can find, anyway). How do I disable sticky table headers? Preferably with Javascript or CSS... sadly, I'm using an instance of Drupal 7 that has a lot of the internals hidden from me.


texts:
I have a field in an entity that is an Entity Reference with widget Select list.

I have created a view and I want to be able to filter by that field in text format, but when I try to configure the filter I get the options to do it as if it were a number (is less than, is equal to...) and not as a text (contains, start with...).

Any idea of what I am doing wrong?

Edited:
Here is screenshot of the filter:

Thanks!


texts: How to ask anonymous to confirm their flag by email?

texts:
I need to add Flags to one of my content types. Two kinds, actually:

I'll take care of it
Solved

Second flag should be available only to node author, and only if first one was already raised. But that's simple part. First kind of flag is trivial for logged in users, too.

The point is - I need to make first kind of flag available for anonymous users, too. And I need to make sure I have their valid email addresses. Standard confirmation link in mail would be OK - so how do I do that?

I know I can develop custom module from scratch, and I will if needed, but I was sure there is already a out-of-the-box solution, and I simply can't find it now.

Just to make some things clear:

Flag module works for anonymous users if you install Session API. No problem here.
I planned to keep emails in Email Field attached to flag itself. For logged in users it defaults to their email, and if they decide to change it, so be it, I have a way to reach them anyway. For anonymous, I want it verified by link in email, and if it is not verified in time, I want to delete flag. Deletion will be easy with CRON and Rules or simple helper module, it's verification that's complicated (and I hope solved already).


texts:
Each time I add a content, I see a node number gets created (i.e. node/2). When I go to the node, I see in the address bar as xxx.com/node/2. Is there way node/2 can be replaced by a value of any field(i.e. title) of the node dynamically? In this case new URL will be xxx.com/nissansentra. [nissansentra is the value of the title field of that node).

I know I can go to config > url alias and give a alias name manually. Instead, I am trying to make it dynamic so I don't have to manually give a alias to each node.

Thanks.

D


texts: Two branches of theming: templates and functions

texts:
Here is the description of theming overrides in Drupal. That (pdf page) great colorful scheme is relevant to Drupal 6, however, as I got that, there are no basic changes in the 7th version that are worth mentioning now. Anyway, Drupal (theme() function) either calls hook as a function (i.e. theme_smthing) or as a template, i.e. template_preproces_smth() -> template_process_smth() -> smth.tpl.php

When I have to override deafault Drupal markup, what way I should do this: with theme_ ... or template_ ... ? Why are there two mechanisms that do the same think? (Or it's resonable and I just haven't understood proper;y what id writen there). Can anybody explain these basics?

Thank you.


texts: Creating a redirect for content type conditionally

texts:
I'm new to Drupal and have inherited a fully functional system (Drupal 7.43), I've had a look on Google with no joy, so hopefully you can help.

For a specific content type it has the following fields (simplified)

URL
info1
info2

When the user clicks to read the page if info1 is empty I would like to redirect to the URL (which is an external, absolute URL) if there is content in info1 I would like to show the page as normal.

How would I go about doing this?


texts: How to display webform results under the webform with contextual filters?

texts:
I created a view listing webform fields
New View » Webform Submissions » Unformatted list of Rendered submissions

It gives me all the submitted data of all the webforms of the website.

I'm looking for a way to have under each webform its results.

So when i visit : website.com/webform/id678
under the form, i would like to have a block showing the previously submitted data i'll be using a pager to only display the 5 latest submissions and be able to browse through submissions if i want to.

This is possible with the contextual filter of Views but i can't seem to figure out how to configure it correctly

thanks

I'm using Drupal 7.56 and webform 4.16


texts: How can we associate an image & textfield with a specific Domain in Drupal 7?

texts: I am using two subdomains in my drupal project. I would like to associate image and textfields with specefic domain only.


texts: How to NOT turn element read only when waiting for '#ajax' callback in Drupal 7 forms?

texts:
I need a simple '#type' => 'textfield' field. When a user types in it, I want to update another section of my form. Just a more elaborate version of built-in autocomplete field, really. So I added:

'#ajax' => array(
  'callback' => 'mymodule_tag',
  'wrapper' => 'edit-tags',
  'method' => 'replace',
  'effect' => 'fade',
  'event' => 'input',
),

The only problem is - it turns my field disabled when waiting for the server's reaction. This is unacceptable: User's input should never be blocked, that's a priority. I bet the solution is simple, but googling for it gives me a lot of results about how to disable field, and none about keeping it enabled. Too much noise for my search skills. Any suggestions?


texts:
I am trying to display my content in Alphabetical group for a specific content type.

What I did?

Added a vocabulary "Category"
Added a term(Myterm) inside this vocabulary.
Added a field in content type and put the relation with this vocabulary and the default option is the term name.

This is working fine. Now I want to show up the Myterm page the content alphabetical group. For your information I used Pathauto module to create the taxonomy term url. So my current url is domainname.com/MyTerm

This page showing the results which are belongs to MyTerm term. I want to just display the Alphabetical group and each group will contain the content whose title starting with this group. Please guys advice me how to implement this. If any contributed module is available, please advice. Thanks in advance.

e.g. Suppose my requirement is like below:

[A]
Amazing Video
A good tutorial
Award wining software
[B]
British Council
Be right back
[C]
Case discussion
Content privacy
....


texts: View to display nodes with a random term

texts:
I have got a view that selects some images. Each image is tagged with a taxonomy term. I would like the view to display only images tagged with a common term that is chosen randomly at every use.

The view is used as a block.

Example:
term: a, images: img1, img2, img3;
term: b, images: img4;
term: c, images: img5, img6;

One user sees a sequence of img1, img2 and img3. Another one sees img4 only. A next one sees img4 too.

How should I do it?


texts: Filtering a view on more than one tag at once

texts:
I have a job view which I can filter on a specific sector or a specific region.

However, my filtering so far only works one at a time. I would like to be able to specify: show all jobs in sector AND region. My link output is like this at the moment: jobsview/[name] (with the name of the term). I guess it would have to be something like jobsview/[clickedsector]/[clickedregion], but I don't know how to do this
Can anyone help me out please?
EDIT:
My filter on pageview:

This is what my link output looks like, ive done the same thing for both sector and region:

So what I want is being able to filter on both of them at the same time


texts:
Here are the facts:

Made a clean install of Drupal 6.20
Installed and enabled Admin Menu module

From this point on I can't access any admin/* page however I can access to both node/* and user/*...

PHP log:

No entries

Apache error log:

No entries

Apache access log:

127.0.0.1 - - [10/Mar/2011:16:22:16 +0000] "GET /drupal_testes/ HTTP/1.0" 200 5771
127.0.0.1 - - [10/Mar/2011:16:22:14 +0000] "GET /drupal_testes/admin HTTP/1.1" 200 -

DB table watchdog:

Nothing serious...

And that's all, for a single access to /drupal_testes/admin...
Disabling admin_menu (at the system table) does work. Also, as a side note, when I go to admin/build/modules and try to enable Admin Menu again the page will take forever to load and end in a WSOD.
After that if I go to drupal_testes/node the admin_menu is active and working, except for the admin/* pages.

I'm aware of WSOD Walkthrough but none of the reasons seems to apply this case..
Any idea why can this be happening?

Edit #4

Exactly the same behaviour when installing Token

Edit #5

Installing CCK, which in theory is much heavier than Token or Admin Menu, presents no problems.
Flushing the cache_* tables changes nothing.
Increasing php.ini memory_limit didn't make any difference...

Although the problem is solved by disabling the offending modules, the goal is to have them active and working properly...


texts: How do I remove the site name from the page title on a particular page?

texts:
I have unchecked the sitename in admin/build/themes/settings but all of the titles of pages are still showing the site name.

I am not sure why this happens. Is there any other way to remove it?

I have installed the Page Title module, and in admin/settings/page-title I have the page title set as [page-title] for that particular page, not as [page-title] | [site-name].


texts: How to integrate custom code into a "Features" feature

texts:
My specific problem:
In a Feature, I have a View. I want to use this View on several different sites. The View has a nid-argument, which validates Node:type == [node_type_1]. When the Feature get's exported, it outputs the filter settings like this:

'node_type_1' => 'node_type_1',
'node_type_2' => 0,
'node_type_3' => 0,

Problems ensue when the feature is used on site number 2, which, with exception of [node_type_1], has an entirely different list of content types. Thus the list becomes

'node_type_1' => 'node_type_1',
'node_type_4' => 0,
'node_type_5' => 0,

And suddently, I have an override, with a diff like:

< 'node_type_2' => 0,
< 'node_type_3' => 0,
> 'node_type_4' => 0,
> 'node_type_5' => 0,

Some background: At some point, I listened to an interview with a Features maintainer, who mentioned something interesting. It is both possible, and supported, to add custom code into features. I hope that can provide me with more dynamic means of handling this particular part of my problem.

My question is deliberately stated such that I hope someone can provide an answer to my specific problem, as well as similar problems, from other modules. I can easily imagine a similar problem showing up in many different situations. However, if it turns out that no-one can solve the problem in a general fashion, yet can solve this specific problem, I will re-phrase the question title to reflect that better.


texts:
I have been looking to expose the images hosted on my site to Google Images search. I was wondering is there is a Drupal 6 module to do that? I am on Pressflow 6.

I can see such modules available for Drupal 7 (see below). http://drupal.org/project/google_image_sitemap
AND
http://drupal.org/node/451234


texts: Redirect to a specific page in ajax callback

texts:
How can I redirect to a specific page in an ajax callback using Drupal 7, I've already tested this method:

function my_ajax_callback($form, &$form_state) {
  if (!user_is_anonymous()) {
    return $form['my_fieldset'];
  }
  else {
    drupal_goto('login');
  }
}

but that code doesn't redirect to /login when current user is anonymous.


texts:
I have a field collection with 3 fields (title, image and link). I'd like to link the title and image to the value of the link field.

I'm using the linked field module to make the fields linkable and enabled the token module. Yet the fields from my field collection aren't in my available tokens list. They also can't be found in admin/help/token

How do I link a field from a field collection to the value of another field from that same collection? Or how do I find the correct token?


texts: Why am I getting a "You are not authorized to access this page." on the Drupal Migrate UI page?

texts: I just installed this module on my Drupal 8 site hosted locally on Acquia Dev Desktop. I haven't had this issue with any other modules and this is occurring immediately after I install the module.


texts: Exposed filters drop down select translated but not displaying on view

texts:
The field items are properly translated but they don't show up in the views exposed filters.

Can be seen over here on the French page:

can be seen here:  http://sandbox.vuxi.com/fr/node?qt-qt_index_search_b_a_u=1#qt-qt_index_search_b_a_u


texts: Any proper module for leave management system?

texts:
I apologise if this is not the right place...
Is there any module for leave management system that used in any Intranet portal or any management system.

Anybody have an idea where to begin with?
I have to add a fixed number for a maximum leave for a year and have to decrease the count per user on approval of any leave. How to add it with each user's profile.


texts: How to find the url of a media library image field in a preprocess function?

texts:
I have a preprocess function that I am using to grab one of 3 profile images.  Basically we're replacing a couple stand-alone image fields with a media library reference field.  The goal is to display the media library image if it is populated at a particular style (called '65x65') or fall back to other stand-alone legacy image fields if it is not populated.
I'm having a heck of a time building the media library image url.  I have tried quite a few things based on this discussion and this discussion and others.  The image field on the image media type is called field_media_image (screenshot).  I'm not sure if it's useful to post my half-baked code attempts so I will leave the parts that I know are working.
foreach ($block->field_block_contributors->referencedEntities() as $contributor) {
    # prefer the media library reference profile image if it exists

    if (!$contributor->field_profile_image->isEmpty()) { # check if there is a media library profile image

      $my_profile_image = $contributor->get('field_profile_image')->referencedEntities(); # seems to load this field ok
      if (!empty($my_profile_image)) {
      // kint($my_profile_image);
      # load a media library image using the '65x65' image style
      // $styled_image_url = ??????

      }
    } elseif (!$contributor->field_user_image->isEmpty()) { # or fall back to one of two legacy image fields.  This part works
      $styled_image_url = ImageStyle::load('65x65')->buildUrl($contributor->field_user_image->entity->getFileUri());
    } elseif (!$contributor->field_speaker_image->isEmpty()) {
      $styled_image_url = ImageStyle::load('65x65')->buildUrl($contributor->field_speaker_image->entity->getFileUri());
    } else {
      $styled_image_url = '';
    }
    $variables['profiles'][] = [
      'title' => $contributor->field_user_title->value,
      'link' => "/user/" . $contributor->uid->value,
      'image' => ['src' => $styled_image_url, 'attributes' => $contributor->field_user_image->value],
      'name' => $contributor->field_user_first_name->value . " " . $contributor->field_user_last_name->value,
    ];
  }

PS. Bonus beer for anyone who knows off the top of their heads how I can link to the user's name instead of their user id # ( the line    'link' => "/user/" . $contributor->uid->value, )
Thanks!!!


texts: is it possible to create new tabs and place them under quick tabs, i.e, i want to create two new quick tabs and add them under (nesting structure) already existing three quick tabs...How can i achieve this


texts: Hiding the field label when creating a content type

texts: I have created a content type called "Design" in which there are 3 fields. When creating this content type I want to hide the label of fields. How would I do that?


texts: How to create custom menu link wrapper function in Drupal 7?

texts:
As you know default wrapper for menu item in Drupal 7 can be modified via function theme_menu_link().

by overriding

theme_menu_link($variables) {}

function we can modify the rendered html output of menu link but it will change all of menu items that their #theme attribute is set to this function. for example in main menu, each item has menu_link__main_menu value in it's #theme attribute.

Now I want to create a custom wrapper function in my theme.

I searched and I found I must create a function with structure like

theme_menu_link($variables) {}

and also I must REGISTER the function name in my theme.

For registration, I used function theme_theme() {}

function theme_theme() {return array('custom_menu_item_wrapper' => array());}

** theme is replaced by name of theme
** custom_menu_item_wrapper is the name of my function for wrapping operation

But I don't know, how should I define parameters in theme function registration because when custom_menu_item_wrapper($variables) function is called $variables is NULL


texts: Drupal 7 - How to show an upcoming event from site 1 on site 2?

texts:
For Drupal 7, Is it possible to show an upcoming event from site A on site B's block?

Also, is it possible to show an upcoming event by category? For example, I wanna have an upcoming event for swimming class and an upcoming event for hiking group. However, they are all in one same calendar.

Thanks,
HL


texts:
I have a person who wants to have feature jobs on his site.

I've already got the descrption allow full html and got WYSIWYG going so he can add pictures and descriptions beside the pictures etc. but he wants it even simpler.  He wants to have images and then a description that goes beside each image, then be able to add more images with descriptions as necessary.  He wants them to look as follows:

*image1 *description1

*image2 *description2

With description one being a bunch of text most likely bullet points.

He's wanting the image/descriptions to be tied to one another.  I'm pretty new so not sure how to do that.  I am comfortable being able to use CSS to format the content if I can create a type that ties the image/description together like this.


texts: Use hook to get the domain configuration from language

texts:
We have enabled English, Spanish, and French on our site. On Regional and language >> Languages detection we selected URL for Content language detection >> Detection Method. For Part of the URL that determines language, we selected Domain. We then set the following domains.

English: example.com
Spanish: es.example.com
French: fr.example.com

How can we programmatically obtain the domain associated to each language? What code should we use in a preprocess function?
Using the following code, we obtained the list of the language, but we are far
 from getting the domain that has been associated with each language.

function mymodule_preprocess_html(&$variables) {
  // to get all enabled languages
  $languages = \Drupal::languageManager()->getLanguages();

  // Did not find method to retrieve the domain configuration.
  foreach($languages as $key => $value) {
    ksm($languages[$key]);
    //stuck here on how to get domain configuration per language.
  }
}


texts: correct way to load JS library for custom module

texts:
I am trying to use d3.js in my module, but I am facing some issues.

I have the D3 module installed in sites/all/modules/d3/ and d3.min.js installed in sites/all/libraries/d3/, and I can see the d3/examples fine.

Now I have a js script in my custom module that is supposed to use D3, but I fail to load it. Here's my attempt to load the library:

drupal_add_library('d3','d3');
# retrieve some data as JSON
$setting = mymodule_load_data($param);
# create the render array
$content = array(
  '#attached' => array(
    # attach JS
    'js' => array(
      array(
        'type' => 'setting',
        'data' => array('mymodule' => array('json_data' => $setting)),
      ),
      array(
        'type' => 'file',
        'data' => drupal_get_path('module', 'mymodule') .'/js/myscript.js',
      ),
    ),
    'css' => array(
      drupal_get_path('module', 'mymodule') . '/css/mystyle.css',
    ),
  )
);
# return result
return $content;

but I don't see d3 included in the source code of my page and myscript.js of course doesn't work.

I have checked the return value of drupal_add_library as suggested in the comments and it's FALSE.

Any hints?


texts: Custom migrate source plugin, extends FieldableEntity class, has migrate status of [error] No migrations found. Why?

texts:
I'm writing a migrate source plugin for migrating D7 entityform (entityform module) submissions. If anyone has done this or knows an existing plugin, please let me know.
I am trying to extend the FieldableEntity base class from Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity; because I want to use its getFields() and getFieldValues() methods when I override prepareRow() to include custom fields from my D7 entityform.
My problem is that when my source plugin extends FieldableEntity, drush reports [error]  No migrations found. for my migration. Importantly, however, if my source plugin instead uses the SqlBase class from Drupal\migrate\Plugin\migrate\source\SqlBase, then drush can import all of my entityforms from D7 into D9 contact forms no problem. So it would seem that I am missing something when I try to implement FieldableEntity preventing it from retrieving data for the migration.
Here is my plugin, which shows up fine in drush ms:
<?php

namespace Drupal\mymodule_migrate\Plugin\migrate\source;

use Drupal\migrate\Row;
use Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity;

/**
 * The 'mymodule_migrate_entityform' source plugin.
 *
 * @MigrateSource(
 *   id = "mymodule_migrate_entityform",
 *   source_module = "mymodule_migrate"
 * )
 */
class Entityform extends FieldableEntity {

  /**
   * {@inheritdoc}
   */
  public function query() {
    $query = $this->select('entityform', 'e')
      ->fields('e', [
        'entityform_id',
        'type',
        'created',
        'changed',
        'uid'
      ]);
    return $query;
  }

  /**
   * {@inheritdoc}
   */
  public function fields() {
    return array(
      'entityform_id' => $this->t('The ID of the entityform submission.'),
      'type' => $this->t('The entityform type.'),
      'created' => $this->t('The time that the entityform was submitted.'),
      'changed' => $this->t('Last updated time.'),
      'uid' => $this->t('The {users}.uid who submitted the entityform. If set to 0, this entityform was submitted by an anonymous user.'),
    );
  }

  /**
   * {@inheritdoc}
   */
  public function getIds() {
    $ids['entityform_id']['type'] = 'integer';
    $ids['entityform_id']['alias'] = 'e';
    return $ids;
  }

  /**
   * {@inheritdoc}
   */
  public function prepareRow(Row $row) {
    $entityform_id = $row->getSourceProperty('entityform_id');
    // Get Field API field values.
    foreach ($this->getFields('entityform', 'BUNDLE_MACHINE_NAME') as $field_name => $field) {
      $row->setSourceProperty($field_name, $this->getFieldValues('entityform', $field_name, $entityform_id));
    }
    return parent::prepareRow($row);
  }

}

I use this yml migration definition. My migrate destination is D8/D9 contact_message entity.
id: mymodule_contact_message
label: D8 Contact message migration from D7 entityform submission
source:
  plugin: mymodule_migrate_entityform
process:
  id: entityform_id
  langcode:
    plugin: default_value
    source: language
    default_value: "und"
  created: created
  changed: changed
destination:
  plugin: entity:contact_message
  default_bundle: MY_DESTINATION_BUNDLE

As stated above, all of this works great when I use SqlBase in my plugin. But with FieldableEntity drush comes back with [error] No migrations found.


texts: How to enable module when there is a WSOD (blank page)?

texts:
Use case: I enabled a module, without enabling the required module. I saved the configuration on the modules page and it showed me the following screen -

I clicked "Continue" and then I get the WSOD (blank page).

I added error reporting php code in my index.php in root directory. It showed a fatal error - Fatal error: Call to undefined function variable_realm_switch() in /mysite/sites/all/modules/i18n/i18n_variable/i18n_variable.module on line 54

I cannot go back to the admin pages to enable the required module, because of WSOD. Is there a way to enable the module from the code? I cannot delete the modules involved in this error, because I will end up losing the data associated with the modules.


texts: how I can create 2 mail templates, and send one for admin and second for user when he is submission webform?

texts:
I have webform, this webform has many of data, was set from user, and others detected by server, so Im create webform mail template for admin and its wrok fine ..

but when I try to send this email to user submission, its will get the same template style for admin, and I dont need it surly ..

what is the way for get email from address field, then send a specific data style ...

Look at my template code:

<?= check_plain($node->title) ?>

<?php
    $x = webform_submission_render($node, $submission, $email, 'html');
?>

Name: <?php echo strip_tags($x['#submission']->data[1][0]); ?>

Email: <?php echo strip_tags($x['#submission']->data[2][0]); ?>

Company: <?php echo strip_tags($x['#submission']->data[3][0]); ?>

Phone: <?php echo strip_tags($x['#submission']->data[4][0]); ?>

<?php
$notes_cart = $x['#submission']->data[5][0];
if(!empty($notes_cart)) {
    echo "
Notes: ".strip_tags($x['#submission']->data[5][0])."
";
}
?>

Items Order From *** for publishing:

<?php echo $x['#submission']->data[6][0]; ?>

this admin email template, and if you see, I can get email for user submission, but how i can get it, then set own template, and send email to him ..

thanks a lot.

Thanks every Body, Im write a php code for resolve this proplim, and its resolved by add this function to my custom module like this

function custom_anees_multitask_drupal_mail($from = 'default_from', $to, $subject, $message) {
  $my_module = 'custom_anees_multitask';// module name
  $my_mail_token = microtime();
  if ($from == 'default_from') {
    // Change this to your own default 'from' email address.
    $from = variable_get('system_mail', 'My Email Address <example@example.com>');
  }
  $message = array(
    'id' => $my_module . '_' . $my_mail_token,
    'to' => $to,
    'subject' => $subject,
    'body' => array($message),
    'headers' => array(
      'From' => $from,
      'Sender' => $from,
      'Return-Path' => $from,
    ),
  );
  $system = drupal_mail_system($my_module, $my_mail_token);
  $message = $system->format($message);
  if ($system->mail($message)) {
    return TRUE;
  }
  else {
    return FALSE;
  }
}

**then Im go to my webform template & Im set a call to module function like this

custom_anees_multitask_drupal_mail($from, $to, $subject, $message);

Good Luck, and if there other solution, I will be happy to look to it.
Best Regards,**


texts:
Drupal Commerce.

On admin/commerce/config/checkout/form you can move around checkout panes between pages. This is cool!

It allows e.g. to move all panes on one page.

Now what I am trying to figure out is how to make a more interesting layout for this page. E.g. by "grouping" the panes into layout regions / columns, like I would for a node display.

Any ideas?


texts: How do I change/modify an update content message

texts:
When someone edits a node, or a profile content type there is a message set with drupal_set_message() that appears at the top of the page. It can look something like this:

  Education 45971 has been updated.

How do I change/modify this message before it is displayed to the user? Is there any hook I can use?


texts:
I've got a custom content type "Publications" with custom fields. Two of these fields are:
DOI (document object identifier), a unique identifier for the publication
Altmetrics, the total "online attention" provided by Altmetric.com's API.

I'm wondering if there is a way via Drupal to automatically update each Publication node daily with the current online attention?

An example of a DOI is:
10.1073/pnas.0913149107

The corresponding API call would be: http://api.altmetric.com/v1/doi/10.1073/pnas.0913149107

The JSON data I'm looking for is object/score (which is currently 176.122).

As you can see the API call would have to use data from the Node. I've looked at Feeds and Feeds extensible parsers but I'm not sure how to make it work.


texts: Drupal: script all admin settings for site cloning

texts:
I am a newbie Drupal user here, tasked with an exam taking site for a school.

I have run a docker container with version 7.69 and installed Quiz and few other modules, made a lot of settings via an admin GUI, like enabled few modules, added module settings etc. Added some taxonomy and some content (questions and a quiz).

Now I'd like to spin up a production site, but I can't imagine doing it all over with the admin GUI.

Is there a way to dump the whole site configuration, bar the content, and apply it to a newly deployed vanilla version? Ideally, I'd put some commands in a Dockerfile, but really any option that does not involve hours of clicking through admin pages...

I have looked at Features, but I am not sure this is my way. I.e. if I understood correctly, the modules I use must support it, and they don't.

Thanks in advance!


texts: Can't set field names with Given users behat call

texts:
When I run the following behat test:

Scenario: Logs in to the site
  Given users:
  | name     | pass        | mail                  | roles         | status | field_fir | field_la |
  | someuser | sompassword | someone@xenomedia.com | administrator | 1      | Some      | User     |
  Given I am on "/user"
  When I fill in "Username" with "someuser"
    And I fill in "Password" with "sompassword"
    And I press "Log in"
  Then I should see "Some User"
  Then I visit "user/logout"
  Then I should be on the homepage

I get the following error:

Given users:                                # Drupal\DrupalExtension\Context\DrupalContext::createUsers()
  | name     | pass        | mail                  | roles         | status | field_fir | field_la |
  | someuser | sompassword | someone@xenomedia.com | administrator | 1      | Some      | User     |
  Warning: explode() expects parameter 2 to be string, array given in /var/www/xmd8/vendor/drupal/drupal-extension/src/Drupal/DrupalExtension/Context/RawDrupalContext.php line 316

The weird thing is if I remove field_fir and change Then I should see "Some User" to Then I should see "User, it works.  For some strange reason it doesn't like field_fir. I verified that field_fir and field_la have exactly the same settings.


texts: How do you store webform submits to a different database?

texts:
I have a client requirement where "user generated content", in specific, webform submissions from the public, need to be stored in a different database from the normal 'one' database approach.

How do I configure the site to store webform submissions in a different database?


texts: Access image alt attribute in field template

texts:
I have copied the field.html.twig Template to field--node--field-image--article.html.twig, to specialize the template for my needs.
In this case the template would be called for content type article and field type image. (This content type uses the Responsive Image module.)
As default, with the image field, you must define an alt-value for the image.
But the alt-value is processed in the template image.html.twig.
Is it possible, to access the alt-value in the field--node--field-image--article.html.twig (the copy of field.html.twig), which calls the image.html.twig via the responsive-image templates.
I want to display the alt text in a div near the image.
I also have tried to access it in hook_preprocess_field(), but all I have for now is the following code.
function mytheme_preprocess_field(&$variables, $hook) {
  if ($variables['element']['#field_name'] == 'field_image') {
    foreach ($variables['element']['#items'] as $item_key => $item) {
      // code to write
    }
  }
}


texts: Is it possible to make a custom facet that behaves like a Views grouped filter?

texts:
I am moving my user search from vanilla Views to the Search API/Solr backend/Facet API with Views.

On my site, I have a Countries field on the user profile, and I would like to give users the option to choose between two options: from Japan or not from Japan.

In Views, I did this using a grouped filter:

Now I am trying to make a facet that does the same thing.  However, I don't think this is possible from the Facet UI, even with Facet API Bonus installed.  There appears to be no way to provide users with the choice of A or NOT A for a facet that has 100+ values.

How can I implement this A or NOT A search using the Facet API for a specific facet?


texts: Limiting nodes returned per group in a view

texts:
Using Drupal 7, I've created a view to render a list of most recent content types grouped by taxonomy. I can set a global limit for items returned but I'd instead like to limit it per group. So if I've got the terms "Apples", "Bananas" and "Carrots" I'd like to get the top three Apples, top three Bananas and top three Carrots. Currently I'm getting results such as top two Apples and one banana or top three apples.

UPDATE

I actually found a way to do it without creating multiple views. There's a module called Views Grouping Row Limit that does exactly that I'm looking for!


texts:
I want to print the menu items as follows.

Menu1   Menu 2    Menu3     More
                            Menu4
                            Menu5

I am getting them as in the following screenshot.

The More menu should contain only Menu 4 link. I created these menu links from the administrative pages.

I printed the menus using the following code.

$menutopleft = menu_navigation_links('menu-top-left-menu');
print_r(theme('links__menu-top-left-menu', array('links' => $menutopleft)));


texts: How to force redirect user to www.domain or http://domain in a nginx environment?

texts:
I'm using drupal with nginx and i'm looking for a way to redirect users either to www.domain.tld or to http://domain.tld

Right now, if i log into the website using http://domain.tld, the website considers me as an anonymous user and i need to log in again when accessing www.domain.tld

I know drupal's .htaccess file manages this issue but it's ineffective with nginx

Thanks


texts:
So, what I want is a dropdown to filter news by months, the select box is like that(months are grouped by years):

- All
-- 2013
--- Jan
--- Feb
--- Mar
--- ...
-- 2012
--- Jan
--- Feb
--- Mar

How I can do that ?

Thank you for your Help.


texts: Get selected item in hook_form_alter in D8

texts:
I have a select box named field_p_destination, and i need to get the selected value on hook_form_alter .

I tried `

function mymodule_form_alter(&$form, FormStateInterface $form_state, $form_id){
  echo $form['field_p_destination']['widget'][0]['value']['#default_value'];`
}

Its not working . But in case of text fields its working fine . Any idea to get the select field ?


texts: Is it possible to protect content types with captcha?

texts:
I would like to protect some pages of my Drupal 7 website with a riddler captcha, to protect those pages from all who can not solve the riddle, but don't make it necessary to login to see the content. As I am using Organic Groups it would be the best, to protect all content that is part of a group by such a riddle.
To make my goals more clear and avoid misunderstandings:

I want to protect pages in a soft way against unauthorized access.
I don't want the audience to login to my side, because for my use case that would be too complicated.
I don't need high security.

Does anybody know how to do that, what would be the most elegant way. Does anybody have a better idea?


texts: Accordion Menu - jQuery seems to stop working on product page

texts:
for several hours I'm struggling to cope with the Accordion Menu in my webshop (Drupal Commerce).

Here's the story...
In my webshop, beside the default content types (Article and Basic Page), I have my own content type - "Product display" which displays related products.
I have a couple views of "Product displays". Furthermore there are pages "About", "Terms and Conditions" etc.

The Accordion Menu works fine everywhere except the product nodes. The jQuery script seems to not working on the product pages. The accordion functionality and its CSS disappears while the menu structure and items are still displayed.

I tried to look for problems using Firebug console. All I found was "Uncaught TypeError: Cannot read property 'length' of undefined" in "jquery-1.10.2.js:631"

And here is an illustration of my problem:

Thanks in advance for your help!


texts: Wrong status after updating from 7.64 to 7.66

texts:
I recently manually updated my localhost drupal site from 7.64 to 7.66.  I ran update.php without errors.  When the process finished, I cleared all cache and checked the status.  It still reported 7.64.  I then re-ran the manual update and got the same results.  When I look at system.info, I see:

; Information added by Drupal.org packaging script on 2019-04-17
version = "7.66"
project = "drupal"
datestamp = "1555533576"

I've noticed other posts (here and here) on the Drupal site that report the same type of symptoms, but, no one has reported a valid solution to resolve this discrepancy.  Does anyone know how to get things back in sync?

UPDATE: As part of this process, I successfully updated two other sites I maintain to 7.66.  The glaring difference that I need explained is after running update.php on localhost, I do not see "Pending Update" as I did on the other two sites.


texts:
What is the purpose of aggregation in view?

And why is it important to enable him when you make charts?


texts: how to show all alphabates in glossary block in drupal 7?

texts: I have a glossary view in drupal 7 with attachment. These attachment missing some alphabates. showing like a|c|d|h|m etc. But I need a|b|c|d|e|f etc like this.


texts: Using drupal_goto for checkout redirection to add $_GET variable, but gets overwritten

texts:
So I want to do redirect to the following URL:

  http:/www.url.com/checkout?foo=bar

Tried using this:

drupal_goto($path = 'checkout', $options = array( 'query' => array( 'foo' => 'bar')), $http_response_code = 302);

Now it works, but instally redirects to this:

  http:/www.url.com/checkout/order_id/

...meaning that I lose the GET variable. How do I do this? The same happens if you just type /checkout into the address bar, it redirects to checkout/order_id. I think it might be commerce doing this automatically. Any idea how to resolve this?


texts: PrePopulate a Node URL from Previous Node via Rules Link to Add Content Form

texts:
Scenario

A Content Node's URL needs to be incorporated into an Application (Node Add) for a future reference so the users can view their Applications made. The user clicks on a Rules Link (i.e.'Contact User') button and the user is taken to a Form (which for my purposes creates a new content Node 'Application',so the entity is Prepopulated with the referring Node URL (or a linked Title) so the user can later view it in a list and for backend managment purposes, the Application Nodes will be CRON purged once in a while as required.

I have installed https://www.drupal.org/project/entityreference_prepopulate module along with Tokens but it doesn't included the previous Node URL as expected although it does add the 'current' mydomain.com URL, so it's working to some degree. And yes, I have looked at online Youtube etc videos, but they don't seem to cover my requirements.

I'm at a loss understanding how the process is working backend in Drupal. I'm not sure if in the Rules Link Component if I need to add the URL first then move to the Form page next (using Rules), or if that is completely an incorrect approach on my part and I need to use an API or whatever.

Any advice is very much appreciated. Thanks.


texts: My hosting provider ask me to use xCache instead of the built in Drupal cache system

texts:
Just that I have a problem with a website (Drupal 7), the server falls down every night.
My hosting provider ask me use xCache instead of built in Drupal cache system.
Does it make any sense?


texts: Can DS manage "admin tabs" placement for a node?

texts: Is there an existing sub-module or someplace i'm not looking for Display Suite to allow me to arbitrarily place the View, Edit, Revisions, Manage Display, Devel tabs that appear when viewing a Node... say I want to move them to a different place in any DS template like Right or Left.


texts: How do I generate PDF content from a node?

texts:
We are looking for a way to convert the Drupal pages into PDF on click of a button for D8. Initially we thought we could use Print Module, but that only has a D7 version.

How do you create a button in D8 so that on click, it will convert the Drupal node into a PDF keeping the current theme styling and elements appropriately? We have been unable to find any D8 modules or process that can allow for this.


texts: Drupal 7 view to loop through store locations

texts: I am needing to setup a view in Drupal 7 that loops through content entries with fields. The content listing page will display teasers of each entry item with only the store name, address, suburb and phone number displayed. When the store name is clicked, I want the resulting page to display all details about the store. Could someone provide me insight on how to get this setup. I have a single content item with multiple field collections that works in a similar way, but it does not provide the click through functionality. It can be viewed here: http://endlessfitness.co.nz/swim-spa-retailers.


texts: AJAX callback function has to be defined in the same file?

texts:
I have defined a textfield that includes an AJAX callback. In another separate file, I have the AJAX callback function defined.

Will this work or does the callback function need to appear in the same file the textfield was defined in?

This is the code I would use.

'associated_element' => array(
  '#type' => 'textfield',
  '#title' => t('Destination Data Element'),
  '#description' => t('Some text.'),
  '#ajax' => array(
      'event'=>'change',
      'wrapper' => 'linked_form_elements',
      'callback' => 'form_editor_linked_form_ajax',
    ),
  ),
);


texts: Theme specific drupal commerce product form

texts:
I want to create a .tpl file for each specific product type form. I get that I can create a custom product template and add this code on my theme's template.php:

'commerce_product_ui_product_form' => array(
               'arguments' => array(
                    'form' => NULL,
                    ),
               'template' => 'templates/products form/node--add--product', // set the path here if not in root theme directory
               'render element' => 'form',
            )

The problem is this changes all the product type's form. How can I find the Form ID for each specific product type form?


texts: Change Drupal interface language back to English

texts:
I made the mistake to translate the Drupal interface in my local language. But since the language is set into the database, I can't delete this language using the Drupal UI. And I'm not sure which file(s) to delete in the database.

Does anyone know a (faultlessly) way to translate the Drupal interface back to English?


texts: Trying to create user programmatically, running into issues

texts:
I'm attempting to programmatically create a user. I'd like to be able to create the user, then set the current global $user object to this newly created user. Here is what my code looks like.

    $new_user = array(
        'name' => $form_state['values']['username'],
        'pass' => $form_state['values']['password'],
        'mail' => $form_state['values']['email'],
        'status' => 1,
        'init' => $form_state['values']['email'],
        'roles' => array(
            DRUPAL_AUTHENTICATED_RID => 'authenticated user'
        )
    );

    if ($saved_user = user_save(NULL, $new_user)){
        user_load($saved_user->uid, TRUE);
        $form_state['redirect'] = 'member/profile';
    } else {
        $form_state['redirect'] = 'member/join';
    }

The reason for me essentially wrapping the existing user page is that there is a lot of additional functionality needed. This code does create a user in the database, but it fails in two places: 1) It does not create any roles for this new user in the users_roles table, and 2) It does not log the current user in or adjust the global $user object.

Any ideas why this is failing?

EDIT: Using Drupal 7.9

EDIT2: I solved the user not being logged in issue by using the function user_login_submit. Roles still aren't creating correctly, however.


texts: How to generate stats or reports for multi-sites?

texts:
We've a large deployment of multi-sites, each site with its own database, and I am looking at generating reports from these sites and making those available online in some format.

For e.g., our sites implement many redirects. I want to be able to pull a report on what redirects are in use by which site. I can readily do this via drush and shell scripts, but it would be nice to have a "stats site" to do the generating of these kinds of reports for all sites in a multi-site setup.