texts: Set background picture only within the text field, not the entire page

texts:
How should I make the background image appear within the text field (in the Basic page content type) but not the entire page?
I am using the Background Image Formatter module, running on Drupal 7 with Bootstrap 3.

I would like it to appear within the text field.

This is the current configuration.

I am extremely new to web development and Drupal.


texts: Multiple forms for one content type using one module

texts:
I want to create the following functionality:

Multiple interrelated forms needed

Form 1,
Form 1 detail and
Form 1 user detail

But the user can fill in the forms only in order.. I mean when the first form is not inserted then the detail and user detail form aren't available to the user.. and additionally I want to relate those forms also..

Is this possible with just one content type? Any ideas how I can achieve this in Drupal 7?


texts:
I create a module like this:

<?php
function mymodule_menu(){
    $items['mymodule/edit']=array(
        'title'=>t('Edit item'),
        'type'=>MENU_CALLBACK,
        'page callback'=>'mymodule_edit_view',
    );
    return $items;
}

function mymodule_edit_view(){
    //...
    $html.='<form '.$form_attr.'>';
    //...
    $html.='</form>';
    //...
    return $html;
}

function mymodule_form_alter(&$form, $form_state, $form_id){
    //...
}

I create a form in mymodule_edit_view, but when I access mymodelu/edit, the drupal did not call mymodule_form_alter. I do not want to create the form with drupal_get_form(), So how should I create the form?


texts: Override html output for a group of related node fields with Display Suite

texts:
I am used to other php CMS, but new to Drupal, my first project, so I guess it's a beginner question.

I need to display several entity node fields (4 integers) with some text, in one table.

Obviously the template i would like to override is this one, in my particular case:

ds-1col--node-tour-full.tpl.php

which is an override of ds-1col.tpl.php, here is the code :

<?php

/**
 * @file
 * Display Suite 1 column template.
 */
?>
<<?php print $ds_content_wrapper; print $layout_attributes; ?> class="ds-1col    <?php print $classes;?> clearfix">

  <?php if (isset($title_suffix['contextual_links'])): ?>
  <?php print render($title_suffix['contextual_links']); ?>
  <?php endif; ?>

  <?php print $ds_content; ?>
</<?php print $ds_content_wrapper ?>>

<?php if (!empty($drupal_render_children)): ?>
  <?php print $drupal_render_children ?>
<?php endif; ?>

Is this the good way to go ? I guess i have to modify the template because i cannot override the display of several fields together to group them in a table with a hook or preprocess function, that will be called for each field. May be i am wrong or there are easier way to go ?

Anyway, if it's the right path to follow, can someone point me out directions to go from the code in ds-1col.tpl.php to modify the output of that particular node type ?

Thanks


texts: Is it possible with Drupal Views to have AND and OR in a filter set?

texts:
I am attempting to build a view with four filters (A, B, C, D). With Views 3 it is possible to select whether you want these filters to be chained with AND statements or OR statements. Is there a way to configure views so as to chain some of them with AND and others with OR?

For example, ending up with a query that is similar to:

SELECT *
FROM {table}
WHERE A = 0
  AND B = 0
  AND (C = 1 OR D = 1)`


texts:
In Drupal 7, every time a node is viewed the following columns are populated in the {accesslog} table:

aid: unique accesslog ID
sid: browser session ID of user that visited page
title: title of page visited
path: internal path to page visited (relative to Drupal root)
url: referrer URI
hostname: hostname of user that visited the page
uid: user users.uid that visited the page
timer: time in milliseconds that the page took to load
timestamp: timestamp of when the page was visited

In Drupal 8, the accesslog was removed from the statistics module. I would like to recreate some this functionality in a Drupal 8 custom module. I need:
- A hook to fire on every node view
- Capture the relevant information
- Write it to a database table

My plan was to copy from statistics module, because it still counts node views. However, the code is not straight forward. In Drupal 8 the mechanism appears to be:

Implement hook_ENTITY_TYPE_view(), which attaches some JavaScript and settings to the page build

/**
 * Implements hook_ENTITY_TYPE_view() for node entities.
 */
function statistics_node_view(array &$build, EntityInterface $node, EntityViewDisplayInterface $display, $view_mode) {
  if (!$node->isNew() && $view_mode == 'full' && node_is_page($node) && empty($node->in_preview)) {
    $build['#attached']['library'][] = 'statistics/drupal.statistics';
    $settings = array('data' => array('nid' => $node->id()), 'url' => Url::fromUri('base:' . drupal_get_path('module', 'statistics') . '/statistics.php')->toString());
    $build['#attached']['drupalSettings']['statistics'] = $settings;
  }
}

Implement the following code in statistics.js

/**
 * @file
 * Statistics functionality.
 */

(function ($, Drupal, drupalSettings) {

  'use strict';

  $(document).ready(function () {
    $.ajax({
      type: 'POST',
      cache: false,
      url: drupalSettings.statistics.url,
      data: drupalSettings.statistics.data
    });
  });
})(jQuery, Drupal, drupalSettings);

Implement statistics.php, which where information gets written to the database

/**
 * @file
 * Handles counts of node views via AJAX with minimal bootstrap.
 */

use Drupal\Core\DrupalKernel;
use Symfony\Component\HttpFoundation\Request;

chdir('../../..');
$autoloader = require_once 'autoload.php';
$kernel = DrupalKernel::createFromRequest(Request::createFromGlobals(), $autoloader, 'prod');
$kernel->boot();
$views = $kernel->getContainer()
  ->get('config.factory')
  ->get('statistics.settings')
  ->get('count_content_views');

if ($views) {
  $nid = filter_input(INPUT_POST, 'nid', FILTER_VALIDATE_INT);
  if ($nid) {
    \Drupal::database()->merge('node_counter')
      ->key('nid', $nid)
      ->fields(array(
        'daycount' => 1,
        'totalcount' => 1,
        'timestamp' => REQUEST_TIME,
      ))
      ->expression('daycount', 'daycount + 1')
      ->expression('totalcount', 'totalcount + 1')
      ->execute();
  }
}

Can anyone explain this code?


texts: Changing drupal_set_message red or yellow

texts:
I am looking to change $errors[] = drupal_set_message(t(' Freshwater Shrimp should be a number!'));

Into a red or yellow message at the top of the page. Looking at the doc I should do this in drupal 6

 $errors[] = drupal_set_message(t(' Gammarus (Freshwater Shrimp) should be a number!', 'Warning',));

But I have no luck.


texts: Can I register an additional namespace to point to the modules folder

texts:
In Drupal 8 is it possible to register an additional namespace which points to the modules folder in addition to the \Drupal namespace?

e.g.: MyOwnNamespace\{module_name} to point to $path_to_module/src? I am asking this, because I would like to better understand how today's class design will affect my migration process to Drupal 8 one day.

This was a follow up question from my original thread regarding namespacing.

As suggested by another user I split this off into a separate question thread, but the question has been answered in the original thread already.


texts: Getting form Array from a webform created with Webform module?

texts:
Is it possible to easily get the form Array from a webform created with Webform module?

I want to be able to call a copy of the form elsewhere

thanks


texts: how to add .js programatically when in an entity list

texts:
I'm in the hook_entity_load in my module and I want to dynamically add a .js library which I already have defined.
The thing is i need to get to  the block objec I'm on to add the library using $block['#attached']['library'][]

How do I get this block object?


texts:
I'm attempting to edit page restrictions on the 'Main Page Content' block, however I'm not able to save any changes to the block because it complains about the machine name having capital letters in it.

The machine name for the block is THEME_content. I'm assuming because the theme name has capital letters in it. However because of this I can't make any changes to it, since it checks the machine name upon saving. There is a text field for the machine name but it does not allow me to edit it.
Is there anyway I can change the machine name? Or make it so that I can save this block despite the name?


texts: How do I limit taxonomy by content type?

texts:
I want to limit the results of my code snippet below to query only items that have been used in a particular content type. How do I do that

<?php

$vid = 15; //vocabulary id
$num_term = 20; //limit maximum terms

//USE INNER JOIN below to only show terms with a count of 1 or more (the LEFT JOIN includes terms with a count of 0)
$query = "SELECT td.tid AS tid, name, COUNT( nid ) AS count
FROM {term_data} AS td
LEFT JOIN {term_node} AS tn ON td.tid = tn.tid
WHERE td.vid=". $vid ."
GROUP BY tn.tid ORDER BY name ASC LIMIT ". $num_term;
$result = db_query($query);
while ($term = db_fetch_object($result)) {
$items[]= l($term->name, "taxonomy/term/$term->tid") . ' (' . $term->count . ')';
}

if(count($items)) {
return theme('item_list',$items);
}

?>


texts: PDO datetime exception when saving a Computed Field (but no datetime in my query)

texts:
This one has me stumped. I get the following error when trying to create/edit a node with a computed field, which is an INT:

  PDOException: SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect
  integer value: '' for column 'field_film_civicrm_event_code_value' at
  row 1: INSERT INTO {field_data_field_film_civicrm_event_code}
  (entity_type, entity_id, revision_id, bundle, delta, language,
  field_film_civicrm_event_code_value) VALUES (:db_insert_placeholder_0,
  :db_insert_placeholder_1, :db_insert_placeholder_2,
  :db_insert_placeholder_3, :db_insert_placeholder_4,
  :db_insert_placeholder_5, :db_insert_placeholder_6); Array (
  [:db_insert_placeholder_0] => node [:db_insert_placeholder_1] => 363
  [:db_insert_placeholder_2] => 364 [:db_insert_placeholder_3] => film
  [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => und
  [:db_insert_placeholder_6] => ) in
  field_sql_storage_field_storage_write() (line 451 of
  /data/disk/o1/static/drupal-7.23/modules/field/modules/field_sql_storage/field_sql_storage.module).

Here is my code for the computed field:

list($id, $vid, ) = entity_extract_ids($entity_type, $entity);

$result = db_query("SELECT
                    ce.id AS CiviEventID
                    FROM node n
                    INNER JOIN civicrm_event ce ON n.title = ce.title COLLATE utf8_unicode_ci
                    WHERE n.nid = :nid
                    AND n.vid = :vid
                                        LIMIT 1",
                  array(':vid' => $vid, ':nid' => $id));

if ($result->fetchField() === NULL)
{
$entity_field[0]['value'] = 0;
}
else
{
/*$entity_field[0]['value'] = 0; */
$entity_field[0]['value'] = $result->fetchField();
}

I'm using a computed field to get a CiviCRM event code where its event name matches my node title. It previously matched the Civi event date to a node date field as well, but I removed that when troubleshooting. This worked normally two weeks ago. Since then I've applied updates to Ubuntu and PHP, and the Entity and Date modules, but haven't changed my computed field code (until troubleshooting for this post). If I hard-code the value to 0, the node saves without error.

The error shows the correct nid and vid, but also shows empty for my computed field (I'm assuming due to this datetime error). When I run the query directly against the DB I get the correct result, so my query syntax isn't broken.

I'm running this all on Linode using the BOA stack from Omega8cc. Drupal is 7.23 currently. Any advice for troubleshooting or a solution?

UPDATE: I've modified the db_query to its simplest form ("SELECT 1 FROM NODE LIMIT 1") and the fetchField() still doesn't return a value. But if I set the value without using a query at all, it saves.


texts:
Uploaded multi-media files to:

public_html/sites/default/files

no error messages
permissions: 0775
files do not appear (in Content, as do files uploaded through the media editor)

Switching from Wordpress to Drupal.  New to Drupal.  Not a programmer.  It would take a long time to upload 1,000+ files through a media editor.  How do I get Drupal to see these files without uploading them one-by-one?


texts: Drupal 7 module for Password Complexity Rules

texts:
For a Drupal 7 site the customer would like to implement the following (see at bottom) Password Complexity Rules.  Which of the below rules are possible to implement and what would be the best module to use for these rules?

The password must be at least 12 characters (network enforced)
The password must contain both upper and lower case characters: a-z, A-Z (network enforced.)
The password must contain numbers and punctuation characters as well as letters: 0-9, !#$%^&*()_+|~=`{}[]:";'<>?,./@ (network enforced.)
The password should not be or contain a word in a dictionary
The password should not be a common usage word, such as:

Names of family, pets, friends, co-workers, fantasy characters, or sport teams
Birthdays or other personal information, such as addresses and phone numbers.


texts: Cant find any info on this method being removed in webform or how to fix

texts:
I am writing a patch for a module that used an old beta or even alpha of webform for drupal 8.

There is a line WebformEntityReferenceItem::getEntityWebformFieldName($node); in the module that errors out saying getEntityWebformFieldName() does not exist and sure enough in Drupal\webform\Plugin\Field\FieldType\WebformEntityReferenceItem the method does not exist.

I checked an older release and the method was there at some point. I've been searching since yesterday but cannot find a workaround or even an answer as to why it was removed. Any ideas?

EDIT

So I managed to get it working, but this certainly seems like the incorrect way to do it.

$node->get('webform')->getValue()[0]['target_id'];

So it seems WebformEntityReferenceItem::getEntityWebformFieldName($node); just gets the webform on the webform node and then grabs its 'target_id' value.

$webform_field_name = WebformEntityReferenceItem::getEntityWebformFieldName($node);
$webform_id = $node->$webform_field_name->target_id;

What I posted in my edit, I do not believe is the correct solution, albeit it is now working. Any suggestions would be appreciated.


texts:
Is there any module or code hack to use tokens to set cck field default values ?
i have a content type with contact details fieldset, this fieldset have some fields to collect data from current logged in user.


texts: Filter the products by selecting the checkbox

texts:
I am developing an e commerce website. I want to display the product catalog on the left sidebar as check-boxes. When the user will select the products, the page should get loaded with those products. I am new to drupal. I know that I will have to use Taxonomy. Please let me know what else i have to use to achieve this? And how all these are linked?

Thanks in advance!


texts: SimplePie library is required for Feeds SimplePie Parser

texts:
The Feeds module is reporting a warning about needing a SimplePie parser and prompts the user download a compiled version of it, but it isn't clear how/where to do this.

Where can I find the compiled version of the required library?


texts: Keeping content in sync when building a new site

texts: I'm moving my company Intranet from D6 to D7, and I'm wondering the best approach to keeping content (nodes) in sync while building and theming the new site. I've cloned the D6 site and did the D7 core and CCK upgrade. But the current Intranet is updated daily with new content that will need to make its way to the new D7 site prior to launch. Is there a way to keep the content in sync during the development stage? Or is there a better way to approach this situation?


texts: calculated field in views based on another view

texts:
i have a view with items and prices, each item has an id, another view taken from a different content type also shows items and their base price the id of the item will be the same (basically one list is items containing seller prices and another is the market price, there can be many sellers but only one market price).

now i want to show in the first view a calculated field that will display the difference between the seller price (price of an item in first view) and the market price (the price of the item containing the same id in the second list).

is there a way to do it? if so how?


texts: CSS not updating with aggregation turned off

texts: I'm running into an issue that I'm not sure how to diagnose. I'm working on minor CSS updates on a custom zen theme for a Drupal 7 site. I have the dev site set up on a laptop running ubuntu dev server. I have gone to performance and turned off css and js aggregation and flushed all the caches via Drush. The problem I'm having is that my css changes are being saved to the styles.css file, but they're not reflected when I refresh the site. Poking around in inspector, the css files have a ?oegwy2 suffix, which suggests that something is still aggregating or modifying the files. I'm not sure what that would be, I didn't set up sass for the this project, so the sass recompiling isn't likely what's going on here.


texts: Unable to access Views fields in block Twig template

texts:
How Drupal 8 uses Twig, how different data is transferred from general template to specific templates?

For view block I have created block template as per default template suggestions. In my new Twig template if I print {{ content }} everything (view result fields) are getting rendered as per Drupal default.

How can I access and apply my theme markup to all view fields in my block template. {{ dump(_context|keys) }} display below.


texts: Create a user profile on user creation in drupal 6

texts:
I have a problem and can't seem to find the answer.
I'm creating a user via a rest service and it's not creating a user profile along with it.
I'm not sure how to even create the profile.
our user profiles have custom fields that i can pull with my user_get, but when i try to create a user with just a blank profile, it doesn't like it.

any help would be appreciated

function user_services_create_user() {
    $user_name = $input['user_name'];
    //the users email address
    $email = $input['email'];
    if(array_key_exists('password', $input)){
        $password = $input['password'];
    }
    else {
        $password = user_password(8);
    }

    //set up the user fields
    $fields = array(
        'name' => $user_name,
        'mail' => $email,
        'pass' => $password,
        'status' => 1,
    );
    //the first parameter is left blank so a new user is created
    $user_account = user_save('', $fields);
    if(!empty($user_account) && $user_account->uid != '') {
        user_services_send_response('New user has been successfully created', 1, 200,    $user_account);
    }
    else {
        user_services_send_response('New user cannot be created. Please try again later', 0);
    }
}

Changed Code:

function user_services_create_user() {

//the user name of the new user
$user_name = $input['user_name'];
//the users email address
$email = $input['email'];
if(array_key_exists('password', $input)){
    $password = $input['password'];
}
else {
    $password = user_password(8);
}
user_services_check_user($input);
//set up the user fields
$fields = array(
    'name' => $user_name,
    'mail' => $email,
    'pass' => $password,
    'status' => 1,
);
//the first parameter is left blank so a new user is created
$user_account = user_save('', $fields);
if(!empty($user_account) && $user_account->uid != '') {

    $node = new stdClass();
    $node->uid = $user_account->uid;
    $node->type='profile';
    $node->title=$user_account->name;
    $node->name=$user_account->name;
    $node->field_receipt_suppress_name[0]['value'] = user_fill_value_from_request('receipt_suppress_name');
    $node->field_receipt_suppress_points[0]['value'] = user_fill_value_from_request('receipt_suppress_points');
    $node->field_phone_number[0]['value'] = user_fill_value_from_request('phone_number');
    $node->field_first_name[0]['value'] = user_fill_value_from_request('first_name');
    $node->field_last_name[0]['value'] = user_fill_value_from_request('last_name');
    $node->field_user_phone_number[0]['value'] = user_fill_value_from_request('user_phone_number');
    $node->field_points[0]['value'] = user_fill_value_from_request('points');
    $node->field_date_points_last_checked[0]['value'] = user_fill_value_from_request('date_points_last_checked');
    $node->field_last_reward_issued_store[0]['nid'] = user_fill_value_from_request('last_reward_issued_store');
    $node->field_last_reward_issued_date[0]['value'] = user_fill_value_from_request('last_reward_issued_date');
    $node->field_last_reward_redeemed[0]['value'] = user_fill_value_from_request('last_reward_redeemed');
    $node->field_last_reward_redeemed_store[0]['nid'] = user_fill_value_from_request('last_reward_redeemed_store');
    $node->field_last_reward_redeemed_date[0]['value'] = user_fill_value_from_request('last_reward_redeemed_date');

    node_save($node);

    user_services_send_response('New user has been successfully created', 1, 200, $user_account);
}
else {
    user_services_send_response('New user cannot be created. Please try again later', 0);
}

}


texts:
I try to set up drupal multisite by using domain access module.we two sites sscsoftweb.com and kumba.sscsoftweb.com.Both are drupal sites which host in shared environment.i install domain access module in sscsoftweb.com. kumba.sscsoftweb.com is subdomain as per installation instruction i remove text followed after /public_html

Then i create a new domain record and create two page called page1 and page2.page1 published in sscsoftweb.com similarly page2 publish in kumba.sscsoftweb.com.i set the homepage for kumba.sscsoftweb.com is node/2.

the problem is when i hit kumba.sscsoftweb.com it automatically redirect to sscsoftweb.com homepage not to node/2. is there any thing i miss.kindly suggest me how to fix this issue.

thanks..


texts: How to translate custom content block title?

texts:
How do I properly translate custom content block titles?

Problem:
I've got a custom content block with just one CKeditor text field. I want to show the custom block title and the text field. When I place that block, the PLACED block title is copied from (but not referencing) the custom content block.

When a content translator later translates that custom content block, the PLACED block title is wrong/untranslated. Is there a way to reference the correctly translated, custom content block title in block placement? E.g. using tokens?

NOT allowed solution:
Giving translators access to block placement to translate the block placement is an absolute no-go. They are only allowed to use custom block library.

Unwanted workaround:
I know I could create an additional fake-title field and disable "Show title" in block placement. But I really hope I can avoid this, or I would have to modify all my existing block templates.


texts: A way to make one Drupal site act like several sites

texts:
I would like to create several sites each with same number of features (content types) but the ability to select different theme.
If I go with multisite feature of Drupal I will have difficulty in setting up and managing all the sites.

I can achieve different sites with Organic groups. But the spaces module is pretty much not working and needs serious development for 7.x version. I tried with all the patches but still it gives me a lot of trouble.

My requirements are more or less same as OpenScholar distribution but I would rather like to use Panopoly (panels) than boxes and context.
Also Openscholar has way too many features that I dont care of and exerts some serious load on the server.

Are there any alternatives to spaces module? Any help would be appreciated. a Case study perhaps.


texts: How to restrict tagged content based on user?

texts:
I'm using drupal 7.39, but I don't know how to restrict users to access some specific content.

I have created a content type called person. Then I have created 5 nodes, like so:

2 nodes tagged with manager term.
2 nodes tagged with lead term.
1 node tagged with worker term.

This is where I struggle:

the worker user must see node tagged with worker.
the lead user must see node tagged with lead and worker.
the manager user should see all nodes.

Is there any solution to get this to work (without writing custom code)? Because a configurable job is always easier.


texts:
I have a custom table defined in hook_views_data().  One of my fields is an integer, which maps to some defined constants.  When they are queried and displayed by views, I'd like to change them to their string name that's represented by the integer.

So, my question is how can I manipulate values returned by views?


texts: Clear cache doesn't clear the cache tables?

texts:
I don't fully understand the Clear Cache action. I just click in clear cache Clear All caches in: admin/config/development/performance , then I go to the database to check all cache_... tables and I find that none of them are empty.

Is this normal?
Can I just truncate all cache_... tables?

In fact I just need to clear cache_form. Can I truncate this table?


texts:
I created a custom module with a configuration settings page. It works fine, but I can't get it to show up under the admin configuration menu. I think the problem is I specified system.admin_config_mymodule as the parent, but it doesn't exist; how do I create it?
in mymodule.routing.yml I have:
mymodule.settings:
path: '/admin/config/mymodule/settings'
in my module.links.menu.yml:
mymodule.settings:
title: 'MyModule Settings'
route_name: mymodule.settings
parent: system.admin_config_mymodule


texts: Cannot Change Max Upload Size in File Field From 8mb

texts: I have made changes to etc/php5/apache2/php.ini to increase max file upload size to 100mb but when I try to raise or lower the file upload size when creating a file field in a content type, it says that the current limit 8 MB even though the field saves the previous input. Anyone have any experience with this issue and could provide a solution?


texts: How to make a index.html file for your website

texts:
Would just like to ask a question in context of how to create a index.html file I will provide some info below in a brief paragraph so it's straight forward and easy to understand.

I have a localhost site which was just finished and a domain and everything but when I used filezilla to upload and after uploaded when I visited my site all I saw was " Index of" and then the name beside a bullet and when clicked just denies me access. I am now aware I need a index.html file I just need a hand from someone on here to point me in the right direction of what to actually put inside , where to put and if there are any other things I should be aware about. Thanks for your time I appreciate it


texts:
I've installed Omega 7.x-4.2 and created my subtheme and I just want to start practising making changes with page.tpl.php and css but there are just so many files and so far nothing has affected change.

I copied over page.tpl.php found in omega/system folder and placed it in my subtheme/templates then placed styles in my subtheme/css/subtheme.hacks.css but see no changes at all.

Also have noticed in sites/all/themes the path structure is different for omega that is all/themes/omega/(ohm)omega/templates and in other
all/themes/subtheme/templates. I set this up a while ago following documentation and can't remember why it has ended up this way and whether or not that would cause problems. There are no errors just no changes taking effect.

Just all seems so unnecessarily complicated!


texts:
I need to modify the query of one of my views. I've found hook_views_query_alter(), but can't for the life of me figure out what I'm supposed to do with it. According to the API,

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

OK, so I know to put the function with the hook in a views.inc file. But what do I need to put in the actual .module file? I can't seem to find any examples of complete module code that uses this hook to point me in the right direction. Does my module code contain the MODULENAME_views_api() and nothing else?


texts: How to filter for a Field Collection in a View

texts:
I have a View of Field Collection fields. The Field Collection is composed of field 1and field 2. The Field Collection is associated, as a single field, to a content type. If I filter the View by a combination of values for field 1 and field 2, and I have established a relationship with the associated content type, I can filter combinations of values, which come as 2-tuples; for example: Music and Great Britain, Sports and USA, etc.

However, if the View is a view of the content type, of the nodes, I don't know how to group filters in such a way that I can look for the specific combinations above. If I put two filters, and search by Music and USA, I will retrieve results even if the correct value is the 2-tuple Music and Great Britain. The view filters in ALL the Field Collections instead of just looking in one each time.

How can achieve the result with a View of content (products)? Or the way is to do it with the Field Collections, as I have done?


texts: Error on drush command: In ThemeHandler.php The theme does not exist

texts:
I manage to broke the default theme in development and now could not access the administration interface nor could I change the theme via drush.

The way I broke the default theme is by changing the name of the theme inside yml files and folder and function names without disabling it first. After changing it back to default and flushing the cache this does not fix the error.

No matter what drush command is run the result is the same:

In ThemeHandler.php line 491:
The theme my_theme does not exist.

Folder is there and all files are there but drush returns always this error.

I try to run:

drush config-set system.theme default bartik

but the result is the same.

Could I fix this some other way?


texts: How to show Numeric keyboard while entering in textfield?

texts:
I am creating a custom form field with text-field type. That will accept only numbers, so I want to display only numeric keyboard instead of alphanumeric keyboard. How can I achieve that?

I tried using Elements module but I don't want to use extra features of this module.So I am searching for code snippet. Is there any way to do it in a custom way?


texts: How to override a file field on webform form?

texts:
I have a webform with a file field printed on an overrided webform template like this:

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

I want to hide the "browse" button and the message "not file selected" in the input (see image below).

I want to show the input rectangle without message or, in a better case, only a message in the input field that says "click here to upload your file".

Is it possible to override the file field to do what I want?


texts: How can I determine if a $form (or $form_state) is an entity create/edit form

texts: When in a function (e.g. a hook_form_alter) is there a reliable way to determine if the form is an entity form and if so, what type of entity?


texts: D7 theme field items of a "List (text)" input as

texts:
In Drupal 7, I have a field for a custom node type that is a text list "List (text)" with a widget input type of "Check boxes/radio buttons". When displayed on the front-end the following HTML is generated:

XHTML

CSS 3

PHP

How can I theme this output as an HTML
 instead? Something like this:

XHTML

CSS 3

PHP

I should note that I'm overriding output using a node--custom_type.tpl.php file.


texts: Coloring rows in returned drupal search results

texts:
I'm trying to modify search-result.tpl.php and template.php to color the backgrounds of search results returned such that every row has a different color than the one that preceded it. Only two colors are used. so, row #1 returned would have background #eee and row 2 would have #ff0000 as its background color. It would start over again at row #3 having #eee and so on. This is easily enough accomplished with PHP. But how can I implement this with Drupal?

Here's how I'm trying to print it out in search-result.tpl.php:

<li class="<?php print $classes; ?>"<?php print $attributes; ?>>

    <?php $inc=0; ?>
      <?php if ($inc %2 == 0) {
                $color = '#eee';
              } else {
                $color = '#ff0000';
              }
              ?>
      <div style="background-color: <?php print $color ?>">

<?php print render($teaser['field_icon']); ?>

<a href="<?php print $result['link']; ?>"><?php print $result['title']; ?>

      <?php print render($teaser['field_type']); ?>
      <?php print render($teaser['field_event_dates']); ?>
      <?php print render($teaser['body']); ?>

      <?php $inc++; ?>

Not getting errors, but the results are not what I was expecting. Each row is just returning the same color background #eee, the first color). So either the $inc variable is not getting incremented or (perhaps more likely) it's becoming '0' again after every returned result. So then I'm thinking maybe I need to add something to my preprocess_search_result function in my template.php file...but I don't know what to add there.

Any help would be greatly appreciated.


texts: Mime detection configuration settings missing ?

texts:
I installed MimeDetect module in my server, added necessary configuration to the settings.php file and also enabled that module.
When I try to configure the "Mime Detection" I get the following message:

  The MimeDetect module is using PHP's fileinfo extension to detect
  MIME types. There are no settings for the extension.

Is there anything I missed out or needs to be configure?


texts: Skip a step on a multipage form based on field input

texts:
I'm using field group module to create a multipage content creation node. I have one field that if "checked" should make the next button skip to final page of form.

For example a 3-page form, if on the first page the user checks "no" on a field, they will skip the second page when they click next and go to the third and final page.


texts:
I have a form with a required checkbox.

If the box is not checked and I confirm my form, I receive a warning with Chrome (see the screenshot).

How to display a warning message in drupal ?

In my module, I add code to display a Drupal warning. Why is not it displayed ?

<?php

namespace Drupal\commerce_agree_cgv\Plugin\Commerce\CheckoutPane;

use Drupal\Component\Serialization\Json;
use Drupal\Core\Form\FormStateInterface;
use Drupal\commerce_checkout\Plugin\Commerce\CheckoutPane\CheckoutPaneBase;
use Drupal\commerce_checkout\Plugin\Commerce\CheckoutPane\CheckoutPaneInterface;
use Drupal\Core\Link;
use Drupal\Core\Url;

/**
 * Provides the completion message pane.
 *
 * @CommerceCheckoutPane(
 *   id = "agree_cgv",
 *   label = @Translation("Agree CGV"),
 *   default_step = "review",
 * )
 */
class AgreeCGV extends CheckoutPaneBase implements CheckoutPaneInterface {

  /**
   * {@inheritdoc}
   */
  public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
    parent::submitConfigurationForm($form, $form_state);

    if (!$form_state->getErrors()) {
      $values = $form_state->getValue($form['#parents']);
      $this->t('You must agree with the terms before continuing.');
    }
  }

  /**
   * {@inheritdoc}
   */
  public function buildPaneForm(array $pane_form, FormStateInterface $form_state, array &$complete_form) {
    $store_name = $this->order->getStore()->getName();
    $store_id = $this->order->getStoreId();
    $pane_form['#attached']['library'][] = 'core/drupal.dialog.ajax';
    $attributes = [
      'attributes' => [
        'modal-title' => $this->t('Terms and conditions'),
        'class' => 'use-ajax',
        'data-dialog-type' => 'modal',
        'data-dialog-options' => Json::encode([
          'width' => auto,
        ]),
      ],
    ];
    $link = Link::fromTextAndUrl(
      $this->t('the general terms and conditions of the store "@store_name"', ['@store_name' => $store_name]),
      Url::fromUri("internal:/store/$store_id/cgv", $attributes)
    )->toString();
    $pane_form['cgv'] = [
      '#type' => 'checkbox',
      '#default_value' => FALSE,
      '#title' => $this->t('I have read and accept @cgv.', ['@cgv' => $link]),
      '#required' => TRUE,
      '#weight' => $this->getWeight(),
    ];
    return $pane_form;
  }

  /**
   * {@inheritdoc}
   */
  public function validatePaneForm(array &$pane_form, FormStateInterface $form_state, array &$complete_form) {
    $values = $form_state->getValue($pane_form['#parents']);
    if (!$values['cgv']) {
      $form_state->setError($pane_form, $this->t('You must agree with the terms before continuing.'));
    }
  }

}


texts: Altering Create New account tab link in user login page

texts:
I tried using form alter for menu of tabs in /user page, that shows

"create new account", "login", request password

is it possible for us to alter the link so that the create new account can go to "customlink" instead of "user/register"

in drupal 7?

thank you!


texts:
I have just started using Drupal 7 and db_select().

if I have a result from db_select() (e.g. $result = $query->execute(), why can I only loop through this result once?

It appears as if there is a cursor that is not reset following a foreach loop.

So I tried to find a function that would convert this result into a multi dimensional array (e.g. $result = $result->fetchAllAssoc()) but I have found nothing.

Instead, at the moment I have to loop through the result to create an array of row objects to use later through the code (if i need to loop through it more than once)

/* this returns an array of row objects that you can use like any other array but seems as though there should be an API function to do this for me as part of the database class ? */

$array = array();
foreach($result as $row) {
  $array[] = $row;
}

Surely there must be an API function to do this already.


texts: How do I get $form_state from hook_entity_update()?

texts:
I've manipulated the edit node form via hook_form_BASE_FORM_ID_alter() to insert a select pull-down menu.

In my module, I've implemented hook_entity_update() to fire when the edit node form is submitted. How do you get the form_state in hook_entity_update()? I want to save the user's choice from the select pull-down.


texts: Get the fields from a reference entity (content type) in a Paragraph field

texts:
I have a paragraph field that is a reference entity to the Customer Testimonial content type. A content editor can add the customer-testimonial paragraph and type the name of the testimonial. This will then display the text on the website.

I have made a paragraph--c15a-customer-testimonial.html.twig template file with the following code.

{%
  set c15a = {

    title: content.field_testimonial.entity.field_testimonial_titel,

  }
%}

Testimonial title

{{ c15a.title }}

Of course, this prints nothing. How can I get the fields from the content type I'm referencing in my paragraph?


texts:
DRUPAL 8 VERSION

Hi i am trying to display the search block in a custom view named as menu--main.html.twig. Below is the code in my theme function

function bootstrap_preprocess_page(&$variables) {
  $block = \Drupal\block\Entity\Block::load('bootstrap_search');
  $variables['block_search_form'] = \Drupal::entityTypeManager()
    ->getViewBuilder('block')
    ->view($block);
}

I am able to display the search block in page.html.twig. But i want to display the block in menu--main.html.twig Can someone guide me how can i achieve this?


texts: How to hide view's results before applying exposed filter?

texts:
In a view I have some exposed filters.I would like the view to show no results before applying the exposed filter(s),but only after I have applied the exposed filter.By default,the view shows all the results.How can I achieve that?
Thanks


texts: How to expose a persistent variable as a field for use in view

texts:
I have a particular base path recorded as a settings var, and I have a number of Views (v3) that unfortunately have this same value hard-coded as part of its links. These links are rendered using the Rewrite results and Output this field as a link options, and are built from a number of field values.

Problem is I have to configure this on every dev/test/prod site. It would be far better if these links could pull the information from the persistent variable.

A couple ideas:

I have tried defining this value as a bespoke token, but as I expected these View options do not support checking for and rendering Tokens. I was hoping that perhaps using the global fields of the Views Field View module might work. So that I might render a field as Exclude from display and reference it with normal Views replacement patterns. However this failed to render Tokens as well.
I could step into each specific field in question and override with a particular template, wrapping its content in the link and sourcing the variable directly with variable_get. But this would actually be quite involved, and would also remove the primary reason for using Views in the first place — the possibility of live modification.

Is there a better way of using a persistent variable from within a View?

I already have a bespoke module set up, so have looked to see if it is possible to modify the replacement patterns of a view with a particular hook or something; however that hasn't turned anything up so far. My last remaining idea is to hook into the final render of the view and perform a token pass, but I don't know if this is such a good idea or not.


texts: Post method trow an Preflight not successful response

texts:
Im working with Drupal 8 and Angular.

I want to create a content from angular.

I have the Get method working.

The problem is with the Post method, I don't know how to configure it.

With the Rest Ui module, i have this configuration:

And in the services.yml file I have this one:

  cors.config:
    enabled: true
    # Specify allowed headers, like 'x-allowed-header'.
    allowedHeaders: []
    # Specify allowed request methods, specify ['*'] to allow all possible ones.
    allowedMethods: []
    # Configure requests allowed from specific origins.
    allowedOrigins: ['*']
    # Sets the Access-Control-Expose-Headers header.
    exposedHeaders: false
    # Sets the Access-Control-Max-Age header.
    maxAge: false
    # Sets the Access-Control-Allow-Credentials header.
    supportsCredentials: false

It works fine for the Get method, but for the POST, it gives me this error:

  XMLHttpRequest cannot load http://drupal.dd:8083/entity/node.
  Preflight response is not successful task.service.ts:92

The task.service.ts is from my Angular app.

Questions:

1) Is the problem from Drupal configuration or from angular? (if is from angular, i will move the post. )

2)Wich on is the correct way to configure Post Method in Drupal?

Extra info from the method


texts: How can I get the form builder service using dependency injection?

texts:
How can I change form builder call in class in to dependency injection method?

My current code:

class CustomBlock extends BlockBase {

  /**
   * {@inheritdoc}
   */
  public function build() {
    $form = \Drupal::formBuilder()->getForm('Drupal\custom_module\Form\CustomForm');
    return $form;
  }

}

And I tried:

class CustomBlock extends BlockBase {

  /**
   * formBuilder.   *
   */
  protected $formBuilder;

  /**
   * Class constructor.
   */
  public function __construct($formBuilder) {
    $this->formBuilder = $formBuilder;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container) {
    return new static(
        $container->get('form_builder')
    );
  }

  /**
   * {@inheritdoc}
   */
  public function build() {
    $form = $this->formBuilder->getForm('Drupal\custom_module\Form\CustomForm');
    return $form;
  }

}

But getting following error:

  Fatal error: Call to a member function getForm() on a non-object in H:\wamp\www\myproject\modules\custom\custom_module\src\Plugin\Block\CustomBlock.php on line 44


texts: Form states with "and" and "or" conditions

texts:
Using form API in D7, I need to use from states to setup a visible input with this condition :

field1 = value A AND (field2 = value B OR value C OR value D)

Something like this, but this example doesn't run :

'#states' => array(
      'visible' => array(
        array(':input[name="question_inhabitant_type"]' => array('value' => 'owner')),
        'AND',
        array(':input[name="question_building_type"]' => array('value' => 'house100')),
        'OR',
        array(':input[name="question_building_type"]' => array('value' => 'house150')),
        'OR',
        array(':input[name="question_building_type"]' => array('value' => 'house200')),
      ),
    ),

Any idea?


texts: How can I hide exposed filter control if the filter is not applicable to existing views results?

texts: I have created a view with three exposed filters. Now I have to hide these Fields dynamically - if field is not present in any of the content types of the nodes in current result, filter based on this field should not be visible. I am using Drupal 7.


texts: How to redirect a user to a personal area of page once logged in?

texts:
I want to allow users to login to their area 'personal' and view their uploaded images/posts (basically creating an instance of the page) which is different to every user that logs in to my website --- similar to Facebook profile page which has the same layout for every user but different content in it.

So far, I have created a role called 'subscriber' (which are members of the page) and I have enabled front page module to re-direct subscribers to the 'personal' page.

I have read that the Views module is useful but I am stuck on how to do this.


texts:
I'm trying to migrate users exported from Drupal into Okta using the /api/v1/users API (specifically [creating users with import hash][1]), and am stuck, and desperate for help as I'm late on a project now because I haven't cracked this issue.
FYI

I posted this to both Okta forum: https://devforum.okta.com/t/migrating-users-from-drupal-7-to-okta/13103
and Drupal forum: https://www.drupal.org/forum/support/post-installation/2021-02-27/migrating-users-from-drupal-7-to-okta
I also contacted support@okta.com who weren't able to offer any further advice
And pestered a bunch folk in various places on Slack and Discord.

I think the core issue is that I'm not getting the 'right' value for the hash from the Drupal pass string.
Here's an example of a user:
{
"name" : "m.nick",
"first": "Nick",
"last" : "M",
"mail" : "m.nick@gmail.com",
"pass" : "$S$D9./psEr4CRGa61wFXVVxPA4sdxK4IRWPuWJMbbkOHBQNnIoUwOb",
}
I believe the $S$ means SHA-512 was used by Drupal, the D means 15 rounds of hashing were performed, character 4-12 are the salt and the rest of the string is the hash?
Here's how I get the settings, salt and hash from the Drupal pass:
const hashType = pass.substring(0,3)
const rounds = pass.substring(3,4)
const salt = pass.substring(4,12)
const hash = pass.substring(12)
I'm then calling /api/v1/users?activate=true with
profile: { firstName: first, lastName: last, email: mail, login: username },
credentials: { password: { hash: { algorithm: 'SHA-512', salt: salt, saltOrder: 'PREFIX', value: hash }}}
Which successfully creates the user, but on attempting sign in with the username: m.nick and the password that works on the old system, gets rejected with INVALID_CREDENTIALS.
I've tried:

Switching the saltOrder to POSTFIX
base64 decoding the hash
base64 decoding and encoding the hash
Concat'ing the salt and the hash together
Every combination of the above

Please help, as I don't know what else to try, and I can't find any examples of Drupal user accounts being imported into Okta.
I'd be grateful for any advice you can offer.  I assume that someone has previously migrated users from Drupal, and so I'm missing something.


texts: How to make users get points when using Rate module to rate content?

texts:
I'm using the Rate module to allow the visitors to rate content. I need the author of the contents get point based in the votes provided for the rate module.

There are plenty of modules to allow the author to get points but I'm looking for one which works fine with the Rate module.


texts: Creating a node with PHP cURL client returns 401 error - X-CSRF token always empty

texts:
A recent update to Services and Drupal requires a csrf token, and it broke the PHP cURL client samples.

I am trying the sample code for Services to:

Create a node here https://drupal.org/node/1334758
Log in a user here https://drupal.org/node/1491754

It fails with 401 error. $csrf_token is always empty for me, so that should be the problem, but I am not sure how to return it with cURL. Any tips?


texts: Hide "language menu" next to search bar / login menu

texts:
I have inherited maintanance of quite horrible looking website that is currently running version 6.x of Drupal. I am now trying to streamline / delete / disable as many unnecessary things as we can on the website.

http://sejong.ff.cuni.cz/

One of the features is a multilingual menu next to search bar / login menu. I visited the multilingual settings but I have been unable to find a way to get rid of that menu.

How can I achieve that? (I am new to Drupal so I am not sure if this is something that was custom put to the system or if it is a default Drupal feature)


texts: How to call/submit Form from another page in custom module?

texts:
I would like to set cron function in my custom module. I have created one form which is called with submit button from UI. Now I would like to submit/call that form from another page (.module file) where I have written my hook_cron function, how it would be possible?

In Drupal 7, I use

$form_state['values'] = "";
drupal_form_submit('customfeedimport_main_pagecallback_submit', $form_state);

But I am new to Drupal 8, so how to perform this cron thing in Drupal 8?

Also what should be included in the namespace, use?


texts: Form has a div within it. How can I add classes to this div?

texts:
There's a div called .description in a form in the site I've inherited. I want to add a another class to the div.

The div's content is created within hook_form_FORM_ID_alter(), eg:

$form['#description'] = 'Please enter your full name';

I've tried adding a classed to it like:

$form['#description'] = [
    '#markup' => '
Please enter your full name
',
  ];

But this just results in "Array" being printed.

Would anyone know what I could do add a class to this element?


texts: Place tag before input text field in search-block-form

texts:
I would like to add an li tag infront of the input field in the search-block.
Should be possible with hook_form_alter. I've already printed the array containing the search-block-form, but I couldn't find input type text to add a prefix value.

function myTheme_form_alter(&$form, &$form_state, $form_id) {
   if ($form_id == 'search_block_form') {
     print_r($form); -> no input type text here to add prefix to.
   }
}


texts: Adding attribute to menu - page specific

texts:
Hi I know I can alter menu links classes/attributes using theme_menu_link() function.
But from what I can see, there is no way to determine what current page is being rendered from within the function.

i.e. I have a wep app that loads in 4 pages (ajax) and you can swipe to change page. I need to add an attribute on each menu link and they differ depending on the page.

Question being, how can I determine page from within theme_menu_link();

Regards


texts: How to get available view modes per content type?

texts:
I am looking for an function that returns all view modes per content type. I already tried to use mobile_theme_entity_view_mode_alter but this function will return all available view modes for a node entity. What I need are the available view modes per node type...

any suggestions?


texts:
After ugrading PHP 5.3 to 5.4.10, drush fails with the following error for most of commands:
Command watchdog-show needs a higher bootstrap level to run - you will need to invoke drush from a more         [error]
functional Drupal environment to run this command
...

I reinstalled Drush(Drush 5.8 does not work on  Mac OSx 10.7.5, so downgraded to 5.0.0), but it did not solve the problem.

Is Drush compatible with php 5.4.10.? Why would i get these errors and how to troubleshoot?

Thank You


texts: $form_state['values'] empty in form _submit hook

texts:
I have an issue with a form I built in a custom module using drupal_get_form() on a menu callback.

My form callback function is _foo_form($form, $form_state) and my submit function _foo_form_submit($form, $form_state).

When I submit the form, $form_state['values'] contains the value in the form callback, but in the submission handler $form_state['values'] is empty.

Here is my module code:

function configurator_menu() {
  $items = array();
  $items['node/%/configurator/items'] = array(
    'title' => 'Steps & items',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('_configurator_node_edit_item', 'list', 1, ''),
    'access arguments' => array('administrer configurator'),
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
}

function _configurator_node_edit_item($form_state, $op, $nid, $iid) {
  $form = array();
  $form['nid'] = array(
    '#type' => 'hidden',
    '#value' => $nid
  );
  $form['title'] = array(
    '#title' => 'Step label',
    '#type' => 'textfield',
    '#value' => '',
    '#size' => 30
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => 'Save',
  );

  return $form;
}

function _configurator_node_edit_item_submit($form, $form_state) {
  dpm($form_state['values']); // devel function to print variable in drupal messages
  // returns an empty array
}

Do you have any idea?


texts: How can I identify if a database is D6 or D7?

texts:
I have been sent site files and a database for a website to review but have had trouble loading it up.  The core and contributed modules are all D7, but when I import the database and run a page on the browser I get a message,

  PDOException: SQLSTATE[42S02]: Base table or view not found: 1146
  Table 'example.semaphore' doesn't exist: SELECT expire, value FROM
  {semaphore} WHERE name = :name; Array ( [:name] => variable_init ) in
  lock_may_be_available() (line 167 of
  example.com/includes/lock.inc).

I suspect this means that the database I have been given is a D6 one, but need to confirm this.  Is the version declared anywhere, or is the absence of the semaphore the evidence I need?


texts: Rebuilding content access permissions upgrade D6->D7 stuck at 99.97%

texts:
Hello I'm having trouble finding why rebuilding content access permissions can't complete. It get stucked at 99.97% every time I try to run it. Everything else seems to work properly. Any idea? I'm migrating Drupal 6 to 7.

Thanks!

Comment

Okay the answer is go to node.module on line 3000 somehting and disallow batch_mode by passing FALSE. It will then work and you can revert at the end of the process


texts: Why do I get this exception when running a query?

texts:
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064
  You have an error in your SQL syntax; check the manual that
  corresponds to your MySQL server version for the right syntax to use
  near 'default) VALUES ('1', '0', 'LSm', '054', '0')' at line 1: INSERT
  INTO {prod_conf_procuct_parameter} (prod_id, price, key1, key2,
  default) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1,
  :db_insert_placeholder_2, :db_insert_placeholder_3,
  :db_insert_placeholder_4);  Array ( [:db_insert_placeholder_0] => 1
  [:db_insert_placeholder_1] => 0 [:db_insert_placeholder_2] => LSm
  [:db_insert_placeholder_3] => 054 [:db_insert_placeholder_4] => 0 )

function _prod_conf_db_query_insert_results_pcpp($arg,$key1,$key2,$price,$default){
watchdog('alert', "Arg: $arg, Key1: $key1, Key2: $key2, Price: $price, Default: $default");
db_insert('prod_conf_procuct_parameter')
  ->fields(array(
    'prod_id'=> $arg,
    'price'=> $price,
    'key1' => $key1,
    'key2' => $key2,
    'default' => $default
    )
  )
  ->execute();
}

watchdog() gives Arg: 1, Key1: LGm, Key2: 054, Price: 0, Default: 0.

The problem is definitively the column "default" because the insert without default|$default works.

The column is defined in hook_schema() as follows.

'default' => array(
          'description' => 'boolean indicates if the new applicated select list has default',
          'type' => 'int',
          'size'=> 'tiny',
          'default' => 0
        ),

If I run the following query from PHPMyAdmin, it works.

INSERT INTO `prod_conf_procuct_parameter`(`prod_id`, `key1`, `key2`, `price`, `default`) VALUES (1,"LSm","054",0,1)


texts: html tags not filtered with print module and html mail

texts:
I'm building a site (drupal 7.41 version) with the following modules:

Printer, email and PDF versions
HTML Mail
Mail System

Well, I had that to create a simple message with print module and succesfully send a email.
But, my message has arrived with html tags and normal mail text.

By ex:

Message1

Message2

NormalText

In a image:

I don't know how to solve it.
Note: I have html mail  module, "Post-filtering" setting as Filtered-HTML

Any suggestions are welcome,


texts:
The Feed module successfully imports a RSS feed. However the Description field does not display.  I can only see it if I click on "Edit". The problem is that the feed-items do not have a text format.

How can I give the Description field a default text format?


texts: Why isn't this theme's script.js executing?

texts:
I've got an Open Atrium 2 (7.x-2.25) site, using the default Open Atrium Radix (7.x-3.5) theme. It uses the Mobile Friendly Navigation Toolar (7.x-1.0-alpha10+8-dev), but with a customised 'Open Atrium Toolbar' taking over from that.

There's meant to be a mobile-friendly version of the toolbar that appears at a certain screen-width, but on my site, at that breakpoint, the toolbar just empties itself. The new mobile icons do not appear at all.

I've had a lengthy discussion with mpotter (who seems to be the lead maintainer from Phase2), here: https://www.drupal.org/node/2381691

We've figured out that the correct CSS classes are being applied to the toolbar elements, which means that the theme's script.js is probably not being executed. The script.js file has the same user:user-group ownership as my other directories and files, and the same permissions as on a fresh, working Pantheon OA2 site.

mpotter has probably gone as far as he can go with troubleshooting, being unable to reproduce this issue... But could anybody here think of anything I might have missed?


texts: Set the search index and the field_revision_body empty

texts:
I'm not using the core Drupal search engine and I'm not using any revisioning on my nodes.  I noticed that the {search_index} table and {field_revision_body} table are occupying 50Mo of my database space.

Does emptying these tables cause any problems?


texts: put the contents of one field into another field upon form submit

texts: how can I add a field to a form submission upon submit that will have the same value as the field name "mail" but with the name "email"


texts: How do I get the UUID for a current logged in user?

texts:
In the Drupal 8 user's table, there is a UUID field. I'm trying to figure out if there is some method to easily access the UUID for a current user like you would when you get a UID for a user.

Thoughts?


texts:
I created a group entity which has a tab 'Pending memberships'. This page callback does a database query which retrieves the pending memberships and renders the usernames in an item list, along with an 'Approve' link next to each item. The link maps via a menu item (obviously) to this function:

function group_user_approve_callback($user, $group) {
  // Update db record, sets membership to approved
  group_user_approve_membership($user->uid, $group->gid);

  $user = user_load($user->uid);
  $group = group_load($group->gid);
  drupal_set_message(t('The pending membership of %username has been approved.', array('%username' => $user->name)));
  watchdog('group_user', 'Membership of %username to group %group_name approved.', array('%username' => $user->name, '%group_name' => $group->name));

  // Redirect to the exact same page
  drupal_goto('group/' . $group->gid . '/pending_memberships');
}

The drupal_goto() function effectively reloads the page.

But somehow, the page is cached and it doesn't show the message and doesn't reflect the approval, since the user is still in the list. Only after clearing the cache, or switching pages, the page is updated.

What is causing this page to be cached?


texts:
I installed Calendar and created a few views. I decided that I want to begin anew with fresh settings, so I disabled Calendar and removed it. The undesired view disappeared. I extracted a fresh copy of Calendar to sites/all/modules and enabled it, but the old view appears again.

Do you know how to delete them?


texts:
I'm very new to drupal.
I have successfully added a new menu Tab. And When I click on it, it shows a new page with the expected data.

However I would like:

To have a "proper page" not just the unthemed view. How can I get the user page and assign my view to its main content ?
Is there any way to make the menu "ajax" ?

So far I have:

function custom_user_page_callback()
{
  $view = views_get_view('activity_feed');
  $view->set_display('view_block_name');
  //$view->set_arguments(array($tid));
  $view->set_items_per_page(5);
  $view->pre_execute();
  $view->execute();

  // Here Instead of printing what shall I do ?
  // like:
  // $page = drupal_get_page( user );
  // $page["main_content"] =  $view->render();
  print $view->render();
}

function custom_user_menu()
{
    $items['user/%user/activity'] = array(
        'title' => 'Activity',
        'page callback' => 'custom_user_page_callback',
        'access arguments' => array('access content'),
        'type' => MENU_LOCAL_TASK,
    );
    return $items;
}


texts: use content type field value as css class in views

texts: I have a content type article with a field called 'type'. Based on the value of this field I want to display my content type differently in a view that I created with the Views module. In order to do that I would like to add the value of the type field as a css class to each item in that view.


texts:
Given an entity type id of a fieldable entity type, a bundle name, and a view mode name, how do I construct a url to the respective field_ui form where this view mode can be edited?

The patterns for the route name seem to be:

entity.entity_view_display.ENTITY_TYPE_ID.view_mode
entity.entity_view_display.ENTITY_TYPE_ID.default

But it seems the parameters have custom names, e.g. /admin/structure/types/manage/{node_type}/display/{view_mode_name}, here the bundle parameter is called node_type.

Is there a generic way to build such urls to field_ui pages for any entity type?


texts: How to get a field in a exposed filter criteria as an autocomplete?

texts:
In a view the field which has widget autocomplete does not get
an option to select as dropdown or autocomplete in exposed filter criteria.
I have a field in a content type which has following properties.
Type : entity reference
widget : autocomplete
How can I set a exposed filter criteria field as autocomplete ?


texts: Feeds importer imports only some of the nodes

texts:
In D7.59 I have to import .csv file and there are all the mappings prepared for that. The file has 500 records, that will become nodes of a content type "record". There are no nodes of this content type in Drupal before the import (all nodes are deleted). When I start the import after it finishes I get the result, that 334 nodes were created and 266 nodes were updated.

Log does not show any errors by the way.

I presume that there are some kind of feeds cache that has to be cleared, to make sure that it does not think that some of the nodes are still in the site. Can someone tell me what SQL tables I should truncate, or maybe there is another way to solving this?


texts:
I would like to get rid of the ajax "add more items" button at the bottom of a multiple elements form item.

The D8 webform I'm building has a custom composite element with multiple values allowed. The table form display has nice + and – buttons in each row. The "Add x more items" element below the table is not needed.

In the advanced tab, under "Multiple settings", there is only an option to hide the +/– buttons, not the "Add x more items" element.

Additional information:

Webform module version: 8.x-5.0-rc7
YAML Source (excerpt):

   fieldset_teilnehmer:
    '#type': fieldset
    '#title': Teilnehmer
    teilnehmer:
      '#type': custom_composite
      '#title': Teilnehmer
      '#required': true
      '#required_error': 'Bitte tragen Sie die Teilnehmer ein.'
      '#multiple__label': Teilnehmer
      '#multiple__labels': Teilnehmer
      '#multiple__min_items': '5'
      '#multiple__empty_items': '5'
      '#multiple__sorting': false
      '#element':
        teilnehmer_name:
          '#type': textfield
          '#title': Name
        teilnehmer_alter:
          '#type': select
          '#options':
            18: ≥18
            17: 17
            16: 16
            15: 15
            14: 14
            13: 13
            12: 12
            11: 11
            10: 10
            9: 9
            8: 8
            7: 7
            6: 6
            5: 5
            4: 4
            3: 3
            2: 2
            1: 1
            0: 0
          '#title': Alter


texts: Creating a Profile2 Relationship in a View blocks some non-Profile fields

texts:
I have a View of nodes where I am showing the node title, main image, taxonomy, and author. All the fields show as expected.

I need to add a field from the user's profile. So I add a Relationship to the View. Before adding any Profile fields, all the fields still display correctly.

But as soon as I add any profile field to the view, the main image and taxonomy fields no longer display, unless the node belongs to the person viewing the view (or is an Admin).


texts: Select a taxonomy parent ID based on the current node type for shared field declarations in cck

texts:
I have a taxonomy vocabulary with the below heirarchy:

*Property Type

 -Commercial
    -Office
    -Building
    -Warehouse
 -Residential
    -Villa
    -Apartment
    -Penthouse

I have two content types for the property information that has a common field called: 'Property Type' relating to that vocab above, again, for the two content types: "Commercial Property" & "Residential Property" they are using the same field declaration that relates to the same vocab group.

I want to use the php advance code to filter 'commercial' and 'residential' whichever content type is concerned. E.g. Villa, Apartment and Penthouse should only show under the "Residential Property" content type.

My Current code is this but it does not work:

if (arg(0) == 'node' && is_numeric(arg(1))) $nodeid = arg(1);
if($nodeid) $type = noad_load($nodeid);
if($type->type=='commercial_for_rent' || $type->type=='commercial_for_sale') return 798;
else if($type->type=='residential_for_rent' || $type->type=='residential_for_sale') return 799;

In other words: Show only the sub category items of 'Property Type' vocab (e.g. "Residential terms") if content type being edited is this (e.g. "Residential Property" content type)...

Can someone help me point to the right direction please.

Thank you!


texts: How to programmatically change region for field instance?

texts: I have content type with more then one regions. When I open admin page "Manage fields" I can see which fields are in which regions. Is it possible to change programatically, in which region some field instance should be? (I don't need to create new region, just switch field to another existing region)


texts: How can I change the ubercart order templates?

texts:
I have been searching around trying to find the answer to my issue, on and off for months. I'm using Drupal 6, Ubercart and Ubercart Marketplace. I'm trying to add the sellers address onto the packing slip as the Returns address. Could really do without receiving products at my address.

I'm fairly confident of how I'll pull that info in. Something like:

<?php $seller = arg(1);
    $account = user_load($seller);
    $seller_id = $account->uid;

    $var = content_profile_load('profile', $seller_id);

    print $var->field_location[0]['street'];
     ............. and so on...

                    ?>

So I've read: Changing invoice templates for Ubercart 2.3 and later.

So I copied the .tpl.php files from modules/ubercart/uc_order/templates over to my theme and flushed the caches.

However any changes (even just adding some text) aren't being displayed. I then just tried editing the original modules/ubercart/uc_order/templates/packingslip.tpl.php ... Still no changes are being shown... I keep relentlessly flushing the caches in hope...

Soul searching on Google just keeps bringing up the method described in the link above...

What am I missing?

EDIT:

It is because i'm using module called Ubercart Invoice... This module adds VAT information to orders and invoices, useful for European countries. It does so by overriding the normal templates with this file: /sites/all/modules/ubercart_invoice/templates/uc_order-invoice-number.tpl.php

Tbh, I'm not 100% on how it does what it does but I do know that if I edit that file, the changes are picked up...


texts: Views PHP and Webform submissions problem

texts:
I am creating a view of submitted data from webform. I was able to create it properly. Next step is to filter the data based on their dates, since webform stores date submitted data as strings, I use Views PHP to convert the date to integer and use that value for the comparison. It was properly filtered, but I am encountering a LOT of notices in view:

Notice: Undefined property: webform_handler_field_submission_data::$webform_node in webform_handler_field_submission_data->render() (line 176 of ...\modules\webform\views\webform_handler_field_submission_data.inc).

how do i remove these notices/errors - need your help! would appreciate your help. thanks in advance.


texts: How to add a date field to content type without installing the date module?

texts:
I want to define a new field with date type and add it to content type by code.

But I don't want to install date module. I want to add a field same as published on field when we are editing a content.

Is there any way to do this or it is impossible?


texts: How copy file field data from one file field to another using Views Bulk Operations?

texts:
For example, you want to copy the data for a file field with the machine readable name field_pdf into field_attachment

I been following the examples, but there is not an example for this action.

Is this possible with VBO and if so what is the code?

I would very much like to resolve this problem for myself and update the page on d.o


texts: View won't save end date configuration as filter criteria

texts:
I'm using Drupal 7 with views 7.x-3.15 and Date 7.x-2.9
I have a date field for an "Events" content type. Events can sometimes last more than 1 day, so I have enabled an associated end date.
See in the video (linked below) that I :

Add the date field as a filter
Set the the "End date" as a relative date (now)
Apply the changes
But when I re-open the filter, the settings I just applied are now associated to the start date, not the end date.
In the video, I repeat the process a couple of times just to demonstrate that it's not doing as I'd expect.

https://www.youtube.com/watch?v=H2rAzwIHJZE
Further detail (maybe not relevant)
I need to select events that even though their start date has passed, their end date is still in the future. I realise in the video that I've selected >= but don't worry about that - the problem is that the filter won't save my configuration.
Has anyone else had experience of this?  Am I doing something wrong ?


texts: How can I show only terms from a certain vocabulary in a view summary?

texts:
I have a View that has a contextual filter for Taxonomy terms... I have selected that if the parameter is not given just show a summary, but I want that summary to show only terms of a certain vocabulary... is that possible?

UPDATE: Just to be clear. I'm selecting nodes that has two fields that points to different vocabularies, so in the summary the view is showing all the terms form both vocabularies, I just want to show the terms that are only on one of them.


texts:
I installed Drupal HybridAuth module on my site for social authentication. I configured this module and it is displaying fine on site block. But when I try to login with any Social Media account details, it is processing correctly, but I cannot login in my site. How can I solve this?
Here's a link to the site:
example.com


texts: ubercart template email addresses hard coded in template

texts:
I have inherited an app which has an email hard coded into an ubercart template here /sites/all/modules/ubercart/uc_order/templates/uc-order--customer.tpl.php

How can I set up this email to be accessible from an adminitratable page instead of being hard coded so it can easily be changed?


texts: node/add page shows 2 of every type. How do I fix this?

texts:
My node/add page (Add Content) shows two of every content type!

Here is a screenshot:

I am 99% sure this is is a database problem, but my database node_type table looks OK and only has one of each type.

I have disabled every module I could, updated everything, and have no errors in the log.

When I point my installation at a fresh database I do not have the problem.  When I point a fresh Drupal installation at my current database I do have the problem.  It seems like database to me.

Using Drupal 7.15.

Any idea on how to fix this?


texts: How can I add a link on the "Structure" admin page?

texts: I created a view page with the path being /abc and I want to add this link on Administrative page with a link in Drupal 8.


texts: Problem creating a node with custom PHP code

texts:
I wrote the following custom PHP code to create a node

<?php
define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

global $user;
$title1=$node->title;
$node = new stdClass;
$node->type = 'Campaign_PlayerList';
$node->title = $title1;
$node->uid = $user->uid;
$node->language='und';
$node->field_cmp_playerid['und'][0]['value']=$user->uid;
$node->field_cmp_userscore['und'][0]['value']=1;
$node->field_cmp_usersupport['und'][0]['value']=1;
node_object_prepare($node);
node_save($node);
?>

The values for field_cmp_playerid and field_cmp_attend_time are not saved.

$node->field_cmp_playerid['und'][0]['value']=$user->uid;

doesnt work and field_cmp_attend_time is the same too.

What could the problem be?

Here is a screenshot of the field management form for the Campaign Playerlist content type:


texts:
I have a block as part of my custom module, I was it to show 2 text boxes (Input & Output) and have a generate button. I cant get it to show the input boxes! It seems they are being stripped out for some reason? I have tried with and without twig but my example below is without twig to keep it simple:

    <?php

/**
 * @file
 * Contains \Drupal\mymodule\Plugin\Block\GenerateBlock.
 */

namespace Drupal\mymodule\Plugin\Block;

use Drupal\Core\Block\BlockBase;
use Drupal\Core\Form\FormStateInterface;

/**
 * Provides a 'generateblock' block.
 *
 * @Block(
 *   id = "generate_block",
 *   admin_label = @Translation("Generate Code"),
 *   category = @Translation("mymodule")
 * )
 */
class generateblock extends BlockBase {

  /**
   * {@inheritdoc}
   */
  public function build() {
    // $twig = \Drupal::service('twig');
    // $template = $twig->loadTemplate(drupal_get_path('module', 'mymodule') . '/templates/generatecode.html.twig');
    // $output = $template->render([]);
    $output='

Generate Access Code

    <input class="form-control" id="codeToCheck" placeholder="Enter Input" type="text" value="" /> <button class="btn btn-default mr-xs mb-sm" type="button">Set</button>

<input class="form-control" id="validationCode" placeholder="" readonly="readonly" type="text" value="" /> <button class="btn btn-default mr-xs mb-sm" type="button">Copy</button>

    Learn More

';

    return array(
      '#type' => 'markup',
      '#markup' => $output,
    );
  }

}

I do not know why the inputs are being stripped out? What am i missing

**** Update ****

I have changed my code to the following and it is no longer stripping out the input boxes but it feels a bit "hacky" Do I need to specify a different render type or something:

class AccessCode extends BlockBase {

  /**
   * {@inheritdoc}
   */
  public function build() {
    $twig = \Drupal::service('twig');
    $template = $twig->loadTemplate(drupal_get_path('module', 'mymodule') . '/templates/accesscode.html.twig');
    $output = $template->render([]);

    return array(
      '#markup' => $output,
      '#allowed_tags' => ['input','span','div','a','button','h2','strong','i',],
    );
  }


texts:
Earlier today I tried to install the MailChimp plugin for Drupal 8. I couldn't get it working properly so I decided I would just go ahead and uninstall it.
However, when I navigate to /admin/modules/uninstall I get the following error:

The website encountered an unexpected error. Please try again later.
Drupal\Component\Plugin\Exception\PluginNotFoundException: The "filter_mailchimp_campaign" plugin does not exist. in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 57 of core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).
Drupal\Core\Plugin\DefaultPluginManager->getDefinition('filter_mailchimp_campaign')
Drupal\filter\FilterPluginCollection->initializePlugin('filter_mailchimp_campaign')
Drupal\Component\Plugin\LazyPluginCollection->get('filter_mailchimp_campaign')
Drupal\filter\FilterPluginCollection->get('filter_mailchimp_campaign')
Drupal\filter\FilterPluginCollection->sortHelper('filter_align', 'filter_mailchimp_campaign')
uasort(Array, Array)
Drupal\Core\Plugin\DefaultLazyPluginCollection->sort()
Drupal\filter\FilterPluginCollection->sort()
Drupal\filter\Entity\FilterFormat->filters()
Drupal\filter\FilterUninstallValidator->validate('filter')
Drupal\Core\Extension\ModuleInstaller->validateUninstall(Array)
Drupal\Core\ProxyClass\Extension\ModuleInstaller->validateUninstall(Array)
Drupal\system\Form\ModulesUninstallForm->buildForm(Array, Object)
call_user_func_array(Array, Array)
Drupal\Core\Form\FormBuilder->retrieveForm('system_modules_uninstall', Object)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber{closure}()
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber{closure}()
call_user_func_array(Object, Array)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1)
Stack\StackedHttpKernel->handle(Object, 1, 1)
Drupal\Core\DrupalKernel->handle(Object)

Likewise, when I try and go to edit any pages content, I get the same error. This is preventing me from doing anything. I went ahead and uninstalled the plugin manually be removing all of the mailchimp files from the modules directory over FTP but I am still getting this error.
Any ideas on what I need to do to fix this? It's driving me crazy!
Thanks


texts: What is the right way to embed the Zend Framework

texts:
I'm currently looking for a way to embed the Zend framework into D7. I have found this module http://drupal.org/project/zend, but no matter what I try, I can't get to work.

It is said the 3.0 branch is for ZF2. So I enabled that module and I put the Zend folder (the one inside the framework libraries folder) in /sites/libraries. But in status report it keeps saying that the Zend Framework is not found.

I have no Drush on the server, but it should also be possible with plain FTP, right?

Also, sometimes when enabling the module (so other times this does not happen), the whole page comes served as plain text with an error at the bottom stating that mysql has disconnected.

Does anyone have experience with this?


texts: How to set up a 'review-like' view that connects users to nodes?

texts:
I want to be able to add to my panel, described here, a view of an 'advocate' that 'endorses' an item.

Each item (unique by NID) has one Advocate (a user, unique by UID) and each User can have multiple endorsements (but still one per item).

In my view I have these settings:

Click to view

I've annotated them to show how I think things link together

NID from the URL connects to the, 'Entity Reference: Endorsement'.
The Entity Reference: Endorsement connects to the '(Content entity referenced from field_tech_endorsement) Entity Reference: Endorser'.
The (Content entity referenced from field_tech_endorsement) Entity
Reference: Endorser connects to the 'User: Name (Name) and User:
Picture'

These settings all seem 'right' to me. but I'm getting no output on my panel.

I think the crux is in the Argument input, that it feeds from the NID selected on the panel (see link), and the UID of the associated (via the relationship Entity Reference: Advocate). But I don't know if I'm doing the 'feeding' right at all.

Nothing comes up on the preview, and nothing come up on the page.

This is what I'm hoping for:

What am I doing wrong on this view? Is my set up right at all?

What I'm trying to do is reflect this set up:

Here is the SQL generated by the query.

<!-- lang-sql -->

SELECT      node.nid AS nid, #The node of the item that has this endorsement (?)
            users_field_data_field_endorser.name AS users_field_data_field_endorser_name, #The username of the advocate who has endorsed the item
            users_field_data_field_endorser.uid AS users_field_data_field_endorser_uid, #The UID of the advocate who has endorsed the item
            users_field_data_field_endorser.picture AS users_field_data_field_endorser_picture, #The picture of the advocate who has endorsed the item
            users_field_data_field_endorser.mail AS users_field_data_field_endorser_mail, #No idea why this is generated
            node.created AS node_created, #No idea why this is generated
            'node' AS field_data_body_node_entity_type #No idea what this is
FROM
            {node} node #A Table of all nodes?
LEFT JOIN   {field_data_field_tech_endorsement} field_data_field_tech_endorsement ON
                    node.nid = field_data_field_tech_endorsement.entity_id AND
            (field_data_field_tech_endorsement.entity_type = 'node' AND
            field_data_field_tech_endorsement.deleted = '0')
            #Left Join our endorsements, where they're not deleted, and they're NID matches their NID (well duh)
LEFT JOIN   {node} node_field_data_field_tech_endorsement ON
                field_data_field_tech_endorsement.field_tech_endorsement_target_id = node_field_data_field_tech_endorsement.nid
             #Left join on Where the NID of the target matches the endorsement (????) That's not right
LEFT JOIN   {field_data_field_endorser} node_field_data_field_tech_endorsement__field_data_field_endorser ON
                node_field_data_field_tech_endorsement.nid = node_field_data_field_tech_endorsement__field_data_field_endorser.entity_id AND
                (node_field_data_field_tech_endorsement__field_data_field_endorser.entity_type = 'node' AND node_field_data_field_tech_endorsement__field_data_field_endorser.deleted = '0')
              #Left join on the endorser/advocate where the Endorsements NID is the same as the NID of the endorser/advocate's endorsement AND where the endorserment is endorsing the right kind of node, AND where the endorser is not deleted
LEFT JOIN   {users} users_field_data_field_endorser ON
                node_field_data_field_tech_endorsement__field_data_field_endorser.field_endorser_target_id = users_field_data_field_endorser.uid
            #Left join on the user details that match the endorser
WHERE (( (node.nid = '13' ) )AND(( (node.status = '1') AND (node.type IN  ('endorsement')) )))
ORDER BY node_created DESC
LIMIT 1 OFFSET 0

I think my understanding of what it's doing it right, but it seems like what it's doing is wrong. What do I do to fix it?


texts: How to ignore default roles in drupal roles

texts:
I don't want to show the default roles to end user and want to ignore anonymous user and authenticated user. How can I remove these two roles from roles array. Shall I hard code the role names and rid say as in example below?

I have used this code.

$ignore = array(1 => 'anonymous user', 2 => 'authenticated user');
$roles = user_roles();
$roles =  array_diff($roles, $ignore);

Thanks for your help.


texts: Is there a product.tpl.php for ALL product types in Drupal Commerce?

texts: Or do you need product-type1.tpl.php, product-type2.tpl.php, etc? I would like to theme every single product on the site but there are multiple product types.


texts: How to put a token in field Simplenews -> Subscribtion block -> block message

texts:
I want to add a token in a field which is used when the simplenews module is installed and configured. There is then a block available for each newsletter.
In this block the user can fill in his email and push the subsribe button.

I want to display a token in this field:

Block > Simplenews subscribption block > block message.

(the block title is supporting tokens, but the block message not)

How to do this?


texts:
When people register for my site I want them to either join an existing group or create a new one if it doesn't exist. They can only be a member of one group, and there's only one group type used on the site.

I've got the autocomplete widget set and I want to alter it's functionality so instead of throwing an error message it creates a group. I presume altering og.module is not a good idea as it wouldn't be easy to make my particular changes generic enough to work for lots of use cases so am I right in thinking I would create a custom module to hook into the pre-save functionality of the user entity and do my checking to see if exists, if not then create group and create membership there or is there another way?

I tried using taxonomy as my group content and using a term reference autocomplete field on my user profile, but og doesn't seem to work fully with taxonomy at the moment, and I had other problems with attached field data not saving on taxonomy so gone back to using a node type as my group content type.


texts: Changing the text displayed in an Entity Reference Autocomplete

texts:
I have an entity reference autocomplete which is populated using an Entity Reference View.

I would like users to be able to type in this autocomplete and for the suggestions to look like this:

"[title of node] [value of custom field]"

However, it seems like there is no way to achieve this. If I add extra fields into the Entity Reference View, these do not display. If I override the output of the title field in the view, this is ignored. It seems like the Entity Reference Autocomplete simply uses the entity title and ignores the 'Fields' section of the view.

Does anyone have any experience with this? I'm sure it was possible in D7!


texts: Views UI affected due to multiple modules

texts:
jquery.once is perfectly working, I placed console.log inside it, but I still get this error especially when I load the Views UI without even before I press any button

When I press any button, a progress animation appears and again this error appears

views-admin.js?op2hqg:164 Uncaught TypeError: $form.once is not a function
    at Object.Drupal.behaviors.addItemForm.attach (views-admin.js?op2hqg:164)

When I investigates I found that the following jquery select returns 0 objects

var $form = $(context).find('form[id^="views-ui-add-item-form"]').first();

How to solve this, should I disable any modules?


texts: Allow shipping that is calculated using a base rate plus a rate per item?

texts:
I figured this would be built in, but it seems it is not. See here:

I have two options:

Flat rate: I can make it 9.99 USD, but then if it's 100 items, it's still 9.99 USD.
I can make it 1 USD per item, but I als don't want that.

What I want is a base rate of 10 USD, and then 1 USD per item after that. Anyone know how to do that?
UPDATE
There is some information available for Commerce 1.0 here, but hardly any information on Commerce 2. This is basically all there is.
Can it be that Commerce 2 doesn't support this? I mean, nowhere can I see "shipping rules" or anything related to that that allows me to set up these rules?
(I miss UberCart)


texts: How to send 2 mails simultaneously with drupal_mail()

texts:
I want to send my order to my email, and also to my client's email.

I am sending an order placed on my website using this code:

function MYMODULE_form_submit($form, &$form_state) {
  order_mail_send($form_state['values']);
}

This is the order_mail_send() code:

function order_mail_send($form_values) {
  $module = 'shop';
  $key = 'key';
  $to = $form_values['email'];

  $language = language_default();
  $params = array();
  $from = NULL;
  $send = FALSE;
  $message = drupal_mail($module, $key, $to, $language, $params, $from, $send);
  $message2 = drupal_mail($module, $key, $from, $language, $params, $from, $send);

  $subject = 'Order Status';

  $message['subject'] = $subject;
  $message['body'] = array();

  $message['body'][] = "
Your order: ".$form_values['first']." ".$form_values['last']."
";

  // …

  // Retrieve the responsible implementation for this message.
  $system = drupal_mail_system($module, $key);

  // Format the message body.
  $message = $system->format($message);
  $message2 = $system->format($message2);

  // Send e-mail.
  $message['result'] = $system->mail($message);
  $message['result2'] = $system->mail($message2);

  if ($message['result'] && $message['result2'] == TRUE) {
    drupal_set_message(t('Your order has been sent. Thank you!'));
  }
  else {
    drupal_set_message(t('There was a problem sending your message and it was not sent.'), 'error');
  }
}

Now it sends the first email ($message = $system->format($message); but not the second one. How can I make it work?
How can I empy the cart values after sending the emails? The cart empties when I close the browser, but I want to delete it after sending as well.


texts: Use email to validate post, not unlike craigslist

texts:
I'd like for anonymous users to be able to post nodes to my site. By default their post is unpublished, but when they submit it, the site sends an email with a verification URL. When they revisit the site with that URL they can then publish their node.

Call this the 'craigslist model.' :-)

Restating: I want users to be able to publish their own node anonymously, by linking out of an email.

I've been unable to find a module or setting that does this, and I thought I'd ask before diving into code.

Update: Found this unmaintained Drupal 5 project: Anonymous publishing.

Similar question: How can anonymous users be allowed to post while still maintaining content integrity?


texts: how to stop annoymous users to login in drupal

texts:
In wordpress, I have been disabling unknown people from accessing my wp-login.php using a script in the .htaccess.

RewriteCond %{REMOTE_ADDR} !^154\.70\.159\.2
RewriteRule ^wp-(login|register)\.php http://www.example.com [R,L]
RewriteRule ^wp-(admin)\.php http://www.example.com [R,L]

Meaning only the user with that above IP will b allowed to Login.

How can I do this with Drupal, so that I redirect unknown user with different IP to my homepage. Those who try to visit the www.example.com/user link.


texts:
I need to run drupalchat with nodejs locally but I get error loading the socket.io.js client library (404 not found)

nodejs server is running

the file exist in that path :

  sites/all/modules/nodejs/node_modules/socket.io/node_modules/socket.io-client/socket.io.js

the request:

  http://localhost/drupal:8080/socket.io/socket.io.js

noddejs config:settings = {
  scheme: 'http',
  port: 8282,
  host: 'localhost',
  resource: '/socket.io',
  serviceKey: '',
  backend: {
    port: 82,
    host: 'localhost',
    scheme: 'http',
    basePath: 'localhost/drupal',
    messagePath: '/nodejs/message'
  },
  debug: false,
  sslKeyPath: '',
  sslCertPath: '',
  sslCAPath: '',
  baseAuthPath: '/nodejs/',
  publishUrl: 'publish',
  kickUserUrl: 'user/kick/:uid',
  logoutUserUrl: 'user/logout/:authtoken',
  addUserToChannelUrl: 'user/channel/add/:channel/:uid',
  removeUserFromChannelUrl: 'user/channel/remove/:channel/:uid',
  addChannelUrl: 'channel/add/:channel',
  removeChannelUrl: 'channel/remove/:channel',
  setUserPresenceListUrl: 'user/presence-list/:uid/:uidList',
  addAuthTokenToChannelUrl: 'authtoken/channel/add/:channel/:uid',
  removeAuthTokenFromChannelUrl: 'authtoken/channel/remove/:channel/:uid',
  toggleDebugUrl: 'debug/toggle',
  contentTokenUrl: 'content/token',
  publishMessageToContentChannelUrl: 'content/token/message',
  extensions: [],
  clientsCanWriteToChannels: false,
  clientsCanWriteToClients: false,
  transports: ['websocket', 'flashsocket', 'htmlfile', 'xhr-polling', 'jsonp-polling'],
  jsMinification: true,
  jsEtag: true,
  logLevel: 1
};

what is wrong/missing config/permissions to run them together?

thanks in advance


texts: How to make multiple fields with taxonomy terms?

texts:
Like so: select-taxonomy-term - price - raiting

Like this picture:


texts: Permission denied when configuring my module though admin page

texts:
I am following drupal's module development tutorials. I am using drupal 7.41 and my operating system is ubuntu.

I am creating a module that list links in the footer section of the page. I am making an admin configuration for my module. I have done everything what the tutorial said and I went to my configuration page, I couldn't see my configuration button of my module in admin/config/content. Here is my hook_menu() implementation:

function footer_links_menu() {
$items = array();

$items['admin/config/content/footer_links'] = array(
    'title' => 'Footer Links',
    'description' => 'Configuration for Footer links posts module',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('footer_links_form'),
    'access arguments' => array('access administration pages'),
    'type' => MENU_NORMAL_ITEM,
);

return $items;
}

I have manually tried to access to admin/config/content/footer_links, I got a permission denied error. However, I was already logged in as the admin.
I have changed the value of access arguments to array('access content'). And it worked. What was the problem? If I leave my code like this, can others also edit my module through the form? Thanks in advance.


texts: Render view for specific user, drupal_mail

texts:
Is it possible to generate the content of the view as a specific user. So only the content the user has access to is rendered.

//Get view
$view = views_get_view("list_nodes");
//Pass arguments
$view->args = $locatie;
//Generate content
$content = $view->execute_display("block");

I got a custom module wich gets a list of users, to all those users the content of this view need to be send. But only the content the use has access to.


texts: Why are anonymous visitors logged in when they visit /user/[uid] page?

texts:
This seems to be a massive security floor in Drupal. I have the following display suite code in a Block which is added as a custom field to the User account display:-

    <?php
global $user;
$uid = arg(1);
$user = user_load($uid);
$roles = $user->roles;

if (in_array('RoleName1', array_values($roles))) {
 print "";
}
if (in_array('RoleName2', array_values($roles))) {
 print "";
}

?>

It checks for a couple of Roles and shows an image if they have a particular Role.

When an anonymous user now loads a user account page, they are logged in as that user! Visiting "/user/1" means they are logged in as the admin user!!!


texts: How do you normally structure your Menus?

texts:
I am using the Sitemap module, and in order to display the pages available on the site, I need to enable which Menus are displayed. It then lists them in sections, with a Menu title above each section.

I have 5 menus at the moment, so the sitemap generated looks very messy. What is the best way around this? How do you structure your Menus so it all looks neat in the Sitemap, but is also functional?

Also, do you  normally rename the Main and Navigation menus to Primary links and secondary links, or do you leave them as they are? Do you  hide the Menu headings from being displayed in the Sitemap?


texts: How to add nofollow attribute to links in profile text field and url field

texts: I add 2 fields via Profile module,one is textarea field names "About me", the other one is url field names  "my website". My questions is how to add nofollow attribute to the links in these 2 fields. I googled for a while but without luck.


texts: Unable to return session value in views Field

texts:
I am storing a session value via Rules when the user is logged in

session_start()
$_SESSION['userkey'] = "12345";

Also testing it below there

echo $_SESSION['userkey'];

Although when I am trying to retrieve this value in my view in a field as Global: PHP

with Value Code:

return $_SESSION['userkey'];

Output code:

<?php
echo $value;
?>

It does not return anything. Unsure whether the session is not being set properly or I am retrieving the value incorrectly?

Thanks.