texts:
I have a feature where if a user navigates to a specific url (www.mysite.com/special-content) they are redirected to the login page, where we've appended a destination to the request (www.mysite.com/user/login?destination=special-content).

We created a custom module using a checkAuthStatus event subscriber to detect anonymous users and redirect them appropriately:

$ cat src/EventSubscriber/RedirectAnonymousSubscriber.php
<?php

namespace Drupal\anon_redirect\EventSubscriber;

use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

/**
 * Event subscriber subscribing to KernelEvents::REQUEST.
 */
class RedirectAnonymousSubscriber implements EventSubscriberInterface {

  public function __construct() {
    $this->account = \Drupal::currentUser();
  }

  public function checkAuthStatus(GetResponseEvent $event) {
    $paths = [
      '/special-content',
      '/more-special-content'
    ];

    if ($this->account->isAnonymous()) {
      foreach ( $paths as $path ) {
        if ( substr($_SERVER['REQUEST_URI'], 0, strlen($path)) === $path ) {
          $url = \Drupal\Core\Url::fromUri('internal:/user/login',[
            'query'=>['destination'=>$_SERVER['REQUEST_URI']],
          ]);
          $response = new RedirectResponse('/user/login?destination='.$_SERVER['REQUEST_URI'], 302);
          $response->send();
          return;
        }
      }
    }

  }

  public static function getSubscribedEvents() {
    $events[KernelEvents::REQUEST][] = ['checkAuthStatus'];
    return $events;
  }
}

This has been working fine for a few months, but recently I got complains that people were not getting redirected. Upon investigation, I saw that they were getting 'access denied', as evidenced by the watchdog log. That is, when they are not logged in, they see our 301 page, instead of getting redirected.

Frustratingly, I've only been able to intermittently reproduce this problem. Sometimes I get the 301 page, sometimes I get the login page with the proper redirect query appended. I've tried both Firefox and Chrome, private sessions, clearing cookies, etc.

I suspect that whatever decides access also is listening to checkAuthStatus and sometimes having the final word about what page is ultimately sent to the end-user, and our module's behavior is not implemented, while other times, our event listener is invoked.

My question is if there is any way I can see what event listeners are subscribed to the checkAuthStatus event, and ideally, which one is having the final word as to the ultimate response from Drupal. I suspect another one is somehow getting prioritized over mine, and would like to confirm or deny that theory.


texts: how to get form element value before submit in drupal

texts:
i have form has first name and last name  field,and a custom login form,when user login it redirect to another page,and i want to get first name and last name fields in that page..,

this is the way i tried...,

function doner_user_login(&$edit, $account) {
  drupal_get_form('doner_step_3');
  $val=$form_state['values']['about_fname'];

  $edit['redirect'] = 'http://test.good.com/moll/ijs/d67/step31?fname='.$val.'';
}


texts: Error "Public files directory Not fully protected" Appears in Nginx?

texts:
I'm wondering why this errors appear on my drupal site when I am using Nginx:

Public files directory  Not fully protected
See http://drupal.org/SA-CORE-2013-003 for information about the recommended .htaccess file which should be added to the sites/default/files directory to help protect against arbitrary code execution.
Error
Temporary files directory   Not fully protected
See http://drupal.org/SA-CORE-2013-003 for information about the recommended .htaccess file which should be added to the tmp directory to help protect against arbitrary code execution.

Any solution to this?


texts: Add placeholder in registration form and removing labels

texts: I wanna customize my registration form on drupal 7. I wanna add placeholders and remove the labels. How can I do that? Thank you


texts: Views filter criteria multiple content types (Drupal 7)

texts:
I have created a view and added the filter criteria content type. I have chosen two content types. They are both being displayed. I would like then further filter one of the content types so that only those which have had a check box selected will display. Is it possible to do this in views?

Thanks,
JP


texts:
In a bash script I use drush site-set @foo_alias to simplify subsequent drush commands.
I would like to compile my SaSS files using compass compile $(drush dd my_theme).  However, for this case I have to explicitly specify the alias as in compass compile $(drush @foo_alias dd my_theme).
Otherwise, I get an error message:

You need to specify an alias or run this command within a drupal site.
Target 'my_theme' not found.

Is there a bash syntax that obviates the need for the alias in the drush dd command?


texts: Dynamic custom template for taxonomy terms

texts:
I want to use dynamic custom templates for taxonomy terms. I have created a vocabulory myvocab, Now in this vocabulory i have created an extra field of template in taxonomies that i want to use for its display.

function myTheme_preprocess_page(&$variables) {

 if(arg(0)=='taxonomy' && arg(1)=='term')
    {
        $termLoaded = taxonomy_term_load(arg(2));
        $tmType =   isset($termLoaded->field_template['und'][0]['value']) ?          $termLoaded->field_template['und'][0]['value'] : false;
     if($tmType){

        $variables['theme_hook_suggestions'][]= 'node__taxonomy_'.$termLoaded->field_template['und'][0]['value'];
/*Here template will be node--taxonomy_basic1.tpl.php and
node--taxonomy_basic2.tpl.php, that i am putting in template folder. But its picking only basic1 template  */
        }
        else{

            $variables['theme_hook_suggestions'][]= 'node__taxonomy';
        }

    }
}

I want it dynamic to display its content, so what i am missing in this code.
Any help would be greatly appreciated.


texts: View page doesn't output but views_embed_view with same arguments does?

texts:
I have a view with a page display. A simple view with a few content types to display, and a contextual filter for taxonomy.

If I enter an argument in the views preview, it works as expected. Displays "no results found" for gibberish, and properly filtered nodes for taxonomy terms that exist.

If I put a views_embed_view in the page template with a hard-coded argument, it also displays as expected.

<?php print views_embed_view('explore', 'explore', 'About-Us'); ?>

My problem is that if I go to the page path www.site.com/explore/About-Us I get nothing. No errors, no "No results" dialog, no results. The content array is completely empty.

I've done dozens of views pages, with arguments and without, and never had this problem. Does anyone have any ideas?


texts: How can I drill down to find the culprit function?

texts:
I can see high CPU usage when I hit search URL of my Drupal application. I have enabled XHProf module and UProfiler extension on PHP5.6 to find the culprit function.

But the report I am getting is giving me only the first level of functions which takes CPU time.

There is no link on the function names to click on it and drill down. Any suggestions on what else can be done to drill down?

Basically it shows only flat profile, how do I get Hierarchical profile view?


texts: Run hook_nodeapi("pre save") but only on inserts, not on updates

texts: For hook_nodeapi(), I want it to run on "presave," but only on inserts, not on updates. How can I do that?


texts: Switching theme for comments as well as nodes (ThemeKey?)

texts:
I'm building a site based on Advanced Forum. I need each forum to display a different theme. ThemeKey does this so nicely with a trigger for which forum taxonomy is in effect, but does not seem to invoke that theme when entering or viewing comments to a post in that forum. So main pages and posting pages for a given forum are in the chosen theme for that forum, but viewing or replying to comments within that forum revert back to the default theme, which is very jarring.

Breadcrumbs know forum you are in even when viewing or replying to comments to posts in that forum, I cannot find a way to make ThemeKey trigger when dealing with comments to posts in forums, as well as it does for main pages and posts within that forum.

Any guidance would be appreciated.


texts: Problem with custom dropdown default value

texts:
I've written a module that allows users to alter the display of a Date/Time object by allowing them to change their timezone via a front-end block.

It does it's primary function properly, changes the time display as expected, however, what is supposed to happen is that once you pick a timezone, the page reloads, and the dropdown form will default to the timezone you selected. Except it doesn't, it stays on a single default value

The array is the #options list for the dropdown item, and the single item underneath is the #default_value key for that dropdown.

As you can see, the default value should be set to Australia/Melbourne, but in the dropdown it's not, it's set to America/Creston Mountain time.

I cannot figure out what's going wrong, have I done the default value code incorrectly or something?

EDIT

This is the code for the select element

$timezone = mymodule_timezone_get_user_timezone();
$options = variable_get('mymodule_timezone_select', system_time_zones());
$options = array_filter($options);

// doing a dpm($timezone) comes back with Australia/Melbourne
// doing a dpm($options) comes back with the arrow shown above

$form['timezone_select'] = array(
  '#type' => 'select',
  '#title' => '',
  '#options' =>  $options,
  '#default_value' => $timezone,
  '#prefix' => t('
Please select your timezone from the drop down box below and click update to convert your viewing times accordingly.
'),
);
$form['submit'] = array(
  '#type' => 'submit',
  '#value' => t('Update') ,
);

And the code referenced in this snippet

function mymodule_timezone_get_user_timezone() {
  $retrieved_timezone = session_cache_get('mymodule_timezone_user_timezone');
  if (empty($retrieved_timezone)) {
    $retrieved_timezone = drupal_get_user_timezone();
  }
  return $retrieved_timezone;
}

The variable for 'mymodule_timezone_select' is just from the default system_time_zones() but the admin has been given the option to delete ones they don't want the user to see (since they are several hundred options by default)


texts: Can we write php conditions in view field templates?

texts:
My view fields are as like shown in screenshot, for each row I need to add comment link,revision link ,edit link, voting icons and topic terms etc And I have large number of views which will share all these fields.

So I thought to remove all the fields and have nid field in all my views. Then create common template file of nid. And in that template file I am planing to use node_laod and fetch all required fields and add them with some common required html structure.

Please suggest if this will be right way to achieve such kind of workflow and reducing work load to add fields in each view, make them easy to edit or make change in fields from template files.

Is this will be good idea to write php code in template file or I am supposed to use some pre process functions etc

Please suggest ! Thanks.


texts: Choose theme depending on the USER_AGENT

texts: How do I use the mobile theme if the $_SERVER['HTTP_USER_AGENT'] is mobile, and use the desktop theme if it is desktop?


texts:
I'm encountering an issue tying in a #validate hook into the Drupal registration form. In a custom module, I have a call to the User Register form (the form that is used on Account Creation) and an addition to #validate that should run an outside validation function.

/**
 * Implements hook_form_FORM_ID_alter()
 * Form ID: user_register_form
 */
function mymodule_form_user_register_form_alter($form, &$form_state) {
  $form['#validate'][] = "mymodule_validate_register_form";
}

function mymodule_validate_register_form($form, &$form_state) {
  //validation code
}

And on running a dpm of the Register Form, the validate statement is in place. However, it appears that the functions is never being run.

When I look at the #validate array, its the last option, predated by user_account_form_validate, user_validate_picture, and user_register_validate. Is it possible that its never being run due to the order of the other validate statements, or is there something wrong in my logic? Are there other approaches to validating the data during User Registration over the hook_form_FORMID_alter function?


texts: Theme function overrides and preprocess functions - for the non-programmer

texts:
I'm trying to get my head around what these are. I've read a few articles and posts introducing Drupal theming where these are mentioned, but I'm struggling to understand what they are and what they do - each explanation I've seen so far (including on Drupal.org) makes an assumption that I know PHP or have programming experience.

Could someone explain in layman's terms or point to a good, simple-to-understand explanation, please?


texts: Are views cached through the core caching mechanisms or should I be setting the caching directly in each view?

texts: I see there are cache settings in each of my views. Do I need to set these or does the core caching mechanisms in /admin/config/development/performance automatically do some of this and these "extra settings" in views are if I want to override the default caching behavior of drupal core?


texts: How can I count the number of nodes submitted by the current user?

texts:
I want to expose in a block the number of content type published by the current user.
I know we can write a query, but is there any other method to do it?


texts: Change URL to meaningful name when I use hyperlink target

texts:
Scenario:

Book

When I click book, it will scroll down to the block and url will be www.example.com/#block-block-1. Is there anyway to change url to something meaningful like www.example.com/#book?

I've tried suggestions from How to give meaningful id names to blocks?, but it is not really what I want.


texts: Can we add different class to first row and last row of view?

texts:
Can we add different classes to first row and last row of view only ?

I have created a view of products listing in which i need to add unique class only in  first row and last row of view.

I need to implement it for creating different designs layout of each row.
In drupal 7 i did it by using below code :

 end($rows);
$last = key($rows);
?>
<?php if (!empty($title)): ?>

<?php print $title; ?>

<?php endif; ?>
<?php foreach ($rows as $id => $row): ?>
<?php if ($id == $last): ?>
<?php $classes_array[$id] .= ' last-element'; ?>
<?php endif; ?>
<div<?php if ($classes_array[$id]) { print ' class="' . $classes_array[$id] .'"';  } ?>>
<?php print $row; ?>

How we can do the same in drupal 8?


texts:
I would just like to hear a confirmation from someone:
If I have a View A that displays View B in case of No results, does the View B display with all its attachments? Somehow I cannot get this cascade to work. The attachment does not show and I'm not sure it's because of limitation or is it me (again)...


texts: How do I correctly sort merged arrays in a template file?

texts:
I have a content type in Drupal 8 with some fields referencing to taxonomy terms. I like to display these terms all together in one sorted array, so I merge the fields and sort them. But the result is always incompletely sorted, some terms are moved, but the others stay in the order they are saved. I tried different ways for sorting: sort function
{% for t in node.field_x|merge(node.field_y)|merge...|sort((a, b) => a.entity.name.value < b.entity.name.value ? -1 : (a.entity.name.value > b.entity.name.value ? 1 : 0)) %}
...
{% endfor %}

I tried it with strcmp
|sort((a, b) => strcmp(a.entity.name.value, b.entity.name.value))

and I tried it with a Twig extension function in a new module. It's always the same wrong result. So obviously I am wrong at some important point.
Can you help me?


texts:
I am trying to add a new view to an existing module. I created the view using Views UI and exported its YML to the 'config/optional' folder.  If I install the module for the first time, the view is enabled in Views UI.
When I add the view to an existing site, it won't activate no matter what I do.  I've tried clearing caches, looked for examples in core & contributed modules and searched the documentation for possible hook_update examples.  The only thing I found was in 'Create or update a View' section at https://www.drupal.org/docs/7/creating-custom-modules/howtos/examples-for-database-update-scripts-using-hook_update_n-how but it's for Drupal 7.  The PHP code looks like it would work for Drupal 8 but I haven't been able to find a way to export a view as code.


texts:
My question is similar to How to redirect user for specific pages not found and some what useful discussion here: https://drupal.org/node/344960
and redirect missing pages to another site

I've a job site and I want to redirect using 301 all expired jobs to one common page. All expired jobs are deleted. To make it easy the job urls have unix timestamp suffixed in some pattern so that I can recognize a url as expired job.

Whenever a page request comes, I want to let it go normally but if page is not found then only I want to check the url with specific pattern and then redirect 301 to common page if it is url of expired job.

Is there any way to do it?


texts: Views PDF CSS file not being applied on generated PDF

texts:
I've created a pdf display with views_pdf module in views, and under the PDF SETTINGS i've included a CSS File (eg. sites/all/themes/custom/mytheme/css/mytheme.css).

When viewing the page display of the view, the css is being applied, but when viewing the generated pdf, all of the css is missing.
I have tried putting inline css as well but it's not working.

Can someone tell me what is the workaround for this?


texts: How to attach profile type to specific user role?

texts:
I have multiple profile types and multiple user roles.  I want to combine specific profile types with users of specific roles.  For example, customer roles have their own profiles, content authors have their own profiles, etc.

Is there a way to assign them together?


texts: Displaying the submitted values in a table

texts:
I created a custom form and after the form is submitted I need to display the submitted data in a table? This seems like a very simple problem. I am able to use dpm() and drupal_set_message() to display data submitted from the form in mymodule_form_submit($form, &$form_state); however, I can't output it to a table.

I have 3 field values

$form_state['redirect'] = 'some/path/' . $form_state['values']['my_value'];

Using this I can send just 1 value. But how can I send an array with this? Query string may appear to be very long.


texts: Duplicate the value of the price of the products to field in node

texts:
I have node (Product display) and inside this node is field link to product. The usual option for commerce.

In commerce product is the field  - commerce_price.

In node is field field_node_price.

How can synchronize value from commerce_price to field_node_price?


texts: Display top level of book, in book navigation block

texts:
In my theme's .theme file I have the book navigation block stored in a twig variable like so.

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

I'm then calling it in my page.html.twig template like so

    {{ book }}

    {{ page.content }}

However on basic pages that are book pages, sibling book items are shown but the top level book page is not. Even when visiting the top level book page the link is not shown in the book block.

Why isn't the top level of the book ever displayed? And is there a way I can get the top level to be shown?

UPDATE:
I've looked at creating a book-tree.html.twig. The contents are below

{% import _self as book_tree %}

{#
  We call a macro which calls itself to render the full tree.
  @see http://twig.sensiolabs.org/doc/tags/macro.html
#}
{{ book_tree.book_links(items, attributes, 0) }}

{% macro book_links(items, attributes, menu_level) %}
  {% import _self as book_tree %}
  {% if items %}
    {% if menu_level == 0 %}

    {% else %}

        {{ dump(book_tree|keys) }}
    {% endif %}
    {% for item in items %}
      {%
        set classes = [
          'menu-item',
          item.is_expanded ? 'menu-item--expanded',
          item.is_collapsed ? 'menu-item--collapsed',
          item.in_active_trail ? 'menu-item--active-trail',
        ]
      %}

        {{ link(item.title, item.url) }}
        {% if item.below %}
          {{ book_tree.book_links(item.below, attributes, menu_level + 1) }}
        {% endif %}

    {% endfor %}

  {% endif %}
{% endmacro %}

But I don't see where I can access the top level.

UPDATE: I found a workaround but I'm looking for a solution that does not require that workaround. Users should not have to create an empty page with the same title just to act as the non displayed top level.


texts:
I am working with a 300K records dataset and I am having some performance issues. I try creating a node for each of the records on the dataset, but even the simple path translation query is taking forever (over 50ms to execute) to get the node ID from the page and the rest of the queries on the page make it insanely slow to load a single page. The server has all the capacity it might need and it even has memcached working, PHP-FPM, NGINX, etc.

I decided to have each page coming from that dataset as simple as possible to avoid having to load all those objects and so on. The question comes when I want to use the url:

http://www.example.com/item-ABBC

ABBC is the argument that will hit the database to perform a search, but I can figure out how to accomplish this with the hook_menu:

function mymodule_menu() {
    $items['item-%'] = array(
      'page callback' => 'mymodule_abbc_view',
      'type' => MENU_CALLBACK,
    );
    return $items;
}

I am trying to avoid hitting the path table as much as possible that is why I wanted to use the MENU_CALLBACK instead of a regular menu item.

Is this possible at all?


texts:
Enabling the Comment module, I get WSOD everywhere.

Suspecting insufficient memory, I have added to sites/default/default.settings.php the following statement :

ini_set('memory_limit', '128M');

After stopping/relaunching the MAMP servers, under phpMyAdmin I emptyed every table in the DB, then reimported the latest Backup & Migrate backup,

then trying again to enable Comment : WSOD :-(

The log file is pretty cryptic to me :

[25-Nov-2014 19:50:46 Europe/Berlin] PHP Fatal error:  Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 2006 MySQL server has gone away' in /Users/Gil/Documents/MAMP/des_gens_f/includes/database/database.inc:2171
Stack trace:
#0 /Users/Gil/Documents/MAMP/des_gens_f/includes/database/database.inc(2171): PDOStatement->execute(Array)
#1 /Users/Gil/Documents/MAMP/des_gens_f/includes/database/database.inc(683): DatabaseStatementBase->execute(Array, Array)
#2 /Users/Gil/Documents/MAMP/des_gens_f/includes/database/database.inc(2350): DatabaseConnection->query('SELECT expire, ...', Array, Array)
#3 /Users/Gil/Documents/MAMP/des_gens_f/includes/lock.inc(167): db_query('SELECT expire, ...', Array)
#4 /Users/Gil/Documents/MAMP/des_gens_f/includes/lock.inc(146): lock_may_be_available('schema:runtime:...')
#5 /Users/Gil/Documents/MAMP/des_gens_f/includes/bootstrap.inc(424): lock_acquire('schema:runtime:...')
#6 /Users/Gil/Documents/MAMP/des_gens_f/includes/bootstrap.inc(446): DrupalCacheArray->set(Array)
#7 [internal function]: DrupalCacheArray- in /Users/Gil/Documents/MAMP/des_gens_f/includes/database/database.inc on line 2171

I've edited the Applications/MAMP/Library/support-files/my-*.cnf files (there are five, ignoring the one that applies, I deited each one). Editing the default max_allowed_packet = 1M (thanks Clive for the links), I tried successively 16M, 32M, 64M, 128M, 256M and 512M. Still getting the same log :-(

It's my first Drupal project. Any track from someone more MySQL/PHP savvy than I ? Thanks.


texts: jplayer module conflicts with viewscarousel module

texts:
When i have turned on a block with viewscarousel and a jplayer inside my page (node/5) it looks like js is conflicting because both of them is stopping to work...

You can take a look at http://hypatia.kz/node/5
When on main page carousel works well, but when jplayer is here - it's not working. Thanks in advance!


texts: Creating smaller menus from chunks of a bigger menu

texts:
I have this really big nav menu in Drupal 7. The top-level links go to child pages. Each of these child pages has several pages hierarchically under them.

On these child pages, I want a block that shows links to sibling pages and children of the current page (But not children of sibling pages).

It seems like it should be relatively easy, but I've been beating my head against a wall all afternoon. Any help? Thanks!


texts: How to avoid url conflict when defining menu items, and make sure path without wildcards will be used in favor of path with %?

texts:
In hook_menu, I have

$path = "events"

$items[$path] = array(
  'title' => t('Events'),
  'page callback' => 'my_events_page',
  'access arguments' => array('view my events'),
  'type' => MENU_NORMAL_ITEM,
  'file' => 'my_events.pages.inc',
);

$items[$path . '/past'] = array(
  'title' => t('Past events'),
  'page callback' => 'my_events_past_page',
  'access arguments' => array('view my events'),
  'type' => MENU_NORMAL_ITEM,
  'file' => 'my_events.pages.inc',
);

$items[$path . '/%'] = array(
  'title' => t('Events'),
  'page callback' => 'my_events_page',
  'page arguments' => array($depth),
  'access arguments' => array('view my events'),
  'type' => MENU_CALLBACK,
  'file' => 'my_events.pages.inc',
);

They were working, but not now.

If I change $items['events/past'] to $items['events/past1'], it works.

Does it mean I have path conflict? If so, how can I resolve it?

Rows in my {menu_router} table are as follows:

path: events
page_callback: views_page (but I set it to xxx_events_page in hook_menu)
fit: 1
include_file: empty (should not be empty)
--
path: events/%
page_callback: xxx_events_page (good)
fit: 2
include_file: a file path is there
--
path: events/past
page_callback: views_page (but I set it to xxx_events_past_page in hook_menu)
fit: 3
include_file: empty (should not be empty)

If I update the page_callback and include_file it works. If I clear the cache, everything set back to default.


texts: how to show a panel node only to authenticated users?

texts: i am using panel nodes to display profile pages such as my profile page on facebook . i have created a menu link for it . When i logout my profile link still shows. I want that only the logged in user should see the my profile link.


texts: How to make a collapsible fieldset in my theme?

texts:
I want to have collapsible fieldsets in my Drupal 7 website in add content. I added this in html.tpl.php of my theme:

<?php
print $styles;
drupal_add_js('misc/form.js');
    drupal_add_js('misc/collapse.js');

?>

But nothing happend to my fieldsets.
Here's a sample code of fieldset I have used:

<fieldset id="fieldset-id" class="collapsible">
  <legend>Fieldset title</legend>

Fieldset description

     Fieldset content

</fieldset>

What is the problem?


texts:
<?php
  $nid = arg(1);
  $arg0 = arg(0);
  if(isset($nid) && is_numeric($nid) && isset($arg0) && $arg0 == 'node') {
    $node = node_load($nid);
  }
  $theme_img = file_create_url($node->field_page_cover_image[$node->language][0]['uri']); //origional image path
  if(isset($theme_img)) {
    // print styled image
    print theme('image_style', array('path' => $node->field_page_cover_image[$node->language][0]['uri'], 'style_name' => 'page_theme'));
  }
?>

I am using the above code to load styled image (from node 6) in page.tpl file. This is working fine in all the pages but when I am trying to load images from individual images by using '$nid' it is not working.
I don't understand what I made mistake in code due to which I couldn't get the value of '$nid'. Please help.


texts: How can I have the JS/CSS cache refresh on every page load?

texts:
How to clear cache on every page load?

I am doing CSS & JS theming and currently having to manually clear cache (using devel module) every time and then reload the page again to see my changes?

How do I do it so that in every page load cache is cleared?


texts:
Is there a way to not promote articles on to the front page and instead gather them under a main menu link?

Like main menu link -> myArticles and on click all articles written will be shown there?


texts: How do I send an email containing the user password?

texts:
I'm implementing a function that send the password to users who forgot it.

This is the code I developed so far.

function my_module_lost_password($email) {
  global $language;

  $response = array();
  $account = user_load_by_mail($email);
  $params = array(
    'subject' => "hi",
    'body' => "hello",
  );
  $from = "The_admin@gmail.com";
  $to = $email;
 drupal_mail("???", "???", $to, $language, $params, $from);

}

This function is called by a POST query (web service).

How do I use drupal_mail() to send a mail to users containing the password from the users table?


texts:
What is the hook to alter the form that appears for the URL admin/people/create?

I tried hook_form_alter(), but that's not the right one.


texts: Why is suggested not to use symlink for sites/all and sites/default?

texts: The status report for Pantheon (Drupal 7) says that sites/all sites/default and sites/default/settings.php is not a symbolic link, and it is considered as best practice. Why?


texts:
I created a Views out of some nodes and displaying it. And I've done views theming of type Row style output and saved the file in following format views-view-fields--[views machine name].tpl.php. All is working great except the views pager/navigation. It's simply not showing up, I tried all type of combinations : full pager, mini pager, Display a specified number of items and display all items, but of no use.

One important thing: I'm also using using CCK pager which might be overriding the views pager. For this issue, I tried changing views pager id, but that too failed.


texts: Is there a way to allow administrator users to enter a credit card payment?

texts:
If we:

Go to COMMERCE->ORDERS->CREATE_NEW_ORDER
Create a new order by filling in customer and product information
Save the order
Then go to the PAYMENTS tab and click ADD PAYMENT

All we get is the message "There are no reusable payment methods available for the selected gateway."
We are using Authorize.net but we get the same message with the Test Gateway (on-site).
I'm not sure why we're getting this message. Is there a way to allow admins to enter a customer's credit card info to an order via the backend?


texts: Drupal - Just want to add HTML to a node's form element how?

texts:
I have a node/content that outputs like a form that is available to guests to add jobs to.  I would like to implement this HTML inside of the form to reduce spam:

    If you see this, Leave Empty:
        <input id="address" name="address" />

    If you see this, Leave Blank:
        <input id="username" name="username" />

I kind of need this within the <form> tag.

Now when the form gets submitted, I'd like to be able to check for this and be sure both inputs are empty, and if they are empty, the form should be submitted, otherwise, if either is filled in with anything, it should not be allowed to be submitted.  I did this on another, Non-Drupal, site and it eliminated the SPAM on that form completely.  But now I'm on a Drupal site, and would like to understand how to do this via a node.

I don't currently have FTP Access, however, I do have complete Admin Access on the Drupal site, so if there is a way to do this via Drupal that would be preferable.  Is there a module that will do something similar to this that I can add as a field on that node?

Any help to point me in the right direction on getting started for this is greatly appreciated.  Also, I have the Devel Module installed if that helps...


texts:
Here's my current situation: I have an external authentication platform that loads in Drupal via an iframe. When the user is authenticated, the external application redirects the user to a Drupal endpoint I set up using:

function mymodule_menu() {

    $items['mymodule/oauth'] = array(
        'title' => 'My Module Receiver',
        'page callback' => 'mymodule_oauth',
        'access callback' => TRUE,
        'type' => MENU_CALLBACK,
        'file' => 'mymodule.pages.inc'
    );

    return $items;
}

And then my callback:

function myapp_oauth() {

    // Does some stuff, authenticates the user, etc

    echo '
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

Please wait...

';
    exit;

}

This seems like an incredibly sloppy way to handle this to me, I would prefer not to have to exit the application, and ideally I would want to simply define a tpl template file to load in place of the theme files for this page. Can someone recommend a better way to handle this?


texts: View that display single node which has id the same as last part of url (from last / to the end)

texts:
I have an urls:

website.com/portfolio-entries/23
website.com/portfolio-entries/25

I would like to make an view for them to display node which has id the same as last part of url (from last / to the end).

I have red the description for View > Url (administration panel > Content > Views > My_view):

  This view will be displayed by visiting this path on your site. You may use "%" in your URL to represent values that will be used for contextual filters: For example, "node/%/feed". If needed you can even specify named route parameters like taxonomy/term/%taxonomy_term

So I set it to portfolio-entries/%entry_id (I hope I understood it right).

But how now make this view display only sinlge entry which has the id set to %entry_id?

I've tried with View > Filters (add) > ID but I can only set there hard-coded values (e.g. 23 makes this view display only entry #23). How can I place there my %entry_id?

In other words I was reproducing steps from https://www.ostraining.com/blog/drupal/views-specific-node/ (it's for Drupal 7 but it works the same way in Drupal 8) but instead of har-coding the id value I want to take it from last part of the url.


texts: Can I use a custom CCK Link field as URL for Ubercart Product Image

texts:
I created a custom link field for my Product content type using Drupal 6 and Ubercart 2.
Now instead of linking the Product image in the Product site to itself or show it as a slideshow I would like to create a link to the URL of the given field.

I found the function that displays the product image, which is called 'theme_uc_product_image' and replaced

 $output .= 'field_direct_shop_link[0]['url'];
$output .= '<a href="'. $destination_url .'" title="'. $first['data']['title'] .'"';

but it didn't work out!

Any ideas on how to solve this?

Thanks a lot in advance.
Best,
Manuel


texts: Adding a field to be indexed in apache solar

texts:
I am new to drupal.

To add a field to be indexed in apache solar. I tried these two functions and its worked.

function filedepot_apachesolr_index_document_build_node(ApacheSolrDocument $document, $entity, $env_id) {
  $description_desc = $entity->description;
  $document->addField('sm_description_label', $description_label);
}

function filedepot_apachesolr_query_prepare(DrupalSolrQueryInterface $query) {
  $query->addParam('fl', 'sm_description_label');
}

This adds field "description_label" to be indexed in apachesolr (which i checked in the number of fields indexed in solr admin/reports/apachesolr/solr)

While indexing solr,reports showing stdclass::$description undefined property.

So i tried to check the properties of entity_type (file) using function entity_get_property_info('file'). It returned an array

 array(1) {
  ["properties"]=>
  array(1) {
    ["fid"]=>
    array(4) {
      ["label"]=>
      string(7) "File ID"
       ["type"]=>
      string(7) "integer"
      ["validation callback"]=>
      string(41) "entity_metadata_validate_integer_positive"
      ["schema field"]=>
      string(3) "fid"
    }

}

Hence entity_type 'file' doesnt contain description. How to add the description property to an entity_type ['field'].

The entity_type 'file' have fid property . How to access it inside apachesolr_index_document_build_node . when i tried to access $entity->fid inside apachesolr_index_document_build_node again it showing no property exists.

Have to add a field to be indexed in apache solr. If the entity_type 'file' doesnt contain the field property,that has to be added to entity_type. How to do this.?


texts: For a customer database table, do I have other options, beside creating a custom module?

texts:
I'm upgrading my site to Drupal 8.

Currently, I have a custom module with a custom database table and I query that to provide historical data that is in the table. The data is really purely tabular and has thousands upon thousands of records.

If there were fewer pieces of data, I would just create a custom content type.  However, I'm not sure that creating thousands upon thousands of nodes would make sense.

The database table includes the following fields.

Person
Product Sold
Revenue Generated
Month Sold

Let's say I generate a few records per month.

How should I handle this? Should I make another custom module to output the data?


texts:
In Drupal, every Views page has a class that is stored in $css_name (inside views-view.tpl.php).

Is there are any way to get this class to appear in the body class of the page?

Ideally, I would like to prefix it with page- (So views-index, would become page-views-index). I would also like to do it without install extra modules.


texts:
I tried to update my installation, but now I'm getting this fatal error:

  Fatal error: require_once() [function.require]: Failed opening required
       '/home/abel/www/lmwep/massteri/sites/all/modules/views/includes/admin.inc'
       (include_path='.:/usr/local/PEAR:/usr/local/share/pear:/usr/local/lib/php')
       in /home/abel/www/lmwep/massteri/sites/all/modules/views/views_ui.module on line 175

I have no clue what this means. Any help is appreciated.


texts:
I have installed the Single Page Site module and I was follow the instructions but still don't works for me.

the module conf:

Menu: main

Menu class/id = #block-mainnavigation

Menu item selector = ""

Title: "Home"

Tag: h2

check: homepage

I have one item of my main menu called : "servicios", link to #servicios"

In my page--front.html.twig

i have a section with a element
Nuestros Servicios

but don't works

any idea?


texts: AJAX Views arguments: how to specify quantity of results and what are other options that can be used?

texts:
From this great answer I have a working jQuery implementation of a simple call to an existing view using AJAX. Which is brilliant, but I want to specify the number of results differently to as is setup in the existing view, and I want to know what other options I can use under view_args.

I can't find documentation/a full example of what's available and how to use it. Is there any?

$.ajax({
    url: url,
    type: 'post',
    data: {
        view_display_id: v_display,
        view_name: v_name,
        //   view_args: {}, // your views arguments
        view_args: v_args,
    },
    dataType: 'json',
    success: function (response) {
        if (response[1] !== undefined) {
            return response[1].data; // do something with the view
        }
    }
});

I inspected the HTML of the Views admin page and saw the pager was encapsulated from the other arguments, and tried this but it carried on supplying 6 items (which is odd because the view is saved to display 10):

var data = {
    'view_name':'ajax_test',
    'view_display_id':'block',
    'pager_options': {
        'items_per_page':'1',
    }
};
$.ajax({
  url: '/views/ajax',
  type: 'post',
  data: data,
  //pager_options: {items_per_page:1},
  dataType: 'json',
  success: function (response) {
    if (response[1] !== undefined) {
      document.write(response[1].data); // do something with the view
    }
  }
});


texts: Views query alter or condition not works

texts:
Want add some or conditions in view queries. I tried two solutions but it not working. What I do wrong?

function up_coaching_custom_views_query_alter(&$view, &$query) {
  $search_string = empty($_GET['filter']) ? '' : '%' . db_like($_GET['filter']) . '%';
  if ($view->name != 'users' || empty($search_string)) {
    return;
  }

  // First way
  $condition = db_or()
      ->condition('users.mail', $search_string, 'LIKE')
      ->condition('field_data_field_company.field_company_value', $search_string, 'LIKE')
      ->condition('field_data_field_user_name.field_user_name_value', $search_string, 'LIKE')
      ->condition('field_data_field_title.field_title_value', $search_string, 'LIKE');
  $query->add_where(2, $condition);

  // Second way
  $query->where[2] = array(
    'args' => array(),
    'type' => 'OR',
    'conditions' => array(
      array(
        'field' => 'users.mail',
        'value' => $search_string,
        'operator' => 'LIKE',
      ),
      array(
        'field' => 'field_data_field_company.field_company_value',
        'value' => $search_string,
        'operator' => 'LIKE',
      ),
      array(
        'field' => 'field_data_field_user_name.field_user_name_value',
        'value' => $search_string,
        'operator' => 'LIKE',
      ),
      array(
        'field' => 'field_data_field_title.field_title_value',
        'value' => $search_string,
        'operator' => 'LIKE',
      ),
    ),
  );
  $query->set_where_group('AND', 2);
  dpm($query);
}


texts: I can't enable SimpleTest due to open_basedir restriction being in force

texts:
I can't enable SimpleTest due to an open_basedir restriction being in force for my Drupal7 installaton which resides on a Linux server running PHP 5.2.12. I found the directive under my PHP.INI file but it is already commented out there.

When I try to enable SimpleTest in my Modules config, I see the following error:

"The testing framework requires the PHP open_basedir restriction to be disabled. Check your webserver configuration or contact your web host. (Currently using PHP open_basedir restriction Enabled)"

What can I do to overcome this? A search on the web so far has not been overly helpful.


texts:
I am creating a view and the Filter Criteria cck text field needs to equal the Node Id. Any ideas on how to accomplish this?

Thanks


texts: Terms for cities and state to build dependent selects

texts:
I'm adding a "City" field to a content type. I need it to be 2 dependent select lists. I mean, the user will select a state in the first select and the second select will be populated with the cities for the selected state.
In fact those are for Spanish provincias (states) and localidades (cities).

I know I can do this using the 'hierarchical_select' module, but now I need to create the taxonomy Terms for states and cities.

Is there any way to find and import those Terms (Spanish provincias and localidades) into my site? Creating these term is a daunting task.


texts: How to programmatically create file entity reference on entity

texts:
Example with "normal" entity reference.

$node = node_load($nid);
$node->field_reference = array(
  $node->language => array(0 => array(
    'target_id' => $other_nid,
  ))
);
node_save($node);

Now I want to do the same, but on a File entity field instead.
Examining an attached file with devel, the field looks mostly like a plain

$file = file_load($fid);

object, but there's some more data on it, so I'm guessing I will hit problems down the road if I just stick the $file on to the ref, instead of figuring out the proper API call.


texts: Difference between "site:current-user:field-foo" and "account:field-foo" in setting a Rules condition?

texts: What is the difference between "site:current-user:field-foo" and "account:field-foo" in the Rules "Add a new condition"?


texts: How to programatically resize image and respect aspect ratio when saving a node

texts: I was wondering if there is an api call that lets me resize an image and respect the aspect ratio.  Right now I am using image_resize to successfully resize an image to a given width and height but it ignores aspect ratio and distorts the images.  Is there an api call that will allow me to do this and maintain original aspect ratio?


texts: What is wrong with the following api call to logout user?

texts:
When i call drupal rest api to logout with following parameters

axios.post('http://my-lando-app.lndo.site/user/logout?_format=json', {
    'csrf_token':  this.state.csrf_token,
    'logout_token' : this.state.logout_token,
    'Content-type': 'application/json'
})

I get response

{"message":"\u0027csrf_token\u0027 URL query argument is missing."}

what is wrong with my request?


texts:
There might be a thread already with sililar question.- I am very new to drupal and looking for a module which will allow access to a user to their individual account. They should be able to see only their data and nothing else.They should not be able to manipulate site. This shouls be done just by email verification. I noticed that admin can grant access of a user after account creation but I am looking something smooth where anyone who creates account should see only their dat and later admin can change access level.
Can anyone help me here.


texts: Do not request a billing address during checkout

texts:
By default, Commerce 2 requests credit card info + address info (name, address, and company name) for all orders.  I want to have users enter their credit card information but I don't want to collect their name, address, or company name. Stripe does not require name/address info so I don't want to require it, either.

As my payment gateway, I am using Commerce Stripe, but this applies to all payment gateways, such as Commerce PayPal, and the Manual (no credit card) payment gateway.

So, how can I safely remove the address form from the checkout page?

I first tried to hack Commerce directly (bad practice, just trying to see how it worked) but I broke the module.

As I looked around, it appeared that the billing info is deeply wired into the Commerce code.  Is there a way to decouple it?  Not all stores (those that sell digital products, etc.) need their customers' physical addresses.

On the checkout "Payment information" screen, I want to remove all of the fields from "Country" down to "Postal code":


texts: How to hook into adding watchdog entries by other modules?

texts: Is it possible to write some code to intercept the process of adding Watchdog entries and filter them before adding to the log? Or is there a module that allows for watchdog filtering before adding to log? (I searched but nothing found) This would be useful if there are tons of well-known messages (like page not found from the same referrer or the same IP) that obfuscate the log.


texts: What does "Use aggregation" option under Other in the Views UI do?

texts: It looks like it might be a function that can reduce duplicates rather than using the Distinct option.


texts: I do not want to display a login block or link on every page. I would instead like to create a single login page accessible from  http://example.com/login. How can I do that?


texts:
How can I create a new content by adding another two contents of same content type?
My situation is
I have one content type 'Student'
and in another content type 'Receipts' whi has one field called months (list field) which stores the fee paid for each term (eg. April, May, June).
the student pays fee for term wise, for term2 fee another Receipt content is created...

Then I acreated a view (Student + Receipts),
It displays like

No Name           Class           Paid Months
1  Sravan         10 A            Apr, May, June
2  Sravan         10 A            Sep, Oct, Nov, Dec
3  Manohar        9 B             Sep, Oct, Nov, Dec (Joined only on Sep)
4  Sreeram        8 C             (No Fee Paid Yet)

I want to find those who did not paid the fee for Apr, May, June..

but when I displayed it shows 'Sravan' in the list cause it searches in his 2nd Receipt for Sep, Oct, Nov, Dec.  (Apr is not in that list)

How can I solve this..

Sorry for my lengthy question.. I would like to explain my situation in details...


texts: Hello I Am Making A Website So I Want To Add Some Of My Product In My Product Page So I Want To Know That How I Can Add Product With Name Cost Of Product And Description Can Any One Suggest Any Module To Setup Product In D7


texts: Why is session.cookie_lifetime set to 23 days?

texts:
As far as I understand the session lifetime at Drupal is limited by session.gc_maxlifetime setting is by default set to some 2.3 days.

Then what is the use of session.cookie_lifetime being set to 23 days?

Here is the snippet from settings.php:

/**
 * Set session lifetime (in seconds), i.e. the time from the user's last visit
 * to the active session may be deleted by the session garbage collector. When
 * a session is deleted, authenticated users are logged out, and the contents
 * of the user's $_SESSION variable is discarded.
 */
ini_set('session.gc_maxlifetime', 200000);

/**
 * Set session cookie lifetime (in seconds), i.e. the time from the session is
 * created to the cookie expires, i.e. when the browser is expected to discard
 * the cookie. The value 0 means "until the browser is closed".
 */
ini_set('session.cookie_lifetime', 2000000);

Please assume that I've set both session.gc_probability and session.gc_divisor  to 1 just for the sake of this question.


texts: How to insert value to taxonomy on custom form submission

texts:
I have a page where admin can add a new hospital name to the site, search for the hosiptals and view all the hospitals in a tabular format. This is done by writing custom module and form.

What I now need is to add the value of the newly created hospital to a taxonomy term "hospital". So that I can use this taxonomy term reference in multiple content types.

If admin adds hospital-1 and hospital-2 to the site using custom form, on form submission these should automatically get added to the taxonomy term.


texts:
I have a view that uses node rows. I looked at views-view-row-node.tpl.php and it only contains 4 lines. I tried to override the theme by using my node.tpl.php code in a new file but got this warning:

  Invalid argument supplied for foreach() in /home/public_html/sites/all/themes/templates/overrides/views-view-row-node--taxonomy-term-attachment.tpl.php on line 36.

How can I use a modified version of node.tpl.php to theme a certain display of my view?


texts:
How can I insert the following:

<!--[if lte IE 9]>
    <style type='text/css'>
  #page{display: none;}
    </style>
<![endif]-->

I tried it in page.tpl.php but not worked.


texts: Poll Listing, Where admin can rate and user and rate a poll?

texts:
I need to develop a page, where we need to display a list of polls which are published.

and

Need to create a content by admin where user and admin, both can rate it.

Does anybody suggest a contributed module or Do i need create custom Module for it?


texts:
Any of you guys know why drupal it's duplicating my url alias when save a new node?

$node->path = 'st.louis';
node_save($node);

But in my alias table I have  st.luis and stlouis


texts: Need a hook a little later then hook_node_insert

texts:
I am working on a module to unzip the contents of my file field after I have submitted the node.  I originally tried to do this in hook_node_insert but this did not work for me because my file field has a custom file path and at the time of hook_node_insert the file is still in the default upload location and it is then moved to the custom file path at some later point.

I also though maybe I could implement my unzipping code hook_file_move (which gets called when the file is moved to the custom file path) but it seems that there is no way to verify that the node type from hook_file_move.

Is there some better hook to implement this unzipping code where I can both verify the type of the node and late enough in the content creation process that the file will have been moved to the location of the custom path.


texts: How to show tooltips using a bootstrap sub-theme in a views filter?

texts:
I am using the bootstrap Tweme theme and would like to show tooltips when hovering over exposed filters (e.g. haslanguagecertificate) in a view. When hovering over profile edit fields the help text is shown properly.

I have also added the snippet in html.tpl.php before the closing < / body>.

(function($) {
   $(document).ready(function() {
   $('[data-toggle=tooltip]').tooltip();
   });
})(jQuery);

This has How to show tooltips on form labels based on view filter descriptions in a Bootstrap sub-theme? that helped, but the tooltips are not showing up. Devel does not show ['title']['#attributes'] - what do i have to write here?

/**
 * Implements hook_form_FORM_ID_alter().
*/

function customisations_form_views_exposed_form_alter(&$form, &$form_state, $form_id) {
dpm($form);
// $field_name = 'filter-title';
$field_name = 'filter-field_haslanguagecertificate_value';
$form['title']['#attributes'] = array(
  'data-toggle' => 'tooltip',
  'data-original-title' => $form['#info'][$field_name]['description']
  );
 $form['#info'][$field_name]['description'] = '';
}


texts: How to make a block display to get parameters from URL?

texts:
I'm using a block display of a View to show some content of several taxonomies. I want to use contextual filters to display content of only one taxonomy when in the URL is the taxonomy id.

By doing some testing in the preview it works fine (it shows different content according to the taxonomy used to test) but when I test in the page it doesn't work. I could try several taxonomies ids in the URL and the view will keep displaying the same content.

Example of my situation:

www.domain.com/mainPage -> This shows a block display with content of several taxonomies
www.domain.com/mainPage/taxonomyId -> This continues displaying the same content of the several taxonomies.


texts:
I was working on site, when I got this error:

  WD php: SearchApiException: Unknown or invalid item type node. in
  [error] search_api_get_datasource_controller() (line 1396 of
  /var/www/luken/shop/sites/all/modules/search_api/search_api.module).
  SearchApiException: Unknown or invalid item type node. w
  search_api_get_datasource_controller() (linia 1396 z
  /var/www/luken/shop/sites/all/modules/search_api/search_api.module).
  Drush command terminated abnormally due to an unrecoverable error.
  [error]

Site is telling me about "Unexpected error", the above error I'm getting thanks to the Drush. Last thing that I did, was:

Removing one Product Display content type (I'm using Commerce),
Changing indexed fields in Search API,
Clearing the cache - after that, site was down.

I even don't know where to start with fixing this. I was trying to disable Search API module with Drush, but it appeared that I can't, because I'm getting above error all the time. I can access to /admin/modules but still I cannot disable Search API, because of unexpected error.

What can I do to fix this?

Added:
I deleted my search index, now I was able to disable Search API, but error still appears when entering the site. I checked log, there is an error:

  EntityMetadataWrapperException: Unknown data property
  commerce_product. w EntityStructureWrapper->getPropertyInfo() (linia
  339 z
  /var/www/luken/shop/sites/all/modules/entity/includes/entity.wrapper.inc).


texts: How to determine create access for a given enitty and bundle

texts:
This one feels like it should be obvious, but after some searching I'm having trouble finding a code example for checking whether a user has create access for an arbitrary entity.

In this case, I'm looking to pass an arbitrary entity type and bundle, in order to check whether a user has create access. This can be any entity type, including custom entities.

I have a sense that the end of the expression will be ->createAccess() , based on what I've read for the entity access interface classes, but where I'm stuck is finding the right class to call first, in order to get the entity information.


texts: Compare date field columns to restrict difference in days between the two

texts:
I have an ad space website, where a person can place an advert, but for a maximum of 30 days.

To do this, I have a date field with a calendar popup and collect an end date on field. So it's one field collecting both dates. I need to validate the input of the end date by comparing it to the first field (start date).
I have the field validation module installed, but I'm not sure how to configure it.

How do I configure it? Or is there a better way to do this?


texts: Is it possible to abort sending of the e-mail somewhere in the middle of sending procedure?

texts:
Mail sending is initiated in the depths of some third party module. There's a case when I need to intervenue and depending on some environment variables either let it through, or prevent it. How do I do that?

I've seen in the wild a weird technique of setting $message['to'] to + (what's logic behind this by the way?). But this generates an error in server logs.

Any ideas?


texts: WYSIWYG only shows in administration theme

texts: Anyone having this issue where the wysiwyg editor is only showing when you are in admin mode?


texts: Drupal 7 multisites with subsite sharing main site data

texts:
I have created a multi-site  Drupal 7 in my localhost environment  with a main-site and a sub-site in it with a single database, with table names of sub-site prefixed with 'sub_'. If I tried editing the setting.php of sub-site, altering 'prefix' value in database array  to a shared table I cant access the sub-site own table. I need the sub-site to access both shared table and its own table.
So that if any content/content-type created in main-site has to be reflected in sub-site.But the content/content-type created in sub-site should not be reflected in main-site.

How to achieve it?


texts: Commons: can each non-admin user create groups?

texts:
I wan to configure a Drupal Common site so that every user can create groups. Can I do so? how? Thanks.

And is there any documentation anywhere for commons? OR a support forum?


texts: Restrict delete operation on a node referenced by another node

texts:
I am using References module to make a node reference in my course content type that reference to school content type (a course belong to one school and a school have many courses).

Now what I want is if I'm going to delete a school, the delete operation will not be completed if the school referenced by any courses.

I've read hook_node_delete() and hook_delete(), written them in my custom module, tried to dpm($node) but no use!

function mymodule_delete($node) {
    dpm($node);
}
function mymodule_node_delete($node) {
    dpm($node);
}

The school node still be deleted!

According to hook_node_info() , I create:

function mymodule_node_info() {
  return array(
     'school' => array(
      'name' => t('School'),
      'base' => 'school',
      'description' => t('A short description'),
    )
  );
}

  base: (required) The base name for implementations of
  node-type-specific hooks that respond to this node type. Base is
  usually the name of the module or 'node_content', but not always

And then in my mymodule.module:

function school_delete($node) {
    dpm($node);
}

The code still not working!


texts:
I have something like the following on my .routing.yml file:

my.path:
  path: '/my-path/{node}'
  defaults:
    _form: 'Drupal\mymodule\Form\MyForm'
  requirements:
    _entity_access: 'node.update'
    node: \d+

This works fine, it checks that the user has permissions to edit the node and all. Now, I want to restrict this route to work only for nodes of a certain content type. Ideally, something like this as the final line:

    node.bundle: 'article'   # this doesn't work, of course

How can I do this?


texts: Why would enabling a new module result in the majority of modules disabling?

texts:
On my Drupal Commerce site, I was attempting to add a Commerce Discount-related module that would allow me to specify a discount based on taxonomy term/product category. When I enabled the module however, my site showed that my enabled module count dropped by ~50 modules. Yikes! This included key features of the site, including payment methods (Paypal, FirstData), as well as XML sitemap-related modules. I also received some exception errors related to existing Rules on the site that were related to shipping rules.

I was able to revive through a backup, but had never seen this type of response before. Any ideas?


texts: using rules module : how i can adding page with the name of text field form when i click in the button

texts:
I want to automatically create a page had like name the one that I put in the fields: title of the node,
here is the image:

the steps that I want:

1 . enter a name of the node (example: Name of node).

2 . click the button BTTN.

3 . and when I click a page is going to automatically create a page as the name (example: Name of node).

I know how to add a page automatically (using rules), but I can not seem to give the name that I want
how i can add a page with the name of the text field?


texts: is it possible to add a class to header found in page.tpl based on a node id?

texts:
first off, i’m using Adaptive Theme so maybe this won’t make sense using a different theme. but here i want to add a class to

<header id=“main-content-header” class="someclasses">

which is found in page.tpl but based on node id. this would have to be done in mysubtheme_preprocess_page(). i have part of the code working.

 $variables['content_header_attributes_array']['class'][] = 'about'

but don’t know how to ascertain the node id that is contained on the page. is it possible? my pseudo code would read something like

if (nodeId == 1){
 $variables['content_header_attributes_array']['class'][] = 'about'
}

by the way, i find myself needing to do this constantly so i can style these headers differently, at least for this project i do. maybe there’s a better way to accomplish,..?

i can use conditional stylesheets but then there’s the issue of adaptive design and you’d have to put media query’s in these conditional stylesheets. don’t know if that’s such a good idea or not.


texts: How to fetch content data based on Node reference field into a view

texts:
i am attempting to fetch the records based on node reference fields into a content type page.

i added node reference fields "news" & "Articles" (and many more) into my "Industry" Content type:

Now i've created a view with a filter (Content type= industries). Find the snap of the view here:

i want to list down all the selected/inserted news and articles (along with their content data) into the view. (currently its fetching only titles but with lot of repetition of the titles from both content types.)


texts: What is the best way to keep your site code in git and pull in core and contrib in the same repository?

texts:
Back when drupal was in CVS I had my sites in a git repository and then pulled in core and contrib via CVS. The two systems happily co-existed and I could track changes to everything and make patches to contrib modules. Now with git I am unsure whether to just download contrib and core and check it into my site's git repository, or maybe use submodules?

I am wondering if there are any best practices on this yet? I am particularly puzzled about how to have core as a submodule if my repo uses drupals root directory as its own root?


texts: Selecting a product attribute from a select list won't update other attribute fields

texts:
I'm working on a store created with Drupal Commerce where I have first created a product variation, then I created a corresponding product display type and finally I created different products, e.g. mattresses.

Now I find myself stuck with this problem: I have mattresses of different size and I have a product attribute (within the product variation) accounting for the different sizes - I have the option "Enable this field to function as an attribute field on Add to Cart forms" already checked.

When I select a size from the select list, the product price changes and displays accordingly but other product attributes, i.e. the sku, displaying on the same page, does not update.

Now, if I move on to the cart summary I can find the right sku, it looks like the price updates without the need for a page reload, while other custom attribute fields don't (you can see all of this live at http://www.dormiplus.it/cms/?q=it/materassi/stella, where "codice" is equivalent to sku).

How can I have the right sku displaying correctly whenever I select a different mattress size?


texts:
I'm experiencing a weird behavior with an ajax form submit that I cannot find an answer to.

This is my first attempt at making an ajax form so bear with me if I'm making a rookie mistake somewhere.

namespace Drupal\MYMODULE\Forms;

use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Ajax\AjaxResponse;
use Drupal\Core\Ajax\HtmlCommand;

class InputForm extends FormBase {

  public function getFormID() {
    return 'authForm';
  }
  /**
   * Implements \Drupal\Core\Form\FormInterface::buildForm().
   */
  public function buildForm(array $form, FormStateInterface $form_state) {

    $form['#prefix'] = '

';

    $form['key'] = array(
        '#type' => 'textfield',
        '#title' => t('Key'),
        '#size' => 10,
        '#name' => 'key',
        '#required' => TRUE,
        '#attributes' => ['id'=>'key','name'=>'key','class'=>array('input-sm')]
    );

    $form['code'] = array(
        '#type' => 'textfield',
        '#title' => t('code'),
        '#name' => 'code',
        '#required' => TRUE,
        '#attributes' => ['id'=>'code','name'=>'code','class'=>array('input-sm')]
    );

    $form['form_submit'] = array(
        '#type' => 'submit',
        '#value' => t('submit'),
        '#name' => 'submit',
        '#ajax' => [
            'callback' => '::test',
            'prevent' => 'submit',
            'progress' => []
        ]
    );
    return $form;
  }
  public function validateForm(array &$form, FormStateInterface $form_state) {

      if (strlen($form_state->getValue('key')) < 10) {
        $form_state->setErrorByName('key', $this->t('Key is too short'));
      }

  }

  public function submitForm(array &$form, FormStateInterface $form_state) {
    // Handle submitted form data.
  }

  public function test(array &$form, FormStateInterface $form_state) {
    if($form_state->hasAnyErrors()) {
        $form_state->setRebuild(TRUE);

        return($form);
    }

    $response = new AjaxResponse();
    $response->addCommand(
        new HtmlCommand(
            '#testdiv',
            '
HELLO
'
        )
    );
    return $response;

  }

}

So the erratic behavior is in the validation of the form. What is happening is when I click the submit button (with no values in the input fields) the ajax fires and through var dumping I know the $form_state->hasAnyErrors() returns true but the form rebuild that is returned is not modifying the form highlighting the fields with errors as expected.

So after spending a couple hours trying to sort out this issue I got frustrated and mashed the submit button over and over again in a rage and low and behold it did what it's supposed to do after about eight clicks.

So then I tried to narrow down how many times it would take hitting the button before it would work correctly and it would always happen at random clicks. Sometimes after 2, sometimes after 3... sometimes after 10.

I'm stumped as to why it doesn't happen each and every single time the button is clicked rebuilding the form properly with errors.

Of Note:

Have tried removing the prevent key
Have tried with Bartik theme with same results
Have tried setting an ID on the submit button but then ajax doesn't fire
Have confirmed that the form does have errors
Have input values into the fields (key value shorter than 10) and the same
behavior happens in the validateForm() function

If anyone could point me to what I could be doing wrong I'd very much appreciate it. Thanks in advance!

Edit for visual example:
Gif showing behavior


texts: How to change path of taxonomy facet search

texts:
I am using facet search on my site.  The search paths for taxonomy term facets are of the pattern "search/term-name", but I would like them to be of the pattern "search/term-tid".

Is this possible?  How can I change this?


texts:
I had a some blocks on the dashboard page.
Then I created a new role with fewer permissions and wanted to show only a couple of them on the dashboard.
I edited all blocks and restricted the access by role.

Now all the blocks with restricted content are still visible in the dashboard but they all have the "(empty)" text on it.

How can I get rid of these blocks completely ?


texts: menu link title overriding form title in content part!

texts: I gave a menu link path to a form. Then when I click on that menu link, the form appears, but the form has the title, that of the "Menu link", which means that the menu link title overrides the form title.


texts: How to add another html tag (i.e. span) before the field value renders using hook_preprocess()?

texts:
I have a field (field_txt) that renders properly, but now i want to add a  tag around it so that i can style the background color of it. How would this be possible using the preprocess field hook?

Output

some text value

Desired Output:

some txt value


texts: Looking for solution to have specific terms have automatic tooltips whenever entered into content items

texts:
I would like to have specific text automatically (or manually) insert a tooltip.

For example, let's say I want every instance on the website of:

CMS

And have the tooltip say:

"Content Management System"

For drupal to automatically add this would be nice...but not asking for that much ;)

Can I add some kind of dynamic token?

The html can be static since the CSS is bootstrap CDN:

Drupal is the best CMS in the world.


texts: CKEditor doesn't load when using Bootstrap theme

texts:
I'm building a fresh site on Drupal 7.26 and the main Bootstrap 3 (7.x-3.0) theme from https://drupal.org/project/bootstrap.

My site also uses Organic Groups and Display Suite, along with many other modules. CKEditor 7.x-1.13 is installed. I have not edited the code of any file in the site, including the theme files.

Problem: When creating new content, CKEditor does not appear in the text area with 'filtered HTML' settings.

Details:

My basic test user with only
"authenticated user" role cannot use CKEditor to create or edit
content. A Bootstrap-themed textarea is all that shows for all 'filtered HTML' text fields.
My admin user, using the Seven theme in overlay for admin and
editing, can access CKEditor everywhere I expect to see it. CKEditor
buttons and layout are correct.
I switched the site
default theme over to Seven, and my basic test user could use
CKEditor. Once the theme was switched back to Bootstrap, CKEditor
went away.
The really
odd part: CKEditor loads properly for the basic test user in
Bootstrap theme for all comment entry forms.

The only permissions I see for CKEditor are "Administer CKEditor access" and "Customize CKEditor appearance", which are both set only to administrator.

Resources I have read that are similar:

Having my own theme for creating and editing Nodes: No WYSIWYG Editor
https://drupal.stackexchange.com/questions/77731/ckeditor-doesnt-show-up
CKEditor is missing when editing a page, but works fine when creating a new page
http://docs.cksource.com/CKEditor_for_Drupal/Open_Source/Drupal_7/Troubleshooting#CKEditor_does_not_work_in_my_theme

In the source code for a create node page in my basic test user's account, I see
finally, at line 273 it has the scripts:

<script src="http://my.site.com/sites/all/modules/ckeditor/includes/ckeditor.utils.js?n1lvkb"></script>
<script src="http://my.site.com/sites/all/libraries/ckeditor/ckeditor.js?n1lvkb"></script>
<script src="http://my.site.com/sites/all/themes/bootstrap/js/bootstrap.js?n1lvkb"></script>

I'm wondering if loading the CKEditor js at the end is related to this problem. Since I haven't yet dug into coding in Drupal though, I'm not sure how to correct it.  I'll be creating a Bootstrap sub-theme, and maybe I can address this problem there? Any advice on this would be greatly appreciated.

As I debug this, I'll add some edits at the bottom showing what I find.

Screen captures:

Updates:

I created a Bootstrap sub-theme and activated it. For a quick test I pasted the script sources for ckeditor into the head tag. In Firebug, when viewing a Page created by Panels, the console shows this error:

TypeError: Drupal.settings.ckeditor is undefined
window.CKEDITOR_BASEPATH = Drupal.settings.ckeditor.editor_path;
on line 5 of ckeditor.utils.js

I guess that means settings haven't loaded yet.

I removed the pasted-in script sources.  After removing them, the above settings error no longer appears.  Based on the tips in the CKEditor troubleshooting, I verified that php commands to print the vars scripts and page_bottom are in place. Now, on a node creation page, Firebug reports these errors:

TypeError: a(...).on is not a function
...a(this),f=e.data("bs.modal"),g=a.extend({},b.DEFAULTS,e.data(),"object"==typeof ...
bootstrap.min.js (line 9)


texts:
My Drupal offers only three types of rendering a Date ISO field (Display management in Content Type admin panel). What if I want to see my date in a different way? Is there any way to set my own formatter?

Second question. Is there any possibility to indicate while calling render(...) or field_view_value(...) (or anywhere else) what formatter to use? For example, I want for specific set of nodes to show not brief date variant but a full one. How can it be achieved?


texts:
I have installed WYSIWYG module in my drupal website and i unziped  fckeditor folder in libraries directory.
In 'Wysiwyg profile' page i set fckeditor for Filtered html format then checked all the button i want to display on the editor.

in the Filtered html configuration page i enabled:
1- Limit allowed HTML tags, and i allowed all the tags i need to use.
2- Convert line breaks into HTML
3- Convert URLs into links
4- Correct faulty and chopped off HTML

Now when editing or create new node the fckeditor appear after finishing and saving the node the text display like this:

[b]Services

1- [/b][u][b]Civil and Electromechanical Contracting for O&G Companies[/b][/u][b]

[u]Construction of sewer pipelines, and waste water treatment plants
Construction o[i]f unpaved r[/i]oads (service roads)
Warehouses & buildings construction
Water wells drilling, uphole and dynamite drilling for geophysical surveys
Electromechanical construction[/u]

2- Foundation & Soil Shoring Systems Contracting
[i]
Geotechnical Investigation
Foundations and soil shoring systems design and execution
Ground treatment and improvement
3- Mining Services
[/i]
Drilling, blasting, crushing, and transport of minerals

[/b]

notice: i set some text as h3 and i colored some words but nothing appear as i want.
Please help


texts: How do I make a profile select option on user registration?

texts:
I thought this was easy but normal fields and media don't seem to do what I want. I can use normal fields, because it is Drupal 8 and the user is an entity. So all I want to be able to do is:

a) show the user a "profile picture" upload option upon registration
b) also allow them to choose one of the 5 pre-existing images I have uploaded
c) easily allow myself as admin to upload more images

Right now I'm thinking of doing a bit of a hack where I simply add an image field, but add another field with custom logic (somehow) that allows the user to choose an image.

But I was hoping someone can suggest something better? Or alternatively, advise perhaps on a way to re-use the image field and add a "choose image" feature to it?

P.s. I am trying to simply allow the user to choose an avatar when signing up. They must just be able to click on the one they like, out of a set of predefined options. If they don't like one, they must be able to upload their own.


texts:
I used taxonomy term field with field collection and taxonomy term id not attached on node id. taxonomy term cannot get result. look video! used D8 but in D7 have the same problem. the same problem have field collection like module, Paragraphs.

https://www.youtube.com/watch?v=cEI1yDcJXT4


texts: How do I theme a link from a template file?

texts:
A twig template is rendering a list of links that come with classes. The basic:

{{ mylink }}

twig code will output something like

the text

Not all links have classes. I want to write a twig template that will instead output something like this:

  the text

What I've tried:

I looked for the twig template to override. Unfortunately it seems that links are not rendered by a twig template.
I tried updating the twig variable like

set mylink['#title'] = "..." ~ mylink['#title']

But it won't let  me do that.


texts: How can I tell Drupal to add autocomplete=off to the login form

texts:
I'm under pressure to close out some issues from a Qualys scan. One issue flagged was

  150112 Sensitive form field has not disabled autocomplete

Suggestions include adding autocomplete="off" to the username and password fields.

What would be the best practice way to achieve this?


texts: How to change views exposed filter default value

texts:
So I have this view with exposed filter of taxonomy terms with depth, I had selected some of the terms to limit the selection.

everything works just fine but the issue is that the default value of the exposed filter (combo-box) is set to the latest entry (taxonomy term), and I want to set it to that -All- thing.

I know that if I don't select any of the terms to limit the selection, it'll be set on -All- as default value for the exposed filter, but I don't wanna do that!

the question seems quite simple but I couldn't figure this out! thanks.


texts: Render form markup outside of an actual form

texts:
I'm creating a form using the form API, and I am loading various things along the way with AJAX. These things function separately from the form itself, but I want them to appear the same i.e. with the same markup as the form fields. Is there any way to render single form elements that don't reference any actual form?

I'm thinking something like the following:

render_textfield(
    array('title' => 'Title');
);


texts: Mutlti level filter with search api and facet in commerce kickstart

texts:
I'm using commerce kickstart, I want to use the built-in filter blocks (facet & search-api).
I have multi-level categories (taxonomy), but filters just display parents categories.
For example I have as categories:

  computers
  -laptops
  -desktops
  -notebook
  Networking
  -routers
  -modems

Filters just display computers and networking


texts:
I'm currently developing a Drupal environment for a school project. I've already read a few books about Drupal, but still need to improve my skills when it comes to programming.

The project exists of developing a new intranet/extranet for existing content. Currently, the intranet/extranet exists of standard html files linked to eachother. The content on the intranet(intranet.example.com) is only available for users on the company network. However, some content needs to be available on the extranet (extranet.example.com).

I'd like to use one Drupal installation to manage all content, users... Is this possible by using a multisite configuration?


texts:
I'm working on a publication database, the result should be something like this: http://www.bmj.com/content/350/bmj.h2747 As you can see in authors list and in Author affiliations block, only unique workplaces are listed as footnotes of authors.

I'd like to figure out how this can be reproduced with views (or with other technique)? I created a content types for authors and can filter them for a given article in a view. But the result should be massively process: I have to filter the unique workplaces and assign them to authors in the display.

So as the title asks: How (and where - in the view?) can I process the result of this view?


texts: content.field_name does not render anything

texts:
i've made a twig file for my 'test' content type called node--test.html.twig. That works fine using {{ content }} to print the node.

I've a custom field with the machine name field_text, the following prints fine:
{{ node.field_text.value }}

For some reason i cant get {{ content.field_text }} to work. I also can't get content.body or any other subset of content to work in any node type.

I must be doing something really daft - thanks for the help


texts: Loading nodes from a specific user and a specific node type

texts:
I have written this function to do so, but it behave strangly, i am wondering if i have the correct approach

function getNodes($type,$userID){
        $where = array();
        $nodes = array();
        $where[':type'] = $type;
        $where[':uid'] = $userID;
        $result = db_query('SELECT nid FROM {node} WHERE uid = :uid AND type = :type', $where);
        if($result){
            foreach($result as $o){
                $nodes = node_load($o->nid);
            }
        }
    return $nodes;
}

Isn't there a drupal API that loads node from the DB by passing it a UID and Node type ?


texts:
Out site has many, many nodes included in a number of menus. When creating a node, the Parent Item select box under Menu Settings is quite long.

Is there a module that provides a better, more usable interface to selecting the parent item? I've done some searching and couldn't find anything.


texts:
In the Panels UI, when you are editing a variant, you have the option to Export the variant, and the tooltip says "Export the variant into code to import into another page."

This is exactly what I would like to do, but where do I paste the code to import it?  When I choose Add variant, I don't see an option to import, and I don't see an import option in the Page Manager UI (admin/structure/pages) either.


texts:
I'm using Drupal 9 and recently discovered Easy Breadcrumb. I'd like to use a custom field to overwrite the page title to be displayed in the breadcrumbs, but it seems to be not working.
In the configuration, there is a field "Alternative title field name for breadcrumb" with "field_breadcrumb_title" by default, but when I add a field with this name to my page, it does not display. Instead, I get the page title or (when I disable "Use the real page title") the formated URL segment.
There is a discription of every configuration field in the documentation, but of all things this one is missing.
Does anyone know, if this functionality is working?
Thank you!


texts: Manage display of geofield with wkt input widget

texts:
I am stuck on something that seemed very simple and need your help.
I have an input form where there is a geofield input field of type WKT. So the user gives the WKT of a point. When the node is viewed I would like the WKT that the user previously gave to be displayed on a map. On the manage display tab all the other options seem to work (WKT, KML, description etc), except from the map option like leaflet, openlayers and geofield maps. There is empty space where the map was supposed to be.
Can anyone help me on this?


texts:
Yesterday I installed the CDN Module using Amazon Cloudfront and magically everything worked as expected. I was quite happy.

This morning I was showing off my new improved CDN enabled website to a colleague and most (not all) of the image style generated images were broken! And to confuse things even further, when I opened a broken image in a browser window the file was actually Drupal's Access Denied Page.

Digging into this further, I found that the /sites/default/files/styles/STYLE folder was empty. This seems strange to me since it was not empty yesterday when all of these files were uploaded to Amazon. What could be deleting the styles/STYLE folder?

So, I installed the Image Style Flush Module and flushed the style in question. Still nothing, but it makes sense since the CDN module is re-writting all of the links to static content and Drupal doesn't actually get hit to re-create the missing image. How the Access Denied page was uploaded is a mystery as well.

Next, I disabled the CDN module and cleared the cache. Reloading the page recreated all of the images and everything works as expected. But, I need to use the CDN as it's a requirement of the project.

Drupal 7.27, CDN module latest version.

I could blacklist the /sites/default/files/styles/STYLE folder, but that represents almost 30 images that are loaded on every page.

Any advice would be greatly appreciated.


texts: How do I set the active menu item dynamically for a view?

texts: How do I change the active menu item when showing a view? This post shows me how to do it for node (using hook_nodeapi()), but how/when/where do I do it for a view? I tried hook_views_pre_view(), but that does not work.


texts: Set a theme for a single content types edit page

texts:
How do you set the theme for the edit page for just one content type on your site?  I am using bootstrap for non-admin pages and using the default seven for the admin pages. So basically I need to override the admin theme of seven with the bootstrap theme, but only for one content type.

Any help is much appreciated.


texts: url alias not working in block page restrictions

texts:
I've create some blocks that I have set up to show on "Only the listed pages".

I had set up a taxonomy with a url alias and added this alias to the list of pages allowed. This was working few weeks ago. The client has come back saying that the blocks have disappeared from the pages and they have.

When I was looking at the block I took it's none aliased url and put that into the list of allowed urls and then the block reappeared.

Has anyone come across this before and if so was there a reason behind it?

Do I now have to go through the site and put the node/1 etc.. url into the block allowed lists?

Thanks in advance for your help.


texts: Optionally add image/icon after node title based on boolean content type field?

texts:
Using Drupal 7.10 with a Zen sub-theme.  I have a custom content type, say Product.  The products have titles such as "Wrench", "Hammer", "TV".  I want to designate certain products as being a recommended product by having a little star icon appear inline after the title.

So for example:

Wrench
Hammer *
TV
Scooter
Piano *

Whether the star appears or not should be based on a boolean field I added to the product content type.  I want the star to appear when viewing the node directly or when the node appears as part of a list in a view.

My thought was to put an if statement in the node template for my content type, e.g. node--product.tpl.php.  However, what has me stuck is that in Zen it appears, if you are viewing a node as a page then the title is rendered in the page template, and if you're not viewing the node as a page then the title is rendered in the node template.  I'm not sure how to reconcile this.  Furthermore, I'm not sure if my field variable would even be available directly from the page template.

UPDATE

It appears I can successfully create a boolean preprocess variable in the function mytheme_preprocess_page whose value is based on field from the node:

function mytheme_preprocess_page(&$variables, $hook) {

  //$variables['sample_variable'] = t('Lorem ipsum.');

  if (isset($variables['node'])
      && $variables['node']->type == 'mycontent_type') {

    if($variables['node']->field_is_recommended
       && $variables['node']->field_is_recommended[LANGUAGE_NONE][0]['value'] == 1) {
      $variables['is_recommended'] = TRUE;
    }
    else {
      $variables['is_recommended'] = FALSE;
    }

  }
}

So now that I know this is possible, what's the best way for me to do this?


texts: I would like to be able to use Rules to have the Node Export module create an XML file whenever a certain type of node has been updated. I have set up a Content Type with a display and an edit screen. The edit screen includes a Save button. I have also set up a Node Export which has successfully created an XML file with data from the node. It runs via a Node Export tab on the display screen of the node. What I would like to do is have the Node Export to XML occur whenever the Save Button is clicked, right after the update of the data is done. I began to create a Rule for this. For the Event, I chose "After updating existing content". However, under "Actions" I was not able to find any reference to Node Export. Has anyone been able to do this or can anyone point me in the right direction? Thank you.


texts: How to find the viewid and view-display-id?

texts:
I'm trying to customize a view displayed in the homepage. Specifically, I'm trying to build slideshow with Bootstrap Carousel.

I've checked this page, but I don't understand how to find viewid or view-display-id. Instead of the viewid I've tried to use the view name, but it doesn't seem to work.
Anyhow, I've created a new folder inside the templates folder called views, in which I've created a new file with the following name: views-view-fields--homepage-carousel--block.html.twig

Here is the code:

    {% if ((title is not empty) or (description is not empty)) %}

        {% if (title is not empty) %}

 {{ title }}

        {% endif %}

        {% if (description is not empty) %}
          {{ description }}
        {% endif %}

    {% endif %}

Which naming should I use to override a view displayed only in the homepage?
Thank you!

UPDATE

I've managed to correct the information thanks to user No Sssweat. Now, I'm able to customize my view. Here is the file name: views-view--homepage-carousel--block-1.html.twig, where homepage-carousel is the viewid and block-1 is the view-display-id


texts: Implement hook_node_access based on field value

texts:
I need to implement hook_node_access based on field value, which I can get only via $form variable. At the moment I cannot do this because I only have variables ($node, $op, $account) available in hook_node_access. Could you please help me to find the way how to implement something like:

if ($form['...']['...'] == 'TRUE') {return NODE_ACCESS_ALLOW;}


texts: Any D7 modules similar to the Project Issues module?

texts: Are there any D7 modules similar to the Project issues module?


texts:
I read How to unset fieldset in hook_form_alter? to disable fieldsets in an hook_form_alter() implementation, but it didn't work.

I tried using the following code, but neither of them worked.

// First try.
foreach ($form['#fieldgroups']['group_employment']->children as $form_element_id) {
  $form[$form_element_id]['#attributes']['disabled'] = TRUE;
}

// Second try
foreach ($form['#fieldgroups']['group_employment']->children as $form_element_id) {
  $form[$form_element_id]['#attributes']['disabled'] = 'disabled';
}

How can I disable fieldsets?


texts: How to provide a contextual filter with an OR conjunction to a view?

texts:
I have users that can be associated with a single node of type foo. The node has a list of users that are associated with it. I populate the entity reference fields in the content type with a view, which filters users that aren't associated with foo (user has no foo).

What I need to happen is that I need this view to also grab users that are associated with the specific node that I'm looking at, so when I try to add new users to the foo content type, the users that were associated with it beforehand remain associated with it (user has no foo OR user's foo id equals current foo id). The problem is that the first filter is a normal filter, the second is a contextual filter. How can I, programmatically or otherwise, get the views to grab the users I need with those conditions?

Edit: Unfortunately, the views-related hooks aren't called when populating an Entity Reference, which makes things like hook_views_query_alter not a solution. So a more accurate question would be: how can I get the entity reference to grab the users I need with the given conditions?


texts: Placing exposed filters (with BEF) in various Panel regions

texts:
So, my question is basically the same as How to show in different positions exposed filters in a View?  However, the answer here did not work for me (and I could not post a comment there because I don't have 50 rep -- very sorry).  I follow the steps outlined exactly and I only have the option to place "View exposed widgets" with no sub options.

Basically, I'm trying to place my exposed filters in various places within the display (almost identically to the referenced ticket).  I'm running Views with type of Context and using Better Exposed filters.  According to quite a few places, that should allow me to place the individual filters in whichever region of the Panel I desire.  However, I don't see them.

Any advice?


texts: How to sort a view using values not stored in the database

texts:
I'm using a view where elements are sorted by price values,
under certain conditions the price values are rewritten on the display (if there are offers) but not in the database. The problem is that I need the results to be ordered by the rewritten price.
I can reorder the results returned by the query using a views_pre_render hook:

https://stackoverflow.com/questions/2471361/how-to-sort-view-results-programmatically

but it only affects the current page so elements are not properly ordered within the elements not shown in the current page.

Other option would be to order the view altering the query itself but since the right price values don't actually exist in the database I don't know how this could be done.
Is there a way to order the results of a the whole view when paginator exists?

I've thought about not using pagination and requesting all the elements of the view so I can create my own paginator once I've ordered the results but I'm not sure how would it affect the speed of the page.


texts: In my website, I want when user click on add to cart to any product it will added automatically to cart via ajax and product should be visible on a cart text like 'Your shopping cart' and as i mouse hover on that link, the products which are in cart should be visble. How can i do this?? I am using ubercart.


texts: What drupal function do I use to rename files when saving nodes programatically?

texts:
Normally when saving a node with the content type form, uploading a file will automatically rename it if the file name is already in the database.

I am creating nodes programatically. Everything works fine, except if the file name is in the database it fails as this is, of course, a unique field.

What function does Drupal use to check if the name already exists and chanages it accordingly? I could write one, but as drupal already seems to handle this perfectly, I dont see a reason to reinvent the wheel. Here is my code for the file saves.

$file = new stdClass();
$file->filename = basename($local_path);
$file->filepath = $local_path;
$file->uri = $local_path;
$file->filemime = $mime;
$file->filesize = filesize($local_path);

$file->uid = $uid;
$file->status = FILE_STATUS_PERMANENT;
file_save($file);

$images[] = array(
'fid' => $file->fid,
'alt' => $page_data['title'],
'title' => $page_data['title']
);


texts:
When we send a comment, it shows:

comment

When we send a reply to that comment, it shows:

comment

reply comment

Now I want to show reply comment in the first article tag.

comment

reply comment


texts:
I installed the Void menu module and I created a link in the main menu with the Path field set to <void>.

When I click in the menu item, the href is javascript%3A%20void%280%29%3B instead of javascript: void(0);

Any idea for fix this issue?


texts:
I want to be able to have a search box so that when you search, the result is displayed in a view. I want to search for tags in nodes.

The reason I want to display this in views is because I only want to display 3 fields and I want to display it in a 3x3 grid with a pager.

I don't want to be using Apache Solr because the output of the search is quite ugly and I can't customise the fields I want to display etc... Also I want to keep the layout consistent with the rest of my views.

I found this http://drupal.org/project/apachesolr_views but it requires views 3, and I don't feel comfortable upgrading.

Is there any way to have some sort of search box for views that would search for tags? and what module would you recommend me for tagging my content?

I'm using Drupal 6.

Thanks.


texts:
So I have webform module installed and I created a webform. Webform has an choice field (drop-down). Let's say you can select one of 3 options: "one", "two", "three". I need a way to add (editable) array of numbers to each of this option. I.e.

one:  75, 50, 80

two:  25, 50, 65

three: 20, 40, 70

So, as far as I know those options are not entities and I can not add fields to them to store those numbers.

My idea is to create new content type to hold those numbers, but I need a way to connect field options with my new content type. Meaning, when creating new node in that new content type, beside entering numbers 75, 50, 80 I need a reference field with options "one", "two" and "three" so I could know to what webform field numbers in this node belong.

Other way would be to reference other way - to add node reference to field option, but I think that's not possible either.

Any idea how to solve this?


texts: Allow users to edit own unpublished content

texts: I would like to provide users with role-A and role-B the ability to edit their own published and unpublished content. I've installed the Content Access Module and seems impossible to make this without coding. Does anyone know how to solve with code?


texts: Is there a way to create a Text Format on install of a Drupal Module? And enable a Filter for my module?

texts:
I want to do a custom filter that replaces certain text with HTML. Essentially shortcodes as done by Wordpress.

Unfortunately, the Filtered HTML Text Format strips most HTML.

So I created my own Text Format manually and enabled only my own Filter.

Is there a way to do this programmatically in the module.install file?