Cannot get any tweets using Twitter Block

Have you tried using the twitter profile widget? The twitter profile widget allows you to stream a twitter feed from a specific user.

First you will need to log into twitter and configure a twitter widget. When you configure  the twitter widget (using your twitter account) you will have output html code.
Once you do this you can then create a content type called twitter widget. Once this content type is created all you have to do is place the html text from your twitter widget into the content type.
Make sure that in your content type text box you set the text to read plain html. Once saved this will create block that can then be configured and dragged around the page.


How do I backup my site w/o the command line?

I'd go with the Backup and Migrate module. You can either start backups manually or have it run automatically on cron run. Then you can just download your /sites/ folder and you should have a full backup of everything (assuming your files, modules and themes are all in /sites/ like they should be.)


Print the current source node of the comment

The node id for the comment is stored in:

$comment->nid

e.g, in the template, to print out the node, you could:

if (isset($comment->nid)) {
  print render(node_view(node_load($comment->nid)));
}

You could also add it as a template variable in preprocess function.

See node_view for more options


How can I translate the name of a vocabulary?

Typical taxonomy translation issues

My best guess is that you are experiencing the typical taxonomy translation issues, as described in the community documentation about Taxonomy translation also. While digesting that, you may want to verify one of its comments, which is about using the Title module also.

The closest I have come so far with translated terms (and without using the Title module), is similar to the setup you have done so far. The result of it being that when you want to select a term from a taxonomy on a language specific node, you get a list of all terms to select from (with all terms from all languages). Not the ideal solution, but similar to what is written in the URL I mentioned, and probably "as good as it gets in D7".

Translate vocabulary name

If however you're only looking for a way to translate the vocabulary name (as the title of your question indicates), then be aware that that is simply not possible today, and is actually a known issue: Vocabulary Name value doesn't get translated. It dates from 2005 (!), related to D6, status "won't fix". However comment # 2 in that issue states:

  I have used the locale module to translate the name of the vocabulary, and display it with t($vocabulary->name). If all modules would display the name this way (e.g. taxonomy_menu does it), then there is no need for a new database table i18n_vocabulary.

The t($vocabulary->name) seems like a possible/partial work around to consider, i.e. from within a (custom) module.

There is a more recent similar issue, i.e. Vocabulary names are not translated. That one is for D7, with status "needs work".

Another potential work around could be to have a separate taxonomy for each language (and with a "name" corresponding to that language). Of course, you'd have to think how to best use these separated taxonomies for each content type (a kind of "solution to the problem, changes the problem) ...


Exporting and Importing configuration setting only

Importing configuration in SQL alone is not possible, you need to run PHP code.

From the command line, if you don't have Drush installed, you can download Drush on the fly and execute the import command:

wget https://github.com/drush-ops/drush/releases/download/8.1.17/drush.phar
php drush.phar config-import


You could use hook_mail_alter to abort the verification email being sent in the condition that the user is using the premium option. As stated on the api.drupal.org page if you set the 'send' parameter of the $message data to FALSE it will abort sending the email.

You'll need to retrieve the 'premium' context within your implementation of hook_mail_alter() to achieve this, which may require setting that property on the user, the session, or in a custom database table.


Rules Workflow: Data selector is invalid

The problem was with the UUID module. Updating it to the latest version fixed this issue.

Similar problem at: Enabling UUID breaks rules config set by Ubercart.


Delete a field from the database manually

In Drupal 8 bundle fields are configuration. This looks like you still have the field storage configured.

In this case export configuration:

drush cex

remove the field storage:

rm field.storage.node.field_example.yml

and import configuration again:

drush cim


Includes or requires is likely your best bet here, why are they tedious? If the includes are within the same theme/template files directory you needn't use absolute paths.

If you cannot use relative paths then you can use getcwd() to get the current path/working directory of a file, or use drupal_get_path() to get the path to a theme or module file.


Its really hard to figure out a solution for your issue without trying different options; but I hope the following instructions will help you.

Backup your current database
Open phpMyAdmin or any desirable MySQL administration tool.
Delete all ctools modules from system table or run this query

DELETE FROM system WHERE name LIKE '%ctool%'
Drop ctools tables ctools_css_cache, ctools_custom_content, ctools_object_cache or run these queries

DROP TABLE ctools_css_cache

DROP TABLE ctools_custom_content

DROP TABLE ctools_object_cache
truncate all cache tables (cache table and all tables with prefix cache_), example of truncate query

TRUNCATE TABLE cache


How to theme nodes in views based on the author's role?

Luckily, Views allows you to add custom row classes through its admin interface, so you can style your view rows according to any field in that row.

Here is what I'd do, in your case, to add a 'staff-author' or 'user-author' class to your view row, depending on who wrote the blog (I'm just assuming those are the roles associated with your two user groups - they may be something else ;-)).  Once you've added such a class, you can add css in your custom theme to style those differently.

Add a 'user' relationship to your blog view.  Under the "Advanced" section of your view, add the following relationship: "User: Content authored".  Now you'll be able to add fields from the node author to your view (even if you don't display them)
Now you can add the 'User: Roles' field to your view - just make sure to select to use the User relationship you've added when configuring the field. You can check to not have it display too!

Finally, now you can edit your format settings to fill in a custom css class, based on any field you choose (from the 'Replacement Pattern' options for your view).  In your case, it would be [rid-role].

Now, inspect the html of your view using Firebug (or something similar), and your view rows should have the new css class filled in, depending on the role of the node author.  Use that to style the entries differently!


User Points Rules: Remove points (based on content type)

Your question seems to be a variation (not a duplicate) of the question "How to grant user User Points equal to certain field's value / calculated value?".

Similar to the accepted answer to that question, use the Rules module and try to create a rule with these Rules Actions:

Calculate a variable that corresponds to "the integer value entered for the Events content type" (similar to what you wrote in your question).
Convert the data type of that variable (to integer).
Grant points to user (using the calculated + converted variable.

With that, the only thing left to do is to find an appropriate Rules Event to get this rule triggered.

PS: such "convert data type" is simply a matter of how Rules works (by design), so it's not to be considered as a bug either.


For a Single Language non English site, When you install Drupal 7, it gives you option of selecting the Language. Plus you will need to download the language PO files for your language.

But if you are using Drupal 8 the only requirement is selecting correct language when you install your Drupal. Drupal 8 will automatically download all the language files for you.


Is it possible to use a path like that : user/%user/word with MENU_NORMAL_ITEM instead of MENU_LOCAL_TASK

i used views to achieve what i wanted to do but it was not easy because :

Fields was not the same and didn't have the good format
There was no filter "current user"
So i create a custom template using views-view-table.tpl.php.

I don't know if what i did is very good:

I call global $user in my template, maybe it's a mistake, i don't know if we can do that
Thxs to criticguy, i improved the following code by removing current user test

 <?php foreach ($rows as $row_count => $row): ?>
    <tr <?php if ($row_classes[$row_count]) { print 'class="' . implode(' ', $row_classes[$row_count]) .'"';  } ?>>
    <?php foreach ($row as $field => $content): ?>
     <td <?php if ($field_classes[$field][$row_count]) { print 'class="'. $field_classes[$field][$row_count] . '" '; } ?><?php print drupal_attributes($field_attributes[$field][$row_count]); ?>>
     <?php if($field == 'last_execute') : ?>
       <?php $last_execute = t('@time ago', array('@time' => format_interval(REQUEST_TIME - $content))); ?>
         <?php print $last_execute; ?>
       <?php elseif($field == 'created'): ?>
         <?php $created = format_date($content, 'short'); ?>
         <?php print $created; ?>
       <?php elseif($field == 'notify_interval'): ?>
         <?php $interval = format_interval($content, 1); ?>
          <?php print $interval; ?>
       <?php elseif($field == 'results'): ?>
          <?php $tab = explode(',', $content); ?>
          <?php $x = 1 ?>

          <?php foreach($tab as $value): ?>

            <?php print 'Resultat '.$x.''; ?>

            <?php $x++ ?>
          <?php endforeach ?>

       <?php else: ?>
        <?php print $content; ?>
       <?php endif ?>

<?php endforeach; ?>

Final result:

I'm always interested by my question about MENU_NORMAL_ITEM and MENU_LOCAL_TASK.


print all the titles of a content type by php

I think the "best" way (most future-proof etc.) would be to use an EntityFieldQuery:

$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'node')
  ->entityCondition('bundle', 'period');

$results = $query->execute();
if (!empty($results['node'])) {
  $nodes = node_load_multiple(array_keys($results['node']));
  foreach ($nodes as $node) {
    // Do something with $node->title
  }
}

There are other options but they either involve deprecated methods or going directly into the node/revision tables, which can be a pain.

If you need this list in page.tpl.php make sure you don't put the code directly in the template file (it's bad practice and can cause problems with caching). The best place would be in a preprocess hook in your theme's template.php file, or a module file.


Title tag not overriding after using meta tag module

Try theme_preprocess_html and modify the title using variable header_title

Sample code:

function mytheme_preprocess_html(&$vars) {
  $vars['head_title'] = 'TITLE';
}

It works for me.


How to create dynamic query for inner join on same table?

$query = db_select('table1','t1');
$query->join('table2','t2','t1.id1=t2.id2');
$query->fields('t1', array('some fields'))
      ->fields('t2', array('some fields'));
$result = $query->execute()->fetchAll();

Then you can do print_r stuff into $result like

echo "<pre>";print_r($result);echo "</pre>";

If you have devel module installed and enabled, then you can also use:-

dsm($result);

This will give the whole result in form of array.
If you need in form of object, then you need to modify few lines of code like this:-

$data = $result->execute();
while($result = $data->fetchObject()){
  //Do your related stuff
}

I think it will help a lot. Thanks.


is there a way to display a message for views if there are no results?

For Drupal 7 / Views 3 the answer would be:

Check the "Advanced" Options on the right side. There you can add a "NO RESULTS BEHAVIOR".


How to stop Watchdog from logging "DEBUG" errors?

The Drupal watchdog includes the errors raised by PHP, such as the one you mention.

It might be possible to use hook_watchdog to filter out certain errors. However, it seems easier to change the PHP error level on your settings.php file, so that PHP does not complain about your ctools module.

The list of possible PHP error levels is here: http://php.net/manual/en/errorfunc.constants.php
Some guidance about modifying the error levels on your settings.phpfile: https://www.drupal.org/docs/7/creating-custom-modules/show-all-errors-while-developing


How to rebuild a cached page when it expires?

If you know what functions need to run in order to warm a cache, checkout httprl. httprl_queue_background_callback() is the function to look into using. Simple example of calling watchdog in the background http://drupalcode.org/project/httprl.git/blob/24a88acd2180191d0b54696e577f14615e37302d:/README.txt#l268

In terms of graceful varnish cache clears this has a good example: https://www.varnish-cache.org/trac/wiki/VCLExampleGrace Example of it in use: http://groups.drupal.org/node/63203


Similar Module for Drupal: Easy Folder Listing?

Maybe you have to try two modules who allow to manage files in Drupal:

media project

  The Media module provides an extensible framework for managing files and multimedia assets, regardless of whether they are hosted on your own site or a 3rd party site

workbench media : it's an integration of the first module in the workbench suite, that's great if you want a listing of all your files uploaded in your site.

If you just want to display files to the users, you can do that quickly with views:

Add a new view
In show section select files

After you'll be able to show all the files you have in your folder (but you can also restrict to only show files from a specific content type)
I took a photo of all the fields available :


Views REST Endpoint With paragraph field

I have solved by using jQuery.parseHTML() or you can use Javascript DOMParser

Something like this

$.ajax({
    type: 'GET',
    url: drupalSettings.path.baseUrl + 'REST_VIEW_PATH/' + nid,
    success: function (data) {
        {
            var paragraphField = data[0]['FIELD_NAME'];
            $.each(paragraphField, function (index, item) {
                var fieldItem = $.parseHTML(item.FIELD_ID_IN_PARAGRAPH);
                console.log(fieldItem[0]['innerText']);
            });
        }
    }
});


The core 'book' module will do what you're after.

First, configure the module so that the content type you are using for blog posts is allowed to be in books at admin/content/book/settings.

Second, understand that a book is a bit like a menu, each page is a single node and the book simply provides the links between those nodes in order.  When you create or edit the node intended as the first page of your book go to the 'book outline' settings at the bottom of the node creation form and select create new book.

To add pages, create or edit the nodes that are to be the next page(s) and select the book you just created.

Finally there is a block that the module creates called 'book navigation', move that block to where you wish the 'next' and 'previous' links to go.

Some styling will probably be required if you want it to look like the example you gave.


How to get field values in node template in Twig

A teaser image linked to the content is the standard configuration for the teaser view mode. You only need to limit it to one image. This is a feature request for core, see this issue https://www.drupal.org/node/1234624. Until then you can use this sandbox project: https://www.drupal.org/node/1234624#comment-11868691.

If you want to do this in a node twig you can get the first field item with the delta 0:

{{ content.field_image.0 }}

and then remove the field from the main content to avoid double content:

{{ content|without('field_image') }}


EntityQuery for taxonomy term of specific bundle

This works :

$terms = \Drupal::entityQuery('taxonomy_term')
  ->condition('vid','mail_template')
  ->execute();


How to show and hide menu tabs in module


The taxonomy module provides a default breadcrumb service and if you have a look at the declaration of this in the taxonomy.services.yml file you will see it has a priority of 1002.

Setting the priority of your breadcrumb service to a value higher than this should get Drupal to use your breadcrumb rather than the default one.

Something like this should do the trick:

custom_breadcrumb.services.yml

services:
  custom_breadcrumb.breadcrumb_blog:
    class: Drupal\custom_breadcrumb\Breadcrumb\BlogBreadcrumbBuilder
    tags:
      - { name: breadcrumb_builder, priority: 10001 }


So after spending more time than I care to admit looking into this, I've come up with two solutions to this.

Solution 1

One way to do it is with the date function that darol100 mentioned in his answer. Modifying his example for my case, in my node--article.html.twig file, I changed:

{% trans %}Submitted by {{ author_name }} on {{ date }}{% endtrans %}

to

{% set createdDate = node.getCreatedTime|date('j F Y') %}
{% trans %}Submitted by {{ author_name }} on {{ createdDate }} {% endtrans %}

The advantage to this approach is that it's easy and quick. The disadvantage is I'm not using Drupal's built-in date format system.

Solution 2

In order to use Drupal's date format system, I first created my custom format at admin/config/regional/date-time. Then I edited node--article.html.twig as follows:

{% set createdDate = node.getCreatedTime|format_date('my_custom_format') %}
{% trans %}Submitted by {{ author_name }} on {{ createdDate }} {% endtrans %}

This assumes I named my custom format "My Custom Format", which results in the machine name my_custom_format.

While this solution requires an extra step, I feel it's the more Drupal way to do it.

I learned about it on this page about Drupal's Twig Filters.


Get Field Name Being Deleted From Configuration Updates/Delete Form

Try with hook_form_alter something like

/**
 * Implements hook_form_alter().
 */
function MyModule_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
  if ($form_id == "field_config_delete_form"){
    $field = $form_state->getFormObject()->getEntity();
    \Drupal::messenger()->addWarning("You are going to delete field : " . $field->getName());
  }
 }


How to get Page Manager to react on path alias before node/%node

If you want to override the default path like node/%node, taxonomy/term/%taxonomy_term and so on then there is a module for that: Page manager existing pages. Some more details about this module (from its project page):

  Page manager existing pages allows you to override/configure Drupal menu paths so you can create variants with Page manager, which is bundled in the CTools project.

Here is an introduction from the author: Overriding any Drupal path with Page manager existing pages.


How to change template file name and destination for some blocks?

Check out template_preprocess_block. You can do this with the following code in your theme's template.php file:

function MYTHEME_preprocess_block(&$variables) {
  // Perform a check based on any parameter, e.g. block ID.
  if ($variables['block_html_id'] == 'block-system-main') {
    // This will lookup for block--system-main-block.tpl.php file in your
    // theme.
    $variables['theme_hook_suggestions'] = 'block__system_main_block';
  }
}

However, Drupal already looks for various template names, before it settles down for the default block.tpl.php. Here is the list:

block--block--[block-id].tpl.php
block--[module]--[delta].tpl.php
block--[module].tpl.php
block--[region].tpl.php
block.tpl.php

See this page for more information.


Assuming Drupal 8 (since you didn't give a version), there are two parts to this.

Imagine this element in the form:

$form['some_field'] = [
  '#type' => 'radios',
  '#options' => [
    'option1' => $this->t('Option 1'),
    'option2' => $this->t('Option 2'),
  ],
];

The submitted value can be retrieved from $form_state in your submit handler:

$radio_value = $form_state->getValue('some_field');

You can then use the value to get the text of the radio, from the $form element:

$radio_text = $form['some_field']['#options'][$radio_value];


How to create a token to render nodes in content?

Even though Mołot made a point about your question, I will give you an answer:

Using dynamic tokens with parameters is possible, but some coding is necessary. See pass parameters with tokens for more info.

You can also achieve what you need with some contrib modules, more specifically Field Collection (https://drupal.org/project/field_collection) and References (https://drupal.org/project/references). With these two, you can create a field collection for your content type which includes one field for text and one field for node reference. Field collection module makes it possible to have multiple values, so you could slice up the text and insert the node references in between. To render full nodes with node reference field, go to manage display and set it to Rendered node. You will end up with something like this (administration):


Drupal Commerce | Hide or set an alias to the order number in the checkout path

I to went that road, did not want customers to see an on each order incrementing ID in URL's. In hook_url_outbound_alter() any path can be encrypted by altering the regular expression.

/**
 * Implements hook_url_inbound_alter().
 */
function mymodule_url_inbound_alter(&$path, $original_path, $path_language) {
  // Decrypt paths that are encrypted by our hook_url_outbound_alter() to hide possible id's in paths.
  if (preg_match('#^ENC:(.+)#', $path, $m)) {
    $path = _mymodule_mcrypt('decrypt', $m[1]);
  }
}

/**
 * Implements hook_url_outbound_alter().
 */
function mymodule_url_outbound_alter(&$path, &$options, $original_path) {
  // To hide id's in paths, we encrypt them.
  if (preg_match('#^checkout/.*#', $path, $m)) {
    $path = 'ENC:' . _mymodule_mcrypt('encrypt', $path);
  }
}

/**
 * Helper function to encrypt and decrypt strings, ie. paths to hide containing id's.
 * NB: We replace forward slashes for exclamation marks, otherwise trailing
 *     slashes in the URL will be ignored by Drupal.
 */
function _mymodule_mcrypt($action, $string, $key = null) {
  if (!$key) {
    $key = $GLOBALS['drupal_hash_salt'];
  }

  $mcrypt_method = MCRYPT_RIJNDAEL_128;
  $iv_size = mcrypt_get_iv_size($mcrypt_method, MCRYPT_MODE_CBC);

  // Make key exactly as long as long as $iv_size.
  $key = substr(str_repeat($key, CEIL($iv_size / strlen($key))), 0, $iv_size);

  if ($action == 'encrypt') {
    $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
    $encrypted_string = base64_encode($iv . mcrypt_encrypt($mcrypt_method, $key, $string, MCRYPT_MODE_CBC, $iv));
    return preg_replace('#/#', '!', $encrypted_string);
  }
  elseif ($action == 'decrypt') {
    $decrypted_string = base64_decode(preg_replace('#!#', '/', $string));
    $iv = substr($decrypted_string, 0, $iv_size);
    $decrypted_string = substr($decrypted_string, $iv_size);

    return rtrim(mcrypt_decrypt($mcrypt_method, $key, $decrypted_string, MCRYPT_MODE_CBC, $iv));
  }

  return false;
}


Filtering Content based on URL arguments from Calendar Module

I am not exactly sure what you mean. Could your provide an example of what the URL looks like?  Off the top of my head I think that you would just want to use view arguments.


Drupal.behavior unexpectedly triggered by Ajax callback

All Drupal behaviors are called when an AJAX call is performed. This allows modules to attach its 'behaviors' to new loaded content.

There are much cases where the behavior should be attached just one time. For this cases the once function is recommended:

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

    $(settings.responsive_tabstoaccordion_panels.tabstoaccordion_panel).once('rttap', function () {
      $(this).easyResponsiveTabs({
        //Set options
        type: 'default',
        //...
      });
    }
  );

This way the anonymous function that calls easyResponsiveTabs is called only one time for each element. If new elements are loaded the behavior is applied.


Filter views on Current user OR Administrator

When dealing with multiple roles, make sure the access control module has all the correct control settings. In Admin->structure->Content Type->Access Control I had the "View any **Content Type** content" checked. As soon as I removed that, the suggestion by @Jimmy Ko, worked, Thanks Jimmy.
 Easy to overlook when you have 3 different places where the content type is limited.


Drupal 7 Views url translated alias with contextual filter

I've finally found the solution for my problem, after a couple of hours :).

It was solved after installing the Extended Path Aliases module.


Custom teasers and show summary checkbox

Set $node->teaser to the value you want to use as teaser. That is what node_submit(), the function indirectly called from node_form_submit(), does.
node_body_field(), the function that add the form fields for the node body, contains the following code:

// Check if we need to restore the teaser at the beginning of the body.
  $include = !isset($node->teaser) || ($node->teaser == substr($node->body, 0, strlen($node->teaser)));

// …

$form['teaser_include'] = array(
  '#type' => 'checkbox',
  '#title' => t('Show summary in full view'),
  '#default_value' => $include,
  '#prefix' => '
',
  '#suffix' => '
',
);

The checkbox is not selected if

the teaser is set, or
the teaser is not the initial part of the body

I would use hook_nodeapi('presave'), which is invoked before the node is saved, but before hook_nodeapi('insert') or hook_nodeapi('update').

To notice that, if the problem is the length of the teaser, node_teaser(), uses the value of the "teaser_length" Drupal variable as length if the teaser. I am not using Drupal 6, but if I remember well, there should be a setting page that allow to change the value of that variable. If the value of the variable is not modified from a setting page, then you can set it in settings.php, or from a custom module.


How to hide a webform field from a node display when the per-user submission limit has been reached

This works (below, added to MY_THEME.theme), but I haven't stress-tested it:

function TEMPLATE_preprocess_node(&$variables) {
  // Hide field_registration_form if already submitted to it.
  if($variables['node']->bundle() == 'CONTENT_TYPE') {
    $current_user = \Drupal::currentUser();
    $uid = $current_user->id();
    $webform = Webform::load('WEBFORM_ID');
    if ($webform->hasSubmissions()) {
      $query = \Drupal::entityQuery('webform_submission')
        ->condition('webform_id', 'WEBFORM_ID');
      $result = $query->execute();
      $submission_data = [];
      foreach ($result as $item) {
        $submission = \Drupal\webform\Entity\WebformSubmission::load($item);
        $submission_data[] = $submission->getData()['user'];
      }
      if (in_array($uid, $submission_data)) {
        unset($variables['content']['field_registration_form']);
      }
    }
  }
}


http://example.com/node/111 also accessible through http://example.com/node/111.000

Automated scans sometimes report issues that are non-issues, and the results of an automated scan do need to be combined with an understanding of the issues at hand (and, if they require fixing, the risks of introducing new code to mitigate supposed vulnerabilities).

As R. Leurquin says, in Drupal there are multiple URLs that may work to access the same node or path directly. While this might not be ideal for SEO (if people link to multiple URLs), it likely isn't an actual security concern.

This can likely be solved using approaches like the Global Redirect module in Drupal 7, and the Redirect module in Drupal 8 (and in D7 if patched from #905914: Merge global redirect functions into Redirect module).

You'll get the SEO improvements, and if the security team really need convincing, hopefully it's an easy item to knock off the list!

If those don't cut it, you could do something similar to what Global Redirect or Redirect do, eg implement hook_url_inbound_alter() or hook_init(), check for those zeroes, and redirect them. In that case, be careful that the "fix" for this "problem" is not riskier than the existing situation.

You could also handle this with redirects at the webserver layer.


Set the site display language based on browser's default language

Goto Admin -> Module -> Locale
Click on Configuration (Locale)
Enable Radio button as per you want to set default language.


Display block on homepage depending on value in user profile field?

You can do something like this

global $user;

 If($user->your_profile_field_value == 'requiredvalue') {
    Return true;
    }
    Else {
    Return false;
    }


As dddave mentioned it is probably because you have on your site more then 31 css files. Ie will use only 31 first files - other will be left alone.

What can you do with it? On live site - turn on standard drupal css aggregation. I will make creating theme painfull - you will need to clean cache(admin/settings/performance) after every css file change. So you can use the IE CSS Optimizer module:

Then there will be more option for css aggregation. It will make possible to aggregate all module's css, and having all theme's files included directly. Hopefully total number of files will be below 31.

For making easier adding condition styles for IE try the Conditional Stylesheets module:


Is there a way to disallow spaces in the user name registration form in drupal 7?

I recently wrote a custom module to disallow spaces and other characters in usernames. Feel free to comment on the code. I also modified username_check to do the same validations in the ajax callback.

//implement hook_form_FORM_ID_alter
function custom_form_user_register_form_alter(&$form, $form_state, $form_id) {
  //define validation function
  $form['#validate'][] = 'my_user_register_validate';
  //overwrite the username help text
  $form['account']['name']['#description'] = 'Username has to be between 5-15 characters long and can only contain letters and numbers';
}

function my_user_register_validate($form, &$form_state) {

  $output['error'] = FALSE;
  $username = $form_state['input']['name'];
  $password = $form_state['input']['pass']['pass1'];

  if (strlen($username) < 5 || strlen($username) > 15) {
    $output['error'] = TRUE;
    $output['msg'] = t('The username has to be between 5 and 15 characters long. ');
  }
  if (strpos($username,' ') > 0 || strpos($username,'.') > 0 || strpos($username,'-') > 0 || strpos($username,'_') > 0 || strpos($username, "'") !== FALSE ){
    $output['error'] = TRUE;
    $output['msg'] = t('Username cannot contain spaces . - _ ' . chr(39)  );
  }

//display username errors
  if ($output['error']){
    //drupal_set_message( $output['msg'], 'error');
    form_set_error('name', $output['msg']);
  }
}


Why is Pressflow not listed under Drupal.org's List of distributions?

Press-flow generally takes the established features of the next version of Drupal and back-ports it to the current version.

For example Pressflow-6 Takes the features(enhancements and performance improvements) from Drupal-7 and back-ports it Drupal-6. These changes generally include changing the core to considerable amount.

The only reason I think of why it is not included is that

  Since it makes changes to the core it doesn't make sense to host it on
  the Drupal.org under project.


For D7, in order to gain access to revision:author tokens, you have to install Revisioning module. (of course you also need token module)

Then you can see all the available tokens by going to Help -> Token (/admin/help/token)

So after enabling the module, a new token category, named "Revisions", is available. You can see for example
[revision:revision-author] which refers to "The author (or editor) of the revision" and a bunch of others regarding the revision author.

P.S. As per this there seems to be currently a bug regarding [revision:revision-author:mail]

Good luck and let me know if you need more help!


The problem is more than likely that the 'c' format includes the timezone, which is not (currently) included in storage.

The storage format for fields that have both date and time is defined by the datetime module as DateTimeItemInterface::DATETIME_STORAGE_FORMAT, which is 'Y-m-d\TH:i:s'.

Something like this will work:

use Drupal\Core\Datetime\DrupalDateTime;
use Drupal\user\Entity\User;
use Drupal\datetime\Plugin\Field\FieldType\DateTimeItemInterface;

$date = DrupalDateTime::createFromTimestamp($new_expiry, 'UTC');
$account = User::load($email_result);
$account->field_expiry_date->value = $date->format(DateTimeItemInterface::DATETIME_STORAGE_FORMAT, [
  'timezone' => 'UTC',
]);
$account->save();

Just remember that date+time values in storage are implicitly UTC, so if you are setting the value manually, you need to ensure that what you are saving represents what you want, but converted to UTC.


Comparing entity against previous entity in views

Probably late by now, but have you tried using revisions? You can pull in individual fields that has any revision.


Need a simple Google Maps solution; lost in the labyrinth of modules

I have created a Drupal feature that implements this using OpenLayers ( See http://drupal.org/project/ol_locator ) or you can use the following walk-through to set up your own.

Download and enable the following Modules:

OpenLayers
OpenLayers Proximity
Chaos tools
Views
Address Field
Geocoder API
Geofield
geoPHP
Libraries

Enable sub-modules:

Geofield Map  7.x-1.0-alpha5
Views UI  7.x-3.0-rc1
OpenLayers UI 7.x-2.0-alpha2
OpenLayers Views  7.x-2.0-alpha2

Go to admin/structure/types/add and create new content type called "Location"
Go to admin/structure/types/manage/location/fields and add the following fields:

Label: Address > Field name: address > Field type: Postal address > Widget: Dynamic address form

Select which available countries you would prefer from the list. Leave blank to allow all of them.
Check off "Address form (country-specific)"

Note: The countries and their associated fields are handled by the Addressfield module. If you do not see your country or if it does not have the appropriate fields you need to file an issue with that module http://drupal.org/project/addressfield (Check to see if there is an issue in the queue about your missing country first before posting)

Label: Geofield > Field name: geofield > Field type: Geofield > Widget: Geocode from another field
Go to admin/structure/types/manage/ol_locator_location/display and change the Default display for Geofield:

Label: Hidden > Format: OpenLayers

Click on gear icon and select the following:

OpenLayers Preset: Geofield Formater Map > Data options: Use full geometry

Go to admin/structure/openlayers/layers/settings and set the following:

Google Maps API version: v3.2

Let's test to see if the Geocoding is working by creating a Test Location

When creating a test content type, make sure you are using a well established address. If Google doesn't know about your address, then neither will your new site.

Go to admin/structure/views/add and create a new view with the following information

View name: Proximity Search > Description: Displays geocoded locations on a dynamic map for users to do proximity searches. > Show: Content of type: Location sorted by: Unsorted > Continue & edit

Add the following fields and keep their default values, except where noted:

Content: Title > Check off Create a label: "Title"
Content: Address (Address)
Content: Geofield (Geofield) > Exclude from display
Proximity: Distance (Distance)

Add the following Filter Criteria to the existing:

Content: Published (Yes) and
Content: Type (= Location)
Proximity: Great-circle (exposed) > Expose this filter to visitors, to allow them to change it > Label: Proximity > add "10" to Value field > Unlock unit of measurement > Unlock location

Header > Global:Text area > Display even if view has no result

"Find a location near you. You can search using your city, province/state or a postal/zip code."

No results behavior > Global: Text area and add the following:

"Sorry, no results found.
1.) Verify the accuracy of your postal/zip code
2.) Check the spelling of your city, province or state
3.) Increase the proximity distance"

Submit button text: Search
Add new display: "OpenLayers Data Overlay"
Format:

Settings >  Apply this openlayers (override) > Map Data Sources: WKT > WKT Field: Geofield > Description Field >  > Apply (this display)

Save the view
Go to admin/structure/openlayers/maps
Clone the default map
General information > Name: location_map . Title: Location Map > Map Description: This is the default location map.
Layer & styles > Overlay layers (select the view we just created) Locations "Enabled" "Activated" Do the same for Placeholder for Geofield Formatter
Behaviours > Pop Up (have to come back and "Select layer to apply popups to." later) > Zoom to Layer "Select layer to zoom to when the map is loaded" > Point Zoom Level : 20 ****
Save the map
Go back to the view we just created

admin/structure/views/view/proximity_search/edit

Add display "Page"

Path: /locator
Format: OpenLayers Map > Apply (this display) > Map: Locations Map (The one we just created in OpenLayers) > Apply

Save the view (We should now see our map in the preview pane at the bottom of our view, with any test content
Add display: "attachment"

Format: Table > Apply (this display)
Attach to: Page
Inherit exposed filters: Yes
Remove the Header > Global: Text area > Apply (this display)
Items to display: Display a specified number of items | 5 items
Inherit pager: Yes
Render pager: Yes

Save View
Behaviours > Pop Up > Layers > proximity_search_openlayers_1 (The views Openlayers map we just created)
Zoom to Layer > Zooms to the extent of a given layer on map loading. > proximity_search_openlayers_1
Return back to admin/structure/types/manage/location/display > click gear icon and change Open Layers Preset to the Location Map that we just created > Update > Save

Voila! Done


You need to use 'rebuild' property of forms here (used in multi-steps form) :

 function skillbar_form($form, &$form_state) {
   if (!empty($form_state['storage']['myvalue'])) {
    drupal_set_message(t("You submitted: @name", array('@name' => $form_state['storage']['myvalue'])));
   }
   $form['skill1'] = array(
    '#type' => 'textfield',
    '#title' => t("What's your skill ?"),
    '#default_value' => variable_get('skill1'),
    '#description' => t("Enter your skill"),
   );
   $form['skill2'] = array(
    '#type' => 'textfield',
    '#title' => t("What's your second skill"),
    '#default_value' => variable_get('skill2'),
    '#description' => t('Enter your second skill'),
   );
   $form['submit_button'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
   );
   return $form;
  }

 function skillbar_form_submit($form, &$form_state) {
  $form_state['rebuild'] = TRUE;
  $form_state['storage']['myvalue'] = $form_state['values']['skill1'];
  $form_state['redirect'] = ANY_URL;
 }


How to do a date countdown (to a future date)?

The Countdown module has a drupal 6 & 7 version. This may work for you. Here is a quote about it (from the module's project page):

Adds a block titled "Countdown" to count the days, hours, minutes, and seconds since or until a specified event. Can configure to just show days, or days and hours, etc.
See also:

jQuery Countdown.
jQuery Countdown Timer.


I think I have the answer. If I use the id selector on this way I can control the specific fields:

[id^="edit-node"] {
    max-width: 100px;
    width: 100%;

Edit:

I was happy to fast, I want to control all of the different edit fields for the first fields it looks great, but for others it does not. The complete id of the first field is id="edit-node-431-field-aantal-und-0-value"
The "431" is a variable but also the "aantal".

The css rule above works for everything that starts with edit-node, but i want to add differente rules for different fields. I have tried to put a * or a ^ in de place of the "431" like this:

[id^="edit-node-*-field-aantal"] {
    max-width: 100px;
    width: 100%;
}

But that does not work. Any ideas?


Custom form: How to implement a module's field widget

In addition to the info posted by @Clive I think it's important to note that this problem can be addressed the other way round[*]: create a node type (or other entity type) with the required fields, and capture the data to process it as you wish when the content is saved.

To do this you would:

Create a custom content type (or other entity type) with the fields you need ;
Implement hook_form_alter to modify your form if you need special features that are not provided by normal content type forms.

From there it depends what you want to do. If you want the content saved (so that it is stored), and want to process the data after it has been saved, then you could implement hook_entity_insert. If you also want to process the data before it is saved, you could add your own submit handler in hook_form_alter as such:

array_unshift($form['actions']['submit']['#submit'], 'my_submit_handler');

If you want the data after it is submitted, but don't want it saved, you could replace the submit handler with your own:

$form['actions']['submit']['#submit'] = array('my_submit_handler');

[*] I realise I'm not answering the question, but I'm offering a solution to the problem :)


Administrator users can add records, end users can view them

here in short all the steps for the simplest solution I can think of:

depending on your content (needed fields...) you may need to create a new contentype (YOURCONTENTTYPE)(maybe using the CCK module (drupal6))
make sure the roles are set correctly (e.g. admin can create and view this content, authenticated only view...) via admin/user/permissions
create a block (node-)view with the views module where you filter by YOURCONTENTTYPE and sort by date
modify the visibility setings of this block via admin/build/block or in the view itself
admin can create content via node/add/YOURCONTENTTYPE

But it really depends on what exactly you want to do.


Is this value stored on the Register Content Type?

You can use the computed_field module.

You will need to read every value in ref_to_course field. Load each of those nodes. From there, read the course_cost and add the values.

Then store the values on the computed field.

Another option is using views module. You can attach a View to the content type. The view can then use the node NID, read the ref_to_course. Add relationship, read the course_cost and add those.

I think the first might be better since you calculate it once.


Roles in Features: Are they always imported in alphabetical order?

Roles being imported in alphabetical order has been my experience, too.

But counting on autoincrement IDs to be consistent between multiple sites is never a good idea.

I recommend, instead of relying on the autoincrement IDs to be generated in a particular order, to avoid using autoincrement IDs.

For Drupal 6 and Drupal 7, the Role Export module turns Role IDs into hashes of machine names, so they're consistent from site to site, regardless of import order.
For Drupal 8, work is in progress to eliminate autoincrement Role IDs altogether.


What is the recommended way for using PHPUnit?

drupal/recommended-project doesn't install PHPUnit, which is instead installed with the drupal/core-dev meta-package. For example, if I wanted to install Drupal 9.0.3, including PHPUnit, I would use the following commands.
composer create-project drupal/recommended-project:^9.0 my-project
cd my-project
composer require 'drupal/core-dev:^9.0'

As said in Starting a Site Using Drupal Composer Project Templates / Adding drupal/core-dev, drupal/core-dev still doesn't depend on drupal/core. Specifying a version of drupal/core-dev is necessary to get a version that matches the Drupal core version you are using.
Also, if you want to install Drush, you need to first install drupal/core-dev and then drush/drush.
As for the PHPUnit version, drupal/core-dev 9.0.3 requires the following packages.

phpspec/prophecy: ^1.7
phpunit/phpunit: ^8.4.1
symfony/phpunit-bridge: ^4.4

Using more recent version for phpunit/phpunit and symfony/phpunit-bridge hasn't been tested, yet.
For Drupal 8.8.0, drupal/core-dev 8.8.0 requires a version of phpunit/phpunit
that matches ^6.5 || ^7, a version of phpspec/prophecy that matches ^1.7, and a version of symfony/phpunit-bridge that matches ^3.4.3.
Even with Drupal 8.8.0, installing PHPUnit after installing Drupal core with drupal/recommended-project requires the same steps I described for Drupal 9.


How do I get Drupal to use my themes page.tpl.php template for the front page?

It is page--front.tpl.php - note the double dashes.

The cascading matches my understanding. page.tpl.php should be called if there are no higher priority page templates. You need devel themer to work this out http://drupal.org/project/devel_themer. It will print out on the screen the template matches.

Details are in the drupal theming guide. in this section:

page--[front|internal/path].tpl.php
base template: page.tpl.php


Try this go on to Configuration > Organic Groups >OG Global permissions and Uncheck the fields that u wish to hide from  non-members ...


Drupal 7 sessions wiped after changing settings.php

This is likely due to the value changing, which changes the way they are recorded:

https://api.drupal.org/api/drupal/includes!bootstrap.inc/function/drupal_settings_initialize/7.x

$base_url and $cookie_domain - changing these values in settings.php will affect any user who was authenticated before if the values change, and will need to re-authenticate.


Just change the setting to "ALL" that should work. Please see the screen below !

Cron will run only if minimum limit is set in the select box see the below code in dblog module.

function dblog_cron() {
  // Cleanup the watchdog table.
  $row_limit = variable_get('dblog_row_limit', 1000);

  // For row limit n, get the wid of the nth row in descending wid order.
  // Counting the most recent n rows avoids issues with wid number sequences,
  // e.g. auto_increment value > 1 or rows deleted directly from the table.
  if ($row_limit > 0) {
    $min_row = db_select('watchdog', 'w')
      ->fields('w', array('wid'))
      ->orderBy('wid', 'DESC')
      ->range($row_limit - 1, 1)
      ->execute()->fetchField();

    // Delete all table entries older than the nth row, if nth row was found.
    if ($min_row) {
      db_delete('watchdog')
        ->condition('wid', $min_row, '<')
        ->execute();
    }
  }
}

If we select value as "ALL" which is 0, Cron won't delete any entries !

For Drupal 6,

You can use Elysia Cron module, to turn off the dblog_cron feature.

Elysia Cron Module tells,

  Turn off (disable) a cron task/feature you don't need.


HTML code to PHP code mapping does not work

You have the smallest of errors in your code; in the very last line you're trying to interpolate a variable into a string using single quotes. You need to use double quotes instead:

drupal_add_js('similetimeline',"$timeline_lib_path/timeline_js/timeline-api.js");

Have a peek at the PHP Strings Documentation for more information.

I've just noticed another problem actually; you don't seem to be using drupal_add_js() properly. The first argument should be the name of a file or an inline string, in which case you should specify that it's inline:

drupal_add_js($timeline_inline_js, 'inline');
drupal_add_js("$timeline_lib_path/timeline_js/timeline-api.js");


How can I show/hide a block on specific taxonomy URLs depending on term depth?

There is another way to answer your question, without PHP in the block settings: you can use the Rules block visibility module for this. Here is a quote from its project page:

  The Rules block visibility module allows Rules components to be used to control block visibility. This provides Drupal administrators and developers extreme flexibility in controlling when blocks should be displayed on their websites, in addition to the default visibility options provided by Drupal.

  The general idea is that if you can do it with Rules, you can use it to control block visibility, so the possibilities are limitless.

  Need to show a block only for users registered more than a month ago?

  Perhaps you have a block that must be shown only between 8am-5pm on weekdays?

  What about displaying or hiding a block based on current weather conditions?

  All of this can be done by using Rules block visibility.

With that, and as per the "if you can do it with Rules, you can use it to control block visibility" above, you've reduced your question to making Rules "check the path of the current page" (so that the appropriate menu block is shown on the appropriate pages).

For an illustration of how to use this module, refer to my answer to "How to show blocks by url, when nodes have multiple paths?". It includes some Rules Components (in Rules export format), which you should replace by the your variations to make it match your specific question.

So with 2 (similar) rules, 1 for each of both blocks, you should be able to get this to work.

To actually "determine the path structure in rules" (as in your extra comment below this answer), you might want to use a Rules Condition using a regular expression. Similar to the Rules Condition in the rule I included in my answer to "How to automatically skip intermediate redirects?".

Using regular expressions opens up many more situations (on top of the Rules block visibility module) where this solution can work. If you're not familiar with Regular Expressions (not obvious ...), then maybe you also want to look at my answer to "How to suppress a core Drupal warning or error message set with drupal_set_message for site users?".

Bonus:

This approach does NOT require the PHP filter to be enabled either (which you should try to avoid whenever possible) ...


I've never been forced to define it before, but here's an attempt at it.

"A variant is a specific response to a request on a Page", in the Page manager. Mostly, using Panels, this involves the rendering of a node or other full page, but not always.

While there are some similarities to "Views displays", unlike Displays, Variants have no inheritance between each other. All variants on any particular Page has the same basic access rules if any, and starts of with whatever context-objects that Page manager derives from the URL, but are not aware of eachother in any way. Based on selection rules, they are evaluated from top to bottom. The first selection rule to return TRUE, gets picked.

A common example is to separate two different content/node-types from each other, allowing you to render them entirely differently. Since each variant may pick its own layout, and place fields/forms/etc in an arbitrary way, the "Article" and "Blog" types may look entirely different. In this case the variants would correspond to node-article.tpl.php and node-blog.tpl.php.

There are various other "Responders" available for Variants that don't involve the use of Panels, such as Contextual administration and plain HTTP Response codes, but I believe this answer is long enough as it is.


How can I quickly re-save all users on my site?

You can use the "Execute arbitrary PHP script" bulk operation in VBO and when you run it enter:

user_save($entity);

You could also run this PHP (you can do so by enabling the devel module and going to devel/php on your site):

set_time_limit(0);
$uids = db_query('SELECT uid FROM {users} WHERE uid != 0')->fetchCol();
$users = user_load_multiple($uids);
foreach ($users as $user) {
  user_save($user);
}

If you don't have many users you shouldn't need the time limit line.

Also, Clive mentions that field_attach_update is faster. To use that replace the user_save line with field_attach_update('user', $user)


some node image missing after node convert batch

Are you migrate your content from D6 to D7? if yes, Then Migrate Fields page is divided into 3 sections:

Available fields

Converted fields

Unavailable fields

you can check the status here. May be it'll helpful to you.


I found a solution instead of related nodes. I am using default node field attached with articles and have cache mapping of other content types with titles and id. And implemented custom code segment encoding which replaces id with title from mapping.


Custom Rules Actions to set content to unpublished

Even though your Rules question could be like an exercise for a training session like "Getting started with Rules in D7", the most recent release of Rules for D8 (= Alfa 3) does not support this yet.

However, as a work-around, you could implement the very same logic if you'd adapt the configuration of your content type X so that the default is that newly created content is published right away.

Note: if your goal is to "let anonymous users access unpublished contents" (as in your comment below this answer), then the view_unpublished module could be a possible alternative. As per its project page: it allows you to grant access for specific user roles to view unpublished nodes of a specific type.


Show a field only once if the value is the same

You might want to use the "Grouping field".

Add your date field to your views.
Click the "Format Settings"

Select your date field in "Group Field".

Tick the "Use rendered output to group rows".
Tick the "Remove tags from rendered output".
Change the date format to "Y".

Save.


I am not sure about what is the question here. In general:

If you want to store content, create a ContentEntityType that extends ContentEntityBase. If you want to create a configuration, create a ConfigEntityType that extends ConfigEntityBase.

What you need sounds like a ContentType where you create your main content by code and have another Form to add/modify the content of a "page description" field in the ContentType. Maybe you can also use "Node" that could save a lot work.


Wanna save text_format custom form in comment

You forgot to add the format:

$comment->comment_body[LANGUAGE_NONE][0]['format'] = $form_state['values']['comment_body'][LANGUAGE_NONE][0]['format'];


You can set it up now but it would be much use until your content is fully indexed by Google


TB Megamenu - How can I reuse a menu with different megamenu configuration?

You can use Superfish module and reuse same main menu . All you need to do is configure super fish menu block with main menu.

Project page says

"Multi-column sub-menus. (Megamenus)
Easing effects with the jQuery Easing plug-in, and many more...."


How to tell if a menu link is route: or not?

Might be able to do a toString and if it's not actually a link that will come back empty

{% if item.below and item.url and item.url.toString|length > 0 %}


How can I use config-set to "unset" the value of a variable?

Use config-delete, not config-set:

drush -y config-delete core.entity_form_display.media.image.default content.field_media_image.settings.crop_types_required

Despite the name, config-delete does not delete any of your config .yml files; it only "deletes" the config inside the database.


Need clarification on adding JS to content item with JS injector and drupal_add_js

1. Like Shrish mention your code needs to be like this

(function($) {
    // your code here
    $(document).ready(function() {
        $("button").click(function() {
            $("p").hide();
        });
    });

})(jQuery);

2. your code says $("button").click(function() { but in your html there is no button:

This is a heading

This is a paragraph.

This is another paragraph.

Click me

So change this to:

This is a heading

This is a paragraph.

This is another paragraph.

<button>Click me</button>

3. Checkmark inline js in JS Injector


How do I get the database value of a text field with $content?

The easiest way is to install and enable Devel module.

  A suite of modules containing fun for module developers and themers
  ...

After that add to your page.tpl.php file this:

<?php dpm($content); ?>

You need to be logged in as administrator and you will see debugger on the page. Find the value you want to print and double-click on it, you will see the exact "path" to the value and just print it as you wrote in your question.


I found that it was because i was using an old version of pressflow it must have had some security problems with the other modules. Updated and things running like a dream :)


Choose multiple products with Commerce product bundle module

It's not possible, I've had to developed my own module to allow to choose the products contained in the bundle.

I created a product reference field in the product, from that set of products the user can choose his bundle.
I created a product reference field in the list_item type, where store which products has selected the user.

My module makes possible to show as I want the products in the product display and add to the cart


How to insert textfield in the table and submit button under the table

implements hook_form in your module and fetch any data you want from database as well as add textfield.
After completion of all form items you can theme it as using

$output = theme('table', array( 'header' => $header,  'rows' => $rows));

in your page callback function.
for more information you can check form api in drupal.org.


How to remove url alias when node is deleted

You can use hook_node_delete:

function hook_node_delete($node){
    // Delete alias.
    $path = path_load(
      array('source' => 'node/'.$node->nid)
    );

    path_delete($path['pid']);
}


How do modules come up with their green, yellow, and red releases?

Many of these standards may be general standards for coding or project development.

In Drupal there is no standard for this. It is left to the best intentions of the module owners.

My personal philosophy is:

Release beta and/or releasecandidate if tested in a testing environment, or if all testcases pass.
Release stable only if I, myself, have successfully implemented the (version of the) module in at least three different real-world projects; or if someone whom I know has my standards, did that and reports back.
A module can be finished. It needs no additional work ever anymore. Something that is limited and scoped in featureset, is stable and predictable. Such modules need no bugfixes, feature-requests or tasks.

In practice, this means very few releases, yet the releases done will affect hardly anyone. That results in hardly ever releasing anything in practice.

My reasoning behind this is:

People in issue-queues hardly test appropriately: they apply a feature, fix or patch, hit f5, see it working and say "yes, works for me +1". "It seems to work" is not equal to "it is fixed". You need trustworthy testing, or else the rest, those who did not even test the change, will flock in with issues reporting something COMPELETELY BORKEND, need fix NOW!!.
Only when a module is implemented in different situations and environments will it have some real-world experience. Most often, during the second implementation you find that you need to rewrite some central api's, forgot some usefull parameter, or simply had a wrong idea about the need for some feature. Only after real-world deployment can something be considered stable. Else it is only stable in theory.
Developers and maintainers of sites, the users of your modules, need to put a huge effort (far more then in any other piece of software I know) in keeping up with new releases, security releases and new versions. any relief for that effort (and budget and time) should be more then welcome.


How to display data from external tables in Drupal without coding?

Have a look at the Forena module. You would use its report writing features (such as its WYSIWYG report writer and/or it's query builder) to first create a report that fits your needs. The result of it could be a tabular output and/or graph. After the report content matches the specifications, you could save it as (e.g.) a CSV file.

Samples

Refer to this online example in the Forena demo site for a report you could (easily) create:

Using Forena's Query builder you would create the required SQL statement (if you'd rather want to write the SQL with your favorite SQL editor that's another option).
Using forena's WYSIWYG report writer you would develop your custom report (if you'd rather want to write that report with your favorite XHTML editor that's another option).

Some more details about the sample report mentioned above:

Use the "Parameters" pulldown option, to select any other state.
Note the PDF hyperlink: using that link, you'll get a PDF version of that report. When creating such report, you could as well ask for other (or additional) report export formats, one of them is CSV (or XLS, DOC, HTML, ...). This is how the CSV equivalent version of that sample report looks like.

The Master Summary with drill down sample report demonstrates how you can also "link" various reports together (while it also shows some of the charting features of Forena). Click on either any of those bars in the chart, or on the total-hyperlink in tabular report below the chart. Doing so will bring you to the report "for the selected state" (= the first sample report mentioned above).

Direct access to data blocks

All data blocks are accessible directly via their url also, provided you have permission to access that block. Here are a few samples of that, for the sample report located at /reports/sample.states:

in XML format (= demo with anonymous access).
in JSON format (= demo with anonymous access).
in XML format (= demo without anonymous access).
in JSON format (= demo without anonymous access).

Video tutorials

The Forena Video demos and tutorials contain quite some links to live demos. They should help a lot to get you started.

Disclosure: I'm a co-maintainer of Forena.


How to acess API rest/views using token or login?

First of all, does your endpoint require authentication to begin with?
If yes, then use this https://www.drupal.org/docs/8/core/modules/rest/3-post-for-creating-content-entities as a guide though it is for a POST request.

UPDATE
You need to know which authentication method are you using, e.g. basic_auth, cookie, Oauth, etc?
According to the method, you should formulate your request. The use of X-CSRF-Token is for Cookie Authentication.
It might be in your case that you successfully got the token, but you're using it on an endpoint which requires Basic Auth.
As I see in your posted REST configuration, you're actually using Basic Auth, thus your request should look something like this:

curl --request GET \
  --url http://example.com/entity/view/{view} \
  --header 'authorization: Basic HASH_HERE' \
  --header 'content-type: application/json' \


Redisplay Captcha on form error in Ajax form submit

If user can submit the form when there is no captcha after errors, it's by design. In captcha settings you checked an option to only verify humanity of an user once. User gets validated as a human on first, failed submit, and is not bothered any more on that form. Go to captcha settings and make him validate each and every time and it will not disappear, but your users will not love you.


As far as I can see, the REST UI module is just thought to change the content of the YAML files for the REST resources. It is up to the module correctly define the URL to use.

In your case, the annotation of the class should contains:

 uri_paths = {
   "canonical" = "/videos/feed/{site}",
   "https://www.drupal.org/link-relations/create" = "/videos/feed"
 }

I am not sure the placeholder makes any difference, but all the examples use {id}.


Where is the logic located which determines the tpl file for the front page?

please review in /includes/theme.inc near to the line if (drupal_is_front_page()) {...

if (drupal_is_front_page()) {
    $suggestions[] = 'custom-page-front-name-here';
  }

I changed the $suggestions[] value, and I saw that .tpl.php name to the front page can be customized.

According the comment of nmc,

  this file/code should not be modified as it is part of Drupal core

. this is only to locate where can be stablished the value.


I've done with hook_views_query_alter().

function mymodule_views_api() { // your module name into hook_views_api
    return array(
        'api' => 3,
        // might not need the line below, but in any case, the last arg is the name of your module
        'path' => drupal_get_path('module', 'mymodule'),
    );
}

function mymodule_views_query_alter(&$view, &$query){
    global $user;
    switch($view->name){
        case 'my_view_name' :
            if(!in_array('administrator', $user->roles) || array_key_exists(4, $user->roles)){
                $result = db_query('my_query_here');
                $nodes = array();
                foreach($result as $row){
                    $nodes[] = $row->entity_id;
                }
                $query->where[0]['conditions'][] = array(
                    'field' => 'node.nid',
                    'value' => $nodes,
                    'operator' => 'in'
                );
            }
            break;
}


Get all enabled viewmodes of a entity/bundle

What @googletorp said is correct. But there is a concept of "enabled" view modes, just not like you're apparently expecting.

Enabled view modes are view displays. Enabling a view mode for a given bundle creates a view display which then stores the formatter configuration.

Same for form modes and form displays.

And I think \Drupal\Core\Entity\EntityDisplayRepository::getViewModeOptionsByBundle() will kind of give you what you're looking for. The view modes for which the given bundle has a view display.


Hierarchy taxonomy terms for node path in drupal 7

The following solution works for me:

[node:field-yourfield:parents:join:/]/[node:title]

where yourfield stands for the name of your reference field.

Then you have to go into Configuration » Search and metadata » URL aliases Settings and under Punctuation change Slash to Do nothing, so it's not stripped from the alias.


add a new field in a view that uses a teaser view mode fomat

Seeing that you are using Display Suite, you should add the field via Display Suite as node.tpl.php is no longer being used. Display Suite has 4 Custom fields that you can add via the interface. You should look into the 'preprocess field'.

You need to define a preprocess field in Display Suite

and the machine name of the preprocess field

should correspond with the name of the field that you provide in your preprocess_node function:

function MYMODULE_preprocess_node(&$vars) {
  $vars['my_new_field'] = "some html or rendered field";
}

You are of course not limited to creating your field value in the preprocess_node function, you could just hand the value over like this:

function custom_preprocess_node(&$vars) {
  $vars['my_new_field'] = drupal_render($vars['content']['get_reward_link']);
}

The only limitation (AFAIK) is that you have to render the field before you let Display
Suite pick it up.

Once you have defined your preprocess field like this, Display Suite will make it available in the manage display tab for the node type.

Also look at Theming with Display Suite and Preprocess Functions


How do I autoload a class with the X Autoload module?

If your file-system is case-sensitive, so is PSR-0. Try changing your class filename to

  MY-SITE/sites/all/modules/foo/lib/Drupal/foo/Pet.php

And make sure you're namespacing your class correctly, e.g.

namespace Drupal\foo;

class Pet {
  ...
}

Lastly, make sure you're referencing the class correctly in your module file. Either

// Top of file.
use Drupal\foo\Pet;

// In a hook or whatever
$dog = Pet::dog();

or

// In a hook
$dog = \Drupal\foo\Pet::dog();


Show Block only if it's a front page and GET variable is set

You missed a closing bracket. Try this:

<?php
if (drupal_is_front_page() && !empty($_GET['listed'])) {
  return TRUE;
}
?>

or

<?php
if (drupal_is_front_page() && isset($_GET['listed'])) {
  return TRUE;
}
?>


what happen if i have the same route as path alias?


field_view_value() with product reference field doesn't display attributes

Instead of using field_get_items/field_view_value try field_view_field.

$product_display = node_load($nid);
$add_to_cart = field_view_field('node', $product_display, 'field_product');
$add_to_cart['#label_display'] = 'hidden';
$cart = drupal_render($add_to_cart);


How to find out if an entity type is provided by core or a contrib/custom module?

You can make use of module handler to get path to extension info file.

/**
 * Implements hook_entity_type_alter().
 */
function example_entity_type_alter(array &$entity_types) {
  $module_handler = \Drupal::moduleHandler();
  foreach ($entity_types as $entity_type => $entity_type_info) {
    $provider = $entity_types['block']->getProvider();
    $module = $module_handler->getModule($provider);
    $info_file = $module->getPathname();
    drupal_set_message("$entity_type ---> $provider ($info_file)");
  }
}


How do you delete a content type's URL aliases in bulk?

I'd do it as an SQL query. Run as a SELECT first, to verify that all is well:

 SELECT alias FROM node n JOIN url_alias u ON CONCAT('node/', n.nid) =
 u.source WHERE n.type='my_type'

then edit it to make it a DELETE:

 DELETE u  FROM node n JOIN url_alias u ON CONCAT('node/', n.nid) =
 u.source WHERE n.type='my_type'


Looks like you're having a block of node teasers, and you want to initialize a slick slider on its items using vanilla JS, yes? There's a better way to do this, and that's to use the Slick module together with Slick Views.

Create a slick carousel view, configure it as a block and not a page.
Filter to the desired nodes
Configure to render the teaser displays
Configure the slider parameters.
On whatever block rendering mechanism you have (Block Layout, Context, Panels, whatever), position the view in the desired location.

All that and you never have to touch code or meddle with the template.


Date field as dynamic source for contextual filter

Use hook_views_query_alter to alter query filter based on current node id or created date of node and put limit 2.

Where clause will be Like:

nid > current_nid
created date > current node created date (this may create issue if we have imported node in bulk)

Also we can do it from contextual filter as well just add contextual filter for current node id, greater than current node id.


Media player for Drupal 7 that can play remote http-accessible files

If this were me; I'd be using a media-compatible media player (such as MediaElement with the 2.x branch of Media) and using remote stream wrapper to allow me to place the remote URL into the media field: https://drupal.org/project/remote_stream_wrapper

This should let you use local media or remote media that the media player can play, and will keep things tidy for you to manage.

/Robin


you need to add a validation to your form via

    $form['#validate'][] = 'yourFunction';

  function yourFunction($form, &$form_state) {
        //to show the form values
        dpm($form_state);
        //do validation
  }


Add this code inside Drupal.behaviors.

$('.views-exposed-form APPLY_BUTTON ID/class').click(function() {
  // Submit the form
  (this).parents('form').submit();
});

Hope it works.


Is it possible to build a complete web site with Drupal 7 without using contributed modules or Hooks?

It depends on the site's requirements. If you want to create a site only for content listing, you can simply change in template files to make it as per design. But you must keep your theme in sites/all/themes directory.

But generally the requirements are not so simple. The modules are contributed to make the better user experience. If you are asking this question for the better performance of site, then you should maintain your site with drupal standard.

The things to keep in mind :

Use contributed module rather than writing custom module.
In some case if you have to write custom module, then use drupal functions and API rather than core PHP functions.
Always keep your site (drupal/modules) updated with security releases.


When using a view in "Unformatted list" format with inline fields, how can I most cleanly add a break between the fields?

I would say CSS is the better route because it separates your content from your layout just as CSS does with respect to HTML.  Also, if you decide to change your layout later on, CSS will most probably be easier (and more obvious) to change than some fake data in a view forcing that is forcing/hardcoding your layout.


how to set minimum quantity of products in the shopping cart?

You could try using the Commerce Minimum Order Quantity and Increment sandbox module.

  The module allow you set minimum order quantity and an order quantity
  increment. This quantity is for the entire order not each product line
  item. Your shoppers will not be able to check out until their order
  quantiy reaches the minimum and/or meets the increment.

  Download this module and install it. Go to admin/commerce/config/moqi
  to config.

Source: Twitter


How can I print node author's last login date on page.tpl.php?

It would be better to put this logic in an preprocess function rather than directly in the template file, but the code would probably be something like this:

if ($node = menu_get_object()) {
  $author = user_load($node->uid);
  $last_login = $author->login;
}


Getting nodes based on what the user has in their profile

One of the possible solution can be

Create a view to show the nodes with contextual filters as
taxonomy,remember to allow multiple taxonomy terms may be separated
by '+' in the contextual filters.

Create a custom menu item in your custom module and in the page callback of which grab the taxonomy terms in the global user object
and call the above created view programmatically.

Here is a snippet showing how you can call your view programmatically
with contextual filters.
views_embed_view("your_view_name", "your_view_dsiplay", $taxonomy_terms_+_separated)

See the following screenshots.
In my test installation, I created the following taxonomy terms:  test1,test2,test3,and test4. I created 4 nodes too, each of them using one of those taxonomy terms (node1 => test1, node2 => test2, etc.).
The following is the screenshot of a view page showing the nodes using the taxonomy IDs passed as contextual filters.

These are the screenshots of the view configuration for those for contextual filters.


Display another field as 'Node author' if node posted anonymously

You have two viable options:

In theme system, use either node.tpl.php file to do it, or probably better template_preprocess_node(&$variables). I'll discuss function as that's what I prefer. When using function, copy it to your own template.php, renaming to mytheme_preprocess_node(&$variables). As a source, use parent theme if it implements it. If not, or if there is no parent theme, use link I provided above.

Then find a line like this:

$variables['node'] = $variables['elements']['#node'];

and after it modify $variables['node'] as you see fit.
Use Computed Field to create a field that shows author's name, and in case of anonymous authors displays arbitrary text. Turn off displaying author and use this field instead.


How to add registry key verification step with the key being stored in another database

What you want is quite doable on Drupal, however if you just started learning Drupal then I am afraid you need to find an experienced developer, who could write up a custom module using the hook_field_validate().


How to show messages starting with "Debug : " to an administrator only?

Option 1: Use the Disable Messages module

Use the Disable Messages module for this. Here is a quote from its project page:

  Gives a site owner options to disable specific messages shown to end users. The core drupal message system as offered by drupal_set_message is an excellent way for modules to send out messages to the end users. However not all drupal site owners are keen to show all the messages sent out by drupal core and all modules to their users. This module gives site administrators a reasonably powerful way to filter out messages shown to the end users.

Some of its features are:

  Filter out messages that match a full text string exactly.
  Filter out messages that match a regular expression.
  Permissions to specifically hide all messages of a given type from any role.
  Disable all filtering for specific users.
  Disable all filtering for specific paths.
  Apply filtering only for specific paths.
  Debug system to get messages in the HTML without showing it to the end users.

Available for either Drupal 6 or Drupal 7 (and a DEV version for Drupal 8).

Option 2: Write your custom code

Use a variation of the approach as explained on Hook into and Preprocess Drupal Messages? Here is a quote from it:

  The following example hides all error/warning messages from anonymous users and user's who don't have the 'administer nodes' permission. You can easily add your own conditions to filter out which message types should be displayed to who.

function mytheme_status_messages ($display = NULL) {

  $output = '';
  foreach (drupal_get_messages($display) as $type => $messages) {

    // skip all error/warning messages for anonymous users
    if (!user_is_logged_in() && ($type == "error" || $type == "warning")) { continue; }

    // skip error/warning messages for users who don't have the 'administer nodes' permission
    else if (!user_access('administer nodes') && ($type == "error" || $type == "warning")) { continue; }

    ...


How to access link fields (url and text) value separately in views template?

The Easy way in Views UI add field_link 2 times.

in 1) Exclude from display, Select url only, and Show url as plain text.
which will give you the url only.

in 2) Exclude from display, and REWRITE RESULTS -> Strip HTML tags
which will give you the  title only.

Then in a custom field you can use twig  URL: {{ field_link }} Url Title: {{ field_link_1 }}

then in your custom template you can use them ...

Option 2) almost as easy create a custom field formatter based on
Drupal\link\Plugin\Field\FieldFormatter\LinkSeparateFormatter.php


hook_node_access() returning NODE_ACCESS_DENY is ignored

There is an error in the code you are showing: A variable is initialized inside a if() statement, but it is used outside that statement. $current_uid is initialized from the following code.

  if (is_array($account->roles) && in_array('vip', $account->roles)) {
    $current_uid  = $account->uid;
  }

It is then used from the following code.

  // If the node owner is the same as the current user, allow to view the node
  if ($current_uid == $node_owner) {
    return NODE_ACCESS_ALLOW;
  }

That code only works if the account object passed to the hook has the vip role, or if the node has been created from the anonymous user (the one whose ID is 0). Differently, $current_uid will be NULL.

Also, the code I show in the second snippet is not doing what the comment says. It is not allowing the current user to view the node if the node was created by that user: It is allowing that user to view, edit, update, and delete the node. The only operation that code is not allowing is creating a node of that content type, since in that case Drupal would pass the content type string in $node and the code is checking $node is an object.

To achieve what the comment is describing, the correct code is the following one.

  if ($current_uid == $node_owner && $op == 'view') {
    return NODE_ACCESS_ALLOW;
  }

I would use the following code, but see the notes after the code.

function mymodule_node_access($node, $op, $account) {
  $type = is_string($node) ? $node : $node->type;
  if (is_object($node)) {
    if ($type == 'my_content_type') {
      $current_uid = $account->uid;
      $node_owner = $node->uid;
      if (is_array($account->roles)) {
        if (!in_array('vip', $account->roles) && !in_array('administrator', $account->roles)) {
          return NODE_ACCESS_DENY;
        }
        elseif (in_array('administrator', $account->roles)) {
          return NODE_ACCESS_ALLOW;
        }
      }
      else {
        return NODE_ACCESS_IGNORE;
      }

      if ($current_uid == $node_owner && $op == 'view') {
        return NODE_ACCESS_ALLOW;
      }

      $node_owner_profile = user_load($node_owner);
      if (isset($node_owner_profile->field_parent[LANGUAGE_NONE][0]['value'])) {
        if ($node_owner_profile->field_parent[LANGUAGE_NONE][0]['value'] == $current_uid) {
          return NODE_ACCESS_ALLOW;
        } else {
          return NODE_ACCESS_DENY;
        }
      } else {
        return NODE_ACCESS_DENY;
      }
    }
  }

  return NODE_ACCESS_IGNORE;
}

Keep in mind the following notes reported in the documentation for hook_node_access(), especially the second one.

  Note that not all modules will want to influence access on all node types. If your module does not want to actively grant or block access, return NODE_ACCESS_IGNORE or simply return nothing. Blindly returning FALSE will break other node access modules.

  Also note that this function isn't called for node listings (e.g., RSS feeds, the default home page at path 'node', a recent content block, etc.) See Node access rights for a full explanation.

Keep also in mind that for users with the bypass node access permission, none of the hook_node_access() implementations are invoked. If the tests are done with accounts having that permission, that would explain why the user is able to act on the nodes even if the code is not giving the permission.

Instead of checking the roles of the user account, I would rather check if the user has a specific permission. hook_node_access() implementations are allowed to use user_permission().


How to add a percentage column to drupal views?

Use php_view module to add column to calculate the percentage

$field_one = 50;
$field_two = 350;

$new_column = ($field_one / 100) * $field_two;


Connecting views to another Drupal database

Have a look at this module, it can do the job for you.

https://www.drupal.org/project/web_widgets


Change Boolean field status on clicking submit button

I would do it.

function my_custom_submit_function($form, &$form_state)
{
    //if value is 1, then value=0
    if ($form_state['values']['field_test_button']['und'][0]['value']==1) {
        $form_state['values']['field_test_button']['und'][0]['value']=0;
    }
    else
        //if value is 0, then value=1
        if ($form_state['values']['field_test_button']['und'][0]['value']==0) {
            $form_state['values']['field_test_button']['und'][0]['value']=1;
        }
    //$form_state['values']['field_test_button']['und'][0]['value']=1;
    db_query("UPDATE {field_data_field_test_button} SET field_test_button_value = :val WHERE entity_id = :eid",
             array(':val' => $form_state['values']['field_test_button']['und'][0]['value'], ':eid' => $form_state['values']['tid']));
    drupal_set_message(t('Your form has been archieved.'));
}


Adding quantity to a Commerce product's attribute

Use the Commerce Add to Cart Extras module. It provides a new product reference field display formatter that does exactly what you need.


Drupal contains a published/unpublished feature by default, which can be filtered in views using the Content: Published filter.

If you want to use a custom field though it should be as simple as you described. Assuming the published field is a taxonomy reference, you should be able to apply a filter to that field and select 'is one of' and the appropriate term (published). I tried this and it works.

As for the second part, you can clone the view and change the field filter to unpublished. Then add a Content: Author relationship and a User: Current (Yes) filter to filter it to content that the current user has authored (you might also want to put some access restrictions on this view). This view can then be added to the 'Footer' section of the first view.


How to use the gallery formatter settings in a display suite code field?

May I suggest field slideshow if you havent tried that already.  Field Slideshow

  Provides a Slideshow formatter for Image fields, using JQuery Cycle
  plugin.

  Compared to Views slideshows, building the slideshow from multiple
  nodes, this module builds it from a single node, with a multi-valued
  Image/Media/Field Collection field.


Add a field programmatically to a custom entity

You'll need to define a field and an field instance in your module's .install file. The function can either be in hook_enable() or hook_install(). The field will provide the name of the field and some default settings. The field instance can be seen  as the link between the field and the entity you want to place the field on.

The format of the settings differs per field type (a text field has a maximum length, an entity reference field can define the selectable bundle(s), etc). Often the available settings are explained in the module's hook_field_info implementation. For core fields these can be found on the following page: 7 functions implement hook_field_info().
For non-core fields the settings are likely to be explained in the hook_field_info implementation as well, for example entityreference_field_info().

The process Drupal follows when registering a field is as follows:

The field is registered in the field api first, with it's default settings (the settings as defined in hook_field_info()). But your module can override them in the settings array of your field_create_field function. So that the field with your name will have by default your settings. Other values such as cardinality (how many values can the field hold) and translatability can be defined as well. See the detailed information on field_create_field() for all values.

From there the field is attached to the entity and it's bundle by means of a field instance. This instance defines which field should be attached to which entity and bundle. Here the settings can be overridden once more for this specific fields implementation on this specific entity. You can also select the widget here; the way the field is to be selected. Modules define their widgets in hook_field_widget_info(), available widgets for core fields can be found here: 7 functions implement hook_field_widget_info(). For a textfield you would use the widget text_textfield, for an image you can use image_image, for a non-core module you'll need to lookup the available widgets yourself in the hook_field_widget_info() implementation.
For a full lis tof all properties you can set on field instances, see field_create_instance().

Image field example

function mymodule_enable() {
  // Check if our field is not already created.
  if (!field_info_field('my_image')) {
    $field = array(
      'field_name' => 'my_image',
      'type' => 'image',
      'locked' => TRUE, // Settings can not be changed
      'settings' => array(
        'no_ui' => TRUE, // Field is not visible in field UI and can only be instantiated programmatically.
      ),
    );
    field_create_field($field);

    // Create the instance on the bundle.
    $instance = array(
      'field_name' => 'my_image',
      'entity_type' => 'my_entity',
      'bundle' => 'my_entity_bundle', // If your entity does not have bundles, this is the same as the entity type.
      'label' => 'Featured image',
      'required' => TRUE, // Field must have a value.
      'widget' => array(
        'type' => 'image_image',
      ),
    );
    field_create_instance($instance);
  }
}

Entity reference example

function mymodule_enable() {

  // Create an entityreference field.
  $field = array(
    'field_name' => 'my_entityreference',
    'type' => 'entityreference',
    'settings' => array(
      'target_type' => 'my_other_entitytype',
    ),
    'cardinality' => 1, // Field may only have one value.
    'translatable' => FALSE,
  );
  field_create_field($field);

  $instance = array(
    'field_name' => 'my_entityreference',
    'entity_type' => 'my_entitytype',
    'bundle' => 'my_entitytype_bundle',
    'label' => 'Reference to my_other_entitytype',
    'required' => TRUE,
    'widget' => array(
      'type' => 'options_select',
    ),
  );
  field_create_instance($instance);
}


How to override Drupal.ajax.prototype.beforeSend?

This might be a better way:

(function ($) {
  // Drupal's core beforeSend function
  var beforeSend = Drupal.ajax.prototype.beforeSend;
  // Add a trigger when beforeSend fires.
  Drupal.ajax.prototype.beforeSend = function(xmlhttprequest, options) {
    beforeSend.call(this, xmlhttprequest, options);
    $(document).trigger('beforeSend');
  }
})(jQuery);

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


Don't confuse fruits/apple with fruits/apples. Drupal will not allow you to create menu entries for paths whose Views Contextual Filter argument does not validate.


If you haven't already, look at the theme information in the Advanced section on your Views admin page. It's near the bottom.

You should see a list of theme templates for each field, along with a row style that should have information for each row. Each field is also linked to a sample template, and you will also notice the list of file names the view is searching for, from general to specific. I've attached an example of what it looks like.

Looking at my own now... You might also want to try the "style output," though in my case I did everything through the field content template.

Edited to add:

I don't have enough reputation to comment yet, but it looks like there is some useful info on How do I access a field value in the $row variable in a field view theme template?

Simply out, here are the two approaches from over there:

$field = $row->{$field->field_alias}
$rendered_field = $view->render_field($fieldname, $view->row_index);


How limit access to a paragraph type by role, like it is for content types?

Simply enable the Paragraphs sub-module Paragraphs Type Permissions. It provides CRUD permissions per Paragraphs Type.

http://cgit.drupalcode.org/paragraphs/tree/modules/paragraphs_type_permissions/paragraphs_type_permissions.info.yml?h=8.x-1.x

  Allows users to configure permissions for individual Paragraphs
  types.


Unclickable Menu link keeps refreshing my page

Ok, i've solved the problem for now. I've just typed ## in "CATEGORIES" link instead of one #. Now when i click on CATEGORIES, the page is not refreshing and a drop down menu appears.


Really really need help debugging this dpm(). It's an error from trying to create a new Message | Fixed by reinstalling Reply module

Exception EntityMalformedException is triggered, because (as you mentioned) your $entity is empty, and based on $info['entity keys']['bundle'] Entity module expects to have $entity->type property, but it doesn't exist.

You should check the backtrace and find which module is responsible for this invalid call, e.g. by adding this line instead of dpm:

var_dump(debug_backtrace()); exit; // Show the backtrace and exit.

in order to identify and fix the broken code. The most relevant part from the backtrace is function which is called, so starting from the top [0]=>, then [1]=>, so once you find the custom code or contrib module responsible for this exception. If there is no custom module apart of messages module, you should report this bug to the maintainer of this module.

Here is the related bug: Fatal errors when content types are deleted before messages are.

For further explanation, check: How to debug EntityMalformedException?


Filter strong and b from content through views

I assume you are using "show teasers option" for rows if yes switch to fields option.

Once you are using the fields add body field and add "Trim this field" then you could either click field may contain html, which will close the html tags before cut-off or you could pick strip html all together...


Drupal Commerce Paypal WPP Programatically Create a Transaction

I was able to solve this issue.  Instead of retyping it, the answer can be found on drupal.org at this link: https://drupal.org/node/1867768#comment-8755925


How do I redirect a taxonomy menu item to another path?

If I understand you want to implement hook_menu_alter() and override the page callback for that path:

function MYMODULE_menu_alter(&$items) {
  $items['taxonomy/term/%taxonomy_term']['page callback'] = 'MYMODULE_taxonomy_page_callback';
}

function MYMODULE_taxonomy_page_callback($term) {
  // Either redirect the page
  drupal_goto('somewhere');

  // Or build up some output to replace the original taxonomy term page.
  // This way you won't actually have to do a redirect at all
}

If I can offer a bit of advice, keep this callback function in your module file so it's always included. Otherwise you'll need to change the file property of the menu item too and that can get quite messy as Drupal is expecting the file to exist in the path that the defining module is in (in this case the taxonomy module).


Dashboard like module that works with Panels

Dashboardify

  Dashboardify is a module for creating complex dashboards.

  Each user with proper permissions can add any block to dashboard and
  rearrange blocks order on his or her dashboard page. There is one
  dashboard with predefined regions available for each user. User can
  add unlimited instances of the same block which can be useful for
  views blocks with different contextual filters applied. Along with
  block information module stores data what contextual filters were used
  while adding block to dashboard. Block order is autosave via AJAX.

Panel Dashboard

  Allows users to locally rearrange and roll up panes on the panel and
  save the state per account. Global state of the panel is not modified
  in the process.

Total Control Admin Dashboard

  The Total Control Admin Dashboard creates a default panel page with
  useful administration tools. Its purpose is to create a central
  location from which a Drupal site can be properly cared for. Several
  overview panes are included for site stats and quick reference.
  Several administration panes are provided with quick links to content
  types, menus, taxonomy, and other scattered locations of important
  Drupal site administration. Several views panes are also provided as
  well as full-page comprehensive versions of the views with bulk
  operations. Each views panel pane is customizable via it's pane
  settings, or override the default views provided to suit your own
  needs.


how can I install Drupal 7 with PHP 5.2 on a Windows Server 2003 machine with IIS 6.0 and SQL server 2000 running on it?

I am not sure why you are using SQL2000 in 2014 because it is not supported anymore.
I have successfully connected to SQL 2008 version using SQLSRV module in Drupal.

I would do the following in this case:

Make sure TCP\IP protocol is enabled and it is listening on some port which is not getting blocked by firewall.
I would try connecting to the database server using IP address and port using enterprise manager first.
I would look in my SQL error logs because it records the authentication failures there.

Please share what you observe.

Thanks
C


ok let us try this ,,, maybe help

1- add new image field to your content type (background field)

2- open node.tpl.php in your theme

3- test if this node from this content type ,, then get the value of the background field image

4- do some thing to make this image url as a background

do the same with a little bit different for the styles :)

For Specific URL (this way maybe not professional):

1- create new content type (Backgrounds) with two fileds (URL + Image)

2- open page.tpl.php and write some php code can test if the current URL exists in any node from content type (Backgrounds)

3- if yes => get the image field and make it as background


Web forms senders to make their email secure

You can use the SMTP Authentication Support which allows you to send your e-mail via port 587 (TLS), which means your e-mail gets encrypted.


Making content and functions maintainable in the long run

I'm not quite sure what you mean.

Block content can be held in the DB. .tpl.php files are as the name suggests used for templates. E.g. block.tpl.php is the template for all blocks.

If you have 2 distinct type of template for blocks then you could certainly create a block-alternate.tpl.php but there is certainly no need to create specific templates per block.

If you want to alter user input then add fields to your custom content types, or maybe look at the Webform module.


Relevant for PHPStorm 10:

Disable the Force break at the first line when a script is outside the project setting. This is accessible under Settings:

  Languages & Frameworks > PHP > Debug > Xdebug

I also disable Force break at the first line when no path mappings specified.


Showing only one feed from different URLs

Your best option is to create an attachment display for each feed which selects just the most recent feed and combine them into a block display.


What is the best way to extend \Drupal\node\Entity\Node?

You shouldn't extend Node but rather \Drupal\Core\Entity\ContentEntityBase or \Drupal\Core\Config\Entity\ConfigEntityBase.


You say "i have entity and class TestEntityRouteProvider extends AdminHtmlRouteProvider implements EntityRouteProviderInterface. Normally you don't rewrite all of the route generating code when extending an entity route provider, you only modify some of the routes, rarely the whole set of routes in getRoutes(). But always execute the parent method first. See this example from a core entity type:

<?php

namespace Drupal\aggregator;

use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Entity\Routing\AdminHtmlRouteProvider;

/**
 * Provides HTML routes for the feed entity type.
 */
class FeedHtmlRouteProvider extends AdminHtmlRouteProvider {

  /**
   * {@inheritdoc}
   */
  protected function getCanonicalRoute(EntityTypeInterface $entity_type) {
    $route = parent::getCanonicalRoute($entity_type);
    $route->setDefault('_title_controller', '\Drupal\aggregator\Controller\AggregatorController::feedTitle');

    return $route;
  }

  /**
   * {@inheritdoc}
   */
  protected function getEditFormRoute(EntityTypeInterface $entity_type) {
    $route = parent::getEditFormRoute($entity_type);

    $route->setDefault('_title', 'Configure');

    return $route;
  }

}

Or if you don't need to modify anything you simply use the standard class for the administration of entity types

  *     "route_provider" = {
  *       "html" = "Drupal\Core\Entity\Routing\AdminHtmlRouteProvider",

in the entity type annotations. Is it working then?