texts: Current page title token doesn't change when going to multiple pages

texts:
I have a block where I want to include a token of the current page Title. But it's either caching or locking up after the first page.

In a sidebar there's a block where I've tried two things:
1. "Find out more about [current-page:title]..."
2. "Find out more about [node:title]..."

[node:title] gives nothing - a blank result.

[current-page:title] will often give the first page a visitor sees. But when they navigate to another page, it only remembers the previous page. They visit page#2 and the text still says "Find out more about page#1"

I don't even know where to begin on this. I have enabled Tokens, as well as Custom tokens and Pathauto. I don't think those would cause any issues, but I mention just in case.

I can research and modify this question if someone has an idea what steps I might take to refine to something more specific


texts: How do I overwrite the controller for admin/content?

texts:
On admin/content, I have created different views for articles and basic pages (the default content types created from Drupal). On admin/content, it shows Content | Article | Basic Page. When I already have Article and Basic page as separate.

On admin/content, I would like to show as Blank means no data instead of showing all data.

I tried the following code.

modules/custom/content/src/Routing/RouteSubscriber.php

namespace Drupal\content\Routing;

use Drupal\Core\Routing\RouteSubscriberBase;
use Symfony\Component\Routing\RouteCollection;

/**
 * Listens to the dynamic route events.
 */
class RouteSubscriber extends RouteSubscriberBase {

  /**
   * Used to alter routes.
   */
  protected function alterRoutes(RouteCollection $collection) {
    if ($route = $collection->get('system.admin_content')) {
      $route->setDefaults(array(
        '_controller' => '\Drupal\content\Controller\ContentOverviewController::overview',
      ));
    }
  }

}

I'm trying to override its default controller, so it show blank.

The code for the controller is the following one.

namespace Drupal\content\Controller;

use Drupal\system\Controller\SystemController;

/**
 * Class ContentOverviewController.
 */
class ContentOverviewController extends SystemController {

  /**
   * Content Overview.
   */
  public function overview($link_id) {

    $build = [
      '#markup' => $this->t('Hello World!'),
    ];
    return $build;
  }

}

The code doesn't seem to work.

I also tried to disable the content view, but that is not needed.


texts:
A site user needs to be able to add news to Drupal 8 site.

Some news might be own contents and some news might be from external sources.

If the site user is adding a news which is from an external source, the site user should be able to add a node by just entering the source URL(i.e. examplesite.com/xyz).

If the site user is adding a news which is their own content, the site user should be able to add a node by entering the contents which may have number of paragraphs with titles and few images for each node.

Site user also should be able to add nodes without any coding.

I already create a role and the user for the role.

I created a content type "News" which currently have title and body fields.

How can I create a content type which meets the above requirements?


texts: List of people who flagged me since my last login

texts:
I've created a Like flag using flag module and a page view to list all people who like the currently logged in user. The views works good and am getting a list of users who like me (the currently logged in user). I want to filter the list of people who've liked me since my last login.

Been messing with the user:last login and user:last access filters. Can't find to make it work. Can anyone please help me with this?? (edit: I realize that the user:last login and user:last access filters is for filtering the list of users so no luck yet)


texts: What's the correct way to install Drupal with Composer if I want to work on core issues?

texts:
I want to install a local Drupal site in such a way that Drupal core is a git repository so I can work on patches.

Just doing a git clone doesn't work, because I also need tools such as Drush, and installing those in a git clone of core changes the composer.json file that belongs to core.

What's the correct way of doing this?


texts:
If I run drush make drupal.make.yml .  the downloaded contrib module colorbox has a colorbox.make file that is executed and install the library colorbox.
How to not permit to run that files, with drush make or in yaml file?
api: 2
core: 7.x
projects:
  drupal:
    version: '7.75'
    patch:
      htaccess:
        url: 'patches/htaccess.patch'
    colorbox:
    subdir: contrib
    version: '2.12'


texts: I'm running Drupal 7.39 and I'm trying to add a textfield exactly between the  "name" and "email" field. I also tried with the #weight property as noted by the Form API but it does not work.


texts: How to translate a word in <a title (tpl)?

texts:
How to translate the word Menu ?
t('Menu') (after class="tb-main-menu-button ...) doesn't work in this case.

<?php
if($menu_bar = render($page['menu_bar'])): ?>

<div class="container <?php print $grid; ?>">

Menu
<?php print $menu_bar; ?>


texts: How to make custom Drush commands to work on remote instance

texts:
I have developed custom Drush commands that includes some shell commands all which work locally. I would like them to work also on the remote instance with aliases that have the remote settings. Here is how the shell commands are currently executed:
//executes command

function execute_command($command)
{
    drush_log(dt('COMMAND: @command', array('@command' => $command)), 'notice');
    //any shell command fore example 'cp some/source dest/dir','tar xvf some.tgz',etc
    drush_shell_exec($command);
    drush_log(drush_shell_exec_output(), 'debug');
}

So, I would like to wrap this into some Drush API so they also execute on remote instance. Is it possible? How should I make the shell commands part of my custom Drush commands to run on the remote instance when user does something like:

drush @remote-alias custom-command

Thank You


texts: Buttons get longer when pressed if using AJAX

texts:
I'm using Ajax Commerce Cart Cart with a custom Drupal 7 theme that I made with Artisteer, but the issue does not seem to just be related to the one module. Whenever AJAX is attached to a button, when the button is click it pretty much doubles in width while the AJAX process is taking place and then returns to it's original size.

I wasn't sure what code or information you'd need so please do ask if you need me to upload anything or provide further details. Does anyone know of any solutions to this problem?

Thanks in advance


texts: Hide block if content is empty not working

texts:
I want to hide an entiere block is it has not result.

I went into my view, then I add "Contextual filter", "Empty", "Hide view".

But my view is always hidden if I do this, and I don't understand why... (I have content in this view, but it could be empty).

Do display my view, I'm using this : https://drupal-bootstrap.org/api/bootstrap/templates%21system%21region.html.twig/8

See my config :


texts: Ubercart uc_recurring subscription issue

texts:
I'm using uc_recurring module in my Drupal based site. I just can't get on with it:
In the cart I want to make possible of subscribing for the products. The customer can subscribe for the products (weekly, biweekly, monthly, semianually, etc) while buying them, for he can get discounts through subscription(12%, 9%, 6%, 3%) respectively. As far as the customer is subscribed for some type of products, on that point when the appointed day comes, transaction should occur via PayPal gateway and a certain amount of money needs to be charged from the subscriber's account, and send them notifications.

How can I manage subscription and unsubscription?


texts: get form state values of forms which added via ajax

texts:
the forms were added via ajax,but I just don't know how to get $values= $form_state['values']['field_name']; ,the result return nothing.Thanks in advance!

<?php

/**
 * hook_menu()
 */

function addstudent_menu(){
    $items= array();
    $items['user/%/add-students'] = array(
        'title'=>t('添加學生賬戶'),
        'page callback' =>'drupal_get_form',
        'page arguments' => array(addstudent_form),
        'access arguments' => array('create new users'),
        'type' => MENU_LOCAL_TASK,

    );

    return $items;

}

function addstudent_form($form,&$form_state){

    $dropdown_source = taxonomy_get_tree(3);
    if(!empty($dropdown_source)){
        $options = array('0'=> '--none--');

        foreach($dropdown_source as $item){ //we get all class term here
            $key = $item->tid;
            $value =$item->name;
            $options[$key] = $value;
        }
    }else {
        drupal_set_message(t('你还没有创建任何班级'),'error');
    }

    $form['addstudent_wrapper'] = array(
        '#title' => t('添加學生賬戶'),
        '#type' =>'fieldset',
        '#prefix'=>'
',
        '#suffix'=> '
',

    );

    $form['addstudent_wrapper']['fields_head']['select_class'] = array(
        '#title'=> t('班级'),
        '#type' => 'select',
        '#options'=>$options
    );

    $form['addstudent_wrapper']['fields_head']['student_qty'] = array(
        '#title' => t('人數'),
        '#type'=> 'textfield',
        '#size'=> 10,

    );

    $form['addstudent_wrapper']['fields_head']['add'] = array(
        '#type' => 'submit',
        '#value'=> '確認',
        '#ajax' => array(
            'callback' => 'addstudent_get_callback',
            'wrapper' =>'fields_wrapper',

        ),
    );

    $form['addstudent_wrapper']['fields_wrapper']=array(
        '#tree' => TRUE,
    );

    return $form;

}

function addstudent_get_callback($form,&$form_state){
    $form_state['rebulid'] = TRUE;
    $i = $form_state['values']['student_qty'];
    return $form['addstudent_wrapper']['fields_wrapper'] = _addstudent_fields($i);

}

function  _addstudent_fields($i){
    for($a=0;$a<$i;$a++){

        $form[$a]['field_number'] = array(
            '#title' => '學號',
            '#markup'=>$a+1,
            '#tree' =>TRUE,
            '#type'=>'markup'

        );

        $form[$a]['field_name'] = array(
            '#title' => '姓名',
            '#type'=> 'textfield',
            '#tree' => TRUE,
            '#parents' => array('field_name', $i, 'field_name'),
            '#size'=> 10,
            '#default_value'=>''
        );
    }

    $form['addstudent_wrapper']['submit'] = array(
        '#type' => 'submit',
        '#value' => 'Confirm',
        '#submit' => array('addstudent_form_submit'),
    );

    return $form;
}

function addstudent_form_submit($form,&$form_state){

    $values= $form_state['values']['field_name'];
    $a = array_values($values);
    foreach($a AS $b){
        foreach($b as $c){
            $r[] = $c;
        }
    }

    dsm($values);

}


texts: Stop Drupal from encoding '&' as '&' in YouTube URLs

texts:
I embedded a YouTube video inside a "News" node. The input format in use is Full HTML.

When node is saved, the ampersand symbol in &wmode=Opaque is substituted for &amp;wmode=Opaque.

Is it possible to prevent the ampersand in the URLs of embedded YouTube videos is encoded as HTML entity?


texts: Loading third party PHP SDK library from a custom module drupal 7

texts:
I am writing a custom drupal module (my first one in my life), and I am trying to load an external library (https://github.com/jwilsson/spotify-web-api-php), and until now I used these methods:

Loaded file array in info file

files[] = spotify-web-api-php/vendor/autoload.php,spotify-web-api-php/src/Request.php,spotify-web-api-php/src/Session.php,spotify-web-api-php/src/SpotifyWebAPI.php,spotify-web-api-php/src/SpotifyWebAPIException.php
I made this function based on another answers here (Copied the library in libraries folder)

function blve_spotify_registry_files_alter (&$files, $modules)
{
  if (!class_exists('SpotifyWebAPI\Session')) {
    $library_path = function_exists('libraries_get_path') ?
      libraries_get_path('spotify-web-api-php') : 'sites/all/libraries/spotify-web-api-php';

$files[$library_path . '/vendor/autoload.php'] = array(
  'module' => 'blve_spotify',
  'weight' => 0,
);

}
}
I used require_once but will only work on one function

None of these methods worked, when I made a function to call all the loaded files any of the methods or files I need are loaded, please help me to made it work with the required php files. Thanks in advance


texts:
hi i'm trying to display a view in a popup but unable to get a solution. i tried

colorbox node module
popup views integration module

Is there any better way to display a view as a popup ?


texts: content_translation_update_8400 causes syntax error

texts:
I just tried updating a Drupal v8.3.7 site to v8.4.4 and when running drush updb I get this error

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL     [error]
server version for the right syntax to use near 'SET content_translation_source='und'
WHERE content_translation_source IS NULL' at line 1: UPDATE {} SET content_translation_source=:db_update_placeholder_0
WHERE content_translation_source IS NULL; Array
(
[:db_update_placeholder_0] => und
)

Performing content_translation_update_8400                  [ok]

It says the "content_translation_update_8400" is ok but that is not true. Every update hook after this one does not get invoked. This causes a very big problem when updating Drupal and the Drupal sites I am maintaining need to be update-to-date.

So, what is the problem here?


texts: Fetching breadcrumb in search result list

texts:
I am trying to get the breadcrumb, for nodes in search result listing.
I came to know that breadcrumb by default fetches the current node context, so I followed the suggestion from here - How do I build Breadcrumbs for a certain node? to override the PathBasedBreadCrumbBuilder and providing the context to it by creating the RouteMatcher. But still, I am not able to get the desired result and it still shows the current page breadcrumb, rather then breadcrumb for each node in result.
The code for CustomPathBasedBreadCrumBuilder is the following.
namespace Drupal\custom_module;

use Drupal\system\PathBasedBreadcrumbBuilder;
use Drupal\Core\Routing\RequestContext;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Url;

/**
 * Class to implement custom Breadcrumb builder, based on passed route.
 */
class CustomPathBasedBreadcrumbBuilder extends PathBasedBreadcrumbBuilder {

  /**
   * {@inheritdoc}
   */
  public function build(RouteMatchInterface $route_match) {

    // Set request context from passed in $route_match.
    // I was not getting the URL from RouteMatch object like below.

    // $url = Url::fromRouteMatch($route_match);

    // @todo Generate the actual URL from RouteMatch.
    // So I tried with passing a fixed node id just to check if it overrides.
    // TESTING - passing the nid to generate the breadcrumb for URL context.

    $options = ['absolute' => FALSE];
    $url = Url::fromRoute('entity.node.canonical', ['node' => 81], $options)->toString();

    if ($request = $this->getRequestForPath($url, [])) {
      $context = new RequestContext();
      $context->fromRequest($request);
      $this->context = $context;
    }
    // Build breadcrumbs using new context ($route_match is unused)
    return parent::build($route_match);
  }

}

I created a service for it.

custom_module.breadcrumb:
    class: Drupal\custom_module\CustomPathBasedBreadcrumbBuilder
    arguments: ['@router.request_context', '@access_manager', '@router', '@path_processor_manager', '@config.factory',  '@title_resolver', '@current_user', '@path.current', '@path.matcher']
    tags:
      - { name: breadcrumb_builder, priority: 1002 }

In the theme, I called service in hook_preprocess_node().
function custom_module_preprocess_node(&$variables) {
  $view_mode = $variables['elements']['#view_mode'];
  $node = $variables['elements']['#node'];
  // Prepare search result content.
  if ($view_mode == 'search_result') {
    $routeName = $node->toUrl()->getRouteName();
    $route = \Drupal::service('router.route_provider')->getRouteByName($routeName);
    $routeParameters = $node->toUrl()->getRouteParameters();
    // Prepare the RouteMatch parameter for overridng breadcrumb.
    $routeMatch = new RouteMatch($routeName, $route, $routeParameters, $routeParameters);
    $variables['search_breadcrumb'] = Drupal::service('custom_module.breadcrumb')->build($routeMatch)->toRenderable();
  }

I am able to override context based on the URL which I am passing to the request,  but it's still returning the breadcrumb for the current node on which result are rendering, rather than for each node in list.
I am not sure what changed or where I am doing it wrong.
References

How do I build Breadcrumbs for a certain node?
https://www.drupal.org/forum/support/module-development-and-code-questions/2017-06-23/how-to-create-currentroutematch


texts: How to upgrade Acquia desktop to php 7.1?

texts:
Drupal 8.4 requires php version greater than 7.1 . In acquia devdesktop default we are getting php 7.0.  How to upgrade php 7.0 to php 7.1 in Acquia dev desktop?

Thank you.


texts: Drupal 8 override administration theme node form css

texts:
I need to override some of the styles on the Seven node form. My initial thought is to alter the form and add a custom css file. Is there a better Drupal 8 way to achieve this?

Thanks,

Dave


texts:
I've made a drush install of drupal 7.28 on my AWS server. I can confirm that the memory is set to 128M, all green on the reports -> site status page. The website will function normally and sporadically return no data, looking at the logs a tremendous amount of memory is trying to be allocated (assuming an infinite loop somewhere). Given that this is a basic install, no modules have yet been added what might be causing this?

PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 140008587493184 bytes) in Unknown on line 0


texts: How to render entity reference data in field template?

texts:
I have a field collection with adding multiple items. In each item there is an entity reference field with multi-selection of contents. I can render entity reference content by target_id using node_load in an entity_reference field template. But it is getting only first value of each item.

How can I render all contents of each item from field collection? Is  there another way to fetch?


texts:
I have integrated paypal payment using the Ubercart 7.x-3.6 module in my website.

My store currency is Rs(INR). Now I have 1500 Rs in a cart When I am proceeding to checkout on paypal its showing 1500 USD.

Isn't it possible that the amount converts in equivalent USD automatically?

If not, then how can I convert it from INR to USD?


texts: Access callback for user/%user/edit menu item not working

texts:
I have two roles, client & student. Students can edit their profiles, clients cannot. I thought the easiest way to solve this would be to add a permission as per below:

function si_permission() {
  return array(
    'edit account' => array(
    'title' => t('Edit account'),
    'description' => t('Allow users to edit their account')
  )
}

I then altered the menu item and changed the access callback to my new permission:

function si_dashboard_menu_alter(&$items) {
  $items['user/%user/edit']['access callback'] = user_access('edit account');
}

I then set the permission appropriately in permissions settings, but it does not work. It always appears to be false, so the menu item access is always disabled. I have even debugged   'user_access('edit account')' whilst logged in as the appropriate user and it returns TRUE, so I know the permission is working.

All caches cleared, menus rebuilt using developer tools. Any ideas?


texts: How to render the 'actions' section of a form in twig template?

texts:
given a form that is built like the following:

public function buildForm(array $form, FormStateInterface $form_state)
{
   $form['#theme'] = 'mymodule_testForm';
   $form['actions']['#type'] = 'actions';
   $form['actions']['submit'] = array(
      '#type' => 'submit',
      '#value' => t('submit'),
      '#button_type' => 'primary',
   );
   return $form;
}

How do I access the submit button in my twig template?


texts: drupal 7 hidden views blocks when node references value is empty

texts:
I created Expert and Review content types, both have a node reference field related each other.

Expert
    - title
    - field_expert_reviews(node reference)

Review
    - title
    - field_review_expert(node reference)

I follow this tutorial create a block show expert's review in the side bar. But I found that when the field_expert_reviews is empty, the block doesn't hidden. How to hidden the block when the node reference field is empty?


texts: How does Drupal generate form ID for a form?

texts:
Following is the code snippet I used to generate a the User Profile edit form:

print drupal_render(drupal_get_form('user_profile_form'));

However, I could not find the declaration of the 'user_profile_form' form id anywhere in the Drupal system. So I assumed that it is generated dynamically, but I am not sure.

So, If it is already defined, Where is it defined?
and if it is generated dynamically then how does Drupal generates these Form IDs.


texts:
I have a hard time setting up URL alias patterns when it comes to taxonomy terms. Especially, I'm stunned that in the Replacement under Content Paths, a term reference field shows just one flat item [node:field_term_name], rather than an expandable set of taxonomy-related tokens. This is the way it used to be (as in the screenshot here: Pathauto url of term for node?)
Have things changed or is it a bug?


texts: Modifying a views organic groups exposed filter

texts:
I have a view with an exposed filter of organic group id's (ie: gid). I wanted to convert it to be a dropdown with the actual group name. I did so with a form alter. The filter works fine, however I'm having an issue with the filter when trying to view all groups. I tried adding 'ALL' to the dropdown, but that doesn't match a particular gid, so it doesn't work. How can I fix my code to allow content of all groups to show?

/**
 *  Implements hook_form_alter().
 */
function tma_views_form_alter(&$form, &$form_state, $form_id) {
  if ($form['#id'] === 'views-exposed-form-event-list-page') {
    $form['field_event_type_tid']['#type'] = 'hidden';
  }
  elseif ($form['#id'] === 'views-exposed-form-page-event-calendar-page') {
    $form['og_group_ref_target_id'] = array(
      '#type' => 'select',
      '#options' => tma_views_get_chapters_list(),
      '#default_value' => 'ALL',
    );
  }
}

/*
 * Retrieves an associated array list of all Chapter nodes
 * return - a list of nids
 */
function tma_views_get_chapters_list() {
  $query = new EntityFieldQuery();
  $query->entityCondition('entity_type', 'node')
    ->entityCondition('bundle', 'chapter');
  $results = $query->execute();
  foreach ($results['node'] as $node) {
    $nids[] = $node->nid;
  }
  $nodes = node_load_multiple($nids);
  $options['ALL'] = 'Select Chapter';
  foreach ($nodes as $node) {
    $options[$node->nid] = $node->title;
  }
  return $options;
}

EDIT:
One more thing to note: when no filter is set at all (for the organic group filter), I get a drupal error message on the screen:

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

I obviously would like to be able to fix that as well.


texts: Do I need to install Drupal using Drush in order to use Drush?

texts:
I installed Drush and then I installed Drupal using the regular installer/method.

When I type drush cc all on my terminal I get this message:

  No Drupal site found, only 'drush' cache was cleared.


texts: Drupal 7 Domain Access Module Gives 500 error, WSOD for subdomains

texts:
I am attempting to get Drupal 7's domain access module working.
I have the original domain that the site was built on, and 2 more domains,
all configured from a local apache virtual host configuration.

I can log in and configure with the original domain name "localhost",
but when I try to log in with any of the other domains I configured I get a 500 Internal Server Error.

Domains Configured (for local use):
1)localhost
2)drupalx.domainaccess.com
3)drupaly.domainaccess.com

This is the domain configuration page for domain's in Drupal.  Note I have 3 domains configured, localhost, drupalx, drupaly.

I know that the domains I set up work because if they did not then this next image would have a warning saying that the domain module could not access files on the domain name.
I also verified this by using the drupalx/drupaly domains and I was able to access css files in a subfolder of the drupal install using these domains.

Here is the home page for the drupalx domain. The only page that can be accesssed is the home page.

If I try to go to any other page in drupalx or drupaly I get a 500 error, WSOD.

Here is my virtual host setup

I don't have any drupal reports on this, and my apache logs only gave the 500 error info

ie:
127.0.0.1 - - [24/Apr/2014:16:54:46 -0700] "GET /user/register HTTP/1.1" 500 530


texts:
Is it possible to perform a single module's update function via drush? I can see drush updatedb which does not take an modulename as argument and runs all available updates. Then there is drush pm-update wich also checks for new files. the documentation says:

  (same as pm-updatecode + updatedb)

Does this mean if I run drush pm-update every available (newer update_function exits) update will be perfomed? Is there a way to only (db)update exactly one module?


texts: Creating multiple URL aliases for the same node with their own context

texts:
I want to solve the following problem with Drupal 7 solely using existing modules and without any extra code.

I have a contenttype called 'News'
I create a news item and assign a taxonomy term called 'Sport' and a taxonomy term called 'Entertainment'.

Now I want Drupal to create two URL aliases, namely:

http://www.domain.com/news/sport/title
http://www.domain.com/entertainment/title

I want to assign different blocks based on the path with context.

Is this possible without custom code? And if custom code is neccesary how would I proceed?


texts: add class to book navigation block links

texts:
I use navigation block generated by block module. Tha block is displayes on all pages that belongs to book. I would like to add custom class to all links inside navigation block. I found that the block is generated by code here>

https://api.drupal.org/api/drupal/modules!book!book.module/function/book_block_view/7

But I am unable to figure out how to alter links. Any help appreciated. Thank you.


texts: Redirect after webform submission inside a colorbox node, doesnt work

texts:
I have a webform inside a colorbox node, shows nicely, submits...
But, both the built in redirect in webform and rules redirect is ignored and the modal stays stubbornly open. And no redirect happens.

Furthermore inside my rule i also set a status msg which never shows.

I do know that the rule is triggered because it also creates a new entity on submissions and sets values from webform to a node. And this part of rules actions happens ok... There is no errors in the log either...

The module i use: colorbox_node module

Please help... :) Thanks in advance...


texts:
Devel query log shows too many highlighted same queries, like

UPDATE block SET module=:db_update_placeholder_0,
delta=:db_update_placeholder_1, theme=:db_update_placeholder_2,
status=:db_update_placeholder_3, weight=:db_update_placeholder_4,
region=:db_update_placeholder_5, custom=:db_update_placeholder_6,
visibility=:db_update_placeholder_7, pages=:db_update_placeholder_8,
title=:db_update_placeholder_9, cache=:db_update_placeholder_10
WHERE  (bid = :db_condition_placeholder_0)

Are there any suggestions that I can solve this problem?


texts:
Hi I have a brand new website, the upload time was around 2 seconds and after installing Memcache it s around 10 seconds, what coulds be causing this issue?
website is in drupal6


texts: How to get a term from the translated term name?

texts:
I have a translated taxonomy term whose name is Autos Y Motores (Spanish). How can I get the taxonomy term object from it?

If the term name were in English, I would use taxonomy_get_term_by_name('Vehicles & Motors') to get the taxonomy term object.

How can I do with a translated taxonomy term name?


texts:
I'm looking for a OOP way to have a simplified User registration form in Drupal 8.

As of today, the default User registration form is declared directly as an annotation in the User class. From the administration pages, it is possible to add a Register form display for the user form. However, when removing all possible fields save for the password/login, there is still a bunch of fields showing up that I want removed:

Username
Password confirmation
Locales settings
Contact settings
etc.

What I want is an extremely simple registration form, with just two fields: e-mail address and password. All other fields will be editable later. I want this form to use OOP if possible, so extending the class Drupal\user\RegisterForm seems to me a good way to achieve this...

I extended the form but can't use it. It requires an entity to be passed to it apparently, but I don't know how to do that.

The ideal way to do it would be:

$entity = \Drupal::entityTypeManager()
  ->getStorage('user')
  ->create([])
;
$formObject = \Drupal::entityTypeManager()
  ->getFormObject('user', 'register')
  ->setEntity($entity)
;
$registerForm = \Drupal::formBuilder()->getForm($formObject);

However this will insist on fetching the original, non-inherited RegisterForm class, not my custom one. How can I tell Drupal to instanciate my own form instead?

BTW how can I make username optional?

I've seen a few solutions out there for redefining the user registration form, however most of them are Drupal 7 solutions and none of them are OOP.


texts: Migrate Update already imported content from the Json source

texts:
I have two JSON source files of product categories which contain duplicate products.

Here's the link of the two source JSON files https://gist.github.com/naveenvalecha/427e32291c0247553bba9586448e4224

I'm traversing the JSON data using the JSONPATH migrate_plus data parser plugin(https://www.drupal.org/node/3007709) with item_selector $.._element[*]
which is returning the arrays of all products under a respective category JSON file.

If a product has multiple categories, it is present in both categories JSON files. Migration status shows the wrong count because it is considering the same product twice which is present in both categories JSON file.

Will it be reliable to merge the source records of different JSON sources when there are thousands of records?

Note: There could be multiple JSON product category JSON source files.

Right now, When I import the products. if a product is present in both of the categories. On the first run, it gets migrated. When the same product gets imported again, it replaces the values of the same content with the new values of the source.

Will it be reliable to merge the field_category values when the same record gets updated again as there are thousands of records?

The migration template(cf_product.yml) is also attached in the gist https://gist.github.com/naveenvalecha/427e32291c0247553bba9586448e4224


texts: Check if a user is logged in using default login form or using email direct login link

texts:
I'm working on a Drupal 8 project, my question is:

is there any method to check if a user is logged in using email direct link or he did using the default site login form?

to check I think the right hook is hook_user_login($account)

function mymodule_user_login($account) {
  // if user logged in from direct link.
    dump('Hey where were you?');
  // if user logged in from default login form.
    dump('Yeah, nice login dude')
}


texts:
I am seriously looking for a solution to encrypt at least some of the tables in my Drupal 7 database.

I'm totally suspicious about my hosting providers, I really don't want my user's data and also my business information to be visible at all.

Are there any solutions for database encryption?  I don't want to buy a VPS.


texts: How to add a flat amount to an order. Using Drupal commerce module

texts:
I need to add a flat amount to an order using the http://drupal.org/project/commerce module.

Lets say I have a order with 3 products then I need to add an amount of 230€ to the total order cost. This amount is a flat amount (it will ever be 230€), it doesn't care how many products there are in the order.

I would use a Sales Taxes type tax but since it only accept percentages it is not useful for me.


texts:
For internal use by editors I would like to get cron link into a custom menu, but I need to do this dynamically, such that it can used across multiple sites.
Editors do not have access to Admin Toolbar which is why I need a link instead.
Why do I need this? I want allow editors to make a quick backup with Backup Migrate, but I don't want to give them full access and the module permissions are not granular enough to just make a quick database backup.
A colleague suggested letting editors run a cron job instead. This seems like a solution.
I already have Menu Token module installed, so I am wondering if there is a token for a site's cron token?
If not. Is another approach recommended?


texts: Tab field formatter for Entity Reference field?

texts:
I'm looking for similar module to this: Reference Tabs
but to work with the  Entity Reference module

The Reference Tabs module works with the References module, I need the same functionallity but for the   Entity Reference module

If there is no module for this, then: can I get this with the Field formatter settings using UI jquery tabs?


texts: Customizing the node create form using a template file

texts:
I have created a template file for my content type, but I don't know how to get form design in that page.

My content type name is wallpaper, and I created the page--node--add--wallpaper.tpl.php template file. How do I access the node title, or the node body, in the template file?


texts:
I am new to Drupal, so please bare with me. I have a Drupal site that is working fine. Now what I want to do is allow access to folder which contains some custom php script.

I tried to put the folder in the /sites/default/files/ but it didn't work. I found a question on it  Extending Drupal Functionality to Custom PHP Page but not able to add Drupal functionality on this page. I just want to access that folder and its content.

So please any help would be appreciated. Thanks


texts:
What is the best way to output 3 new dates relative to the first date? For instance, I have a date field called "medication_start" = 1/1/2010. I would like three new dates generated in 3 new fields in 6, 12, and 18 months from the start date.

Period 1 (6 months): 6/1/2010
Period 2 (12 months): 12/1/2010
Period 3 (18 months): 6/1/2011


texts: Configuring Commerce in an existing drupal install

texts:
I'm running drupal 7 and would like to add the Commerce module to my site and am having problems with basic functionality. I've created a product display with views, but I'm unable to figure out how to add an 'add to cart' button to item listings, as well as how to add a checkout page.

Just about everything that I've found suggests using kickstart from a clean installation but that isn't an option for me. The documentation seems to be missing gaps of information relating how to set up blocks which normally would be included in commerce kickstart.

What is a good place to start learning about the basic module so I can get my cart up and running?


texts: How to acquire (and use) node id in the teaser template of a view?

texts:
I tried to find a solution to this problem, but couldn't.  I will describe what I would like to achieve, and hope someone could help.  Sorry if my description is a bit lengthy, I am trying to be detailed in order to help those who could provide advice.

I am building a website for a school.  I have a content type of 'staff'.  I control its appearance by a template file, specifically:

/templates/node/node--staff.html.twig

In it, I have a

{% if teaser == true %}

that controls appearance for teaser mode .. Now that works fine, and code for teaser mode gets picked up by views.

The problem is, I use some 'block type' views of staff in 3-4 specific pages, and in there, I would like some custom code each time - according to which page the 'teaser code' is being used by the view.

I tried with {{ node.id }} but of course this doesn't work (it gives me the respective node-id of each 'staff'.

So the question is ..  How can I have the information on which page each block view is currently being used ? To be more precise perhaps, how can I have the information in the 'teaser code' of the content type, so I can customise, according to which view is using the template code?

I guess I could have different template files for every case, but I would rather avoid it if I can - code will basically be the same, with only a minor string being added each time, so if I can do it with if statements in one file, I 'd rather do that.

My block views are obviously different for each case (to pick up the staff they need) - they 're different block-type views if you understand what I mean.  So if I can somehow put something in the view characteristics that can later help me in the template code, that would be great.

I just don't know how to do it .. It's the first site I ever build with Drupal, so I might be missing something obvious ...

I hope I described the problem sufficiently - any help would be greatly appreciated.

Also, if anyone could suggest a better title for this question, please do - this is the best I could come with.

thanks,

thomas


texts:
My website occasionally loses images due to the image url being set to http://default/sites/files/XXXX.jpg. The "default" baseurl is the issue and as i understand drupal 8 has no way of setting this manually.

As this seems to happen sporadically i am assuming it is related to a cron job running under baseurl of "default" and then the page being saved to the cache.

Anyone have any ideas how to diagnose or possible causes? i was thinking something like SimpleSiteMap could be affecting this.

thanks

UPDATE
After some testing it seems likely that its a cron job accessing the pages and the image urls being cached incorrectly.

The cron jobs run under base url of 'http://default' so the chain of events seems to be:
cron starts
clears caches
a cron job attempts to render the page causing the img urls to be cache incorrecly

If i then clear the cache again and navigate to the pages the urls are re-written and cached correctly now.


texts: How to modify term reference field in Drupal 7 custom content type?

texts: I am using a term reference field in a content type in Drupal 7 which is a long hierarchical list of categories. In the input form, I want to show them as checkboxes and it gets displayed as a flat list of around 100 items and that of course is not user friendly at all. What hook do I use or where do I manipulate the code of the generated field so that I can display them in a hierarchical way and at the same time use some jQuery to show hide the sub categories. I guess I can intercept it in the theme preprocess and modify the field but I believe theres a better way?


texts: Changes made in hook_node_view() are not applied?

texts:
I wanted to change the title of a node field on the node display page.

I have implemented hook_node_view() and changed the title in code using following code:

$node->content['my_field']['#title'] = t('Field Name');

When I dpm() the $node object I can see that above code has been successfully executed, but on node display page I still don't see the field name changed.

I also did a dpm() of $content from tpl file and found out that $content['my_field']['#title'] has been set to 'Field Name' as per above code. But it still displays the older title.

Whay may be causing this to happen?


texts:
I am following the info here to alter 'Results' page for my webform. I want to do exactly what is given in the example on that page (make the table view the default, remove the 'Submissions' tab.

I have copied the code listed into my webform.module file, cleared cache, restarted MAMP (running locally), however the changes aren't reflected on my site.

Here is the code snippet:

 * Implements hook_local_tasks_alter().
 */
function webform_ui_local_tasks_alter(&$local_tasks) {
  // Change 'Results' route to display the results 'Table'.
  $local_tasks['entity.webform.results']['route_name'] = 'entity.webform.results_table';
  // Move the 'Table' sub task to be first.
  $local_tasks['entity.webform.results_table']['weight'] = -100;
  // OPTIONAL: Remove the 'Submissions' task.
  unset($local_tasks['entity.webform.results_submissions']);

  // Apply the same changes the Webform node local tasks.
  if (\Drupal::moduleHandler()->moduleExists('webform_node')) {
    $local_tasks['entity.node.webform.results']['route_name'] = 'entity.node.webform.results_table';
    $local_tasks['entity.node.webform.results_table']['weight'] = -100;
    unset($local_tasks['entity.node.webform.results_submissions']);
  }
}

The code example in the snippet above uses:

function webform_ui_local_tasks_alter(&$local_tasks)

which I assume is different from:

function webform_local_tasks_alter(&$local_tasks)

which is already present in the webform.module file. Therefore I have placed the snippet on its own within the file. I have also tried adding the individual functions in the snippet to the function webform_local_tasks_alter(&$local_tasks) section already present in webform.module.

Any suggestions for that I need to do differently?


texts: Not able to print variables of content type

texts:
I want to print variables of a particular content type, but I have not found any way. Here is my code.

function mytheme_preprocess_node_mytype(&$vars) {
  echo '<pre>';print_r($vars); echo '</pre>';
}

This function is in template.php. Is there a problem with my code?


texts: Displaying a subcategory field along with suggestions in apachesolr autocomplete drupal 7

texts:
I am using apachesolr_autocomplete module of Drupal 7 to implement the search functionality on my website(supermarket website). But now i want to implement a functionality to show subcategories as well in the search suggestions. Suppose user searches for 'ipho', then the autocomplete suggestions should be :

'iphone in mobiles'
'iphone in mobile covers' etc.

I have indexed the category field but couldn't find any way to get this done. Also the D7 docs for apachesolr didn't help much.


texts: Feeds importer won't save images to folder after import error, but works fine after waiting overnight. Is there a timed cache I need to flush?

texts:
I'm using feeds to import images. The images are saved into a subfolder in sites/default/files/[nid] using filefield_paths module. Usually, imports work fine.

But as I am constantly tweaking the import process and data, occasionally, a node doesn't import properly and throws a SQL error like

  "SQLSTATE[HY000]: General error: 1366 Incorrect string value...".

When this happens, the image is saved in sites/default/files, not sites/default/files/[nid]. And when I delete imported nodes, the images that were properly saved in subfolders are deleted, but the ones saved in sites/default/files are not deleted, and I have to delete them manually.

Here's the issue... After I fix the import error, the imported nodes continue to be saved in sites/default/files, not in the subfolder sites/default/files/[nid]. I have tried flushing all caches, disabling then enabling the feed importer, and running cron, but nothing works. The only thing that works is that if I wait overnight, the next day the import works fine and saves images in the proper folder.

This is extremely frustrating since every time I make an import error, I have to wait until the next day to keep working on the import.

My conclusion is that there must be a timed cached somewhere that clears after 12 or 24 hours or something which remembers where it last saved imported images. But I have no idea where this could be. Any ideas?

Thanks!


texts: Drupal node templates which apply to more than one content type. Possible?

texts:
I've started looking at content type specific node.tpl.php files. However, say I have two content types, and wish both to be displayed in a similar manner, but not apply this to every content type (at the level of node.tpl.php).

It seems a bit of an overkill to have two identical files for node--contenttype_1.tpl.php and node--contenttype_2.tpl.php which are the same? Is there a way to have a multi-content-type template for this?

In case you're wondering the reason for having two different content types in the first place, one is a simpler version of the other, has different URL generation rules (via pathauto), and fewer fields associated with it.


texts: form_set_error() field not highlited red

texts:
When validating a field manually from my form a error is displayed but the field doesn't get red. For the first parameter i used the name of the input element. DRUPAL 7

if($form_state['values']['panes']['webform_nid31'][0]['contact_person'] == '') {
    form_set_error('panes[webform_nid31][0][contact_person]', t('You must select a name for this group of settings.'));
  }


texts: Is it possible for anonymos users to subscribe to calendar events created using the Calendar module? If so, how would I go about achieving this?


texts: Not able to access the key value of a list in a twig file

texts:
I'm trying to access the key of a list (Text) in a paragraph twig file

This is what I have in my list
small|Small Item
big|Big Item

{{content.field_option.0['#context'].value}}
{% set value = content.field_option.0['#markup'] %}
{{ value }}

I always got the text. Small Item or Big Item. I would like to obtain small or big of course depending of the user selection.

I'm going to use this value as an HTML Class.

Thanks for your help


texts: How can I add a condition to the list of taxonomy a view is created from

texts:
I've created a view using a taxonomy term let's say (a,b,c,d,e)

A content type can have multiple selections of these taxonomy term.

The view returns the content-type based off the taxonomy term selected "Content: Has taxonomy term (exposed)"

From this, it also returns a select list of all the taxonomy terms.

Now in the taxonomy I have a custom field "hide from public".  Terms "d" and "e" in the above list have this selected.

I would like to add a condition so that the view only returns the content type where "hide from public" is "false" and then the select list only shows the values where "hide from public" is false.

I can't add the condition if "hide from public" is false in the "Filter Criteria" because I believe it's checking for the Content-Type to have this value which it does not, so it returns nothing. How do I make the taxonomy list conditional?

Thanks!


texts: Ubercart- free shipping through pay per click

texts:
Can anyone think of a way to offer free shipping for people who arrive at the site through Pay-per-click advertising (without a coupon code).

drupal 7.

thanks!


texts: Generate new bearer token with simple_oauth programmatically?

texts: I have a custom service and in the custom service, I want to generate a new Bearer token for the current user ( it's logged in) with simple_oauth module. in its documentation is has not mentioned how can I generate new a new token for current logged in user. So, how can I generate a new Bearer token for current logged in user?


texts:
i have created a view block and added some fields to it,i want to change the style of those fields with css, is there a way that i can do it.
"Thank you"


texts: Migrating a Drupal 6 site to Drupal 7 can I copy the D6 database as a local source?

texts: I am trying to migrate a small D6 site over to D7 and the Migrate/D2D modules look like they will handle most of my content. Is there any way to simply copy the D6 database over to the D7 machine and use it as a local source to migrate into the D7 database?  Or, do I need to specify a path and access credentials to the mysql server on the active D6 website?  Thanks.


texts: how to get radio value from radio button by form api drupal

texts:
How to get radio value from radio button by using the following code

$form['pd']= array(
  '#type' => 'radio',
  '#title' => t('Programme Day'),
  '#options' => array(0 => 'One Day Programme', 1 => 'Two or More Day Programmes'),
  '#required'=>TRUE
);

$form['one_day'] = array(
  '#title' => t('Date'),
  '#type' => 'date',
  '#description' => t('Please select the date of Programme'),
  '#required' => TRUE,
  '#date_format' => "d-m-Y h:i A",
  '#date_year_range' => -15:+1',
  '#states' => array('visible' => array(':input[name="pd"]' => array('value' => 0)))
);

$form['from_day'] = array(
  '#title' => t('From Date'),
  '#type' => 'date',
  '#description' => t('Please select the from date of Programme'),
  '#required' => TRUE,
  '#date_format' => "d-m-Y h:i A",
  '#date_year_range' => '-15:+1',
  '#states'=>array('visible'=>array(':input[name="pd"]'=>array('value'=>1)))
);

$form['two_day'] = array(
  '#title' => t('To Date'),
  '#type' => 'date',
  '#description' => t('Please select the To date of Programme'),
  '#required' => TRUE,
  '#date_format' => "d-m-Y h:i A",
  '#date_year_range' => '-15:+1',
  '#states'=>array('visible'=>array(':input[name="pd"]'=>array('value'=>1)))
);

I tried the following code but the value shows as array not value.

$prog_day = $form_state['values']['pd'];

$one_date = $form_state['values']['one_day'];
$from_date = $form_state['values']['from_day'];
$two_date = $form_state['values']['two_day'];


texts: Using views, how to render a block of father terms with a brief shortlist of child terms?

texts:
I've a list of taxonomy terms with related subs as follows:

Father 1

child 1.1
child 1.2
child 1.n

Father 2

child 2.1
child 2.2
child 2.n

Father 3

child 3.1
child 3.2
child 3.n

and so on.

I need to put a list of the father followed by the first 5 child elements in a block and put it into homepage.

Now the point is, that after lots of trying, I didn't find a solution about how I can do this.

The only thing that I managed was the selective display of the fathers, but I didn't reach the child in any way. I don't reach the father through a node, or his own term page, because I only need the taxonomy tree iterated in a block containing a list of unformatted columns.

I have already themed all but I'm still not capable of displaying the childs under the father term.

For short, here is a representation of what I'm looking for:

I'm going out of my head because of this, so any help will be greatly appreciated!


texts:
I was deleting nodes using Views Bulk Operations and suddenly I got a white screen.

In my error log I get the following error:

  mod_fcgid: stderr: PHP Fatal error:  Cannot access empty property in /var/www/clients/client1/web9/web/modules/field/field.attach.inc on line 324

I'm using domain module and my other subdomains work fine, but my main domain always gives me a white screen with that error.

Does anyone know what I can do to fix this?


texts: Extend machine name for custom field type

texts:
I have a custom field type and I would like to extend the default machine name for this particular field type.

From field_ to something like field_country_.

Is that possible ?


texts:
I have made a custom views field handler by the following instruction:

http://www.interactivejunky.com/blog/database-independent-views-3-custom-field-handlers

The problem is that, I cannot sort the values of the created pseudo field in view. I know the reason is that my pseudo field basically doesn't exist in query of the corresponding view, and cannot exist there as it doesn't exist in any tables and it's just a computed field for that view.

Any ideas about making this field sortable?


texts: Can't add sub tab local tasks to admin/content/my_entity

texts:
I have a custom content entity list which has its own tab into admin/content/my_entity.
The content of this tab is generated by using EntityListBuilder class. Actually, I created it with the drupal console. Now I am trying to add two more subtabs in this way:

my_module.links.menu.yml

entity.my_entity.collection:
  title: 'My entities'
  route_name: entity.my_entity.collection
  description: 'List of my entities'
  parent: system.admin_content
  weight: 0

my_module.links.task.yml

entity.my_entity.list:
  route_name: entity.my_entity.collection
  base_route: system.admin_content
  title: 'List of my entities'
  weight: 10

entity.my_entity.list_tab_default:
  route_name: entity.my_entity.collection
  parent_id: entity.my_entity.collection
  title: 'Property 1'

entity.my_entity.list_tab_two:
  route_name: entity.my_entity.collection_two
  parent_id: entity.my_entity.collection
  title: 'Property 2'

However, I can't get them to display under the parent's tab. Only parent tab is visible. Also, I tried to add these subtabs with the view and I could not make it displayed either.
What I am doing wrong here?


texts: Display block after some action (saved node)

texts:
I want to display block after an action. My user will create new content (node). After he save it, the content is shown with a specific block (only once, no further).

I was looking on trigger module, but I do not see this option.

I am using Drupal 6

Thank you for help!


texts: Views query alter but Views calc is not rendering right result

texts:
I am alter the views query with this

 <?php
function cc_invoice_views_query_alter(&$view, &$query) {
    foreach ( $query->where[0]['clauses'] as $key => $value) {
      $explode = explode('.',$value);
      if($explode[1] == "field_status_value = '%s'") {
         $alias = $explode[0];
         if($query->where[0]['args'][$key] == '0') {
            $query->where[0]['clauses'][$key] =  $alias . ".field_status_value IN ('%s' ,'%s')";
            #$query->where[0]['clauses'][$count] =  $alias . ".field_status_value IN '%s'";
            $query->where[0]['args'][] = -2;
         }
         elseif ($query->where[0]['args'][$key] == '1') {
            $query->where[0]['clauses'][$key] =  $alias . ".field_status_value IN ('%s' ,'%s')";
            $query->where[0]['args'][] = 8;
       }
         break;
      }
    }
}

?>

In this code, I just altered the views query. the result is displaying rightly, but in the views calculation section, the subtotal and total is not rendering right. It does not add the altered value while calculating the total or sub-total. Is there anything else i need to correct here. Please advise.


texts: View XML Request when using WSClient and Rules

texts:
I am building a website that uses 3rd party data from a web service. I decided to use WSClient...so far so good.

I am using Rules together with WSClient to create the proper SOAP request, however I am having issues debugging the requests (they are returning errors) because I can't figure out how to view the actual XML. Using Devel, I can see the values in the data structures I am creating, but I can't figure out how to view the XML itself, thus I'm not sure if I've built out the structure properly.

I've looked here, https://www.drupal.org/node/1801200, but haven't quite figured out how to see the XML.

Any idea or leads on how to trace or view the XML itself would be appreciated.

Thanks.

P.S. I come from a product management/ui/design background, so please pardon me if any of this seems obvious.


texts: What is the best way to write a cron that deletes a very large number old nodes and comments?

texts: I am writing a module the preferably implements a cron job, and possibly a queue, to run sql queries to delete old nodes and their comment. Approximately 20 Million nodes, and about 40 mil comments. I want to run pure mysql queries and bypass the drupal api (as much as I can), for performance reasons. I have already developed the relevant queries and would like to know what would be the best way I could implement this so it does not user Drupal api? This is on drupal 7 by the way.


texts: JavaScript loading but not being applied in Drupal 8 theme

texts:
I'm using this javascript to create a 'zaccordion' on my Drupal 8 site. However, it's not working. My 'slideshow' just appears as a bulleted list of images.

Here's what I've got so far:

A block on my page with the following content:

image

image

I've also got the required javascript files from the download link (above) in themename/js. I've also got my own instantiation of the zaccordion in another js file in that same folder and it targets #slideshow like so:

(function ($) {
  $(document).ready(function() {
    $("#slideshow").zAccordion({
      settings here
    });
  });
})(jQuery);

Then, in my libraries.yml file I have this:

zaccordion:
  header: true
  version: 1.x
  js:
    js/jquery.zaccordion.min.js: { }
    js/jquery.zaccordion.js: { }
    js/zaccordionUsage.js: { }
  dependencies:
    - core/jquery

I put that in the 'header' because it wasn't working in the footer. I can confirm the files are being pulled into the page because I see links to the scripts in the  of the html.

Finally, I have the javascript library being placed into the page with this call near the top of page--front.html.twig:

{{ attach_library('themename/zaccordion') }}

Are all these settings correct?

I have this same slideshow functionality working easily on a Jekyll site I created so I assume it's something to do with the way my block is trying to reference the javascript files or something.

Note: yes, I have JavaScript aggregation unchecked (Performance > Aggregate Javascript)


texts: How to loop through field deltas of an object?

texts:
In Drupal 7 I loaded the node/entity I want with node_load / entity_load and, if necessary, then I took a field with multiple deltas and take the value I wanted with a foreach loop.

In Drupal 8 how can I do the same in a hook?

For example, this loads my first value of a field:

$a_id = $adress->field_a->target_id;

In this case an entity reference field.
But there are more target_ids.

So how to take them?


texts: This may sound a stupid question but as I have upgraded to D7, my main menu has disappeared and I could not figure out how to move it to corolla's 'Menu Bar' area (or anywhere else) . So appreciate your help.


texts:
In Drupal-6 I have a content type called: Colors with the following fields: title, body and code.
Then I have another content type called: Material with the following fields: title, body and color. This color field is a node reference related to the Colors content type.

So far so good.

Now when I create a Material node I can select a color from a select list. And here is my issue: this select list shows the title of the colors nodes. Is there any way to show the code for the node instead of the title. Or better, show the title and the code.


texts: Display field inputs side-by-side in node edit form

texts:
I have quite a few Field Collections on my node edit form that each have three text input boxes. By default drupal displays them one on top of the other which makes for a very long page:

Ideally I'd like to display the three fields in a single row. Do I have to override this with CSS or is there a setting I'm missing? It's a pai to Google a solution because I keep getting article about in-place editing or theming webforms.


texts: Will upgrading PHP version affect my current site that running Drupal 6?

texts:
I am going to test Drupal 8 RC, unfortunately my PHP version is too old.

It's asking for upgrade the version higher than PHP 5.5.9.

If I upgrade it to PHP 5.5.9 or latest version PHP 5.6.14, will it affect my current site that running Drupal 6?

Your PHP installation is too old. Drupal requires at least PHP 5.5.9. See the system requirements page for more information.


texts: Trying to keep facets visible even when the terms restrict facets

texts:
I believe the setting I am looking for is minimum facet count, so that I can set it to 0.

I'm going based on this:

https://drupal.org/node/1669600#comment-6190924

I don't have search API installed, however I do have Apache Solr installed.

When I'm searching for something, say tech, whenever there are results that don't have that keyword, the facets are disappearing - the client doesn't want the facets to disappear.

I tried to disable this disappearance in the template.php above, but it didn't work.

How do I keep facets visible in Apache Solr even when there are 0 results?


texts: Errors when trying to install adaptive theme on D8 from backend GUI method

texts:
When I try to install the Adaptive Theme for Drupal 8 on https://simplytest.me/, I get the following error on /core/autorize.php.

  drupal 8.2.0-rc1
    Update manager
    Error message
    Installation failed! See the log below for more information.

  adaptivetheme

  Error installing/updating
      File Transfer failed, reason: Cannot copy /home/r1rkn/www/tmp/update-extraction-3b2e9e06/adaptivetheme/Gemfile.lock to /home/r1rkn/www/themes/adaptivetheme/Gemfile.lock.

This is for the latest Drupal 8 development snapshot version.

How can I fix this error?


texts: Unable to set Drupal environmental variables using Drush alias

texts:
$aliases['opendoor_stage'] = array(
    'uri' => 'stage.opendoor.com',
    'root' => '/var/www/stage.opendoor.com',
    'db-url' => 'mysql://someurl',
    'path-aliases' => array(
      '%dump-dir' => '/var/www/database-dumps',
     ),
    'variables' => array(
        'site_name' => 'My Drupal siteSSSSSSSSSSSSSSSSSSSSSSSSSSSS',
        'file_temporary_path' => '/var/www/open_door_files/uploads',
        'file_private_path' => '/var/www/open_door_files/contentfiles',
      ),
     'command-specific' => array (
       'sql-sync' => array (
         'no-cache' => TRUE,
         'structure-tables-key' => 'skip',
       ),
     ),
    'command-specific' => array (
    'sql-sync' => array (
      'sanitize' => TRUE,
      'no-ordered-dump' => TRUE,
      'structure-tables' => array(
       // You can add more tables which contain data to be ignored by the database dump
        'skip' => array('cache', 'cache_filter', 'cache_menu', 'cache_page', 'history', 'sessions', 'watchdog'),
      ),
    ),
  ),
  );

I then do the following commands to copy into my stage environment:

drush rsync @opendoor_test @opendoor_stage

and

drush sql-sync @opendoor_test @opendoor_stage --no-cache

Everything copies over fine however the information in the variables array never gets set. What am I doing wrong? I am following the documentation verbatim.


texts: Use username password on different subdomain

texts:
I now have a website which is using drupal. This is the 'main' website on the www domain. I would like to build a small gimmick which is only accessible to my users. This gimmick site is probably not using drupal at all.

Is there a way to duplicate the login procedure for my subdomain so that only users from my main site can use the gimmick site?

thanks in advance


texts: Some of the pending updates cannot be applied because their dependencies were not met

texts:
I have a Drupal 7 site that is giving me the above error.  I cannot for the life of me, figure out what dependency needs to be met.  And I can't not remember what I did, or if I did anything, to cause it.

Is there any way to get more info than that?


texts: Extract email addresses from composite field type using Computed Twig

texts:
I am using a custom composite field type to gather multiple pieces of data from a user. This custom composite field type contains a field which gathers the email addresses entered.
What I am trying to do is use a Computed Twig field to extract the email addresses entered within the custom composite field type and use an email handler to send a confirmation email to all those email addresses, however, I am having real trouble trying to reference a field inside a composite field type. I have used multiple pieces of twig code, but all I seem to be able to reference is the values from all the fields in the custom composite and not a specific field.
I am really new to twig, so do not understand the full capabilities yet, but does anyone know how to reference a field value inside a composite field type, using twig?


texts: How to use $language array in region--header.tpl.php

texts:
I am using Language Switcher Dropdown module for language selection.

Successfully implemented this module and also get $language array properly in page.tpl.php file based on language selection.

But I am not able to get $language array in region--header.tpl.php file.

So how can I use this array in region files ?


texts:
This is a test site where i have installed fbconnect module I am facing issues while Inviting Friends:

What i am doing:
1. Connect to site through Fbconnect (by clicking on Login with Fb button)
2. Click on Invite Friends link which goes to fbconnect/invite/friends
3. Select Friends i want to invite.
4. Click "Send FB APP NAME Invitation"

Now, the Invited person gets a notification

Naushad Shaikh
Invited you to FB APP NAME. Try Now

URL Points to : http://www.facebook.com/games#

However nothing happens and the invitation does not succeed as it should.

Please let me know what should i do / what am i doing wrong.


texts: How to construct a db_query() with complex criteria?

texts:
I'm getting into the database API and it's really interesting how it works. The function db_query() makes querying the database very easy. However, I don't quite understand placeholders and the relationship between placeholders and $args parameter.

Example #1, the first comment on the doc page, can be written as:

$result = db_query('SELECT n.field1, n.field2, ... FROM {table} n
            WHERE n.field0 = :field0', array(':field0' => $field0value));
foreach ($result as $record) {
  // Data are in $record->field1, $record->field2, ...

The db_query function has two parameters; the first is an SQL query and the second is an array definition. The two are related by ":field0", which is called a placeholder. The fields and table are also modified by something called "n"; I don't know what that is.

I found that the above code works. However, I also found that it works and yields the same results without the n's, without the placeholder, and without the array: (The function syntax says the default if the array is not provided is simply "array()".)

'SELECT field1, field2, ... FROM table WHERE field0 = ' . $field0value

I tried this because I need to use complex criteria in which it is not clear what to do with the placeholder and array:

SELECT * FROM table WHERE concat(if(field1 = "", field2, field1), "value1") = "value2"

I ran this in phpMyAdmin and it works fine. It works by first looking at field1 and if there's something there, it uses that but if it's empty then it takes the value from field2. It then combines that with "value1" and selects records for which the result equals "value2".

So I put that in db_query like so:

db_query('SELECT * FROM {table} WHERE concat(if(field1 = "", field2, field1), "value1") = "value2"');

which resulted in the message:

PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column '' in 'where clause': SELECT * FROM {table} WHERE concat(if(field1 = "", field2, field1), "value1") = "value2"; Array ( ) in include_once() (line 87 of ....php).

Drupal does not seem to be complaining about the use of the concat and if functions, so it seems to be capable of handling them.
The symbol between the words "column" and "in" above is a pair of single quotes. So it looks like Drupal is looking for a column designation somewhere and not finding one. My guess is it's looking for something in the empty array. Do I need to use one or more placeholders and some form of array construct in order to get this to work?

Thanks for your help.


texts:
I try to use menu_alter for changing Delete option in access callback. I clear cache many times but it still not working.
I also tried some solution in this site but still got nothing. Please help me to solve this one.

function manage_child_menu_alter(&$items) {
   $items['comment/%/delete']['access callback'] = 'manage_child_comment_delete_access';
   $items['comment/%/delete']['access arguments'] = array(1);
   dpm($items);
}

Drupal Commons 3.28

Thanks.


texts: Which hook do I need to use to pull external content in pages?

texts:
I want some of my pages to pull content from another application. Someone suggest I should write a module to do that.
As I'm a complete beginner in Drupal I was wondering which hook do I need to implement (a snippet would be greatly appreciated) :

hook_page_alter
hook_page_delivery_callback_alter
something else ?


texts: Problems getting Default Content module to work with Features

texts:
I'm trying to export some Default Content when creating a drupal 7 distribution.  Noticed that Phase II is using Default Content module to set default content for OpenPublic.  I can't find any documentation on how to get the module to work.

How do you get the Default Content Module to work?


texts: Can I use Ubercart Stock to monitor individual components of a product?

texts:
For example, I'm selling Hamburgers.

Hamburgers require the following ingredients:

Bread
Beef
Tomato
Lettuce
Onions

For every one hamburger sold, stock decrement should be: 1 Bread, 1 Beef, 2 Tomatoes, 1 Lettuce, 3 Onions.

The ingredients will never be sold individually, they collectively make one product.

Is it possible to do this?


texts: Override global JPEG quality value based on cookie

texts:
I am working on a site that has an international audience and that needs to allow users to toggle a "low bandwidth" version. In order to achieve this, I would like to check if a cookie has been set and if so, override the global JPEG quality value from 75% down to, for example, 40%.

How can I override this variable and is this even possible with image caching?


texts: How do you get dropdown menus with toolbar.module?

texts:
I'm personally more a fan of the admin_menu style dropdown menus than Drupal 7's toolbar. I was watching a screencast by Randy Fay when I noticed he seems to have the toolbar displaying in a dropdown fashion. Does anyone know how he does that?

Check out the video at 1:50 to see it in action.


texts: Can you tell which page you're on of a DB API pager?

texts:
I'm doing the usual sort of Drupal 7 DB API pager stuff to work through a bunch of items, e.g (greatly simplified):

$the_nodes = db_select('node', 'n')->extend('PagerDefault');
-- conditions, fields, etc. --
$the_nodes->limit(10);
return $the_nodes->execute()->fetchCol();

and then the appropriate rendering code to make the pager study appear, of course.

What I'd like to be able to do is, from inside the function containing this query, to be able to tell which page of the pager I'm on -- in particular, if I'm on the first page, or not.  The idea is to insert a couple of other records at the beginning of the list, but only on the first page.

So: Does anybody know if this is possible?  Thanks!


texts: Page disappears after enabling/disabling module or after clearing all caches

texts: I have a page provided by Views (no custom coding). After I enable/disable any module, or after I clear Drupal caches, this page disappears. When I go to this view configuration page, hit any field, hit apply and save the view (without any changes - I just hit apply on field config) - page is coming back. Probably someone deleting view's menu_route? How can I identify who is deleting it?


texts:
Having trouble getting HOOK_theme_suggestions_field_alter to do what I expect. Think I'm missing something key about naming precendence.

Tiny bit of context: I have several field--xyz.html.twig  files in my theme that do nothing but remove the wrapping <div>s found in my default field template. Trying to create a preprocess function where I can point several fields at the same wrapper-less twig template. Because, cleaner.

Here's what I've tried. Open to other methods!

I created mytheme/templates/field/no-wrapper.html.twig

I added this function to the mytheme.theme file.

function mytheme_theme_suggestions_field_alter(array &$suggestions, array $variables) {
  if (in_array('field__my_field', $suggestions)) {
    array_splice($suggestions, 0, count($suggestions), 'no_wrapper');
    kint($suggestions);
  }
}

The result of that kint() call is as expected:

array(1)
  string(10) "no_wrapper"

That is, no_wrapper is the only suggestion in the array. But it still uses field.html.twig. From the source:

<!-- THEME DEBUG -->
<!-- THEME HOOK: 'field' -->
<!-- FILE NAME SUGGESTIONS:
   * no-wrapper.html.twig
   x field.html.twig
-->
<!-- BEGIN OUTPUT from 'themes/custom/my_theme/templates/fields/field.html.twig' -->

For what it's worth, the field in question is a Field Collection field.

What gives?

I've also (somewhat blindly) tried:

function mytheme_preprocess_field__my_field(&$variables) {
  $variables['theme_hook_original'] = 'no_wrapper';
}

Which puts no-wrapper.html.twig at the top of the suggestions list, adds no_wrapper as the THEME HOOK but still renders field.html.twig.

<!-- THEME DEBUG -->
<!-- THEME HOOK: 'no_wrapper' -->
<!-- FILE NAME SUGGESTIONS:
   * field--node--my-field.html.twig
   * field--node--my-node-type.html.twig
   * field--my-field.html.twig
   * field--field-collection.html.twig
   * no-wrapper.html.twig
-->
<!-- BEGIN OUTPUT from 'themes/custom/my_theme/templates/fields/field.html.twig' -->


texts: How do I add reCaptcha to a form programmatically?

texts:
I have a custom form on my site, and I want to attach a reCaptcha to it. I wasn't successful using the Drupal 7 code for this. Suggestions?
This is the Drupal 7 code I'm using:

$form['recaptcha'] = array(
  '#type' => 'recaptcha'
);


texts: How can I access values of multiple select list in a form?

texts:
I have a custom form in a custom module with multiple select:

$form['sponsors'] = array(
 '#type' => 'select',
 '#options' => $sponsors,
 '#multiple' => TRUE,
 '#size' => 20,
);

But I'm stumped how to access the submitted multiple values in the form_submit function. I tried to get the values by looping through the key (one guess was $form['values']['sponsors'][$key]) but no luck... anyone can point me in right direction would be appreciated!


texts: Link a field in content types to the user profile

texts:
I want to link the output of a field (e.g. "Written by:Name" or "Photographed by:name") in the content type (e.g. Article) to the user profile.

Can anyone help me with it?


texts: Sending attachment on webforms with drupal 7

texts:
Dears,

I have a webform where quest can send a attachment. For registered users this works bit for guest they send the mail whitout an attachment. The file is uploaded in the webform folder. How can I fix this taht the file is send with the email?

Thanks in advance.


texts: How do I specify an image reference in a Drupal 8 REST POST request body?

texts:
We have a content-type that includes a field of type Image.  There is also an image file that has been uploaded to Drupal.

We are trying to add new content via a Drupal 8 REST POST.  A new node is successfully created when the POST finishes, but the image field is never set.  Here is what we are trying:

POST to:   http:///entity/node?_format=hal_json
The normal 4 headers are set
POST Body:

{
    "_links": {
    "type": {
      "href": "http://localhost:8087/rest/type/node/product"
    }
  },
    "title": [{"value":"ProductC"}],
    "field_description": [{"value":"ProductC Description"}],
    "field_product_image": [{"src":"/sites/default/files/2017-03/samplelogo_1.jpeg"}],
    "field_product_name": [{"value":"ProductCName"}],
    "field_product_n": [{"value":"prodC"}]
}

Any pointers on how to construct the "field_product_image" line in the payload to link the image to new content node?
Thanks


texts: How can I add Google Tag Manager's code to my website?

texts: Is there any module to add some new things like Google Tag Manager's code to Drupal based website? for example you should install Google analytic module to add analytic to your site, is any equivalent for Google Tag Manager?


texts:
I got a Form and a Table displayed on the same page. The weird thing is that when the form is submitted and the page are reloaded (after doing a database SELECT) with $_POST values, the table is not showing....why?

Here is the code (suppose $tabb2 have correct table data):

<?php

function collabinc_menu($may_cache) {
  $items = array();
  $items['admin/reporting/report_details2'] = array(
    'title' => 'Report: User details by stores',
    'access arguments' => array('access content'),
    'page callback' => 'say_report_details2',
    'type' => MENU_CALLBACK,
  );
  return $items;
}

function say_report_details2($values = array()) {
  $output = "";

  if (isset ($_POST['search'])) {
     $output = theme("table", $tabb2);
  }

  $build['content'] = array(
    'this_does_not_matter_too_much2' => drupal_get_form("report_details_form"),
    'this_does_not_matter_too_much1' => array('#markup' => $output,),);

  return $build;
}

Please note that both Form and Table are working, and displayed correctly at the same time when not putting the "if (isset ($_POST['search']))" condition. Also note that the condition is fully working and checked.

Thanks!


texts: How to specify translation for strings in twig template & php files

texts:
I've found a lot of examples and modules where such expressions are used .

In php files

 t('Submit this form'),

In twig files

 {{ 'Send'|trans }}

So as I know this is used for the translation purpose, and I've also used these functions in my theme & modules.

But the question is where I can specify translation for these words & phrases ?


texts: How can I programmatically create a select input whose values come from a foreign key using Form API?

texts:
I have Table A who has a foreign key referring to Table B. I want my form associated with Table A to have a select field whose values will come from Table B. I want the select field to have options with key-value pairs coming from Table B.

Both Table A and Table B contain entities of different types.

I'm currently looking for programmatic solutions that use Entity Reference, but without having to go through adding a new field from Administration > Structure > <entity type>.


texts: How do I add Google +1 to Addthis Button?

texts: I am using the Addthis Module version 6.x-3.0-beta2, the problem is that google +1 doesn't appear as one of the services. Anyone knows how to fix this ? Thanks !


texts: How to hide a form field in hook_node_view()

texts:
function hook_node_view($node, $view_mode, $langcode) {
// How can I hide a field in the hook_node_view() using $node
// In my case the field is an image file field
}


texts: Can Panels provide a panels context based on the URL string or URL query?

texts:
I need to know if Panels can provide a panels context based on the URL string or URL query. This context may then be used to set in the panel pane settings.

Background info:
I have panels that contain panel views panes. The panels pane settings use the available panel context.

I therefore want to create a panel context based on the current URL string or URL query. Is that possible?

Note: if that is not possible, I would have to create new views panes that get their contextual filter directly from the URL instead of the available panel contexts. Using panels contexts would allow me to re-use views more efficiently.


texts: How to change the blog page title with specific user's only blog posts?

texts:
There is a team page of the company and there are few links to social accounts which every user have, including the link to their blog posts.
This link redirects you to blog page, but only with this user blog articles. The address shows blog/user_id and the title of the page is "Blog". I want the title to be different depending on what user's blog you've entered. Something like this: "John Doe's blog posts". Should I edit blog template? I use Drupal 8.


texts: Filters and relationships data from a display to another within the same view

texts:
Hi everybody,

I've been freshly introduced to Drupal and I'm having my first "serious" issue with contextual filters and relationships. Here is the context :

I have a "process" content type and several contents (processes)based on it
Some processes (contents) have an field, called "sub-process", which is an entity reference to processes
I made a grid page view showing every process and a bloxk view showing every "sub-process"
In every cell of the grid, there is one process and I want to display the sub-processes attached to it.
I can display the name of every process's sub-process through the "sub-process" field, but I would like to display other properties of these subprocesses.
To do so, I used the Views Field View module and a Global : view field. The problem is that it shoes all the subprocesses in all the cells of the gris except the right ones.

Any idea how to proceed ?


texts:
I just changed the server one of my sites is hosted on. In doing so, I lost all the images. The CCK file upload fields show "ghost" data but contain no actual image data as they did before the site transfer.
All my data is fine, however.

Is there a way to prevent this so all my images are maintained?
Thanks


texts: How to restrict a specific user to an IP range he can login from?

texts:
I want to create a subscription service where the user can only login with the IP address the user registered with and all Class C & D's of that IP range. How can this be done?

Would also be great if I can restrict the user to logging in from withing that state if possible.


texts: I am a newbi to drupal.I installed breadcrumb in my website.It is showing in all pages but one page it is not showing the breadcrumb.I created the page using panels module.


texts: How to get Webform Radio Option Value as a token value for email template?

texts:
I am trying to use my webform's radio field to choose between two departments, let's call them ABCDE and XYZ.  On the webform display that the user sees, I want them to show up as ABCDE and XYZ.  When I send the form as an email, I need these to show up as a similar 4 digit word such as ABCD and WXYZ.

I attempted to do this by setting the "Option Value" as the hidden 4 digit word and then have the actual text show up as "Option Text".

In the email template, I have this printed out as: [webform_submission:values:radioButtonName]

This prints it out as the "Option Text" (ABCDE and XYZ) rather than the "Option Value" (4 digit ABCD or WXYZ) that I am looking for.  Is there a way to print the "Option Value" of this radio button instead?  I assume its done by changing the word "values" to something else, but I haven't been able to find this.


texts: How to setup custom breadcrumbs with taxonomy?

texts:
I have content types that use taxonomy to categorize content. The Pathauto url alias structure is 'content type' / 'taxonomy term' For example:

Food/japanese - where food is the content type and japanese categorizes it.

I am using Custom breadcrumbs with great success except for when viewing a taxonomy page at it's alias. breadcrumbs don't work at all. The term does not show up, the parent does not show up, nothing happens. I have the 'custom breadcrumbs taxonomy' module enabled.

I saw that enabling that sub module created a place where I could create a custom path for each term. Technically I could go through and create a path, but I have 100s, if not over 1000 different terms and more added all the time. It would not be possible to use the term.

This would be very easy if I could just specify 'content type' / 'term' like I do for Path auto. One entry could take care of every situation. Is this possible? anyone know how I can configure this correctly?


texts: How to theming on webform field element in single twig file (for example webform--contact-us.twig.html?

texts:
I have tried a lot to get form element in webform twig file. But variables are not coming.For example : when I'm using  {{ element.elements.name }} in webform--contact-us.twig.html , nothing I'm getting. Only {{ children }} is giving me a whole form.

Any help will be appreciated.


texts: Add a message to messages array using theme process or preprocess function

texts:
For testing purposes, I'm trying to manually add a message to the $messages array, in either process or preprocess page function. To be clear, I first tried using

template.php -> mytheme_preprocess_page (&$vars) {}

but then I realized there's no $messages array there, so instead I am doing it via process.page.inc.

The code I have tried, which is not working is:

function mytheme_process_page(&$variables) {
    $variables[messages][] = 'new test message';
    kpr($variables);
}

I have tried some variations on this, but nothing worked.


texts: Webservice args types automatic validation

texts:
It's a Drupal 7 with Webservices module, and there is a service with something like this (example):

'create-product' => array(
  'operations' => array(
    'create' => array(
      'help' => t('Add Product'),
      'file' => array(
        'type' => 'endpoints.inc',
        'module' => 'custommodule',
        'name' => 'custommodule',
      ),
        'callback' => 'custommodule_create_product',
        'args' => array(
            array(
                'name' => 'appID',
                'type' => 'int',
                'description' => t("App ID"),
                'source' => array('data' => 'appID'),
                'optional' => FALSE
            ),
            ...

Okay, so the type here is "int". Is it possible to make Drupal return some error automatically, if it's not an int that is being sent as appID.
Like if it's a string being sent, then it will throw an error.
I can't make it work.
Why else is there a "type" key-value?


texts:
I am attempting to add glyphicon options to titles. Is there a way I can add a field to a content type in order to render the html showing the glyphicon? I am trying to add it to just the basic page content type and the page it shows on title click.

I tried adding a select list with the  inside as options for example, but it would not render the html.

EDIT:::

I tried the title html module, but it only allows a few elements. I would ideally like to add a select list to my content type that contains all the glyphicons i'd like to use on the page and i could just select which one to show before the title from that select list. It would then show the glyphicon before the title on save.


texts: Sort tableselect on taxonomy name (not tid)

texts:
So I've got a nice list of products in a tableselect element, like this:

$form['nodes'] = array(
  '#type' => 'tableselect',
  '#header' => $header,
  '#options' => $options,
  '#empty' => t('No content available.'),
);

I'm using EntityFieldQuery to make $options and each row is a "product", with a "product type" field which is a taxonomy term. But I want to sort the "product type" column by the taxonomy term rather than the tid (currently they aren't alphabetical and I intend to add more). This is what I've got now:

$header = array(
    'Name' => array(...
    ),
    'Product_type' => array(
        'data' => t('Product Type'),
        'type'=>'field',
        'specifier' => array(
            'field'=>'field_product_type',
            'column'=>'tid',
        ),),
    'Price' => array(...),
    ...
);

Is there a way to do this? I'm trying to avoid using "Views".


texts: Config Export: How to store default value of taxonomy field?

texts:
When I define a field with taxonomy term fields, I can set a default value depending on the available terms. Since the terms themselves are content, they are not stored via configuration management. When I export the configuration on one server (e.g. development) and import it into a different server (e.g. stage), these values may differ. Especially two terms with the same value on the servers don't necessarily share the same tid.

When I set a default value in dev, then this value's tid maybe not be the same as on the stage server and thus no default value or a wrong default value might be chosen, if I insert a new content of the type that has that field.

How do I manage this?


texts: Reset password single login link no longer valid

texts:
In a Drupal 8 project, when trying to reset password, the single login link is successfully sent to the entered email address but when clicking that link it always print the following message event when the link has never been used before either not expired yet (Account activation link expiration setting is set to 86400 which means 24 hours)

  You have attempted to use a single login link that has already been used or is no longer valid. Please request a new one using the form below.

Any suggestions?

Many thanks.


texts: Why doesn't this Views 3 contextual filter work?

texts:
I have expanded the article content type to include a few more fields and want to display an article node as a page.  Each article node (content) I give an alias with the following pattern: press-releases/[name-of-article]

I've set up A "Press Releases" view which has three displays.  Two of the displays are block displays and these work perfectly. I also want to make a page display with this view, and that's where I'm running in to problems. I want this view to be active for any node (content) that has the url press-releases/[name-of-article] and so I set up the view like this:

And the Contextual Filter has these settings for the Node ID:

But when I visit any press-releases/[name-of-article] it's like the Contextual Filter is completely being ignored and I just get the node spit out all the default fields as determined by the content type, and not according to the View's Page display. Why is this, and how can it be corrected?


texts:
I have a form, automatically generated by a content type. I want to run a form_submit function to input/change some data to get saved in the database.

The content-type already has these fields setup, but I want them to be determined in a form_submit function rather than via user input.

I can get a form submit function, but I don't know how to add to the array of values being submitted without having to write the whole query myself.  What variables do I need to grab and how to alter them to do this?

To be more specific.. in the form_alter, this does what I want. $form["field_org_id"]["und"][0]['value']['#default_value'] = $org->id;

But how do I do the equivalent out of site in the form_submit? (this is a content-add form and hoping not to rewrite the entire query)


texts:
In D7 there appear to be various methods by which a module can carry out validation of a form's fields, including:

#element_validate callback
#validate callback
hook_field_validate() implementation
hook_form_validate() implementation
hook_field_attach_validate() implementation

Firstly, can anyone list the execution order of the above?

Secondly, can anyone please explain why one might choose to use a callback instead of a hook or a hook instead of a callback?


texts: Views exposed filter and non latin characters

texts: I have a combined text box exposed filter of a view. Is there any way that I can alter the keywords used by the user to convert non-latin characters to latin using hook_views_query_alter?


texts: Alternatives to Commerce Coupon / Discount

texts:
I need to add coupon codes for a e-com shop built using Drupal Commerce, and have been playing with Commerce Coupon and Commerce Discount modules, but I can't seem to fix the problem of coupons being removed during checkout. This has been reported many times (see issues below), with various supposed fixes but I've tried everything and nothing works.

So, is there any alternative for this kind of functionality?

I really only need discounts on full orders (instead of products) but do need both percentage and fixed price options.

Alternatively if anyone has a real fix for the issue please let me know!

Issues for reference:

https://www.drupal.org/node/2619448

https://www.drupal.org/node/2328357

https://www.drupal.org/node/2464525


texts: How can I grant users permissions to edit certain views (add/remove fields in a view) in drupal?

texts:
We offer a Drupal site to our client with a set of views. The client wants to edit a (predefined) set of views. So, say for example the application got 3 views. The client is allowed to edit one of them.

I have been looking for a module to take care of this but couldn't find any. I was hoping there would be a module which would take the Views tags into account, so you can set permissions on this tag. Say I assign the tag 'Client' to a view. I then can assign the edit permission for a certain role on this tag.

How would you solve this or is there already a solution available?

Thanks!


texts: How to show form elements within PDF by print module?

texts: I'm using the print module to convert a node to a PDF. I see that there is the print.tpl.php for theming, but where can I say that I want to show form elements (eg. input fields, radiobuttons, ..) within the PDF?


texts: Drupal 7 Display legal module fieldset on user/% instead of user/%/edit

texts: How can I display the legal module fieldset on /user/% instead of /user/%/edit? Please note my /user/% is a view page so I can use views template schema.


texts: How to include a rule variable (text) in "Set a data value" direct input mode

texts:
Originally posted this in the Rules issue queue ( http://drupal.org/node/1547160 ) but then saw how few posts from the last 2 weeks had any replies. Scary!

When setting a data value (text) I am unable to include a rule variable (also text) in direct input mode. I was originally trying to do this to build up a large string from fields while looping through a list of nodes. For the sake of understandability I've reduced this to the simplest possible case. The rule export is below and requires Devel module.

Note: I can perform direct assignment of one variable to another using data selection. (Unfortunately that does not satisfy my use case.) It's just direct input mode where I'm failing.

Please can someone tell me whether I should be able to do this and, if so, what I'm doing wrong?

{ "rules_example_text_inclusion" : {
    "LABEL" : "Example text inclusion",
    "PLUGIN" : "reaction rule",
    "REQUIRES" : [ "rules", "devel" ],
    "ON" : [ "node_view" ],
    "DO" : [
      { "variable_add" : {
          "USING" : { "type" : "text", "value" : "*This is the value of text_variable_1*" },
          "PROVIDE" : { "variable_added" : { "text_variable_1" : "Text variable 1" } }
        }
      },
      { "variable_add" : {
          "USING" : {
            "type" : "text",
            "value" : "*This is the initial value of text variable 2*"
          },
          "PROVIDE" : { "variable_added" : { "text_variable_2" : "Text variable 2" } }
        }
      },
      { "data_set" : {
          "data" : [ "text-variable-2" ],
          "value" : "Overwriting the value of text_variable_2:\r\n[text-variable-1]\r\n[text_variable_1]\r\n"
        }
      },
      { "devel_debug" : { "value" : [ "text-variable-2" ] } }
    ]
  }
}


texts: How to direct authenticated and anonymous users to different ( custom ) front pages?

texts:
I want anonymous users to always see /node/1 but authenticated users to see /myview/uid where uid is the current user's id.

I don't want to use Rules, but would prefer a code solution.


texts: How do I get drush to run remote drush not in a path?

texts:
A remote server doesn't have drush, so I put it in my ~.

Adding a $PATH works fine for myself being logged in, but since ssh [command] wont open a shell, $PATH is never picked up when I use drush @remote-alias status.


texts: How do I forward user to a specific page from the node create page when a role and nodes creation limit matched?

texts:
I am recreating my website from Drupal 7 to Drupal 9, and I am struggling with getting a rule that I had setup in D7 working on D9.  Rules is still in Alpha, and the Rules Form module is non-existent for D8/D9 so I do not want to attempt to use Rules for this.
I want to limit the number of nodes a user can create by node type and role.  Currently the code I have in D7 Rules is:
// Configure your settings: Node limit/quota & Content Type
$nodelimit = 3;
$content_type = 'car';

// Check it we are just editing an existing node, and quit if so
if(arg(0) == 'node' && arg(2) == 'edit'){
return FALSE;
}

// Load the active user account
global $user;

// Drupal has a security feature called the Database Abstraction Layer.
// You have to build DB queries with variables that are defined in an array.
// Define the query string, where ":drupaluid" etc. are arbitrary placeholders
$query = 'SELECT * FROM {node} WHERE uid=:drupaluid AND type=:drupaltype';

// Define each placeholder
$variables = array(':drupaluid' => $user->uid, ':drupaltype' => $content_type);

// Query the Drupal database
$result = db_query($query, $variables);

// Count the number of rows returned from the Drupal database
// From: http://api.drupal.org/api/drupal/includes%21database%21database.inc/function/db_query/7
$nodecount = $result->rowCount();

// Set the flag as to whether this Rule is effective or not
if ( $nodecount >= $nodelimit) {
return TRUE; // You will be over the accepted quota
} else {
return FALSE; // Still got room. Allow the new node.
}

If this returns true, I then have a Rules action that forwards the user to a specific page instead of the node create form.
However I am not a programmer, and I am struggling to figure out how to do this in D9 without rules.  It looks like maybe I could create a small module and use "function hook_node_access"?  I'm also not sure if the API's that are called in the code above for D7 will work in D9?  The code above also does not "forward" to another page if true, as I was using Rules to do that.