texts: Views : custom table with relationship is not queried

texts:
I use a custom table to store data on my nodes, and hook on _views_data to display or sort from this table.

Everything's going fine :

/**
* Implements hook_views_data()
*/
function MYMODULE_views_data() {

  $data['MYTABLE']['table']['join'] = array(
    'node' => array(
      'left_field' => 'nid',
      'field' => 'nid',
    )
  );
  $data['MYTABLE']['MYFIELD'] = array(
    'field' => array(
      'handler' => 'MYHANDLER',
    )
  );
}

class MYCLASS extends views_handler_field {
  function query() {
    // Add 2 columns I need to the query
    $this->view->query->add_field('MYTABLE', 'COLUMN1', 'ALIAS1');
    $this->view->query->add_field('MYTABLE', 'COLUMN2', 'ALIAS2');
  }

function render($values) {
    // WORKS FINE WITH NO RELATIONSHIP
    $dates = array($values->ALIAS1, $values->ALIAS2);
    ...
    return ..
  }
}

My problem is : I can't get values when my table is called on a node-relationship relationship.

I tried

function query() {
        if(isset($this->relationship) && !empty($this->relationship)) {
            $table = $this->view->relationship[$this->options['relationship']]->table_alias;
            $field = $this->view->relationship[$this->options['relationship']]->real_field;
            $this->view->query->add_field($table . '.' . $field, 'COLUMN1', 'ALIAS1');
            $this->view->query->add_field($table . '.' . $field, 'COLUMN2', 'ALIAS2');
        }
}

and

function query() {
if (!empty($this->relationship)) {
            $this->table = $this->query->ensure_table($this->table, $this->relationship);
        }

but in render, my $values is always empty when the relationship is set.


texts: View Shows Latest Members - How to Limit Count by Last 3 Months

texts: I created a view that shows all recent members. Right now it shows members, from the newest to the oldest. I want to limit this view to show only the last 3 months of latest users.


texts: Tokens for taxonomy term parents in Pathauto

texts:
I am trying to find the correct tokens to use for a Pathauto pattern in Drupal 8.

In Drupal 7, I have a Pathauto module pattern that creates a URL alias with a node's term and parent term.

So if the node had a Term reference of Health -> Diet. The URL would be health/diet/node-title.

The pattern to generate this is [node:field-topic:0:parents:join-path]/[node:field-topic:0]/[node:title]

Note the :0 is because the Term reference field allows multiple values.


texts:
I have a form with 3 textareas and some other fields. I would like to put in an autosave functionality and found the Autosave module. But that seems to be specifically for editing nodes and is also too advanced for what I need. I just need to save the contents every 3 seconds or so, no revision support or anything fancy like that.

I'm thinking about a silent form submit that the user doesn't notice or a specific page that receives the contents of the form posted with JavaScript.

But something like this must have been done before, so is there an example or some pointers on how to implement this? I'm using Drupal 7.


texts: Remove "Password reset instructions" hint on reset you password page?

texts: Could not find any hooks or templates for it.


texts: On feeds, how to access ORGANIZER source

texts:
I'm importing an iCal feed using iCal Parser. I've actually tried a few other parsers including Date API iCal parser, iCalCreator parser, but every one seems to have the same set of sources. How can I access all the other fields in the feed, specifically, the ORGANIZER: ORGANIZER;CN=name@email.com:mailto:name@email.com?

I've tried to hook into hook_feeds_parser_sources_alter, and setting up a new callback function. Like this:

/**
* Implements hook_feeds_parser_sources_alter().
*/
function my_hook_feeds_parser_sources_alter(&$sources, $content_type) {
$sources['field_importer_reference'] = array(
'name' => t('Organizer'),
'description' => t('The name of the organizer.'),
'callback' => 'my_hook_get_organizer',
);
}
function my_hook_get_organizer(FeedsSource $source) {
dpm($source->CN);// this doesn't do anything...
return $source->CN;
}

I get this message when I try to import: Date iCal does not recognize the "Organizer" Mapping Source, and must skip it.


texts: View filtered by node value NOT IN another view?

texts:
I'd like to create a view for a CCK type, and show nodes of which the value does not exist in the result of another view.

For example, I have Student and Attendance CCK types, I'd like to list all the students who are not shown in the Attendance nodes.

Both CCK types shared the same student_id CCK field.


texts: Sortng the field collection in the user-profile.tpl.php

texts: I have rendered field collection in the user-profile.tpl.php like   and its working fine and i need to sort the fields as per my case with out view. How to perform the this sort by useing custom code are do we have any modules like weight.


texts: Goal: 1 Webform as Block, Multiple Nodes with block in Panel pane

texts:
I am trying to create a single webform that I can expose as a block and re-use on multiple 'profile' nodes.  These nodes will use Panels and Panel/Panes to display content.

Problem: I need to pass email address(s) stored on the "parent"('profile') node (cck fields perhaps) to the "child" webform so that the form is sent to the address(s).

I've tried following a few articles that said to create a custom module to implement hook_form_alter.  I haven't been able to get it to work.  I'm a bit of a noob at the whole programming side of Drupal so any help would be appreciated.


texts: I want to use features module. Can i use this module as stand alone and get it working or do i need help of modules like strongarm or context module. Will have have any added advantage if i user these modules along with features module ?  Any good flow chart of how to use features module?


texts:
I'm writing a migration module, and I have an entity reference multiple field in which users can choose what type of content they want to add.

I need to map to this field from multiple sourceMigrations, but each one of the migration tables has different id column name.

I know i can do something similar to this for a single migration

  $query->leftJoin('Wet', 'w', 'p.AUTO = `w.wt-stauto`');

  $this->addFieldMapping('field_add_system', 'buildNums')
    ->separator(',')
    ->sourceMigration('novaWet');

I know this isn't correct but in my head it would need to be something like

   $this->addFieldMapping('field_add_system', 'wetIds', 'dryIds', 'pumpIds')
    ->separator(',')
    ->sourceMigration('Wet', 'Dry' 'Pump');

Anyone accomplished something like this?


texts: Need help optimizing a site for speed and response time

texts:
In my Drupal 6 site (fairly busy about 200 anonymous users on average at at time) I have the following setup to speed up the site.

Caching Mode - normal
Optimize JavaScript files
Gzip enabled via .htaccess
Cloudflare - normal setting
Disabled database logging

Can I add memcached or Varnish into this setup? Which one will work better for this site? Should I even care about Varnish and memcached in this setup?


texts: Is the MODULE.schema.yml required when you define the MODULE.settings.yml? It seems that it also works when I remove the MODULE.schema.yml file from install/schema.


texts: How to enable Rich text editor for content types

texts:
I have installed Ckeditor module and configured it to work with advanced editing options. But couldn't get rich text editor. I even tried all options in content authoring I din't get any solution.

And I want to enable rich text editor for certain fields and webforms. Here my case is the rich text editor should be enabled only some fields not all the fields.

For example, if i have two text fields(text areas) like summary and body. Only the body field should be enabled with rich text format the other should show basic editor. Can I have a clear answer.


texts: Add class to view row in template.php based on taxonomy parent

texts:
I'm trying to solve a complex problem with views.  I've got rows of rewritten semantic views data.  There are certain rows that need a special class added to the HTML if the node has a particular parent tax term.  I can easily include the taxonomy term as a field and include it as a data value in the HTML, but the problem is that not all nodes have the parent term checked, nor can I expect them to.

I'm able to get the parent term in views_pre_render by calling taxonomy_get_parents, but I cannot pass this information to the front end.  This view is using semantic views, so no normal views markup is used and the entire result is rewritten.

The fields that I'm using are just title, date, taxonomy, path and an image.


texts: Can't re-import a majority of products in CSV file

texts:
I have been working on a development site for a long time, so there have been many instances where I have imported, deleted, re-imported, re-imported with tampering, etc. There seems to be a large chunk of products from the CSV file that keep getting skipped during the import, and I can't figure out where there is a record of them in Drupal that could cause them to be "flagged" as already imported.

One possible source of the problem may involve the CSV files. The client is exporting a CSV file of all products on a weekly basis from an incredibly old computer system. The filename is always the same, and I have set up the feed with the File Upload settings set to "Supply path to file or directory directly."

I've used the Commerce Reset module, cleared caches, rebuilt the feeds importers with different machine names - everything I could possibly think of - yet it skips several hundred products that I know I have imported before. Is there something I'm missing, possibly regarding GUIDs, UUIDs, product_id/entity id?

EDIT:

I should also have mentioned that I am using two feeds to import products - one to add the prices, and one for everything else (it's part of the client's DOS-based system, so no flexibility there). The current process involves running a feed to create the product (add the SKU, title, keywords), then running the price feed, which is set to update only.

Last night, I simply switched the settings on the price feed (add new products, overwrite existing, skip hash check, delete non-existing - the same as the other feed) and ran it. I was able to import all of the products. However, I decided to run the other feed to get the descriptions and keywords, and it would only update the products that it had last imported when it was set to create/overwrite/delete. What is happening here?


texts: Number of protocol messages (Page not found)

texts: Why does i get a gigantic number of protocol messages for just one "page not found" request? How can i fix it? Isn't this a huge leak for the performance?


texts: How do I pull a field value from a form field in to my inline entity form?

texts:
I'm trying to do something which I would think is fairly simple, but I'm just stumped right now, hoping somebody can help.

I have an entity called 'page', and in that entity I have inline entities called 'subpages'. Both of these entities have a field called 'group_reference' which tells the entity what 'group' the entities belong to.

Basically what I want to do is automatically change the group_reference form field value in my inline entity form to match the group reference in my page form. So far, I'm using inline_entity_form_entity_form_alter to access the inline entity forms values. I'm able to adjust the value to an arbitrary value like this:

function MYMODULE_inline_entity_form_entity_form_alter(&$entity_form, &$form_state) {
  if ($entity_form['#bundle'] == 'subpage') {
    $entity_form['field_group_reference']['und']['0']['#default_value']=X;
  }
}

X being the group id.

So the next step I want is to pull in the group id from the page group_reference field which is already set. That way, they will always match (the user is not able to change this value, it all should be done behind the scenes).

I've tried to include in my module a function that pulls out the value from the field, but I just can't seem to make it work:

function MYMODULE_grab_group_reference(&$form, &$form_state) {
    return $form['field_group_reference']['und']['#value'];
}

function MYMODULE_inline_entity_form_entity_form_alter(&$entity_form, &$form_state) {
  if ($entity_form['#bundle'] == 'subpage') {
    $groupid=MYMODULE_grab_group_reference();
    $entity_form['field_group_reference']['und']['0']['#default_value']=$groupid;
  }
}

I've tried a bunch of different variations. Am I not targeting my values correctly? Is this just an improper way to do it? I'm flummoxed. Any help would be greatly appreciated! Thanks!


texts:
Straight to the point, I need a WYSIWYG module for Drupal 6; here are the requirements:

Easy to change the toolbar button
Able to add custom style
Able to upload image and put into content
Able to upload flash and render it inside content
Able to upload file and show it as download link inside content

Anybody familiar with Wordpress WYSIWYG editor? That is something like what I want.


texts:
Under views when i select unformated settings and can Grouping field, it is working fine.

Now i am using bootsrap tabs but it is not working

How we can do this


texts: Specify the widget type for a form field which doesn't have a related entity

texts:
We have a custom form with an image field and want to use the entity_browser widget from the File Entity Browser module, however it isn't displaying the uploaded content.

The code we have so far:

$fields['testing'] = [
  '#type' => 'container',
  'widget' => array(
    '#title' => t('Test'),
    '#description' => t('The content to be linked in the menu.'),
    '#type' => 'entity_browser',
    '#entity_browser' => 'browse_files_modal',
    '#field_widget_remove' => true,
    '#open' => true,
    '#selection_mode' => 'selection_edit',
    '#preview_image_style' => 'thumbnail',
    '#field_widget_edit' => true,
    '#view_mode' => 'default'
  )
];

The "Browse files" button appears and clicking this opens the correct popup to select files / browser library. The problem comes next as the uploaded files are not listed out after uploading (No Preview / Filename / Metadata / Operations etc). There are no errors on the page.


texts: Is there a D7 equivalent to the Unlimited Field module?

texts:
I need a field allowing either a numeric value or "unlimited".

The Unlimited Number module is exactly what I want, but it's D8-only.

Is there a way to do the same thing in D7?


texts: exporting a field from dev to production

texts:
My custom module creates a content type which has fields. I want to export config so that other developers/production can use it.
I run

drush config-export --destination=/tmp/myconfig

from /tmp/myconfig I take the following files:

field.field.node.CONTENT_TYPE.FIELD_NAME.yml   #field instance
field.storage.node.FIELD_NAME.yml   #field storage
core.entity_form_display.node.CONTENT_TYPE.default.yml
core.entity_view_display.node.CONTENT_TYPE.default.yml

and copy these files to modules/custom/mymodule/config/optional

In the destination machine I run

drush config-import  --partial --source=modules/custom/mymodule/config/optional

The field instance gets imported (I can see it on the content type) but the storage does not, and no table is being created in the database.

Am I doing anything wrong?
Uninstalling and re-installing the module doesn't help.


texts: Error with Node_load() - : Base table or view not found

texts:
I implemented a function to load nodes which it is loaded from a unitary test..

function labdoo_rest_get_laptop($id) {
    $node = node_load($id);
    return $node;
    }

And i get an error like this:

    Test PDOStatement->execute() failed: PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 TabTest PDOStatement->execute() failed: PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table                    [error]
&#039;lbd.simpletest291431node_type&#039; doesn&#039;t exist: SELECT nt.*
FROM
{node_type} nt
WHERE  (disabled = :db_condition_placeholder_0)
ORDER BY nt.type ASC; Array
(
    [:db_condition_placeholder_0] =&gt; 0
)
 in _node_types_build() (line 738 of /var/www/lbd/modules/node/node.module).
le                    [error]
    &#039;lbd.simpletest291431node_type&#039; doesn&#039;t exist: SELECT nt.*
    FROM
    {node_type} nt
    WHERE  (disabled = :db_condition_placeholder_0)
    ORDER BY nt.type ASC; Array
    (
        [:db_condition_placeholder_0] =&gt; 0
    )
     in _node_types_build() (line 738 of /var/www/lbd/modules/node/node.module).

The error is difficult to read... anyway i can understand it is trying to load the node from the database 'lbd.simpletest', but it is not correct!!, I don't know why it is trying to do this.... I tried the 'db_set_active' operation, but i receive the same error, also i could get the node information with sql_query but i prefer this method, it seems better.

My file (with name labdoo_rest.test) to test the SQL function is:

<?php

//TODO Add comments

class LabdooRestUnitaryTest extends DrupalUnitTestCase {

  public static function getInfo() {
    return array(
      'name' => 'Labdoo REST test functionality',
      'description' => "Test SQL  operations: Review functions with SQL queries. ",
      'group' => 'Labdoo'
    );
  }

  function testHelloWorld ()  {
        print "test message\n";
        $this->assertTrue(TRUE,"My first test works");
 }
 function testGetLaptop ()  {
        $id=2;
        $result = labdoo_rest_get_laptop($id);
        print "$result"."\n";
        $this->assertTrue(TRUE,"Test get laptop");
}

}

Thanks for your help...

UPDATE:

$id = 2;  <- it is the node's nid, and the node exists
I proved var_dump($node) but I didn't receive results because my error
message is an exception (PDOException).

UPDATE2:

I tested drush php-eval "print print_r(node_load(2), 1)" and it
returns the correct information.
I am using druh with drush test-clean && drush test-run
... to run the function. I suppose the problem is related to the drush test-run call.

UPDATE3:
 - My code in the Github project:
https://github.com/Labdoo/Labdoo-2.0/tree/features/web-services-api/modules/custom/labdoo_rest


texts: How to add mulitple legends in chart created with the Forena reports module?

texts:
I have created a report using the module Forena reports. It's a compound graph of 3 items.

I need to mention these 3 items in legend. But I am not able to add more than 1 legend.
I am trying to create this graph from the front end itself. I don't want to use the frx file.


texts: How do I Check if a Token is exists/isset Before Printing?

texts: I have been using the auto title module and trying to have the title use a token from a list list, if it has been set.


texts:
I have an entity and when I try to pass the whole entity object, only the name is passed through the routing.

Here is the relevant code in routing.yml:

mymodule.myentity_info:
  path: '/admin/config/mymodule/myentity/{myentity}/info'
  defaults:
    _content: '\Drupal\mymodule\Controller\MyModuleController::info'
    _title: 'Myentity Info'
  options:
    parameters:
      myentity:
      type: entity:myentity
  requirements:
    _entity_create_access: 'mymodule_myentity'

After clicking the link, I get this error: Trying to get property of non-object

I've added an issue regarding this to my sandbox project: https://www.drupal.org/node/2301021


texts:
I am working on a project with a fresh install of Drupal 7.41 and the customer wanted to use a Themeforest layout.

Installation of core, theme and modules went without a problem, however, when I try to create content via 'article or basic page' nothing happens except a page refresh. No content shows in the content list and no content is created.

Yet, I am able to create a webform with the webform module.

Notes

I have checked my logs and there are no errors.  None!
I cleared my cache several times
I am running as Admin and the proper permissions have been checked.
My roles are in the proper order.  (Admin being at the bottom)
I created a new custom content type and that does not work either.  Even after enabling permissions.

Any insight would be greatly appreciated as I have never encountered this issue before.


texts:
In order to get entity link, I'm using:

$entity->getTranslation($language)->url();

So it gives me : /en/node/21

But I want this url to be absolute.

How to pass $options = array('absolute' => TRUE); in above node url?


texts: Setting a User Reference Programmatically in a Rule

texts:
Use Case: I have Supervisors creating (authoring) Employee Evaluations and need to give the employees view access to their past evaluations. In the evaluation node I have an existing select list with the employee names that has a key of the employees User ID (in LDAP).

I think that I can create the desired functionality with the References module to create the user reference and then the Node Access User Reference for permissioning.

Problem: I want the supervisor to select the employee name from a select list and then set the user reference programmatically (possible with a Rule that contains a PHP snippet action).

So Far I have tried the following in a Rule for the creation of a new Evaluation (with no success)

$username = $node->field_employee_name2[$node->language][0]['value'];
$user = user_load_by_name($username);
$user_id = $user->uid;
$node->field_employee_name_user_[$node->language][0]['uid']=$user_id;


texts:
I add contact form block in front page

And for some reason when I go to send messages it doesn't work. My site opens some page which is not front with this css, which doesn't exist on my front page. Also I don't receive any mail. On that page there is all content from front page but there is no css who is on front page.

<head-placeholder token="q2goFNv0--dtpJFM_4fZIJ8a13PQ4CARSwpHuSGhS5XqUhWfv60QQhZjM6B0JxHq-CohSC9hxg">
    <css-placeholder token="q2goFNv0--dtpJFM_4fZIJ8a13PQ4CARSwpHuSGhS5XqUhWfv60QQhZjM6B0JxHq-CohSC9hxg">
        <js-placeholder token="q2goFNv0--dtpJFM_4fZIJ8a13PQ4CARSwpHuSGhS5XqUhWfv60QQhZjM6B0JxHq-CohSC9hxg">

Also that page don't page  THEME HOOK: 'page'  suggestion. Its start from region.

And on site.com/contact Its work. I receive email, but after click on send messages I get this

  The website encountered an unexpected error. Please try again later.


texts: Remove extraneous Symbols/Characters in a variable

texts:
I have a variable $student whose value is from the database. When I tried displaying it in a table using Ajax callback function, it throws an error saying:

But when I initialized the variable $student with a constant string, the code turns out good. For example:

$student = 'Constant String';

I guess my problem is that $student fetch from the database contains symbols/characters, that causes Ajax to break out. Below is the sample characters:

"\0" - NULL
"\t" - tab
"\n" - new line
"\x0B" - vertical tab
"\r" - carriage return

How will I get rid of these characters in my variable?


texts:
In my preprocess_page() function, I'm setting variables based on the user that is logged in.

I created a custom page that is used as a Welcome page with the information about the user that I set in the variables in the preprocess_page() function.

The problem I have is that the page is not allowing me to put the print statements to echo out the variable, i.e.

<?php print $FirstName. " ".$LastName; ?>

It doesn't echo out the variable values.

Also, I need later to do something based on the value of a variable. I have tried using an if statement like this:

<?php
  if($designations == 'ABCDE') {
?>

</php
  } else {
?>
              &nbsp;
<?php
   }

but all it does is print out part of the PHP:

if($designations == 'ABCDE') {
?>
} else {
?>

What am I doing wrong here???

Updated (Added preprocess_page function code):

function mix_and_match_preprocess_page(&$vars) {
  $vars['page_color'] = theme_get_setting('mix_and_match_page_bg');
  if(user_is_logged_in()) {
    // Get the user's info and assign the values to variables.
    $vars['ParticipantID'] = 1007945;
    $vars['Username'] = 'JOESMITH';
    $vars['Password'] = 'passwd';
    $vars['FirstName'] = 'Joe';
    $vars['MiddleName'] = '';
    $vars['LastName'] = 'Smith';
    $vars['Suffix'] = '';
    $vars['PreferedEmailAddress'] = 'joe_smith@mysite.com';
  } // if($logged_in)
}

Showing new code and results:
This code:

<?php print $FirstName. " ".$LastName; ?>

produces (When view source):

<?php print $FirstName. " ".$LastName; ??>

this code:

drupal_set_message('I got here');
<?php if($designations == 'ABCDE': ?>

drupal_set_message('I got here');
<?php else: ?>
                  &nbsp;
<?php endif; ?>

produces (When view source):

drupal_set_message('I got here');

<?php if($designations == 'UACIC'): ??>

drupal_set_message('I got here');
<?php else: ??>

<?php endif; ??>


texts: Setting fallback values for a template based on a parent entity via entity reference

texts:
I have a node content hierarchy of Chain (parent) and Property (child), related by an entity reference (ER) on the Property back to Chain.

Each of these node types has an ER to a Skin (custom entity) - these Skins furthermore contain ERs to Slides (another custom entity) but I don't think that's important right now (Shirley!) This is all held together with Inline Entity Form.

I have a situation that I can't work out after many attempts. There is a multi-value field on the Property create page:

Make a new Skin (use the IEF on this page)
Use the parent values (use the Chain's skin)
Use fallback mechanism (where Property has no value set, use the Chain value)

This means I need to either:

process & inject the Chain's Skin into the Property's Skin template as an additional variable, and perform the either/ors in there based on the multi-value
preprocess the Skin so that the correct values are already present in the template so I can just "go ahead and render" based on the multi-value.

Ideally, I'd like to be able to just use the normal {{ content }} variables in the end template, either way. The first suggestion I tried, but I have got no idea, I've tried lots of things. The second looks like it might work with some sort of hook_entity_view[_alter] or similar, but I have been unable to deduce the correct approach or find a suitable example to copy.


texts:
I have this structure :

mobile

Lg

V10
V20

Samsung

A7
J5

Nokia

1100
1110

laptop ...
tablet ...

How can I create that with view expose filter? (step by step filter)


texts:
can i use entity id instead of node id to load node with node_load() function coz
i don't find any difference between entity id and node id . both node id and entity id return same result

$e_id = node_load($entity_id);
dpm($e_id);
$n_id = node_load($node_id);
dpm($n_id);

both $e_id and $n_id return exactly same result


texts:
I am using the Hosting module through Aegir. I created a module with some extra fields such as "site_name," "fields," and "description," which was done successfully. I want to use these fields on a newly created website. I am using this code in the new site:

function silverpack_config_menu() {
  // Create additional primary menu items
  $items = array(
    array('link_path' => '<front>', 'link_title' => t('Home'), 'weight' => 0),
    array('link_path' => 'node/2', 'link_title' =>t(drush_get_option('site_name')), 'weight' => 6),
    array('link_path' => 'node/3', 'link_title' => t('Contact'), 'weight' => 8),
     array('link_path' => 'node/4', 'link_title' => t('Contact US'), 'weight' => 10),
     array('link_path' => 'node/5', 'link_title' => t('Terms & Conditions'), 'weight' => 10),
     );

  foreach ($items as $item) {
    $item += array(
      'mlid' => 0,
      'module' => 'menu',
      'has_children' => 0,
      'options' => array(
        'attributes' => array(
          'title' => '',
        ),
      ),
      'customized' => 1,
      'original_item' => array(
        'link_title' => '',
        'mlid' => 0,
        'plid' => 0,
        'menu_name' => 'primary-links',
        'weight' => 1,
        'link_path' => '',
        'options' => array(),
        'module' => 'menu',
        'expanded' => 0,
        'hidden' => 0,
        'has_children' => 0,
      ),
      'description' => '',
      'expanded' => 0,
      'parent' => 'primary-links:0',
      'hidden' => 0,
      'plid' => 0,
      'menu_name' => 'primary-links',
    );
    menu_link_save($item);
  }

}

Here, I want to use drush_get_option('site_name'). "site_name" is one of the fields I use in Aegir's Hosting module.

Does anybody have an idea on how to do this?


texts: Multisite config directories of subsides

texts:
I set up a local Drupal 8 multisite, using Acquia dev desktop. It's working fine. I added all Drupal 8 core files to my local repository and pushed them to a central remote repository.

in sites/default/settings.php I added
$config_directories['staging'] = 'sites/default/config/staging';to
make the configuration directory versionable.
All sites (main site, subside1 and subside2) has different databases

But what about the sites/subside1/ and sites/subside2/ config files? Do I have to add also a different path for those files? Do those have to be versioned or not?

I want to clone my repo to make instances of this multisite for staging and live environments.


texts: Restrict forum access based on user (user list)

texts:
I need to restrict access to forums so that only selected users can access an individual forum. (The users should apply for a forum and a moderator should decide if the user should be allowed to participate in that forum or not.)

If users visit the forum listing page for the first time, they should only see all forums listed but they should not be able to see the topics.

I have used Flag module to implement a subscription system.

I have set a flag 'subscribe_forum' that allows users to flag a forum, and another flag 'approve_forum_subscription' that allows an administrator to flag a flagging, which means the subscription of the user is accepted.

What I want to do is to grant that user access only to those forums which he has subscribed to and has been approved by an administrator.

The solution you would suggest doesn't have to use this flag system. I am open to any other suggestions.

I have installed Forum Access module, however it allows me to restrict access based on roles, but I need to have a list of users for each individual forum. The only thing that is useful for my case on this module is the ability to set a moderator for individual forums.

Edit: I am also using Advanced Forum module to extend the functionality of the core Forum.

UPDATE:

I have mostly achieved my goal using Panel pages which are already provided by Advanced Forum, adding some custom selection rules.

I have added a PHP Code rule which returns TRUE if the user has flagged the forum, and a moderator accepted it (i.e. flagged the flagging of the user), and FALSE otherwise. I have also added a fallback variant which shows only an 'access denied' message in a panel pane.

I have done the same thing to the topic listing panel, as well.

Then, I have enabled the panel page that overrides node/node% and added 2 selection rules, one for checking if the content type is forum and the other one is the custom PHP.

So, I have almost what I wanted to have, but I am not yet completely sure if this method I follow is a good one. To be honest, I don't find it elegant enough.

I am still open to other suggestions. It can also be a completely different approach.

Thanks in advance.


texts:
I have one specific warning in Drupal 7 from the workbench module which I do not want to display. All other warnings should not be changed.

For now I edit the workbench module by comment the specific line which is not the way it should be solved for final.

I tried to use disables messages wit a specific regex but this is not working. I think because it is a warning and not a message.

I prefer to use hook_page_alter but cannot find the specific warning in the $vars array.

Any suggestion for this or what approach and possibility is there to solve this?


texts: Can you add a 'select all' option to a webform_select_options_list?

texts:
I have a webform that collects a list of flagged items. I'd like to add a "select all" option, because the list can get fairly long (50+) selections, and it can be tedious to manually check the boxes.

I'm using webform with views, sessions, and custom webform_select_options_info function.

Any ideas?


texts: Why do I get this error when I try to use db_change_field()?

texts:
My Drupal installation has a table with a field title of type varchar and length of 255.

For some custom process, I need to increase the length to 500 characters.

I tried doing so with the following code:

function mymodule_schema_alter(&$schema){
    if( isset($schema['field_data_field_document_title']) ){
        db_change_field('field_data_field_document_title', 'field_document_title_value', 'field_document_title_value',
            array(
                'length' => 11,
            )
        );

    }
}

Originally I had that code in my .module file. When I flushed caches I could verify using the DEVEL module that my field length changed. But in phpmyadmin the field length remained 255.

Then I migrated the function to the .install file. I execute run updates and get the following error:

  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 NULL' at line 1: ALTER TABLE {field_data_field_document_title} CHANGE field_document_title_value field_document_title_value DEFAULT NULL; Array ( ) in db_change_field() (line 3020 of /var/www/Intranet/includes/database/database.inc).

I could really use some help, please.


texts:
I have created a field groups programmatically using this code:

in *.module file

/**
 * Implements hook_ctools_plugin_api()
 */
 function field_test_module3_ctools_plugin_api($module, $api) {

      if ($module == 'field_group' && $api == 'field_group') {
        return array('version' => 1);
  }
}

in *.field_group.inc

/**
 * Implements hook_field_group_info()
 */

function field_test_module3_field_group_info(){

 $field_groups = array();
 $field_group = new stdClass();
 $field_group->disabled = FALSE; /* Edit this to true to make a default field_group disabled initially */
 $field_group->api_version = 1;
 $field_group->identifier = 'generale|node|field_esempio3|form';
 $field_group->group_name = 'generale';
 $field_group->entity_type = 'node';
 $field_group->bundle = 'field_esempio3';
 $field_group->mode = 'form';
 $field_group->parent_name = '';
 $field_group->data = array(
   'label' => 'Generale',
   'weight' => '2',
   'children' => array(
     0 => 'coverage',
   ),
   'format_type' => 'fieldset',
   'format_settings' => array(
     'formatter' => 'collapsed', //collapsible
     'instance_settings' => array(
       'description' => 'provo a creare un field group',
       'classes' => '', //generale field-group-fieldset
       'required_fields' => 1,
     ),
   ),
 );
 $field_groups['generale|node|field_esempio3|form'] = $field_group;

 return $field_groups;
}

===================================================

Field groups is created but not dysplayed.
Bottom of the page there is a section "Disabled fieldgroups" where it appears

If it's enable there are no problem but I need that fieldgroups is activated automatically.
There is a way to enable this fieldgroups programatically?

Thank you.


texts: How to check if a user has privs to access a node in organic groups

texts:
Does someone know what function within Organic Groups I can use to check if a user (the signed in user) as access to a given node? Do you have an example?

Thanks


texts: taxonomy_term entity loadByProperties depth not found

texts:
The terms returned contain depth as a Term object attribute.
$vocabulary = 'category';
$entity_manager = \Drupal::entityTypeManager();
$entity_storage = $entity_manager->getStorage('taxonomy_term');
$terms = $entity_storage->loadTree($vocabulary);

However, when I try to load terms by depth, I get an error.
$entity_manager = \Drupal::entityTypeManager();
$entity_storage = $entity_manager->getStorage('taxonomy_term');
$terms = $entity_storage->loadByProperties([
  'vid' => $vocabulary,
  'depth' => 0,
]);

The error is the following.

Uncaught PHP Exception Drupal\Core\Entity\Query\QueryException: "'depth' not found

What is the way to find attributes I can use on loadByProperties()?


texts: How do I transfer anonymous data the user when he registers?

texts:
I have a system for storing data (e.g. accessibility settings like colour contrast) for anonymous and authenticated users. Authenticated users have the data in a dedicated table.

For anonymous users I'm using CTools object cache so if the person keeps the session he won't lose his accessibility settings. (I might use this for storing searches as well.)

I could use Session API but there is a potential issue with European cookie law - yes, this is about site usability which theoretically trumps that law but it's a very public site so the client doesn't want any trouble, valid or not.

Okay, so here's the point: If a person registers I need to go from CTools to my custom storage. The actual process of doing that is simple enough but when a person registers, their session ID changes, so once they are logged in (e.g. when hook_user_register() gets called) the old session ID is dead and gone.

Any ideas how I can keep the old session ID, or transfer the data from not-logged-in to logged-in? (Putting the data in form_state in the user_register_form goes some of the distance, but not all of it.)


texts: How do I pre / post process aggregated css or js files?

texts:
I want to declare the character encoding of our aggregated css files - how would I be able to pre or post process the aggregated css files in Drupal 8?

E.g. injecting @charset "UTF-8"; on top of all css files.


texts: how to use a view to node field based on url

texts:
I have a content type A which has a node reference to another node (type B). I want to create a block (using views) to display the content of that node reference in a side block on its respective node page (type B).

I think this might be possible with either contextual filters or relationships, but as I have never used either, I'm not sure exactly how to do this. If I could use these, I imagine that I could use the url as a filter.


texts: How can i set the value of first field to the second in same form

texts:
I have a form with a value field and i would like to set the value to a markup field as shown below. The problem is that it retuns empty. Is there other alternatives.

public function buildForm(array $form, FormStateInterface $form_state) {
     $form['container']['#tree'] = TRUE;
     $form['container']['#type'] = 'container';
     $form['container']['store_value'] = [
         '#type' => 'value',
         '#value' => 'Angeline Mnene'
     ];
     $form['container']['show_value'] = [
         '#type' => 'markup',
         '#markup' => 'The stored value is: ' . $form_state-
          >getValue(['container','store_value']),
     ];

     return $form;
}


texts: I am displaying some view blocks on a page. The content is being filtered by passing the nid from the url into some custom php. I wish to change the block title to use a field from the node in question. Is this possible?


texts: How to add auto create feature to custom taxonomy_term field while creating custom entity

texts:
I created a custom module which has an custom entity.
I added base field term_id to it using below code

$fields['term_id'] = BaseFieldDefinition::create('entity_reference')
    ->setLabel(t('Category'))
    ->setDescription(t('Default Category.'))
    ->setRevisionable(TRUE)
    ->setSetting('target_type', 'taxonomy_term')
    ->setSetting('handler', 'default:taxonomy_term')
    ->setSetting('handler_settings', [
            'target_bundles' => ['question_category' => 'question_category']
        ]
    )
    ->setTranslatable(TRUE)
    ->setDisplayOptions('view', array(
        'label' => 'hidden',
        'type' => 'author',
        'weight' => 0,
    ))
    ->setDisplayOptions('form', array(
        'type' => 'entity_reference_autocomplete',
        'weight' => 5,
        'settings' => array(
            'match_operator' => 'CONTAINS',
            'size' => '60',
            'autocomplete_type' => 'tags',
            'placeholder' => '',
        ),
    ))
    ->setDisplayConfigurable('form', TRUE)
    ->setDisplayConfigurable('view', TRUE);

I have a YAML file taxonomy.vocabulary.question_category.yml,
which create question_category vocabulary, I can see it in admin too.

But when I try to add a new text in it. I get an error
There are no entities matching ||new enitity title||

I want user to create terms and add it to question_category taxonomy.

Please suggest, what might be the error.

--

Thanks


texts:
I have a custom block that reads information from the database. As the user will be filling out a form, refreshing the page and viewing the block it cannot be cached. How do I fix this?

I have tried:

$build['#cache']['max-age'] = 0;

And this did not fix it.

I also tried copying the code from the custom block to the top of the form, so it runs as part of the page, here it doesn't cache. Unfortunately this isn't a solution as I need the block on another page also.


texts: Why isn't hook_node_access() invoked when a node is created?

texts:
The following code doesn't work.
function mymodule_node_access(\Drupal\node\NodeInterface $node, $op, \Drupal\Core\Session\AccountInterface $account) {
    $type = $node->getType();

  if ($type == 'application' && $op == 'create' && arg(3) != "" ) {
    print_r(arg(3));
    return AccessResult::neutral();
  }
  else {
    // ...
    return AccessResult::forbidden();
  }
}

Could you tell me what is wrong in the code?


texts: Limit Change to Read More Link in Node Teaser to One Content Type

texts:
Building on this answer:

/**
 * Implements hook_preprocess_links().
 */
function bartik_preprocess_links(&$variables) {
    if (isset($variables['links']['node-readmore'])) {
      $variables['links']['node-readmore']['link']['#title'] = t('Read more custom text');
    }
}

does anyone know how to build the if statement to further limit the change in the read more link to a particular content type? I'm working in Drupal 8, not 7.


texts: How to allow user's of a certain role to change the node creation date

texts:
I want to allow some users (a role) to change the node creation date (ideally on the node's form).

I could add permission 'administer nodes' to this role but it's too strong
I could create a new field for this date, but i want to keep the drupal submitted informations on the top of the node

If someone have any idea, thanks


texts: How to create a block with taxonomy terms and their corresponding nodes?

texts:
This is what I want to achieve in views:

Taxonomy vocabular "Categories":

Term 1 -> 3 node titles;

Term 2 -> 3 node titles;

Term 3 -> 3 node titles;


texts: How do I display the correct amount of nodes on a view?

texts:
I have a content type called "spotlight". It's just a box that sits at the bottom of each page with related content inside of it. I have the view set up correctly to display 4 items (because that is the max per row and I only want 1 row) and it displays perfectly on the front page, displaying 4 spotlights.

Now on my other page I only want to display 3 spotlights. I add only three and leave the last one blank. Instead of displaying 3 spotlights, it displays the 3 spotlights I called out then repeats the first one again.

It's almost like if I still only added 3 spotlights but set the pager to display 150 items, it would just display those same 3 over and over 50 times in a row.


texts: How to get all database which can be used in 'db_set_active'

texts:
Is there any way to list all possible database connections using Drush?
I am debugging an application where db connections are not written in settings.php and I'm not able to find all possible connections. And in code I can see

$database = db_set_active('test');

Is there any way to list the db connection names like test, test1, test2?
Any help is appreciated.


texts:
I am trying to change the format of the content promoted to the front page. I want to move the display order of the title below the image. By default it's set to title, image and then Read More.

Editing the content type (manage field, manage displays) does not do anything in this regard.

Manage display: I've set the order from Image first then Body. (no effect)

Teaser: I've set it to only show the Image (body is hidden) (no effect)

I've read the docs to change the page.tpl.php to page--front.tpl.php but I don't see any options to move the title down below the image in this file. (I only see this code in node.tpl.php.)

I can move the title block under the content block and it works, but this affects all pages.

How can I change this only for the front page, so it doesn't affect all pages?

node.tpl.php

Title block

<?php print render($title_prefix); ?>
<?php if (!$page): ?>
 <h2<?php print $title_attributes; ?>>
  <a href="<?php print $node_url; ?>"><?php print $title; ?>

<?php endif; ?>
<?php print render($title_suffix); ?>

Content block

<div class="content clearfix"<?php print $content_attributes; ?>>
<?php
  // We hide the comments and links now so that we can render them later.
  hide($content['comments']);
  hide($content['links']);
  print render($content);
?>


texts:
I am trying to make a submission from one page that has a form to another dynamic page with a form. As you can see in my hook menu I'm using drupal_get_form as the callback and I would think this would normally work, since I am able to go to the 1st form just fine without any problems.

I do notice I get this error when I submit to the URL, the page is simply not rendering the 2nd form or the contents I have in the function that is suppose to display in the mark up of the 2nd form.

This is the error I get

Notice: Undefined index: listings_mini_form in drupal_retrieve_form() (line 764 of /home/domain/public_html/includes/form.inc).
Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'listings_mini_form' not found or invalid function name in drupal_retrieve_form() (line 799 of /home/domain/public_html/includes/form.inc)

This is not a multiform rather it is 2 different pages with their own forms.

Any suggestions?

/**
 * Implements hook_menu().
 */
function listings_menu() {
    $items = array();

    $items['site/listings'] = array(
        'title' => 'State Listings',
        'page callback' => 'drupal_get_form',
        'page arguments' => array('listings_form'),
        'access arguments' => array('access content'),
    );

    $items['site/listings/%/%'] = array(
        'title' => 'Business Listings',
        'page callback' => 'drupal_get_form',
        'page arguments' => array('listings_mini_form'),
        'access arguments' => array('access content')
    );

    return $items;

}

/*
 *  FIRST FORM
 */

function listings_form($form, &$form_state){

    $form['zipcode'] = array(
        '#title' => t('Zipcode'),
        '#type' => 'textfield',
        '#maxlength' => 5,
    );

    $form['form-wrapper']['form-wrapper-zip']['submit'] = array(
        '#type' => 'submit',
        '#value' =>  t('Submit')
    );

    return $form;
}

/*
 *  FIRST FORM SUBMIT FUNCTION
 */

function listings_form_submit($form, &$form_state){

    $zipcode = $form_state['values']['zipcode'];

    $form_state['redirect'] = 'site/listings/'.strtolower(listings_db_state($zipcode)).'/'.strtolower(str_replace(' ', '+', listing_db_city($zipcode)));
}

/*
 *  2ND FORM ON PAGE IM CALLING
 */

function listings_mini_form($form, &$form_state){

    $form['mini-form'] =  array(
        '#title' => t('Enter your Zip Code for more listings.'),
        '#type' => 'textfield',
        '#maxlength' => 5,
    );

    $form['submit'] = array(
        '#type' => 'submit',
        '#value' =>  t('Submit')
    );

    if(isset($form_state['values'])){
        $form['page_output'] = array(
            '#markup' => listings_list_view($form, $form_state)
        );
    }

}

/*
 *  2ND FORM SUBMIT FUNCTION
 */

function listings_mini_form_submit($form, &$form_state){

    $zipcode = $form_state['values']['zipcode'];

    $form_state['redirect'] = 'site/listings/'.strtolower(listings_db_state($zipcode)).'/'.strtolower(str_replace(' ', '+', listing_db_city($zipcode)));
}

/*
 *  FUNCTION WITH LISTINGS INSIDE OF IT
 */

function listings_list_view($form, &$form_state){

    global $base_url;

    $zipcode = isset($form_state['values']['zipcode']);
     dpr($zipcode);

     #blah blah blah
}


texts: Contextual Filter (Author's Username) Multiple usernames

texts:
I'm setting up a custom Views RSS Feed that looks something like this.

The problem is, when I add one user name as a filter, it works but anything after it, the view will not show the post of the other user. Ex: If my name is X and I put X in for the filter, it shows X's post but if I put in X/Y, only X's posts will show.


texts: What is the true impact of Panels Everywhere on theming and layout duties?

texts:
From an answer on another question:

  If you have chosen Precision because it is minimalist, then you might
  want to consider adding the 'Panels Everywhere' module. This module
  works very well with Panels (same authors) and allows you to bypass
  the Drupal Theming process altogether. This greatly simplified my
  styling work.

Does this mean regions and blocks are completely ignored with Panels Everywhere (PE) in favor of panels only?
If so, does it mean one has to recreate some layout for standard pages such as node edition and publishing for example? I have an editor user profile to create specific content. Do I loose all the layout of existing Drupal screens the user could access?
After enabling PE, what configuration is expected regarding layout and theming (CSS) on standard pages delivered by Drupal?

Fact is, when trying PE with the Precision theme, I lost layout on all standard pages, but I want to know if this is a configuration issue or not.


texts: display selectable drop down options based on a checkbox selection

texts: I am trying to create a form in Drupal. I want to create the following situation: if a  checkbox is selected I want to display a drop down menu. can you please suggest a way to do it.


texts: Domain access issue w.r.t viewing a content other than admin user

texts:
I am using domain access module with sub domains and content creation.

I am able to create content but I am not able to view content which was created by the user, it says You are not authorized to access this page where as admin I am able to create and view content.

In my another local site I tried domain access module and for other roles I am able to crate and view and edit the content. I don't have any issues. Same settings only I have for my another site.

But still it throws me this error You are not authorized to access this page after creating a content and in view section it shows this error.

Is any other module causing this issue?


texts: How do I let users be able to view, update and delete their own content?

texts:
I want to let users view a list of their own content and also be able to edit or delete them same as "/admin/content" page.

However, giving access to edit and delete their own content can be achieved using Node Access Rules or setting the access to user type at Permissions tab.

Thanks for the help.


texts:
In Drupal 8 you can export configuration and move that to a production server. In core.extensions.yml there is an exported list of the enabled modules. If on development I have devel and other auxiliary modules installed these are added in that file but I do not want that to be part of the production environment.

Is there a switch to do that? How can master module from Drupal 7 replicated here?


texts: Drupal 7 doesn't allow search in chinese character

texts:
I'm using drupal 7 multilanguage site. When I enter chinese character (UTF8) in search box and search, it gives error like below:

Bad Request

Your browser sent a request that this server could not understand.

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

Can I know what's the problem and how to solve it?

Thank you in advance.


texts: How to make link unchangeable when using Pathauto?

texts:
Link for each node is made with Pathauto based on several fields.
Those fields are required so when user makes the node first time, link is generated.

I would like to leave these links unchangeable if user changes something later in those fields (which is needed).

I consider this would be better solution then auto301 each link as this would cause thousands of them later on which is bad for SEO.

How to make link that is created first time by Pathauto unchangable even if the user changes fields that are part of pathauto tokens ?


texts: How do you programatically render a views exposed filter form block in a tpl in Drupal 6?

texts: I am trying to setup my views exposed filter form block in a custom tpl. How do I do this programatically? Note: My views setup display type is a page with a separate exposed filter form block.


texts: How to use jquery to show divs based on select box?

texts:
This is a follow on to my previous question. I didn't want to make ajax calls for this and instead loaded all the term field text with views_get_view_result(). Then I looped over the results and created divs within the node add/edit form.

I know have for every term option in the select box a hidden div:

help text for termid 123

I added a

scripts[] = custom.js

to my module.info file with:

(function($){
$("#edit-field-disc-topic-und").click(function(){
    var option = document.getElementById("edit-field-disc-topic-und").value;
    document.getElementById(option).style.visibility ="visible";
})
})(jQuery);

Should I post this on Stackoverflow instead?


texts:
Using Drupal 7, I have a block that displays a view. It contains a simple aggregator list view. The aggregator item titles are links to an external website and I want them to open in a new window.

I found the code that renders the link in modules/aggregator/views_handler_field_aggregator_title_link.inc, line 45 in class views_handler_field_aggregator_title_link function render_link()
https://api.drupal.org/api/views/modules%21aggregator%21views_handler_field_aggregator_title_link.inc/function/views_handler_field_aggregator_title_link%3A%3Arender_link/7.x-3.x

I can add $this->options['alter']['target'] = '_blank'; to make the link render correctly, but obviously I don't want to change the core module code. What is the correct place to achieve this?


texts: Enabling a custom module generates errors for undefined regions when blocks are enabled.

texts:
A custom module defines some blocks, with this sample definition:

  return array(
    'info'        => 'Site Header',
    'cache'       => DRUPAL_NO_CACHE, // @TODO change it later
    'status'      => TRUE,
    'region'      => 'header',
    'visibility'  => BLOCK_VISIBILITY_NOTLISTED,
  //  'page'        => '<front>',
  );

When enabling the module, I get the following error:

The block Site Header was assigned to the invalid region header and has been disabled.

The same happens for all blocks defined in this module. The regions exist in both admin and site theme, as I inserted a var_dump in block.admin.inc.

array(13) {
  ["content"]=>
  string(7) "Content"
  ["bigBox"]=>
  string(7) "Big Box"
  ["headline"]=>
  string(18) "Headline caroussel"
  ["leftCol"]=>
  string(17) "Colonne de gauche"
  ["rightCol"]=>
  string(17) "Colonne de droite"
  ["navigation"]=>
  string(14) "Navigation bar"
  ["header"]=>
  string(6) "Header"
  ["footer"]=>
  string(6) "Footer"
  ["page_top"]=>
  string(8) "Page top"
  ["page_bottom"]=>
   string(11) "Page bottom"
  ["dashboard_main"]=>
  string(16) "Dashboard (main)"
  ["dashboard_sidebar"]=>
  string(19) "Dashboard (sidebar)"
  ["dashboard_inactive"]=>
  string(20) "Dashboard (inactive)"
}

Does anyone have an idea of how I can overcome this issue?


texts:
I my .info file I have this:

regions[footermenu] = Footer Menu

The region--footer.tp.php has this:

<?php
    print render($page['footermenu']);
?>

I've placed a menu block in the "Footer Menu" (it shows up under structure->blocks). However, it's blank. If I place the block in region I know works the menu content is seen fine. Any idea why the region wouldn't see the block?


texts: Remove library from page based on node field value

texts:
We have a content type, Basic Page, where we may want to include 3rd party CSS such as Bootstrap. However, this 3rd party CSS may conflict with our custom theme, mytheme. On the Basic Page, we added a custom field of type Boolean, field_include_css, that a content editor can set to true if they want to use the Bootstrap CSS instead of mytheme.

How would we remove all the libraries added to the page that come from mytheme?

Here is what we tried, but did not work.

function mytheme_preprocess_page(&$variables) {
  $node = $variables['node']'
  // Basic page's machine name is page.
  if(is_object($node) && $node->getType() == 'page' && $node->field_include_css->value == '1') {
    unset($variables['page']['#attached']['library']);

    // above line didn't work so we also tried these, but they failed too.
    $variables['page']['#attached']['library'] = '';
    $variables['#attached']['library'] = '';
    unset($variables['#attached']['library']);
  }
}


texts: What to do when saving nodes one-by-one and bulk resaving give different results

texts:
I'm using the Location Taxonomize module with the Address Field module to create a vocabulary of node locations.

I want to re-create the locations from scratch, and I have a term reference field attached to the node.  This term reference field contains a reference to the automatically generated Location Taxonomize vocabulary.

The problem is, after I delete the vocabulary and term reference field and then re-create them, I cannot use VBO to re-save my nodes to automatically generate the Location Taxonomize terms and fill in the term reference fields.  Instead, I have to save the nodes one-by-one, but there are 30,000+ nodes.

In other words: saving nodes individually works fine, but saving nodes in bulk does nothing.

The relevant code from Location Taxonomize Address Field submodule looks like this:

function location_taxonomize_af_element_submitted($form, &$form_state) {
  $lang = 'und';
  // Act on values
  $fields = $form_state['temporary']['addressfields'];
  $items = array();
  foreach ($fields as $field) {
    $deltas = $form_state['values'][$field][$lang];
    foreach ($deltas as $delta => $values) {
      // Don't process 'add more'.
      if (is_numeric($delta)) {
        // Add the Administrative Area name, if possible
        if (isset($form[$field][$lang][$delta]['locality_block']['administrative_area']['#options'])) {
          $options = $form[$field][$lang][$delta]['locality_block']['administrative_area']['#options'];
          $values['administrative_area_name'] = $options[$values['administrative_area']];
        }
        // Add the country name
        $values['country_name'] = location_taxonomize_get_country_name($values['country']);
        $items[] = $values;
      }
    }
  }
  // taxonomize
  if (!empty($items)) {
    location_taxonomize_taxonomize($items, $form, $form_state);
  }
}

As far as I can tell, this code is added by a submit handler, so when the nodes are re-saved using VBO, the submit handler is not called (I could be wrong about this; I am in over my head in this part of Drupal).  What I want to do is force this bit of code to be called with VBO-- I know how to make a Rules action in code, but for nodes, that gives me the variable $node, not $form.  Is there some way to go from $node to $form to run this code?  Or, is there some way to re-save a node in a bulk operation as if it were saved individually?


texts: Which module should I use to manage translations in D7?

texts:
I want to develop a multilingual site with support for which I followed this site. But after doing the initial steps I am not getting the translation management.

I downloaded the Hindi translation package, internationalization, locale modules have been installed. Unable to install the internationalization views as it's not compatible with Drupal 7.x

Translation management is also not supported

So how can I translate my site to any other language?

I'm using Drupal v7.34.


texts: Check if the user has flagged content with any flag

texts:
It is possible with the following code to check if a content has been flagged by the current user with a certain flag:
$flag = flag_get_flag('flag_name');
if ($flag && $flag->is_flagged($node->nid, $GLOBALS['user']->uid)) {
  print "This node is flagged";
}

But, how to check if the user has flagged content with any flag ?


texts: How to place images in footer region through page.tpl.php

texts: I would like to know how to place images in footer region through page.tpl.php. I know a block can be created and done so but i want to do so using page.tpl.php. Where should i write the code?


texts: Is there any method yet for cloning existing products in Drupal Commerce 2?


texts: How to debug invalid plugins derived by the GraphQL module?

texts:
I'm currently using the GraphQL module in combination with the Brightcove module.

When I visit /graphql/explorer, all I'm getting is a totally white screen. When I visit /graphql/voyager, I end up with an "invalid syntax" error. My supposition is that one of the derived Brightcove plugins has invalid definitions. Unfortunately, GraphQL doesn't seem to throw any sort of error message.

Any ideas on how I can debug GraphQL?


texts:
My field_image is not rendering on user-profile.tpl. I have the following code (two different ways to render for testing):

    $image = field_get_items('user', $user, 'field_image');
    $output = field_view_value('user', $user, 'field_image', $image[0], array(
      'type' => 'image',
      'settings' => array(
        'image_style' => 'header_image_160x160',
      ),
    ));
    print render($output);

This produces the following in html:

<img src="https://coinme.io/sites/default/files/styles/header_image_160x160/public?itok=f31sbmSd" width="160" height="160" alt="">

I get the dead image logo. It is missing the final part of the file structure. And this is how I normally render:

$to_render = field_view_field('user', $user, 'field_image', array('settings' => array('image_style' => 'header_image_160x160'))); print render($to_render);

This is showing the default image, even though the image does exist:

https://coinme.io/sites/default/files/styles/header_image_160x160/public/images/profile/profile-large.png?itok=rb-2qFOw

I have the same field in a content type which is rendering correctly (only difference being the $user user -> $node node.

<?php $to_render = field_view_field('node', $node, 'field_image', array('settings' => array('image_style' => 'header_image_160x160'))); print render($to_render);?>

So it appears that when using user-profile specifically is the issue. I have also tried adding a new field type and same effect. Any suggestions?

Thanks,
Paul.


texts:
I have a sidebar block and a content block. I want display both of them as inline. But my Bootstrap theme gives me one section (row) with col-sm-12, how can I create a new row, with a sidebar (col-sm-4) and a content block (col-sm-8).

I have no idea on how to do this. Do I Need a extra module or do I achieve them with settings in my theme?


texts:
I've created a new block in my views.

Let's say the block name is 'slideshow'.

I've put the block into "Main Content" region and it's showing up.

The problem is that "Main Content" region is also displaying a list of nodes of "slideshow" with unformatted. So basically, "Main Content" region is displaying both unformatted version of "slideshow" and "slideshow"

when I inspect unformatted slideshow block, it has an id of "block-system-main".

How do I remove block-system-main ?


texts:
I have a custom content type named Movie.

Every user must have 3 lists of movies :-

1) seen

2) want to see

3) watching right now

Right now i am solving these by adding three flags(seen,want to see,watching) on movie content.
That is on every movie node and teaser these 3 flags are shown.and by clicking those flags user can add that particular movie to corresponding list.
But these 3 buttons make the look clumsy and the users are finding it not too easy to populate their list of movies.

Now i want to have a ADD button, that should appear on every movie node and teaser ,when a user hovers on the add button or clicks on it ,those 3 flags should appear, and then the user by selecting the corresponding flag, can populate his list.

And this should be ajaxified.

How can i do this??

I am using Drupal 7 and the flag module.

Please help :-)

THANX IN ADVANCE


texts:
I'm trying to add a new fields with hook_form_alter on user_profile_form. From the core module right now there are:

Password confirm

Pass and re-enter pass

E-mail

This is the part of my code:

/*
 * Implements hook_form_alter().
 */

 function mymodule_form_alter (&$form, &$form_state, $form_id) {

switch ($form_id) {
        case 'user_profile_form':

        $form['account']['telephone'] = array(
        '#type' => 'textfield',
        '#title' => t('New mobile'),
        );

        $form['account']['pass_title'] = array(
        '#type' => 'markup',
        '#markup' => '
Password change
',
        '#weight' => -6,
        );

        //krumo($form);
        break;
        }
}

As you can see I've added the telephone field into the form, but when I add text into that text field it doesn't save. The url is user/%/edit. I'm missing something.

The core fields password and email are properly saving.

The next thing is to do is when I add a new field on user_profile_form to be displayed into user/%.

Previously I've mention admin/config/people/accounts/fields, when I add a field from there let's say "telephone" it's working great. On user/%/edit is appearing as a form field and on user/% the result is rendering well. But my idea is: when I've added this field I want to have a title over the "telephone" field result. The title will be "Changing telephone" and bellow will be displayed the "telephone" field result (the result is what the user filled in the textfield on user/%/edit).

@Alfred Armstrong post helped a lot.

With The Field group module this is possible to achieve. It's amazing that on user_profile_form I can use fieldset and wrap the field into, it displays into user/%/edit  and on display field that render the results on user/% I can use different fieldset and with little CSS I can do exactly what I want. Many thanks to Alfred Amstrong for showing me this module and thank you all who helped me to find an aswer for this task. I wish I could add +1 to you all :)


texts: Scalable way to add custom css/js to a page

texts:
So I'm working on a site where the ability to add custom javascript is core to the site's functionality. Right now, I'm using the Code Per Node module to handle this, but I have a feeling it's going to be a bit unwieldy when I'm dealing with 20 or 30 pages with custom javascript. Also, I'd love to have a way to keep the js in source control, not the database.

In my mind, the idea solution would be able to either upload or reference an existing javascript file to be loaded in a script block at the bottom of the page. Or, alternatively, pay close attention to how I'm calling things on the DOM and just have all of javascript files minified into one that would be called by my theme's .info file.

Is there a better alternate approach to this problem?


texts: Change the submit function for user login

texts:
I'm building a site for a client that already has a website through another CMS that they do not wish to move away from despite my best efforts to convince them otherwise.

This CMS does offer an api that allows for implementation for single sign on so I'm trying to set that up.

I've gotten as far as

    function mymodule_form_alter(&$form, &$form_state, $form_id)
    {
        if ($form_id == 'user_login') {
            $form['#submit'] = ['mymodule_login'];
        }
    }

    function mymodule_login($form, &$form_state)
    {
        exit('SUCCESS');
    }

But the success message is never shown.

Oh, I tried searching to see if there was already a module that implemented this but no such luck.


texts: How to change title of "Log in" link in account menu for anonymous users?

texts: How to change title of "Log in" link in account menu for anonymous users in Drupal 8? Thanks for any suggestions.


texts: Print User Registration Block Through template.php file

texts:
I just want to print the user registration block through my template.php file without using the Form Block or Enabling php on my site to use this code:

<?php

if(user_is_anonymous()) {
  $form = drupal_get_form('user_register_form');
  print drupal_render($form);
}

?>

I have tried the following:

function my_template_form_alter {

      $form = drupal_get_form('user_register_form');
      print drupal_render($form);
}

I want this block to appear on my blocks administration page just like the user login block, so I can place it anywhere I like. Any help as per how to achieve this? Thanks


texts: How to stop views from slicing ISO:8601 date time attributes in rewrite results of a field?

texts:
In a Barrio BS4 subtheme I am working on I included the most recent release of  Timeago.js as a library, since the ago formatter still seems broken for multilingual.

So, in a couple of views I am making use of the HTML5 time tag. Basically, this:

<time class="timeago" datetime="2008-07-17T09:24:17Z">July 17, 2008</time>

Actually, more like this:

<time class="timeago" datetime="{{ Created }}">{{ Created_1 }}</time>

The previous version of Timeago(1.5.something)made use of UNIX time stamps, and I have that functioning fine in some older BS3 subthemes. However, when trying to include the twigged 'authored on' date as an ISO:8601, the resulting attribute is trimmed to only the digits after the last colon.

Why is that happening? I'd like to know.


texts: How to include block using machine name?

texts:
I created a custom block that I want to include in my template file. But I don't want to include using block id. Is there any way to do it?

I enabled the box module so a machine name is added with each block. I want to add using machine name.


texts: Find a node/page in admin by looking at the code

texts:
I'm very new to Drupal, and I want to edit some text on the front page. In the page.tpl.php, I have this code print render($page['content']), if I remove it, then the area that I want to edit with is disappeared from the front page, so I know this is the right part, but how can I find out which page, content, or node is being called in the backend?

I'm using Drupal 7.55.


texts: Can I "drush rsync" with "chown @ destination"?

texts:
I understand that drush rsync is, by design, capable of preserving uid:gid.

if I am synchronizing with drush rsync @site1 @site2, and uid:did exists on both site1, and site2, all is well.

How would I go about changing the uid:gid to a specific selection on site2, within drush's command/alias config?

For example, on site1 all files are wwwrun:www, but on site2 I want to save all files as bob:admins, neither of which exists on site1.

Is there an integrated solution?  I know I can use 'drush ssh @site2 "chown ..."' as a subsequent step. Can I instead define/chain the command in aliases.drush.rc?

Using "remote-user=xxx" certainly works, but, apparently, it is limited to users that are allowed SSH access on the remote box.

@ remote
egrep -i "allowusers" /usr/local/etc/ssh/sshd_config
    AllowUsers         root locuse testuser

@ local
whoami
    locuse
drush --remote-user=testuser rsync @siteA @siteB
    You will destroy data from locuse@siteB.loc:/srv/www/siteB/ and replace with data from /srv/www/siteA//
    Do you really want to continue? (y/n): y

@ remote
ls -al PROD/ | head -n 5
    total 248K
    drwsrws--- 10 testuser users 4.0K Mar  8 00:08 ./
    drwxrwx---  4 wwwrun   www   4.0K Mar  8 08:11 ../
    -rw-rw----  1 testuser users 6.5K Mar  6 17:31 authorize.php
    -rw-rw----  1 testuser users  64K Mar  6 17:31 CHANGELOG.txt
    -rw-rw----  1 testuser users  996 Mar  6 17:31 COPYRIGHT.txt

That doesn't address my particular issue/interest.

More clearly, what I want to do is ssh-in from local->remote as an authorized user ('locuse' or 'root'), but I have the remote files' uid:gid set to an existing pair, where the target uid does/will NOT have ssh-access (e.g., wwwrun:www).

Reading the output of "man rsync," I read:

  USING RSYNC-DAEMON FEATURES VIA A REMOTE-SHELL CONNECTION

Then @siteB

mkdir -p            /path/to/target
chown -R wwwrun:www /path/to/target

vi /etc/rsyncd.conf
    transfer logging = true
    log format       = %h %o %f %l %b
    log file         = /var/log/rsyncd.log
    pid file         = /var/run/rsyncd.pid
    lock file        = /var/run/rsync.lock
    hosts deny       = *
    use chroot       = no
    [siteB]
        path = /path/to/target
        hosts allow = *
        comment = COMMENTS
        uid = wwwrun
        gid = www
        read only = no
        list = yes

and @local

whoami
    locuse
ls -al ~/SourceDir
    total 240K
    drwxrwxrwx  2 locuse users 4.0K Mar  8 10:42 ./
    drwxr-xr-x 27 locuse users 4.0K Mar  8 10:41 ../
    -rw-r--r--  1 locuse users 5.2K Mar  8 10:43 file1.txt
    -rw-r--r--  1 locuse users 2.8K Mar  8 10:43 file2.txt

rsync -av --rsh=ssh ~/SourceDir/ root@siteB.loc::SiteB

Checking on remote:

ls -al /path/to/target
    total 240K
    drwxrwxrwx  2 root   root 4.0K Mar  8 10:42 ./
    drwxr-xr-x 27 wwwrun www  4.0K Mar  8 10:41 ../
    -rw-r--r--  1 wwwrun www  5.2K Mar  8 10:43 file1.txt
    -rw-r--r--  1 wwwrun www  2.8K Mar  8 10:43 file2.txt

It ends up with exactly the end-state I'm after.


texts: While making custom URL, Meta tags is not displaying custom URL?

texts:
I'm using drupal 7 and using meta-tag module, while inserting the custom url I'm not able to get the custom url display in the source code.

If i insert in meta-tag page title: user [node:title] | [site:name] its display the url in source code,
but if i insert this kind of url hello drupal its not displaying this url.

what should I do so that my custom url can be display while serching the source code in browser.


texts: Form API Submit Button for Multiple Forms

texts: I created a module with 3 forms on it. Is there a way to only have one submit button at the very bottom of the page that will store all three values?


texts: I want to override the template of the contact page

texts:
I use bootstrap as theme in Drupal 8, and I created a sub-theme. I want to override the contact page with a custom template.

I added debug: true in services.yml, but I didn't find the right template to recreate it in the sub-theme.


texts: Cloning Node with Webform and Conditional Confirmation Message

texts: I currently have an "Event" content type with a webform attached to each event. The webforms use the conditional confirmation message module to display different confirmation messages depending on the input to the form. I'm using the node clone module to duplicate events and everything works well expect that the conditional confirmation messages are not being duplicated. What should I do so that every part of the event node (including the conditional confirmation messages) is duplicated?


texts: taxonomy menu select list with redirect when a menu item is selected

texts:
I'd like to have a taxonomy drop-down list like the one in www.1mobile.com.

When I select an term, it should go to the respective page, showing products concerning with selected term.
I tried Custom Search module. But as far as I concern, it is not meet my requirement.

What is the best way to fulfill this requirement?


texts:
could you help me to fix my problem?
note:
each user have two field (fields are taxonomy reference)

I want to get two fields with OR condition
the output of my code returns in the shape of AND result

here is my code :

 $query = new EntityFieldQuery();
  $query->entityCondition('entity_type', 'user')
        ->propertyCondition('status', 1)
        ->fieldCondition('field_software_abilities', 'tid', $abilities, 'IN')
    ->fieldCondition('field_other_abilities', 'tid', $abilities, 'IN');
    $result = $query->execute();

I read an article about using addtag and hook_query_tag_alter()
but I can't use it


texts: Node access by role or user, what module(s) should I use?

texts:
I'm trying to limit the access to certain nodes in certain content types by role. So far I wasn't able to find any suitable module that would do just that.

Please take into consideration that content type access by role is not enough (but surely, I'll look into any suggested module that does this too), it must go to the node level.
Are you aware of any module that might do it?

This might be another question but since it's so closely related and it could solve my problem I'll put it here too:
I know about nodeaccess, however when I programmatically load nodes using $node = node_load($nid), there's no item in the $node array that suggests node access permissions were set. Everything else is there including those "pesky" CCK fields. Am I doing something wrong here?

Thanks in advance.


texts:
I altered node_type_edit_form and added a section to get some settings like below:

Now I need to save the configurations and build the default value based on last selection using Configuration API .

The problem is it needs to build the fields selected (checkbox) in every content type form.


texts: How to change the check box to radio buttons Yes/No in tableselect form api?

texts:
How can I add a radio buttons with Yes/No options instead of the checkbox in the tableselect form (api)?

Here is the code in form.inc on line (3376):

$element[$key] = array(
        '#type' => 'checkbox',
        '#title' => $title,
        '#title_display' => 'invisible',
        '#return_value' => $key,
        '#default_value' => isset($value[$key]) ? $key : NULL,
        '#attributes' => $element['#attributes'],
      );

I changed the code like this:

$element[$key] = array(
        '#type' => 'radios',
        '#title' => $title,
        '#title_display' => 'invisible',
        '#options' => array(
          '1'   => t('Yes'),
          '0' => t('No'),
        ),
        '#return_value' => $key,
        '#default_value' => isset($value[$key]) ? $key : NULL,
        '#attributes' => $element['#attributes'],
      );

When I run it, it shows the form perfectly. But when I click the Submit button it gives me this error:

  "An illegal choice has been detected. Please contact the site administrator."

Any help?


texts:
I am working on a login form (information sent via https to a remote system), that by default contains a username field, a password field and a static hidden field (necessary in order to validate with the remote system).

There is one additional hidden field necessary, which should be built from the value of the username and the value of the existing hidden validation field, separated by an underscore, like this: username_hidden_id

Is it possible to achieve that after the form has been submitted? I tried to add the field using the form submit function, but that doesn't seem to work.

I could add this the mentioned field and generate it's value via JavaScript/jQuery, but I wouldn't like to have this field visible/public.

I have the following code:

function custom_login_form($form, $form_state) {

    $form['username'] = array(
      '#type' => 'textfield',
      '#title' => t('Username'),
      '#maxlength' => USERNAME_MAX_LENGTH,
      '#size' => 15,
      '#required' => TRUE,
    );
    $form['password'] = array(
      '#type' => 'password',
      '#title' => t('Password'),
      '#size' => 15,
      '#required' => TRUE,
    );
    // Hidden validation field
    $form['hidden_id'] = array(
      '#type' => 'hidden',
      '#value' => '1234',
    );
    // Submit button
    $form['actions'] = array('#type' => 'actions');
    $form['actions']['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Log in'),
    );

    return $form;
}

function custom_login_form_validate(&$form, &$form_state) {

  if (empty($form_state['values']['username'])) {
    form_set_error('username', 'Please enter a username.');
    $form_state['rebuild'] = TRUE;
  }
  if (empty($form_state['values']['password'])) {
    form_set_error('password', 'Please enter a password.');
    $form_state['rebuild'] = TRUE;
  }

}

function custom_login_form_submit(&$form, &$form_state) {

  if (isset($form_state['input']) && !empty($form_state['input']['username']) && !empty($form_state['input']['hidden_id'])) {
    $form['username_hidden_id'] = array(
      '#type' => 'hidden',
      '#value' => $form_state['values']['username'] . '-' . $form_state['values']['hidden_id'],
    );
  }

}


texts: How do I allow users to just click a marker on an OpenLayers map to go directly to the node?

texts: I am using the OpenLayers module and it appears that I can add a popup and a tooltip behaviour if a users clicks or hovers over a marker on a map, but I only need users to be able to click the marker to go to the node (no popups). Is there a config I am missing to do this?


texts: How to use fixed width in AT Panels everywhere (site template)?

texts:
I am using the AT Panels Everywhere theme and its ATPanels Everywhere Site Template. However, apparently it overrides the At panels everywhere theme because the width seems to be fluid and not fixed. How can I change the width to fixed? I tried it in admin/structure/pages/site_template and added css code but nothing changes. The site keeps it fluid width.

/* set a fixed overall width */
  #page-wrapper  {
    width: 960px;
    margin-left: auto;
    margin-right: auto;
  }

  /* Add some margin to the main content row. This class was set in the layout designer. */
  #page-wrapper .main-content {
    padding: 0 10px;
  }

The question is: How can I create a fixed width with AT panels everywhere site template?


texts: How to add current user field to view field list, when it has no relation to the content?

texts:
Is it possible to add the current user-id in the rewrite results of a View Field ?

I have created a view of fields of a custom content type "Document". My goal is to rewrite the Document: Title-field to a hyperlink of the following format:

http://mysite.com/download.php?u=[user-id]&docid=[document-fid]

where user-id is the id of the currently logged-in user, and [document-fid] is the id of the file in the records of the view.

I know full well that before you can use a certain field in a rewrite, it needs to be added to the fields list of the view, and it has to be placed before the field you want  rewritten. But here is the problem. When I click "add" in the fields list, I don't see a User, or a User: Current-field.

Please bare in mind that User: Current has absolutely NO relation to the author of the item, or any other user related to the document. Therefor I cannot use the Relationships, under the Advanced section in views.

Please advise.


texts: Display all terms from a specific vocabulary in my template

texts: I have a page where I want to display the terms for the vocabulary named "Services" in an unordered list. The Page is in no way associated with the vocabulary, I just want to display the terms at the end of the article. What should I type in my file?


texts: Getting .info file not found in my custom module, even though it does contain an .info file

texts:
I am trying to install my custom module, but the error I get is:

  modulename.tar.gz does not contain any .info files.

My module tar.gz file does indeed contain a .info file. I have installed other modules on the server, so I shouldn't have any permission issues.

The following is the content of the .info file.

    name = Module Name
    description = Initialization module for hl
    package = My modules
    core = 7.x
    files[] = modulename.module
    files[] = modulename.install
    files[] = modulename.inc
    files[] = includes/mydrupalusers.php


texts: Separate Display for Start date and End date using Date module

texts:
I have a date field which collects both start date and end date. I would like to display start date and end date as seprate in the display.

I don't see any options in the display page. I am sure I am missing some basic setting. Any ideas?

Note : I am not using views and I would like to do it using the field display options only.


texts: Inline CSS stripped from Global: Custom text in Views

texts:
I did some research on the problem in the title but haven't found any good solutions yet.

I'm using a Global: Custom text view field in a view and I need inline CSS to work in there.

I know that it gets stripped because security reasons, and I have to use inline CSS for my problem. So "use CSS classes" is not a solution, I'm well aware that in most cases that would be the best but it's not ok in this case.

Writing a node.tpl.php for the content instead of using a view in Fields mode is also not possible, becaue I have to use view result counter token on the same div where my inline css should go (with another token inside the inline css).

Thank you!


texts:
We have a block on some pages which we like it without title, but when using < none > or leave it blank, it just showing the page title on the block title !

So how can we hide the block title ?


texts:
I'm using the Views Grid layout and I'm looking for a way to place Google Adsense ads randomly within the grid. Here is the code in views-view-grid.tpl.php:

<?php if (!empty($title)) : ?>

<?php print $title; ?>

<?php endif; ?>
<table class="<?php print $class; ?>"<?php print $attributes; ?>>
  <?php if (!empty($caption)) : ?>

<?php print $caption; ?>

  <?php endif; ?>

    <?php foreach ($rows as $row_number => $columns): ?>
      <tr <?php if ($row_classes[$row_number]) { print 'class="' . $row_classes[$row_number] .'"';  } ?>>
        <?php foreach ($columns as $column_number => $item): ?>
          <td <?php if ($column_classes[$row_number][$column_number]) { print 'class="' . $column_classes[$row_number][$column_number] .'"';  } ?>>
            <?php print $item; ?>

        <?php endforeach; ?>

    <?php endforeach; ?>

Is editing the template file the correct way to do this? I'm not a programmer so a lot of this is beyond me but I am willing to learn.


texts: The item of an unregistered user's cart is shown a different unregistered user

texts: Using Drupal Commerce 2 in Drupal 8.8, if an unregistered user puts something in the cart (and doesn't check it out) another unregistered user sees these items in Cart block (provided by view (order)). They aren't shown to the users on the /cart page.


texts: Why doesn't $row->path output its value?

texts:
I made a view with a relationship, showing:

Title of the node
Title of the referenced node
Path of the referenced node

These values display as expected, but if I create a PHP field with the following code in the output, it only displays titles.

echo 'Title: '. $row->title.'
';
echo 'Title 1: '. $row->title_1.'
';
echo 'Path: '. $row->path.'
';

Why?


texts:
I am trying to build a menu page for a restaurant and I am stuck. Essentially, I need it to match the picture attached. I am using nodes with fields grouped with the Field Collection module and using views to render this data.

Any help appreciated.

See link to image outlining my desired layout


texts: Looking for informaton on Drupal core security process, audits and benchmarking

texts:
I'm looking for information on Drupal's security processes, any audits carried out, benchmarking against securty standards, what happens security-wise before a new Drupal release etc...

The most useful info i have found thus far is here:

http://drupalsecurityreport.org/

and here:

https://www.drupal.org/security-team

But it doesn't give much detail on internal processes or on accreditations etc.

Danny.


texts: One click upload setting not able to save

texts: I want upload file enable to upload image from my system for that i have installed ONE CLICK UPLOAD plugin for drupal and using Ck editor. now i have to change preference setting for upload button but when i changed toolbar buttons its not saving my changes and i am not able to add that upload button to my editor. please guide if anybody has any solution. my setting path for drupal ch editor is:: module > ck editor > edit/config > Editor appearance


texts:
Why would this not work as a Views PHP filter criteria?

if (arg(0) == 'node' && is_numeric(arg(1)) && ! arg(2)) {
  $node = node_load(arg(1));
  $a1 = format_date($node->created, 'custom', 'm/d/Y');
  $a2 = date('m/d/Y',strtotime('-2 months',strtotime($a1)));
  $a3 = format_date($row->created, 'custom', 'm/d/Y');

  $b1 = new DateTime($a1);
  $b2 = new DateTime($a2);
  $b3 = new DateTime($a3);

  if ($b3 < $b2) {
    return TRUE;
  }
}

The code should remove rows that are older than the current node except it doesn't?!


texts: Seeking module/technique for giving site visitors a download "gift" in exchage for their email

texts:
A friend has an eBook site where he sells his eBook. A customer bought a large bulk order for use as a large group gift, but he wants my friend's site to be able to collect the email addresses of all the people who goto the eBook site and retrieve their gifted eBook.

So, we're seeking some module or technique that an anonymous user can visit a page, and by supplying their email to a form, they get access to download their pre-purchased eBook.

Now, I know how to write a module to do this, but my friend can't afford me, I'm already working full time, an so on... anyone know of some technique or module to accomplish this without writing a new module?

Seems like something along the lines of a CCK form for getting each email, which would then need to be verified by something like the Email Verification module, and once passing that test the user simply gets a role assignment for access to the download page.

However, being a code-monkey, I have no idea how to handle the glue logic of this solution without writing a module.


texts: list of parent nodes with a list of child referring nodes

texts:
I would like to make a list of all parent nodes and under each parent display a list of child nodes that are referencing parent node. Something like drupal.org modules page, except in my case this is not with taxonomy. Using drupal 6 views 2

example

parent1
-child1
-child2
-child3
more parent1

parent2
-child1a
-child2a
-child3a
more parent2

I am not able to display it using one view. Can anybody help me with some ideas? Thank you


texts: Redirect customer to specific order checkout later

texts:
I'm using Commerce Quotes sandbox project (https://www.drupal.org/sandbox/xatoo/1860944) to get quote system in commerce. Customer add products to cart and requests a quote instead of checkout. Then store owner can respond to quote (store owner may give discounts to product s unit price) and system sends new quote to customer by email. Then customer can accept or decline the offer.

My problem is that if customer accepts the offer he/she should be able to pay the order in the website. Is there some url I could redirect customer to? I tried following approach with Rules:

After accepting quote change Order status to "Checkout: Shipping"
Redirect customer to /checkout/[order_id]/shipping

The problem was that now in checkout product prices were original, not the discounted one that store owner was saved to order. Any idea why is that?

Is there better way to let customer pay the accepted offer?

Big thanks in advance!


texts: Views filter depending on the number of node references

texts:
I have a content type A that has a node reference to a content type B.

How can I create a view that show A nodes, and either filter by or sort by the number of references to the content type B? (Let's suppose the node reference to B field in A is named field_reference_b)

I'm interested in both filtering and sorting by that criteria.

Edit:

I could do this using the module Views PHP Filter, but I'm trying to avoid using it as much as possible.


texts: Remove or Redirect Users who go to www.domain.com to domain.com

texts:
My drupal site is apparently accessible as both 'www.domain.com' and just 'domain.com'. Does anyone know of a way to remove the 'www' accessibility, or at least redirect users who go there to the 'domain.com' domain?

I've installed Global Redirect module but am not seeing options that solve this problem. Does Global Redirect module solve this problem or is this a stackoverflow question?


texts: How can I change the page title for user/login for unauthenticated users?

texts:
In D7, we need to modify the page title for the user login page (shown when users have not yet authenticated).

The default value is 'User account', and it is set in 'user.module' line 1965:
    return user_is_logged_in() ? t('My account') : t('User account');

It appears as the page title for the paths:
  user/register
  user/password
  user/login

This is how it is eventually rendered:
    User Account

To override the value for an authenticated user, we can simply implement

function MODULE_username_alter(&$name, $account) {
 $name = 'New Name!';
}

But how to override that value for unauthenticated users?

It seems like it should be done in THEME_preprocess, but I can't seem to find the attribute to set.

I implemented page--user--login.tpl.php, and see there that it is somehow part of $page['content'], but can't find the attribute to set.


texts:
I currently have a glossary view set up using attachments in views using Drupal 7. I would like to have a header on top of the list of results displaying an  element of the currently selected letter with a divider (top image). So far I've tried setting up a footer on the attachment but can't seem to figure a way to extract the current letter into the footer (bottom image).

 .

I would like the view to look the same way the top image does. I've hardcoded the letter 'A' into the footer but am looking for a way to make it change with the letter selection.


texts: How can I check if the current user is accessing his/her own user page?

texts:
I would like to print something in page-user.tpl.php only when the current user is accessing his own user page.
(any URL starting with /user/%uid/ but when %uid/ is the user id of the current logged in user)

For example, printing something like "Your are viewing your own user page now." in page-user.tpl.php

How can I make this condtion?


texts: How do I translate a views field to lowercase and with spaces replaced with dashes but not make it a link?

texts:
I've got a link that surrounds some code (jquery hexagons). I'd like to be able to just print out the link.

The solution

Firstly, 2 copies of the 'studio name field'. The second set to 'rewrite as link' with the translations.

Secondly, 'exclude from display' both fields.

Thirdly. Custom text to print out the hexagon.

[field_studio_name]

        [field_studio_address]

[field_studio_name]

        [field_studio_address]

If I use the 'rewrite as link' replacement then I get

 <a href="/studio/">

If I use the raw version I am stuck with

Here is a fiddle with a views export that demonstrates the problem.


texts:
function ga_script_script_question($form, &$form_state) {
    $form['question'] = array(
        '#type' => 'fieldset',
        '#title' => t('Question'),
        '#collapsible' => FALSE,
        '#collapsed' => FALSE,
        '#prefix' => '
',
        '#suffix' => '
',
    );

    if(isset($form_state['storage']['myflag'])) {
        $form['question']['new_thing'] = array(
            '#markup' => "new thing",
        );
    }

    $form['question']['original_thing'] = array(
        '#markup' => "original thing",
    );

    $form['next_question'] = array(
        '#type' => 'submit',
        '#value' => t('Next question'),
        '#submit' => array('ga_script_script_next_question'),
        '#ajax' => array(
            'callback' => 'ga_script_script_callback',
            'wrapper' => 'question-wrapper',
        ),
    );

    return $form;
}

function ga_script_script_next_question($form, $form_state) {
    $form_state['storage']['myflag'] = 1;
    $form_state['rebuild'] = TRUE;
}

function ga_script_script_callback($form, &$form_state) {
    return $form['question'];
}

When I submit this form, nothing happens. I get the little spinning thing next to my submit button, but the contents of question-wrapper are unchanged. It seems like the form is not getting rebuilt.

What am I doing wrong?


texts: Drupal in sub directory, still not clear

texts:
My drupal project is in directory /var/www/MY_ORGANIZATION/MY_PROJECT/current, and apache2 is configured to point the web subdirectory of the above location. When I access the site, it is of course under http://www.myorganization.it/. Now I need to move it to http://www.myorganization.it/myproject, both for organization policies and to allow it to be more easily reached through a reverse proxy. I searched around and I found a couple of interesting links, like this and this and a few more. Inspired by them, I tried to move the contents of web/ to web/myproject, but when I accessed http://www.myorganization.it/myproject I got blank page. The error in the logs is crystal clear:

Failed opening required '/var/www/MY_ORGANIZATION/MY_PROJECT/current/web/myproject/../vendor/autoload.php'

So I put back the installation in web/ and renamed it to myproject, changed apache configuration to point /var/www/MY_ORGANIZATION/MY_PROJECT/current, and that worked like a charm. But I am not sure this is an advisable configuration, since, well, since all Drupal installations I saw were in a web directory. Also, from my research I had understood that Drupal installation can be moved to arbitrary subdirectories, but I didn't find any official documentation. It would appear that I should at least configure a path for vendor.

So, the concluding question is, would you recommend simply renaming web to myproject, or should I do it another way?

EDIT: a symlink from myproject to web seems an elegant solution, it works fine in apache (dev environment), while I'm getting errors with nginx+php-fpm (staging environment); still, it may be the way to go.