How to show views block output in drupal menu?

If you are trying to build a dropdown menu, you can have a look at Nice Menus. This module provides blocks that automatically generates dropdown menus from a selected menu.

If you want to build something more particular than a basic dropdown menu based on Drupal menu system, you should add your block to a hidden region in your html and then move it in the DOM with jquery.

You can do something like that:

// Get menu item
menu = jQuery('#selector .to li');

// Get block
block = jQuery('#block-block-myblock');

// Force hide
block.hide();

// Append the block to the menu item
block.appendTo(menu);

// Show / hide menu on hover
menu.hover(function(){ // Function to be run on mouse hover
  block.fadeIn();
}, function(){ // Function to be run on mouse out
  block.fadeOut();
});

Hope this will help you !
Cheers


How are entities and libraries for the Apache Solr server organized?

Iv updated solr to 3.6 version, it has integrated support for spatial search.


How do I skip importing a duplicate item?

I have a hard time parsing your question. This is what I think you want:

If the source item has a title that already exists on the website, don't import this item.
If the source item has a title that does not exist on the website, import as a new item.

So if above are your only requirements, it would imply that you don't need to update existing content. In this case, the solution is:

On the processor settings, set "Update existing" to "Do not update existing".
On the mapping page, only set "Title" as unique.

From your story though, I sense that there might be more going on than just the above scenario, but I'm not exactly sure what it is.


What may cause the text of a message created with the Message module to be empty?

This is a rather typical issue in multi-language sites. A variation (not duplicate) of your question is what is described in "Rules - Set language of message notification".

A possible solution (work-around?) is what you wrote in your own comment below your question, i.e.:

  I checked Message class, and it turns out that I have a wrong language code, 'cause I set administer language to English other than default language. It works now after I set language back to default.

Another solution is to indicate the language in which the message is to be created.


Views: Display the value of multiple value field as a separate column/field?

In order to display the value of a field differently.

In the view, click on that particular field listed under FIELDS section. In the window that is opened select MULTIPLE FIELD SETTINGS then from there change DISPLAY TYPE to one of existing or Simple Seperator and provide * html break line br * as value of Simple Seperator.

Alternative approach:

Under FORMAT -> SHOW select Content not Fields and choose the View Mode as Full Content then by default, all the values are displayed one per column.

If you want further editing then consider reading about

Delta
Module to allow adding PHP Code so you can iterate through values
Override a template
Preprocess function for that particular field.


Sending variable from php to js file not working

You shouldn't set the values in the submit hook, you should use hook_init().

In the submit hook you should set a variable ( variable_set("name", "value") ) and read it in the hook_init using variable_get("name", "dafault_value");

On the other hand, you should NEVER add the password in js variables. It's a huge security risk.


What @Kantu already said. Take a look at this tutorial: Panels 3: Creating a new front page with Views and Panels 3.


How can I make views exposed filter case-sensitive?

For the solution I used the hook_views_query_alter and used the LIKE BINARY operator in my condition.
condition('node_field_data.title', "%{$word}%", 'LIKE BINARY')


Your order seems correct, you need to instanciate a new TrustedRedirectResponse object like:

$response = new TrustedRedirectResponse($url_string);


Based on the markup on your test page reflecting an html5  element and the code snippet calling for a "picture_sizes_formatter", I suspect your site has the Picture and Breakpoints module) installed which automatically serve images based on predefined/configured breakpoints.

Go to the Picture Mappings configuration page Config >
 Media > Picture Mappings (/admin/config/media/picture) to examine existing mappings and add new ones.

You should be able to add a new picture mapping for a wider breakpoint to serve the original image, thus limiting serving the large image to a narrower desktop viewport.

Once you've added an additional mapping (and possibly a wide breakpoint), don't forget to clear the caches before reloading your test page.


How can I make SMTP plugin work with multiple languages?

The problem is that the parameters are not translatable. In my case it has been solved by overriding the values of the port and protocol variables in settings.php.

$config['smtp.settings']['smtp_port'] = '587';
$config['smtp.settings']['smtp_protocol'] = 'tls';


Anonymous users email subscriptions to node updates

You could try the MailChimp Subscriptions module. It won't let you subscribe to individual pages, but instead to node authors. (Never tested that)

Another way, might be to use the Simple Subscriptions module and to write some custom code to achieve exactly what you want.


views and contextual filter with entity reference to current user

Was able to get it working using the following code, it does however only allow for one retail location, which is all I need for this scenario.

  global $user;
  $query = new EntityFieldQuery;
  $query->entityCondition('entity_type', 'node')
      ->entityCondition('bundle', 'rnm_principal')
      ->fieldCondition('field_principal_retailer', 'target_id', array($user->uid));
  $results = $query->execute();
  return current($results['node'])->nid;


Checkboxes in exposed form in block aren't checked in initial state

To do so you might have to checkboxes when you expose the form and save the view.


Upgrade from D6 cause unability to edit existing node

If there was changes in the fields you were using in the very nodes, that renders nodes unusable, you will need to export data from 6.x site to some more or less universal format, like csv or xml, and import it anew to 7.x

Delete migrated data and it's content type
Create new content type with new-style fields, that maps 1:1 to old node structure. If possible, keep names
Export node data from original site (recreated from backup if needed), using Node Export, Views data export or similar tool
Secure all the files referenced by nodes
If needed, manually upload secured files to new version; see next step
Import nodes using tool like Node Export or Feeds - it may be required for files to be already uploaded, read the manual of your importing tool


If these sections are text or similar, you can create field collections that enclose other fields.

  Provides a field-collection field, to which any number of fields can
  be attached.

  A field collection is internally represented as an entity, which is
  embedded in the host entity. Thus, if desired field collections may be
  viewed and edited separately too.


Drush command to show site information configuration

If you are running multisite then you can do

$ drush @sites status

Or site specific

$ drush [site-name] status

Note : You should be in Drupal installation directory to run drush commands.


How to eMail a periodic summary of flagged nodes to users of some role?

Assuming you think of creating a view for such flagged content / users for (say) "current day", there is a solution to do what you're asking about. This solution uses the Rules, Views and Views Rules module, as further detailed below.

1. About the Views Rules module

The Views Rules module makes Views data available in Rules, enabling intuitive rule configuration for dynamic data. Some details from its project page:

  ... provides two types of elements in Rules, configured with a "Rules" view display:

  Views loop: A views loop is similar to a regular Rules loop, but allows looping over rows of view results.

  Collect view result rows (action): This action collects each variable in all view result rows into list variables for use in Rules.

  Tip: When selecting the data type for variables in the view, if the field is an entity identifier (e.g. Node ID), you can set the data type to the entity type (i.e. Node) to directly use the variable in Rules as an entity!

2. Create a view of display type 'Rules'

After you enable the Views Rules module, use Views to create a view of your "* flagged content / users*" (as in your question). Add of view of display type Rules (important, that's the key to make it work!). Here is how you can add such display:

Next configure the row variables, by using the link that says "edit field info", as shown here:

3. Create a Rule Component using the view of display type 'Rules'

Create a Rules Component, using these guidelines:

Add whatever Rules Conditions you might want (if any).
Some Rules Actions you'll need to create (add) for sure:

Create a variable, with no initial value, say you name it "eMail Summary" (machine name email_summary), which will be used in subsequent Rules Actions.
Add a Views loop (by using the link that says Add view loop), and select the "Rules" display created in the previous step. Configure the parameters and variable names. And for each views result contained in your Views loop (about some "flagged content / user", as in your question), perform a Rules Action like Set a data value, for the email_summary variable from the previous Rules Action. The actual value to be assigned, is the previous value of email_summary, to which you append the desired data about the Views result being processed. For this you can use the variables you configured at the end of the previous step (you may have to revisit the previous step to add more similar variables there if needed).
Add a Rules Action to Send an eMail to a selected role (as per your "periodic summary email that gets sent to a specific role"), whereas for the body of that eMail you simply use the value of the email_summary variable.

If you're not familiar enough with Rules to create and populate that email_summary variable, you may want to have a look at the Rules example included in my answer to "How to concatenate all token values of a list in a single field within a Rules loop?", in which a similar variable is used.

Try to execute your Rules Component "manually" (just to test), to unit-test if it works as desired. To do so, use the "execute" link to the right of the Rules Component (in the Rules UI).

4. Schedule the Rules Component for daily execution

Make sure you have the "Rules scheduler" enabled (a sub-module of Rules).

Improve your Rules Component from the previous step, by adding a Rules Action (as the last action to be performed) to Schedule a Rules Component, whereas the actual Rules Component to be scheduled is the Rules Component itself. You want it to be scheduled in "1 day from now" (to make it happen daily).

To execute this Rules Component the very first time, just execute your Rules Component "manually". To do so, use the "execute" link to the right of the Rules Component (in the Rules UI).

Assuming your QA-testing succeeded, and assuming your cron jobs are running also, the eMail should get created next time cron runs (after an amount of time, depending on the amount of time you configured in your Rules Component to get it rescheduled).

PS: The above addresses "Item #1" of your question, though it should be pretty forward to use a similar approach for the other items in your question.


EDIT: I think this is actually wrong: Views doesn't evaluate hook_node_access() for performance reasons. How to filter a view according to nodes permissions

It's going to be difficult for Views to model the relationships needed for this correctly, because Roles are configuration entities in Drupal 8 (as opposed to content entities).

You may be going about this the wrong way, though. Views already respects entity access control, preventing entities from showing in results if the current user doesn't have permission to access those entities. You haven't made those access control rules explicit to Drupal yet, which is why they don't get automatically filtered out in Views. But you could implement hook_node_access() to formally describe those access permission rules to Drupal.

Here's the API documentation example: https://api.drupal.org/api/drupal/core!modules!node!node.api.php/function/hook_node_access/8.8.x

Your implementation would look something like this:

<?php

function MYMODULE_node_access(\Drupal\node\NodeInterface $node, $op, \Drupal\Core\Session\AccountInterface $account) {
  if ($op == 'view' && $node->hasField('field_roles')) {
    $node_roles = array_column($node->field_roles->getValue(), 'target_id');
    $user_roles = $account->getRoles();
    if (array_intersect($node_roles, $user_roles)) {
      return \Drupal\Core\Access\AccessResult::allowed();
    }
    else {
      return \Drupal\Core\Access\AccessResult::forbidden();
    }
  }
  return \Drupal\Core\Access\AccessResult::neutral();
}


Using the fetch() method in database query to get an array

You can use fetchAllKeyed try with:

  $connection = \Drupal::database();
    $query = $connection->select('node_field_data', 'n');
    $query->condition('n.type', 'employee');
    $query->condition('n.status', 1);
    $query->fields('n', ['nid', 'title']);
    // use fetchAllKeyed
    $results = $query->execute()->fetchAllKeyed(0,1);


The Raydash module (if it's this one) appears to be a sandbox project that isn't even hosted on Drupal.org.

Sandbox projects are not suitable for production use and usually have a number of bugs; this is what makes them sandbox projects rather than real modules on Drupal.org.

Also, the Raydash module I linked to only had one commit a year ago.  Drupal 7 has changed some since then so it's unlikely that this module would still work "out of the box" if it ever did.

I would disable the module for now and either:

Consider forking the module and fixing it yourself (giving back the patches if you succeed) or

or

Looking for a different solution.


Issue in taxonomy term with hyphen(-) in url drupal7

If you want a taxonomy term to be recognized wholly, then you definitely do not want to divide it with spaces, so uncheck the Transform dashes in URL to spaces in term name filter values.

Also check on the Use path alias instead of internal path option and set the correct path component. It shows set to 1, but most probably it's different component in the taxonomy path alias.

Additionally, try to use term ID instead of term name.


How to create a fields on the users profile to allow them choose from a number of opens then order them based on preference

If it's D7, user profiles are fieldable, so you've got what you want out of the box : add a field in admin/config/people/accounts/fields with a select wodget and you're done.

For the ordering, I think Draggable Views could be worth a look.


Untag/Remove a taxonomy term from a node

With Views Bulk Operations for Drupal 7, you can execute arbitrary PHP scripts.

In order to bulk-delete a specific taxonomy term, you can make a View that shows all content with the particular term you want to remove: Be sure to add a Relationship in the View like "Content: Taxonomy terms on node" so you can filter out content with the terms you want to keep.

Then in the same View, you'd add a VBO field to execute an arbitrary PHP script. VBO no longer uses $node but rather $entity, so you can pass through the following script modified from Dave Parrish's answer above (where field_name_of_taxonomy_term would be the name of the Term Reference or Entity Reference field where you save the taxonomy terms on the node):

for ($i = 0; count($entity->field_name_of_taxonomy_term[$entity->language]) > $i; $i++) {
    if ($entity->field_name_of_taxonomy_term[$entity->language][$i]['tid'] == 'TID to Remove') {
        unset($entity->field_name_of_taxonomy_term[$entity->language][$i]);
    break;
    }
}
node_save($entity);


'Create new book' in Drupal 6 won't create, only shows loading icon

I found the problem. We had to disable the jQuery update module, but it breaks stuff on the frontpage.


How to filter a view according to nodes permissions

The correct answer is actually here.

  It seems that a better way to control node access is through hook_node_access_records and hook_node_grants as described here http://drupal.org/node/1260948. This works with views properly.


How to define another teaser for the second theme?

Problem solves by the following:

Created DS template for default teaser in 2nd theme: ds-2col--node-article-teaser.tpl.php
Place into it code to define my new node_teaser_mobile to show:

print render(node_view($node, $view_mode = 'node_teaser_mobile', $langcode = NULL));


Dompdf returns PDF on Controller function but not on Submit Form function

By default after form submit drupal makes a redirect, if there is no redirect defined intentionally allways will go to current url. To prevent this, you need call to disableRedirect() method from FormState at the final of submitForm().

Example:

public function submitForm(array &$form, FormStateInterface $form_state)
{
    $dompdf = new Dompdf();
    $dompdf->loadHtml('
hello world
');
    $dompdf->setPaper('A4');
    $dompdf->render();
    $dompdf->stream("example.pdf", array("Attachment"=>0));
    if ($dompdf){
        drupal_set_message("DOMPDF");
    }
    foreach($form_state->getValues() as $key => $value){
        drupal_set_message($key . ': ' . $value);
    }
    // Prevent form redirection to print PDF.
    $form_state->disableRedirect();
}

Source: https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Form%21FormState.php/function/FormState%3A%3AdisableRedirect/8.2.x

Other option, more dirty, is call to exit() method from PHP (http://php.net/manual/es/function.exit.php) also at the final of the function.


You shouldn't be replacing Drupal form code with static HTML code for various reasons. You can redirect users to specific URLs by using Rules or actions/triggers:

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


How to guide user through multiple unrelated forms

I'm not sure, but you might find References and Relation module useful for this.


Trying to filter a View based on a Paragraph entity reference

The way to list nodes that reference the one you're currenty viewing is by adding a Contextual filter for the Entity reference field that connects them.

You have one more connection in between - the Paragraph. You already added the Relationship to it so you're half way there.

Now that you have the 'my_field' available you need to add the Contextual filter for that field. Configure it to Provide default value, Content ID from URL, and set the other options in a way that makes sense in your particular case.

This will give you a Views Display that is sensitive to the context of the node you're currently viewing, and it will show all the other nodes that reference this node through their Paragraphs.

Usually this Views Display is a Block that you then put in a region of your theme to be displayed on Articles only, and don't forget to set the Block contextual option too.

If you're using regular Filters like you mentioned to filter only node 123, the normal fields will display its info, and not the info from the node that refereces node 123. To display "the child" node info that references the filtered node you have to make the fields use the Relationship for it. Either add the 'my_field' Field (it will automatically use the Paragraph Relationship), and if that won't work you need to add another Relationship that introduces that node info into the Views, then you'll be able to add the Title field for example, and make it use the second Relationship to show the node that references the current node.


Can I use the prepopulate module on an entityreference field in an entityform?

I actually did this on a project recently.

You can use Entity Reference Prepopulate. It's nice because you can make the field disabled if it's populated, all handled through the UI.

The alternative would be to just write a little bit of JS that disables the field on the node edit form if the value isn't empty.


view list on user profile, to show content of that user

You need to adjust where the contextual filter is retrieving the UID from.

When you provide a value for your contextual filter, you want to retrieve the raw UID value that's coming from Drupal's path system. To do this, look at the When the Filter Value is not available section.

Selecting Raw value from URL will use Drupal's internal path for the currently viewed page (e.g. /node/XXX, /user/YYY, etc.). The path component refers to which one of the "subdirectories" in the path to reference (e.g. 1 = "user", 2 = YYY, in the previous example).

In your example, you want a Path Component of 2 (i.e. the UID from /user/XXX profile page).


Use Statistics module to view published/unpublished nodes

The Drupal 7 Statistics module is for monitoring web pages. It records when pages are viewed and who viewed it. Per its documentation, "these statistics are useful in determining how users are visiting and navigating your site."

I think what you're asking for is a module that counts the content (i.e. the individual nodes). You should be able to do this with Views, by selecting the appropriate Fields (what kind of content), Field Filters (published or not), and then "Use Aggregation" (to calculate counts). I found a module called Count that might do what you want, but it's only for Drupal 6.

I'd be interested in other people's answers on your question.


How to get the count of referenced entity (by views entityreference result)?

Entity Reference Count

  This Entity Reference Count is in-and-of itself, just another field
  type (called "entityreference_count" in the code) that may be attached
  to any Drupal entity. The field may be configured to select which
  referencing entity types and fields you want to aggregate in the
  count. The counter field is automatically re-calculated when the
  referencing or referenced entity get inserted, updated or deleted. The
  Entity Reference Count's numeric field value may be enabled, displayed
  and manipulated via view modes, through the "Manage Fields" interface
  provided by Drupal core's Field UI, and has built-in Views
  integration.

OR

Make sure Child has an entity reference to Parent.
Create a new view
In Filter Criteria, add a new Type (= Parent)
In Advanced>Other, set Aggregation to YES
In Advanced>Relationships, add a new relationship
for "A bridge to the Content entity that is referencing Content via
field_parent" where field_parent is your entity reference. Call this
"Parents"
In Fields, add Content: Title and when prompted set its
Aggregation type to Group results together
In Fields, add Field:
Parents and when prompted set its Aggregation type to COUNT
(Distinct)


The user ID Drupal uses is contained in the uid field of the {users} table. On that table, the user ID for the anonymous users is 0.

You cannot alter the user ID to be a different value, especially if that value is not even contained in the {users} table. If you alter the user ID associated with a node, you are changing the author of that node.

I don't think it is even possible to associate an anonymous user with a Facebook account. What for Drupal is an anonymous user is not really a single user but a multitude of users that access a Drupal site without logging in; also the Google bot is an anonymous user, and associating it with a Facebook account would not make sense.


hook_form_alter() will fire once for every time there is a form on the current page.

You can try the hook hook_form_FORM_ID_alter(). This will only run once when the form with the specific ID pops up.

Unfortunately I had this issue happen before, the hook_form_alter() ran multiple times. I stopped the code from running multiple times by encapsulating the code inside an IF statement inside the hook_form_alter() example: if($form_id == my_id). So the hook ran multiple times but the code only ran once.


How do you add a nodequeue to an existing view on the front page?

OPTION 1

Edit your Nodequeue view and click on +Add button and select Attachment.

Now go to your front page view and in the FOOTER add Global: View area and select your attachment.

OPTION 2

In blocks, place the Nodequeue view block on a region and configure the block, for Visivility Settings select only listed pages and put <front>


Remove "Delete" in node/edit via hook_form_alter

You can use hook_node_access instead

e.g:

/**
 * Implements hook_node_access().
 */
function MODULE_node_access($node, $op, $account) {

  if ($op == "delete") {
    // If no user object is supplied, the access check is for the current user.
    if (empty($account)) {
      $account = $GLOBALS['user'];
    }
    // You can add your own condition check here...
    return user_access("delete content", $account) ? NODE_ACCESS_ALLOW : NODE_ACCESS_DENY;
  }

  return NODE_ACCESS_IGNORE;

}


How to add another filter to Scald search?

The search is provided by a View called Scald Atoms.  Add the filters you want to that view.


How to add html to title output of taxonomy terms in Drupal 7?

To make changes to the taxonomy term out put you can use the below function. This is taken from the batrik theme so you would use the function mytheme_field__taxonomy_term_reference

To change the markup of the term change #markup the defualt value would be

term name

change that to

 $item[#markup] = 'term name'

function batrik_field__taxonomy_term_reference($variables) {
  $output = '';

  // Render the label, if it's not hidden.
  if (!$variables['label_hidden']) {
    $output .= '
' . $variables['label'] . ':
';
  }

  // Render the items.
  $output .= ($variables['element']['#label_display'] == 'inline') ? '
' : '
';
  foreach ($variables['items'] as $delta => $item) {
    $output .= '
' . drupal_render($item) . '
';
  }
  $output .= '
';

  // Render the top-level DIV.
  $output = '
' . $output . '
';

  return $output;
}


According to the FAPI documentation, #default_value isn't a valid property for a file element which is probably why adding it to the array has no effect.

You might have better luck using a managed file element instead; although the documentation also states that a #default_value is not valid for that type either, I've used it successfully for ages now. The default value needs to be a file id (fid) which references a file in the file_managed table.


An easy solution is to use the Flag module to create your votes.  Then you can make a View, sorted by flags and potentially with other criteria (like date windows).  You may also be able fold in criteria based on Radioactivity.


How to make a page where two content types are combined

In views you can "Group By" the parent nodes. So if you were using entity references to do the relationship, you would have it as a field in views and group by it.

Are they different content types? How are you relating the children to the parent?

If the default Group By isn't enough, there's a module called Views Field View which can put a view inside a view but that could be a bit unnecessary.


Passing PHP filtered arguments to Panel and View Pane

By far the best way to do this is to provide your own context.

See What are Ctools plugin (content type, access, etc), and how does one create them? for how ctools plugins work, and adapt one of the examples to a context plugin instead.

That way you can decide what data is passed into Panels, and on to the individual panes in a safe manner.


How do you give permissions to certain roles to get certain menu items to display in the admin_menu toolbar?

Select People or users in admin bar, the user section on the right side there is permissions tab click it. then scroll down to store section, there u can set the permission for each type of user in your site.

Just to be clear user account ur are using as restricted go to his account page and see what type of user he is? ex admin or user or author.

then tick yes the setting u want for your restricted user in the permission tab.


need to print current row position number in block for most popular article

You can do this in two steps below,
STEP : 1
Add the views result counter under the fields option
Ex:
Fields
Global: View result counter
Content: Title
Content: Body

STEP : 2
If you want to theme it in your own way add the following tpl.php file in your theme folder,
views-view-field--custom-view-theming--counter.tpl.php
I have added the following html to theme it like a tab
<span style="margin-bottom: 20px;padding: 5px;border-radius: 3px;background: #479ED2;color:#fff;">
    View result counter:<?php print $output; ?>
</span>

Thats all about bringing a view counter in your block.


Can't set field names with Given users behat call

I didn't think this was the issue but I recently upgraded to PHP 7.  I downgraded to PHP 5.6 and the issue went away.  I created an issue on Drupal.org.

Turns out that I was using an older version of drupal-extension.  Upgraded to and the issue went away:

"drupal/drupal-extension": "^3.2",


Date of Birth in Views: Age is 1 day ahead of desired value

The problem is that "Time ago" has no understanding of leap years so when it is calculating an interval it uses a "common year" which is 365 days.

If we go back 30 years ago from today (2018-11-08) to 1988-11-08 and then use a date time calculator we get 30 years exactly, OR 360 months, OR 10957 days.

If the "Time ago" was smart enough to subtract the years, following by the months, followed by the days then it would come up with 30 years, 0 months, and 0 days. The problem is that it does all of its math in days and then tries to convert to years.

10957/365 = 30.019 common years or 30 years and a week. This is because there was 7 leap years between 2018 and 1988...

So there isn't anything wrong per say. It is actually doing exactly what you asked it to do.

You can get much closer if you divide the date by 365.2425 which is the average length of the year of 365.25 which is defined as a Julian year. Julian years are used in astronomy.


Manage/Assign Roles to Users Other than Administrators

NOTE: Since Drupal 6 is un-supported now (check announcement), you won't get a module which still have the D6 version actively supported. Also don't expect the module to be supported for any issues.

You can check the Role Delegation module, which allow users to set user roles to other user. Following is the module description from module page:

  This module allows site administrators to grant specific roles the
  authority to assign selected roles to users, without them needing the
  administer permissions permission.

The last release of this module for Drupal 6 version was made available on 9 Dec 2010, you can download it from here.


Even though the module's name is 'Feeds' , it can import CSV, XML and other types of data too. Also, you can attach them to a stand alone form or a node type form.

The basic difference between aggregator and Feeds module is, how it stores data.

Aggregator module stores categories, feed URLs and imported data in its own tables. You will have Views support but it cannot be extended like nodes or such entity.

Also, you will not be able to map data. It's almost a fixed structure, like title to title, body to body, etc.

But in case of Feeds, you can decide what you need.
You can build a standard feed importer that maps feed item's title to node title and contents to a body field. But you can also be radical by mapping to other fields.

You also can use different entities as the target.
It also has 'pubsubhubbub' support which Aggregator doesn't support.

Both modules uses cron to fetch data.

Use aggregator if you want to show contents from few RSS/atom feeds in a simple block.
For all other cases, I'd recommend Feeds module.


You cannot change View types (i.e. Users to Content or Content to Comments etc.).
You will have to start the view from scratch.


As the official doc says you can do something like

  panels-pane_node-title.tpl.php

  panels-pane_panel_node_title.tpl.php

  panels-pane-node-title.tpl.php

  panels-pane-node_title.tpl.php

After some search i have found that the suggestions are not detecting by panels, and i end up in this preprocess function.

function MYTHEME_preprocess_panels_pane(&$vars) {
// get the subtype
$subtype = $vars['pane']->subtype;

// Add the subtype to the panel theme suggestions list
$vars['theme_hook_suggestions'][] = 'panels_pane__'.$subtype;

return $vars;
}

After a long search in forums i found this too,

<?php
function THEMENAME_preprocess_page(&$vars) {
    global $theme_path;
    if($panel_page = page_manager_get_current_page()){

        $target_menu = 'menu-sixth-form-college';
        $current_path = menu_get_item();

        $target_menu_links = menu_load_links($target_menu);
        foreach($target_menu_links as $links) {
            $link_paths[] = $links['link_path'];
        }
        $preferred_link_paths = $link_paths;
        // if the current link is inside menu_load_link
        if(in_array($current_path['href'], $preferred_link_paths)) {
            $vars['theme_hook_suggestions'][] = 'page__sixthform';
        }
        if($panel_page['name'] == 'page-sixth_form_college') {
            $vars['theme_hook_suggestions'][] = 'page__sixthform';
        }
    }
?>

Theme and Cache.

When it comes to caching, i believe Drupal will handle template caching for you as normal page cache. If your dont think it work you can do something like

<?php
function my_module_function() {
  $my_data = &drupal_static(__FUNCTION__);
  if (!isset($my_data)) {
    if ($cache = cache_get('my_module_data')) {
      $my_data = $cache->data;
    }
    else {
      // Do your expensive calculations here, and populate $my_data
      // with the correct stuff..
      cache_set('my_module_data', $my_data, 'cache');
    }
  }
  return $my_data;
}
?>


PayPal WPS submodule of Commerce PayPal provides only one payment option, which redirects the user to PayPal for payment. Credit card icons are there to let users know that at PayPal's end they will be able to make the payment via PayPal balance or using listed credit cards.

You see only one radio button for PayPal WPS payment method because it is expected behavior. If you wish to allow your users to pay via credit card without leaving your website - enable PayPal WPP submodule.


You can use the Comment form above comments module which adds option to place comment form above the comments thread.


The hook you want is hook_form_FORM_ID_alter():

/**
 * Implements hook_form_FORM_ID_alter().
 */
function MYMODULE_form_search_form_alter(&$form, &$form_state, $form_id) {
  // Code here
}

Alternatively you could use hook_form_alter():

/**
 * Implements hook_form_alter().
 */
function MYMODULE_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'search_form') {
    // Code here
  }
}


How to add a custom antispam questions in User registration Form

You can also customize captcha by the CAPTCHA Pack module. Here is a quote about it (from the module's project page):

  ... contains several CAPTCHA types for use with the CAPTCHA module. The CAPTCHA Pack module is meant to provide lightweight, yet effective alternatives for the traditional image CAPTCHA, which is undesirable in certain situation (e.g. bandwidth restrictions, cpu restrictions, accessibility constraints, etc).


Commerce partial payment : pay deposit at checkout and full settlement later

I got it working the following way.

First install Commerce Partial Payment.
Write a custom function to calculate deposit, MODULENAME_deposit_calculation

In order to get Commerce Deposit work with the deposit calculation you like to instead of a customer deposit input, patch it as following :

function commerce_partial_payment_form_commerce_checkout_form_alter(&$form, &$form_state, $form_id) {
  //... line 93
  $acompte = MODULENAME_deposit_calculation($form_state['order']) /100;
    if (!is_null($acompte) && $acompte > 0) {
      $default = $acompte;
    }
  //... line 109 Add the amount to the payment details form,in a hidden field.
  $form['commerce_payment']['payment_details']['amount'] = array(
    '#type' => 'hidden',
  //...
}

function commerce_partial_payment_checkout_validate($form, &$form_state, $checkout_pane, $order) {
  //... line 261
  $amount['amount'] = MODULENAME_deposit_calculation($order)  /100;
  //...
}

function commerce_partial_payment_checkout_submit($form, &$form_state, $checkout_pane, $order) {
  //...line 317
  if ($pane_values['payment_methods']) {
    $amount = MODULENAME_deposit_calculation($order) /100;
    $order->data['atos']['request']['amount'] = $amount;
    if (!empty( $amount)){
      $amount['amount'] = $amount;
  //...
}

As the sandbox doesn't properly send the deposit amount to off site payment, we need to hook the payment method :

In a METHOD_PAYMENT.api.php file

function hook_METHOD_PAYMENT_request_alter(&$settings) {
  //no example
}

Now send to off site payment the deposit amount instead of order total :

function commerce_partial_payment_PAYMENT_METHOD_request_alter(&$settings) {
  $order = commerce_order_load($settings['order_id']);
  $deposit = MODULENAME_deposit_calculation($order);
  $settings['amount'] = $deposit;
}

Last, add a price component deposit below Total to inform the customer what he's going to pay.

function commerce_partial_payment_commerce_price_formatted_components_alter(&$components, $price, $entity) {
  //Add a deposit line to price components
  $deposit= MODULENAME_deposit_calculation($entity);

  $components['deposit'] = array(
      'title' => t('Deposit'),
      'price' => array(
        'amount' => $deposit,
        'currency_code' => $components['commerce_price_formatted_amount']['price']['currency_code'],
        'data' => '',
      ),
    'weight' => '200',
  );
}


how to create a user programmatically using comment_presave hook?

There are some errors in the code you are using, but the main error, which is causing the error message you quoted is that the code is creating users always with the same username, which is not allowed in Drupal: Every user needs to have a unique username.

If you are showing exactly all the code you are using for that hook, it's not clear why you keep creating an account before a comment is saved. You aren't checking which user is creating the comment, which means the user account is created even if the comment is created from the admin user.

To avoid that error message, you need to first verify the account you are going to create doesn't already exist, or you create a different username every time a comment is created. (It doesn't make sense, though.)

In the first case, you use user_load_by_name() passing the username; if the function returns FALSE, it means a user with that username doesn't exist, and it can be created.
In the second case, you just add a random number to the username, to make it unique; even in this case, I would verify there isn't already an account with that username.

As for the other errors:

The roles array should be the following one:

'roles' => array(
  DRUPAL_AUTHENTICATED_RID => 'authenticated user',
),

The first argument of user_save() is an object, not an empty string, for example the value returned from new stdClass()


I need a solution to in-depth scan into Drupal git repositories to find useful code snippets

drupalcontrib.org is a nice place to find functions used within contributed modules as well as the core Drupal API.  It has helped me out in the past


How to create a node from a Webform using rules?

1st attempt

Before using a Rules Action like "Set a data value" for your a field, you have to make sure to add a Rules condition Entity has field (related to the  field for which you want to set a value). And make sure to add that Entity has field condition BEFORE other Rules Conditions in which you might want to refer to this field.

That's also what is mentioned in the Rules UI, e.g. when you're adding a "data comparison" condition: somewhere it says "The data selector helps you drill down into the data available to Rules. To make entity fields appear in the data selector, you may have to use the condition 'entity has field' (or 'content is of type')".

The above applies to any of your "... rest of the fields in the webform" (as in your question).

For a video tutorial that illustrates the importance of this Entity has field condition, refer to Data types and data selection, especially what is shown between about 13:30 and 17:30 in it.

2nd attempt

The prior attempt is more or less like a Getting-started-with-Rules that resolves various situations where some variables appear to not be available in Rules Actions, etc. However, for this specific question, which is about using Rules in combination with Webform, things are a very little bit more complicated, as further explained below.

Let's assume I have a webform created with some of its fields with machine names like so:

contact_us_first_name.
contact_us_last_name.
contact_us_subject.

After you add these fields (with identical machine names) to any of your own forms, you should be able to import the prototype-rule below (using the Rules UI) in your own environment (without running into an integrity constraint):

{ "rules_create_a_node_from_a_submitted_webform" : {
    "LABEL" : "Create a node from a submitted webform",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "webform_rules" ],
    "ON" : { "webform_rules_submit" : [] },
    "IF" : [
      { "user_has_role" : { "account" : [ "user" ], "roles" : { "value" : { "2" : "2" } } } }
    ],
    "DO" : [
      { "drupal_message" : { "message" : "The webform component submitted by [data:contact_us_first_name-value] (= [data:contact_us_first_name-title]) [data:contact_us_last_name-value] (= [data:contact_us_last_name-title]) contains a field labeled \u0022[data:contact_us_subject-title]\u0022 which has value \u0022[data:contact_us_subject-value]\u0022." } }
    ]
  }
}

In the above rule I included an extra Rules Condition to prevent the Rules Action from being executed for anonymous users (feel free to adapt the role id of it, or just remove that Rules Condition. And the rule is triggered via Rules Event "After a webform has been submitted".

The Rules Action only displays an (informational) message on the site (my recommended way of writing and debugging Rules ...) after a webform gets submitted. Here is what I specified (in the rules UI) as the message to be shown:

  The webform component submitted by [data:contact_us_first_name-value] (= [data:contact_us_first_name-title]) [data:contact_us_last_name-value] (= [data:contact_us_last_name-title]) contains a field labeled "[data:contact_us_subject-title]" which has value "[data:contact_us_subject-value]".

Here is a sample of the message shown in my own setup:

  The webform component submitted by Dries (= First name:) Buytaert (= Last name:) contains a field labeled "Subject:" which has value " Rumour goes that the rules module can even replace the node_convert module! ".

What the above prototype-rule shows is that the "clue" to answer your question is that you have access to all labels and all values of any field of a webform available, ie:

[data:MachineFieldName-title] contains the Label of a field with machine name MachineFieldName.
[data:MachineFieldName-value] contains the Value of a field with machine name MachineFieldName

3rd attempt

The above is a good start, but still not sufficient to achieve your goal (= "... use the rest of the fields in the webform to transpose the information across, for example the body text ...", as in your question). However, you can use a technique similar to what is described in my answer to "How to do a data comparison to submitted webform data when using the Rules module?". For short:

Add an extra Rules Action to Add a variable (for each of the Webform components to transpose the information across, with a value assigned to it equal to your [data:ComponentName-value-raw] (and with a data type which equals the data type of your Webform component).
In your subsequent Rules Actions you can refer to the value of these variables you just added (that's the clue!).

Demo

Webform components

Assume a webform with form_id=191 and with these Webform Components:

Label = Title, Machine name = demoform_title, Data type = Textfield.
Label = Text, Machine name = demoform_text, Data type = Textarea.
Label = Number, Machine name = demoform_number, Data type = Number.
Label = Option, Machine name = demoform_option, Data type = Select options (single value).

Article content type

Assume an Article content type with these fields:

Label = Title, Machine name = title, Field type = Node module element.
Label = Body, Machine name = body, Field type = Long text and summary.
Label = Free Format Nr, Machine name = field_free_format_nr, Field type = Integer.
Label = OptionList, Machine name = field_optionlist, Field type = List(text).

Custom Rule

Here is a custom rule (in Rules export format), which is an extended (improved) version of the rule included in the question. This rule will create a new node (of type Article), and which will use the data included in the above mentioned Webform components:

{ "rules_create_a_node_from_webform_data" : {
    "LABEL" : "Create a node from webform data",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "webform_rules", "rules" ],
    "ON" : { "webform_rules_submit" : [] },
    "IF" : [
      { "webform_has_id" : {
          "form_id" : [ "form_id" ],
          "selected_webform" : { "value" : { "webform-client-form-191" : "webform-client-form-191" } }
        }
      }
    ],
    "DO" : [
      { "drupal_message" : { "message" : "The webform submitted contains these fields:\r\n\u003C\/ul\u003E\r\n\u003Cli\u003Ethe field labeled \u0022[data:demoform_title-title]\u0022 which has value \u0022[data:demoform_title-value-raw]\u0022.\u003C\/li\u003E\r\n\u003Cli\u003E the field labeled \u0022[data:demoform_text-title]\u0022 which has value \u0022[data:demoform_text-value-raw]\u0022.\u003C\/li\u003E\r\n\u003Cli\u003E the field labeled \u0022[data:demoform_number-title]\u0022 which has value \u0022[data:demoform_number-value-raw]\u0022.\u003C\/li\u003E\r\n\u003Cli\u003E the field labeled \u0022[data:demoform_option-title]\u0022 which has value \u0022[data:demoform_option-value-raw]\u0022.\u003C\/li\u003E\r\n\u003C\/ul\u003E" } },
      { "variable_add" : {
          "USING" : { "type" : "text", "value" : "[data:demoform_text-value-raw]" },
          "PROVIDE" : { "variable_added" : { "var_demoform_text" : "Form variable text" } }
        }
      },
      { "variable_add" : {
          "USING" : { "type" : "text", "value" : "[data:demoform_number-value-raw]" },
          "PROVIDE" : { "variable_added" : { "var_demoform_number_text" : "Form variable number text" } }
        }
      },
      { "data_convert" : {
          "USING" : { "type" : "integer", "value" : [ "var-demoform-number-text" ] },
          "PROVIDE" : { "conversion_result" : { "var_demoformvar_number" : "Form variable number" } }
        }
      },
      { "variable_add" : {
          "USING" : { "type" : "text", "value" : "[data:demoform_option-value-raw]" },
          "PROVIDE" : { "variable_added" : { "var_demoform_option" : " Form variable option" } }
        }
      },
      { "entity_create" : {
          "USING" : {
            "type" : "node",
            "param_type" : "article",
            "param_title" : "[data:demoform_title-value-raw]",
            "param_author" : [ "user" ]
          },
          "PROVIDE" : { "entity_created" : { "article_created" : "Created article" } }
        }
      },
      { "data_set" : {
          "data" : [ "article-created:body:value" ],
          "value" : [ "var-demoform-text" ]
        }
      },
      { "data_set" : {
          "data" : [ "article-created:field-free-format-nr" ],
          "value" : [ "var-demoformvar-number" ]
        }
      },
      { "data_set" : {
          "data" : [ "article-created:field-optionlist" ],
          "value" : [ "var-demoform-option" ]
        }
      },
      { "data_set" : { "data" : [ "article-created:comment" ], "value" : "0" } },
      { "entity_save" : { "data" : [ "article-created" ], "immediate" : "1" } },
      { "drupal_message" : { "message" : "A new article got created, with nid=[article-created:nid] and url=[article-created:url]" } }
    ]
  }
}

Some more details about the Rules Actions that were added:

Show a message on the site: This is just for debugging/demo purposes (remove it you don't want/need it anymore). Here is a sample message that gets displayed after submitting a webform:

  The webform submitted contains these fields:

  the field labeled "Title" which has value "Some interesting title of
  my webform".
  the field labeled "Text" which has value "Just some text,
  with some additional text and yet another line and another one".
  the field labeled "Number" which has value "842316".
  the field labeled "Option" which has value "A".

Add a variable (twice): To make the value of the Webform components demoform_number and demoform_option available in subsequent Rules Actions. Note that for demoform_number an additional Rules Action Convert data type is needed to get it to work.
Set a data value (3 times): To populate the node's body and the 2 node fields, using the variables created in a preceeding Rules Action.
Set a data value: To set "Comments closed" for the node being created (this is an optional Rules Action, just an illustration of other things you can do with such node being created).
Save entity: To actually save the node.
Show a message on the site: This is just for debugging/demo purposes (remove it you don't want/need it anymore). Here is a sample message that gets displayed after submitting a webform:

  A new article got created, with nid=123
  and url=http://www.example.com/node/123

Final result

After submitting the webform with data as in the sample above, a new article (with node id = 123) got created, and with these details about that node:

Title: Some interesting title of my webform
Body:

  Just some text,

  with some additional text

  and yet another line

  and another one

Free Format Nr: 842316
OptionList: Advanced (the label corresponding to key-value "A")

Additional possibilities

With some further refinements, the above prototype-rule can also be used to create a Rules based alternative for the Node Convert module ... and seems to have the potential also to create like an Entity Convert equivalent also.


finally went with duo Organic Group + OG Taxonomy permission modules


Substitute "Your Name" field for anonymous shown on posted comments

I found it was the antispam module and created a bug + patch


The test case is not recognized by the Simpletest module

As srihita pointed out in a comment, you need to add the file which contains the test class to the files[] array in your module's info file like this:

files[]=yourmodule.test

Then, let it rebuild by submitting the modules page or use the "Clear information" (or similar, not sure about the exact label right now) at the bottom of the Testing page.

Also, you're code is missing a ', but that might be a copy/paste error.


What are some ways to tell if you are currently on the same Drupal installation as your code?

drush status may give you some info that you need, but probably not.

If you have unique site names setup, then this should work:

drush vget site_name

If not, then read on...

Is this a multisite setup?  If so, then the mapping of hostname onto sites/{sitename} will be either fully automatic based on these rules or determined by the configuration in sites.php.

If it's not a multisite setup and you instead have fully separate directories for each site then the mapping of hostname > directory is determined by your vhost setup.

In either case, I don't think there's any drush command that will just spit out which hostname you should be using to access the site based upon the directory you run it in.

Instead, I'd suggest you set up some drush aliases that let you be much more purposeful about running drush commands against a specific directory and hostname.  So, if you have a site at example.com, a simple alias might look like

$aliases['example.com'] = array(
 'root' => '/path/to/example',
 'uri' => 'example.com',
);

Then, anytime you want to run drush commands against example.com it doesn't matter what directory you're in, as long as you have access to drush (stick it in your path) you can run:

drush @example.com arbitrarydrushcommandhere

Take the time to set up your aliases and hopefully you'll be more sane.


Are deleted entities automatically excluded from entity queries?

Deleted entities are not excluded because they are gone. They can't be excluded nor included as they do no longer exist in the database.

So they can also not be counted anymore.

This might change during 8.x, as there is work going on for archiving/putting them into trash instead of actually deleting. The details of that and how that affects entity queries are still being discussed.


Taxonomy Term View with Expose filter Dropdown of Terms Name

to get a dropdown filter you dont have to choose the taxonomy name rather the taxonomy term and select the vacabulary.

You follow this steps to get what you need :

1- https://monosnap.com/direct/Zw1q6Ww9If5vQZAAQsvysCt3TmL4L7

2- https://monosnap.com/direct/P4YbmYcXooNk7eLd1kev5y9sRyxekW

3- https://monosnap.com/direct/7gI69kySC5ciKtaBeBtbRRkCQS9Mf1)


enforce naming conventions for page aliases by content type

Yes, this use case is covered under the Pathauto module.

Essentially, you'll add a new Content patterns (from the admin UI in admin/config/search/path/patterns) for each of your content types with the following path pattern, my_type/[node:author:account-name].

As long as the user doesn't have the Administer URL aliases & Create and edit URL aliases permissions, their created content path will be set automatically without being able to change the path.


Subtheme inheritance is a bit different in D8. I believe you are running into expected Drupal 8 Theming behaviour.

In D7, the parent theme's functions were called, followed by the subtheme's preprocess functions - I hope this is still the case, but it seems from your troubles that it might not be.

When in doubt, just duplicate the corresponding file in your subtheme.

Here's some more reading on the subject:

https://www.drupal.org/docs/8/theming-drupal-8/creating-a-drupal-8-sub-theme-or-sub-theme-of-sub-theme
https://www.drupal.org/docs/8/theming/sub-theme-inheritance


Best way to create a Facebook Follow button on nodes

Facebook Subscribe Button

  This module will automatically add the Facebook code for Facebook
  Subscribe button which will be displayed in the block and each page
  node.

  Administrators can also control which content type(s) the Facebook Subscribe button will or won't appear on, as well as which role(s) are
  allowed to view the button (regardless of whether or not the user is
  logged into Facebook at the time).
  Along with a Subscribe button appearing for each node, there is an optional block that can be set to appear on each page.
  By default, the button will only appear on a node's "full" page view. This option is also customizable, however, so that the button(s)
  will show up on teasers as well.


I know for a fact (though it is probably not the only reason) that t() allows for replacement arguments:

echo t('my %string', ('%string' => 'Foo'));

Which renders as: 'my Foo' (emphasized text).

If you were to use such placeholders on your site, they will not work unless you wrap them through t() or format_string() (where t() is much much shorter).

Here comes the opinion part; if you only were to use plain text strings it probably wouldn't matter. But if you use t() on the front end with formatting and you would compare that value in the backend with a plain text string, it wouldn't match. And writing all tests to use format_string() instead would be very confusing.

In the end it all depends on your situation and your tests.


How to add profile fields on Ubercart 3 checkout page?

You can try out the Extra Fields Checkout Pane module.

  This modules allows an administrator to define additional (billing and shipping) address fields (i.e. VAT) as well as custom order fields in Ubercart e-commerce suite. These fields will be available during checkout process and in order handling pages.


How to embed a Rules Link in a View in order to trigger a Rules link to run?

These are 2 modules that can trigger events based on the 'current URL being viewed' (quotes are from their project pages):

Rules URL Argument:

  ... provides two rules conditions based on URL arguments:

  check if a URL argument is present
  compare the value of and URL argument

  It also provides an action that makes the value of an URL argument available as new variable to Rules.

Path Rules:

  ... implements Rules conditions for checking the URL against a given string for triggering actions.

You can also use the Rules Link module to generate a custom link that can trigger a rule. But that requires the link to be clicked to access the page and there might be an issue that the user must be logged in.


I think it was a PHP memory limit.  I upped that, and don't seem to have this problem anymore.


How to override logic of specific drush command?

Actually returning just FALSE without drush_set_error should work fine without error and the original command isn't executed, e.g.

/**
 * Validate feature revert of specific module.
 *
 * Implementation of drush_hook_COMMAND_validate().
 *
 */
function drush_policy_features_revert_validate() {
  $args = drush_get_arguments();
  if (strpos($args[1], 'rules') !== FALSE) {
    drush_log(dt('Reverting rules...'), 'ok');
    drush_invoke_process('@self', 'rules-revert-all');
    drush_log(dt('Reverting of rules finished.'), 'ok');
    // drush_postflight(); // Set context as completed, but this is not needed.
    return FALSE;
  }
}


Create a Drupal 7 node by email and populate multiple fields

You can take a look at Feeds Tamper that allows you to modify data before it gets saved. Then create a custom plugin if needed.


In static markup normally one has row level classes, element level classes and wrapper classes. By looking into those classes add exactly the same classes into your views interface, or override default template and add your markup and then render your block in appropriate region


How to change user info with a rule when Points are granted to user (using userpoints module)?

I think that was added recently in dev: drupal.org/node/1109992


Use THEME_preprocess_search_block_form to add drupal_add_js calls for the required javascript.


What is the url for product page in drupal commerce. Its admin url is : admin/commerce/products/2

In Drupal Commerce, you need to add product entities separately from product display pages. We simply create a product display node and reference all of our product entities using the product reference field.

See the docs for more help on this.

http://www.drupalcommerce.org/user-guide/products


On hook_form_alter setting select list options for a field

Try to rename the variable $user/ $users. May be your code is overwriting the default $user object of drupal. Try after renaming the variables $user/ $users.


Parameter replacement only works for WHERE clauses, it won't work for the kind of query you're trying to run.

You need to insert $start_value directly into the query string. If that value comes from an un-trustworthy source then obviously you need to sanitise it and make sure it falls within the correct bounds yourself:

$start_value = (int)$start_value; // Make sure it's an integer

// Do any other checks you need to here (bounds checking, etc.)

// Build the query string and run it
$sql = "ALTER TABLE {tripletex_invoice} AUTO_INCREMENT = $start_value";
db_query($sql);


How to add canonical links on ALL URL's?

As mentioned elsewhere, global redirect is a good option. But even Metatag is a good module. It not only handles the canonical urls but also meta keywords, description, Copyright data and many more important Meta data including OG. So, you can also have a check on this module. http://drupal.org/project/metatag and a tutorial on how to get the canonical url to work on this link: http://amitavroy.com/justread/content/articles/canonical-links-and-drupal-7

The one thing with meta tag module is that by default it will print relative canonical urls whereas I have seen major sites like smashingmagazine, engadget etc uses absolute. So, if you want that to happen then the second url is the key.


How to pass multiple values in setArguments() and render view?

Depends if you need OR or AND clause :

$view->setArguments(array('23,46'));
$view->setArguments(array('23+46'));

One string for each argument.


How to insert value to taxonomy on custom form submission

To add taxonomy term in form submission, get all inputted term values and those to Vocabulary you need.

use Drupal\taxonomy\Entity\Term;
$categories_vocabulary = 'EXAMPLE'; // Vocabulary machine name
$categories = ['test 1', 'test 2', 'test 3', 'test 4']; // List of test terms
foreach ($categories as $category) {
  $term = Term::create(array(
    'parent' => array(),
    'name' => $category,
    'vid' => $categories_vocabulary,
))->save();


How to make payments on recurring product automatically(RESOLVED)

If you're using the Card on File module, that means you're storing tokens that point to card data stored securely by the payment gateway itself. What you then need is to combine that with Commerce Recurring or the Commerce License suite to create the schedule for recurring charges and Commerce Dunning to react to payment failures.


populating field A with content of field B

In Drupal 6 you could use Computed Field for that, but unfortunately it's not completely ready for Drupal 7 yet.

You could also create a custom module in which you implement hook_node_presave to set the value of 'field A' based on the value of 'field B'. When you choose this method, you may also want to implement hook_form_alter to hide field A from the node form.


Merging new contents with new functionalities

Use below modules and git

Modules:

1) Backup and migrate(By this module you can take the backup of database from the production site).

2) Features(You can export content types, admin settings and global settings).

3) Drush(You can use this module for the production deployment).

Version control system

1) GIT

Below are the steps how to sync your code and database with the production site.

1) Take the database backup from the production site before you start working on the local machine and import that database into the local machine.

2) Take the updated code base from the git repository of production site.

3) Complete your work whatever you want and in the evening after completion of your work create features(If you have done some changes in content type, permission or any other settings) and pull code from the git repository if there is conflict then resolve it otherwise just commit your code on the git repository and move those changes from git repository to prod server.

4) Test whether it is working fine or not. If it is not working perfectly then revert your changes from git and commit your files and then move your files from git repository to prod server.


If you go into the view thru the Views UI, and look at the fields, you can configure/remove the wrapper html from the field by selecting none for the wrapper of the field, and that should take a lot, if not all, of the html away that you don't want.  Also, if you go into the views admin screen and go to tools, you can check the "Do not show hover links over views" which should remove the first edit portion of all of your views when looked at via an admin type account as well.

If the above doesn't take away all the html you want, you can either modify the templates as you mentioned above, or use something like this instead of views_embed_view:

$view = views_get_view('teaserview');
$display_id = 'default';
$view->set_display($display_id);
$view->execute();

which will execute but not display the view ... but will create a $view->result which is an array of row objects basically, so you could then go in there and print out whatever you wanted.

To find out what is in there, throw in a

drupal_set_message('<pre>' . print_r($view->result, true) . '</pre>');

and you'll see what you can work with.

PS
Once you have this working, I would put it in a preprocess hook and assign this output to a variable instead of putting any/all of this code in your page.tpl, too...

PPS
I also am assuming you know that the Theme Developer module is throwing a lot of html in there as well (all those thmr='s as such).


db_update after a submit button is clicked

Although db_update should work with db_set_active in fact db_set_active is completely unnecessary in Drupal 7. Instead of db_update($table, $options) you can do Database::getConnection('default', 'enrollment')->update($table, $options); a bit more verbose but avoids changing the global state.


How to reference existing term if it exists or create new one if not exist via Inline Entity Form module?

This solution is a bit "out there" so I'll just describe the logic.

Three taxonomy fields. One for first name, one for last name (so there's autocomplete), one for full name generated by rules.
On node save, join the first+last as tokens and fetch term by property name. This will give a list containing one or no terms.
Two rules components that receive the list.
No. 1: condition, list is empty. Actions. Create term and send it back to the rule.
No. 2: condition, list is not empty. Actions. Send back the fetched term.
In the main rule, set data value on node, returned terms.

It's "out there" but that's because there are two fields for one term.


What is the best way to use Panels with the Omega theme?

If you want to use Panels, Omega is probably not the way to go.  The lead Omega developer is a big supporter of the Context module (as noted by Letharion) and you can see an example of the slow uptake of panels support on this thread.

If you're new to Drupal and want to use Panels, I would recommend trying Adaptivetheme, especially the 3.x branch (currently rc1 but due for a stable release soon).  Adaptivetheme has a long history in the Drupal community and has nearly 30,000 sites using it; it also has the best Panels support of all the major theme frameworks.  The 3.x version of Adaptivetheme adds support for responsive design in Panels, easy CSS resets, etc., making it very comparable to the Omega theme but allowing for excellent Panels support.  There are also a variety of subthemes available (links on the module page) that should give you a good idea of what this theme is capable of.


How to edit Advanced Search Form's Content Type checkbox-list using hook_form_alter

The advanced fields are added by the node.module in node_form_search_form_alter() (a hook_form_FORM_ID_alter() implementation). It sounds like your module's hook_form_alter() is getting called before the node.module one, so you're not seeing it's additions.

The ordering of when hooks are fired is controlled by the weight column in the system table. Have you altered that previously for your module? Usually, node.module has a weight of 0 so if your module comes before that in the rows in the system table when sorted by weight then that will be your problem.


Including static pages in the search index?

Your module needs to implement hook_search_info, hook_update_search and as part of that hook call search_index and then fully define how the content is indexed.

Out of interest why don't you just create static pages as regular nodes?


Load jquery action on link menu click/node load

It depends on what page you need to add the script, adding jquery_ui is fairly straightforward if you know which component it is.

You should add the following line in the template.php (changing the ui.autocomplete to what you need)

drupal_add_library('system', 'ui.autocomplete');

The following page is extremely useful https://drupal.org/node/171213

Update as described in comments

function MY_THEME_preprocess_html(&$variables) {
    if(arg(0)=='node' && arg(1) === 3)) {
        $node = node_load(arg(1));
        drupal_add_js('system', 'ui.autocpmplete);}
       }
    }


Adding jQuery to a view (exposed filter: search terms)

Use hook views pre render instead.

function themename_views_pre_render(&$view) {

   if ($view->name == 'view_name' && $view->current_display == 'block_1') {
    drupal_add_js(drupal_get_path('theme', 'themename') . '/js/jquery.highlight-5.js');
   }
}

replace themename with your theme name
replace view_name with your view name
replace block_1 with your machine name


Where to define permissions for user roles in FCKEDitor file uploads?

Are you using the IMCE module for file uploads/directory? It could be a setting there that you need to enable.


How do I change the default '- Any -' option in views exposed filter?

Better Exposed Filters works for me well in my Drupal 8. The only thing what you have to do is follow this path.

Better Exposed Filters > Settings > More Options > Rewrite results.

Then you have to replace the any text using this format in Drupal 8. I think what you missed is this one. Replace using this token

- Any -|your replacement


How can I override the default forums and container pages with a view?

You can use Advanced Forum module, which provides many advanced features, and overrides the default forum listing with views and panels. It is not a replacement module for core forum but an enhancement.

If you don't want to use it, you can at least take a look at how they've overriden the core forum listing and make your own implementation.


Attaching existing server files to filefield

I would try Media and its associated modules. It's an evolution of FileField Sources, and provides most of the same kind of functionality although with Drupal 7 fields.


Adding a taxonomy drop down to drupal search

I think you will need to use custom search module. For auto-complete feature i think it is better to go with custom development rather than depending on contributed modules which will come with lot of unwanted features.

To preface :

You will need to use hook_form_alter() for add you custom field.
Then with the help of hook_search you can inject your custom search criteria using search query extract and search query insert.


How to add comma separated list for the select list check box field type

Do you have the Text list formatter module installed on the first site, but not the second site? That would provide the functionality you describe.


I don't think Views does anything like that by default, but a quick...

if (count($view->result)==1) {
  drupal_goto('node/' . $view->result[0]->nid);
}

...at the beginning of a display output template for the view in question should do it for you.

Or better yet, per @MPD...

function MOTOMODULE_views_pre_render(&$view) {

  if ($view->name=='JUSTONEPLEASE' && count($view->result)==1) {
    drupal_goto('node/' . $view->result[0]->nid);
  }

  // any other pre_render()ing here

}


Change autocomplete results based users selected checkbox

MYMODULE/src/EntityAutoCompleteMatcher.php:

class EntityAutocompleteMatcher extends \Drupal\Core\Entity\EntityAutocompleteMatcher {

  /**
   * Gets matched labels based on a given search string.
   */
  public function getMatches($target_type, $selection_handler, $selection_settings, $string = '') {

    $matches = [];

    $options = [
      'target_type'      => $target_type,
      'handler'          => $selection_handler,
      'handler_settings' => $selection_settings,
    ];

    $handler = $this->selectionManager->getInstance($options);

    if (isset($string)) {
      // Get an array of matching entities.
      $match_operator = !empty($selection_settings['match_operator']) ? $selection_settings['match_operator'] : 'CONTAINS';
      $entity_labels = $handler->getReferenceableEntities($string, $match_operator, 10);

      // Loop through the entities and convert them into autocomplete output.
      foreach ($entity_labels as $values) {
        foreach ($values as $entity_id => $label) {

          $entity = \Drupal::entityTypeManager()->getStorage($target_type)->load($entity_id);
          $entity = \Drupal::entityManager()->getTranslationFromContext($entity);

          // Only return bundle types we want.
          if ($entity->bundle() == 'page') {
            $matches[] = ['value' => $label, 'label' => $label];
          }
        }
      }
    }

    return $matches;
  }

}

More work would need to be done, but this shows where we can control the returned list of referenced entities.

See:

https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Entity%21EntityAutocompleteMatcher.php/8.8.x


How to make the submit button not appear on form unless an option is selected from radios?

You can use #states attribute in form api to hide submit button and check box

For Example

$form['email_canceled']['settings'] = array(
    '#type' => 'container',
    '#states' => array(

      // Hide the settings when the cancel notify checkbox is disabled.

      'invisible' => array(

       ':input[name="email_canceled_toggle"]' => array('checked' => FALSE),
      ),
    ),
  );


test_module.settings:
    message: 'Hello'
    langcode: 'en'

Is that really content of your file? It should only contain:

message: 'Hello'
langcode: 'en'

Also, Configuration on config/install is only imported when a module is installed. If it is an existing module, you need to re-install it or write an update function to initialize the configuration.

You can always use something like print_r($config->get()) to see everything in your config file.


Does it need to be a user reference?

Assuming that you are not using a global flag (then you wouldn't have an issue with multiple users), that information should already be stored in the flag tables. You should be able to show that information with a view (which you can attach to the node with http://drupal.org/project/views_attach). Or if that doesn't work, do a custom query in a hook_node_view() implementation in a custom module.

And if it has to be a user reference for some reason, an unlimited multi-value user reference should be easier to handle with Rules than a unlimited number of user reference fields. CCK (nor Fields, for that matter) is just not designed for that. And you can only add fields to content types, not single nodes.


Getting error rendering same node in different view mode

I found the solution but do not know the actual cause.  Apparently I have to clone the current node to avoid conflicts:

$node = clone menu_get_object();
$node_view = node_view($node, $view_mode = 'card_view', $langcode = NULL);
echo drupal_render($node_view);

If anyone has any detail feel free to edit or add a comment.


Views... no format options in Fields->User?

The short answer is that the user image is not a field unlike images attached to nodes. Views is using the field formatter that applies to fields and the way they are themed to allow you to select how you want to theme the field. This functionality doesn't work for properties like the user image.

The same goes for the say the node type. You can't select how to display the node type.

The easiest thing to do, is properly get the raw url and with theming turn it into the image with the image cache preset you want to use.


Database corruption after trying to reinstall Rules Module

As it turns out the drive on which my database was installed had run out of disk space, so as JimaJamma suggested, the table could not be created by the rules module.


Customise Webform Email Submission Data 2

Are those fields inside a fieldset? This has tripped me up a few times.

Fields in a fieldset need to be [submission:values:fieldset-name:name:nolabel]


Drupal running behind a proxy send emails with links to the wrong domain/IP

Silly me, forgot all about setting $base_url in settings.php. By default it is commented out, but I've now set it to:

$base_url = 'http://www.mysite.com/press';


Check if a node exist where field_a = Sessionvalue && field_b=arg1

If you want to get value from entity without loading the entity object. You can use EntityFieldQuery

Example:

$query = new EntityFieldQuery();

$query->entityCondition('entity_id', 1)
      ->fieldCondition('field_custom_field', 'value', '', '!=')
      ->addMetaData('account', user_load(1)); // Run the query as user 1.

$result = $query->execute();

if (!empty($result['node'])) {
  // field value exists!.
}


You have to override the view template.

In your views UI click on 'Theme:information'. This will open up a dialog with views templates and suggestions. As your view is using grouping, you need to override the 'Style output' theme template as it is the one that contains the h3 tag you want to alter. When you click on the blue 'Style output' link it will open up a dialog with the code you can copy and alter. That code needs to go into a file placed within the template's folder of your theme. The file name must be selected from the list of suggestions in the same line next to the blue 'Style output' link. First in the list is:

views-view-list.tpl.php

If you override that template it will override it for all views of HTML List format, so you now have to select a more targeted suggestion. Going down the list you will see how different template suggestions target different contexts.

Have a look at this question for more information: Commerce Product Collection View Block: What Determines CSS For Each Header Link?


Showing Taxonomy Terms with Empty Descriptions in Views

Try adding this to the filter field for the taxonomy term description in the regex: ^[\s]*$


how to get a list of all nodes that haven been created and are not in use on the system

You could set up a view showing title of content type A,  title of content type B (using relations), hide both and create a custom PHP field that just returns title of ct A if ct A does not have ct B referencing to it. Maybe


I have discovered that this wasn't a problem after all.

I think the error I initially got (on performing a "clear cache") was caused by the original version of my module already being loaded from global version, and loading again from the local version caused the "redeclare" error.

If I had just reloaded the page, Drupal would now know to load from the local copy, and ignore the global one.


You just need to first visit the page rendering the string you want to translate while using any other language.

Drupal only adds this string to the database once it has been rendered once, and you will be able to see it in the /admin/config/regional/translate page.


Images within content of page but not separate fields

You can do this with the following modules:

WYSIWYG
CKEditor module with CKEditor library
IMCE module:

Lot of setup and config, but once its there, its there so to speak.


Fill in user reference from current user page while adding new content

If you're using "Entity reference" module for the user reference field, you could use http://drupal.org/project/entityreference_prepopulate module which allows to set the entity id with an URL parameter.

For example, if the field name is "field_user_reference", and the entity you're creating is "appointment", you'll have to generate a simple link like:

  node/add/article?field_user_reference=UID

Instead, if you're using "References" module, you can install and enable http://drupal.org/project/userreference_url which does the same, although the syntax is a bit different:

  node/add/article?user_reference=UID

I hope this will help.


How to create Omega 4 subtheme with new "default" libSass based starterkit?

I've had a lot of problems getting started with the new starterkit. It seems to me as if omega-guard does not yet support the new kit. You can still accomplish the same by running gulp in the subthemes directory. This will start the gulp watching process in foreground.

For more information about gulp and the libSass starter kit, I can recommend this post: https://www.drupal.org/node/2537364#comment-10287771


Typically text based fields are automatically added to the Solr index, as a convenience feature. It is up to the site builder to exclude fields. One reason the field may not appear in the index could be it's data type, but if it's a standard field type (shipped with Core) then there is something much simpler incorrectly setup (or it's just not indexed itself yet).


How can I add rows to grouping in views?

The views Format Settings has your answer.  There is a drop-down for "Grouping field Nr.1" that does exactly this.

As it is, you have one "row" showing for each unique set of values because this is what mysql returns.  By setting this field grouping, Views will match up the values from the selected field and use them as headers for sub sections of your results.

If this is not a good enough match to your issue, please provide details on how it doesn't work and I can update the answer.

Continued:

The view is a tool for making a mysql query and then theming the returned result.  With this in mind, you need to craft a set of data relations and filters to get the appropriate data linkages for the ratios you want in your display.  This means you want the database handing you a field table like:

Category parent | product | category | trait

Sweet Corn | corn product 1  | Type 1  |  Null
Sweet Corn | corn product 2  | Type 2  |  Null
Sweet Corn | generic corn product  |  Null | Augmented
Onions | onion product 1 | Type 3 | Null
Onions | onion product 3 | Null  | Celebrate

Then once you have the dataset you need, you work on the theming side of the views tool.  Use the above mentioned Grouping field setting on the Category Parent.  This will make the sections with the parent titles as indicated in your question, but it might look like

Sweet Corn

corn product 1  | Type 1  |
generic corn product  | | Augmented

Then use the "exclude from display" on the product field, or actually remove it from the fields list.  I have it included here because it is needed to show the data grouping as I understand it in your question.  Finally, configure the "category" field with the link you want it to have and exclude it from display; use the "No Results Behavior" rewrite option on Trait to put in the token for the Category field, something like [field_term_category].  You should be able to find this token in the list of "replacement patterns" available in the Rewrite Results area.

You should now have a list of parent categories showing the linked sub categories and traits where you want them.  The "trait" field will either have the category or the trait in there, as it shows trait when trait is present, and category when not.  Be sure to uncheck the "hide if empty".


Taxonomy field not visible for anonymous users with content create permission

You just have to give anonymous user the permission of administer taxonomy.


Try this

$orders = commerce_order_load_multiple(array(), array('uid' => $user_id));

You can use the conditions parameter of commerce_order_load_multiple.


create a page view to have only one specific content type show

Under filter criteria, click on add, select content: Type, and then check the type you want filtered


Stopping Drupal 7 spammers registering at mysite.com

There is Honeypot as well

  Honeypot uses both the honeypot and timestamp methods of deterring
  spam bots from completing forms on your Drupal site

Usually, forms take at least a few seconds to fill out when a human is entering data into them—especially surveys, user registration forms, etc. Spam bots try to fill out as many forms as they can in as little time as possible, so they will often fill out a form within a couple seconds at most. The Honeypot module requires at least 5 seconds to pass (by default - you can adjust this too!) before a form can be submitted.

Alternative modules

There are many spam-protection modules on drupal.org, some of which have more or less robust methods of dealing with form spam. Some of the most used and recommended include:

Mollom - Offers spam protection through their premium service.
CAPTCHA - A simple image-based CAPTCHA builder.
reCAPTCHA - Implements reCAPTCHA for image-based CAPTCHAs.
Hidden CAPTCHA - Similar to this module in it's effectiveness.


The file examples/policy.drush.inc contains a drush_policy_pm_update_validate hook. If drush pm-update, gives you the message "This codebase is assembled with Composer instead of Drush. [...]" you know that Drush uses the file.


What does the project: key in module.info.yml do?

The Drupal 8 documentation for the keys to use in a .info.yml file doesn't mention it, but that is the same key documented in Writing module .info files (Drupal 7.x).

  project (Discouraged, packaging use only)

  Module maintainers should not use this at all. The packaging script on drupal.org will automatically place a string here to identify what project the module came from. This is primarily for the Update status module, so that Drupal installations can monitor versions of installed packages and notify administrators when new versions are available.

Drupal uses its value for building URLs when finding information about the module, or any file related to it. Technically, every Drupal core module could use the value of the project key to build a URL for something related to a module. I take the documentation gives the primary use of that key, since the Update module is present in all the last versions of Drupal.

I guess that, since its usage is discouraged, they don't document it for Drupal 8 to avoid users add it in their .info.yml files. It could help users creating a module that handles new keys in .info.yml files, though.
As for documenting it, I would document it just to avoid a developer creates a module that handles custom keys that conflict with the ones already used from Drupal core. I can understand this is seen as a use case that remotely interest developers, though.


How can I change the order of vertical tabs?

An alternative to user842's answer (for those who are interested in a more code-based solution) is to set the weights on all the form items whose group is "additional_settings". The idea here is, higher the weight, lower the tab will appear, where the default is the one with the lowest weight (or one whose weight is not set).

To do this without modifying core code, create a module with a very large weight (see weight module for a module-based, or this post for a DB-based approach). Specifying the weight is important so that the module can be executed later than other modules which may change the order of the tabs. In this module, implement hook_form_alter, or hook_node_form_alter, which exposes the $form array.

At this point, you can look at the $form array, and pick out the indices that correspond to the vertical tabs whose order you wish to edit. One way to look at the $form array is by printing it out (via drupal_set_message($form) in the hook_form_alter or hook_node_form_alter). This array is huge, so you may want to run some kind of browser search to find the items that you want.

The indices that correspond to items on the vertical tabs are items with #group set to additional_settings (so you can search for the string "additional_settings"). For example, you may see the following when you print out the $form array:

Array
(
   ...
   [path] => Array
        (
           ...
           [#group] => additional_settings
           [#weight] => 314159265359
           ...
        )
)

and this is showing that path which corresponds to the location tab in the vertical tabs has a large weight 314159265359, which might be the reason that it is showing last in the vertical tabs.

With this info, you can now change the order of this tab in your hook by decreasing the value of the weight:

// set a small weight for the path tab
$form['path']['#weight'] = -1;

in your hook. Notice that weights can also be negative. You can do this for some/every tab (by going through and changing their weights).

This unfortunately doesn't work for all situations. If the #weight of some vertical tab is unset, somehow, that tab will bubble to the top. You can fix that by giving the tab. The source-code might look something like

/**
   Implements hook_form_FORMID_alter, hook_node_form_alter.
   Changes the $form array to reorder vertical tabs.
*/
function reorder_vertical_tabs_node_form_alter(&$form, &$form_state, $form_id)
{
   // move 'location' to the top (as the default)
   $form['path']['#weight'] = -1;

   // move 'themekey' under 'locations'
   $form['themekey_ui_themes']['#weight'] = 0;

   // move 'published/unpublished' down
   $form['options']['#weight'] = 100;
}

From experience, I do not think you can change the order of the vertical tabs by setting $form['#after_build']. At that point, the order of the vertical tabs are already set.


How to change a user reference field from select list to autocomplete in a Views exposed filter?

To get User Reference Field as autocomplete exposed filter,

Let me consider you have created a user reference field in your content type as Users-ref

Now in your View :

Add a relationship for your entity reference field for Eg: Entity Reference: Users-ref and make it required.
Now add a filter criteria User:Name  with the relationship Entity Reference: Users-ref
you should find (User entity referenced from field_users_ref) User: Name (exposed) in your filter criteria now.
And this should be an autocomplete widget!!

There is also a module named Views Autocomplete Filters along with this wonderful tutorial!!


How do I check that the private file system is setup correctly from hook_requirements()?

There are a few different ways.
Use the \Drupal\Core\Site\Settings class static method get:
if (\Drupal\Core\Site\Settings::get('file_private_path')) {

}

Check for the existence of the stream_wrapper.private service, which is only instantiated when the above check passes. Need to catch the appropriate exception coming from Symfony. Update 2017.01.23 @Berdir suggests using the getContainer method, which means we don't have to catch the exception!
if (\Drupal::hasService('stream_wrapper.private')) {

}

Use the file_system service to check if it's a valid scheme. This will basically check if the above service's class exists.
$fileSystem = \Drupal::service('file_system');

// Check if the private file stream wrapper is ready to use.
if ($fileSystem->validScheme('private')) {

}


Locked out of Drupal 8 site, and new user can't get in

For a while it seemed that adding localhost to the Trusted Host settings in settings php did some good, then I realized it didn't so I removed it, leaving just the lines below:

$settings['container_yamls'][] = $app_root . '/' . $site_path . '/services.yml';
$settings['trusted_host_patterns'] = array(
'^mydomain\.com$',
'^.+\.mydomain\.com$',
);

I think the Trusted Host settings is critical for several reasons. But then out of the blue I somehow found I can enter the site by logging into

mysite/user/login

Even though it throws the error page with this message:

Redirects to external URLs are not allowed by default, use \Drupal\Core\Routing\TrustedRedirectResponse for it.

However I'm actually logged in. All I have to do is append the site folder name to the path then I'm in.

http://www.mysiteurl/sitefolder/

In fact, I can just log in by going to

http://www.mysiteurl/sitefolder/user/login

The sitefolder added to the URL seems to be an alternate url for the entire site. I don't know if that will cause a problem but at least most of my problems are solved for now.

I hope this helps somebody. It seems to result from shared hosting not letting me install my primary site to a subfolder in public_html without making a fancy adjustment in htaccess.


How to make the Access by Term module respect User Role permissions first?

You are using Access By Term. I've never used this module, but I have used Workbench Access which allows setting of an Editorial Section for content and people assigned to those sections to edit that content.

It sounds like you want a complex workflow better supported by Workbench.


500 HTTP error on "Manage Display" tab after changing layout with Display Suite! What should I do?

Had the same issue, deleting the rows corresponding to my problamtic content type from the table "field_group" solved it. This way I didn't lose my entire field group settings.


cant see the list of databases in Feeds Database module UI tab

The documentation for this module is poor, but the solution is simple.

The module picks up the $databases array defined in your settings.php file. In most installations, only one database 'default' is defined. Use the format for 'default' and define a second database say 'test', listing the correct connection credentials. The 'test' database will show up in the drop down. The module removes 'default' from the list because it makes no sense to map a database to itself.

I think better documentation for Feeds Database is in order :). However, the core Database API can be configured for multiple databases. See Database Configuration.


Openlayers views , center map to each geofield

Go to /admin/structure/openlayers/maps
Choose the map you are using to display your geofield on the user
Select the behaviors tab
Check off Zoom to Layer
Select geofield_formatter
Enter your zoom level

Note: If I misunderstood your question, and you were actually referring to centering on the markers on your view that compiled all of the users, then just select your view name in the 'Zoom to Layer'.


Why does Drupal display node titles at the page level instead of the node level?

Not every page is a node. It's really as simple as that; if node pages' titles were displayed on the node level but other pages' titles were displayed at the page level it makes things inconsistent and more difficult to maintain, document, predict, etc.


You need to create the schema using the following code

$schema = Database::getConnection()->schema();
$schema->createTable('custom_form', $spec);

For further details visit here


Messages are displayed in a block, check that this block is in a region and that region is displayed in your theme.


Can't retrieve POST parameters in Webform

You need to use hook_form_alter to change value of full form email field. Just take value from table or session where you save one-field email result per user.


How can I trace a HTTP 500 (Internal Server Error) at `admin/reports/status`?

Check the Apache/nginx/other server error log, 500 errors almost always appear in there.

As neok notes, checking the validity of your .htaccess file would also be a good thing to do. If required extensions are missing for .htaccess directives a 500 error is often the result


Try using the views module and views_embed_view


Multiple hook_menu_alter over-writing issue

You can try to change the weight of the module in the systems table but doesn't always work and can cause other issues.  I would use the hook_modules_implement_alter function.  You will need to unset yours and then add yours to the top or before the other module.  Here is an example I used doing a hook_user_delete and hook_user_insert

function users_module_implements_alter(&$implementations, $hook)
{
  if($hook == "user_insert" || $hook == "user_delete")
  {
    unset($implementations['user']);
    $user = array('users' => false);
    $implementations = $user + $implementations;
  }
}

Yours would be like this:

function users_module_implements_alter(&$implementations, $hook)
{
  if($hook == "menu_alter")
  {
    unset($implementations['mymodule']);
    $mymodule = array('mymodule' => false);
    $implementations = $mymodule + $implementations; // Also could use array_merge
  }
}


For D6 there is Embed widgets

  Embed widgets allows content such as pages, blocks, views, and nodes
  from your Drupal site to be embedded in external sites (including
  non-Drupal ones).

If its D7 there is Embeddables

  Embeddable provide a method for embed thingies in content.It is a
  pluggable system that currently allows the embedding of nodes and
  blocks.

Found 136 results containing the words: Embed on drupal.org


Disable the overlay for admin using a feature?

You can use a feature for this, but IMO it makes more sense to do this in an install profile, because you are just setting this once. One way or the other, you will need to add some code to the .install file of your install profile or feature, in the form of a hook_install implementation.

This is untested code but I believe it should work:

<?php
/**
 * Implement hook_install().
 */
function PROFILENAME_install() {
  user_save(user_load(1), array('data' => array('overlay' => 0)));
}
?>

Of course you need to replace 'PROFILENAME' with the name of your install profile or the name of your feature.


I've found a problem. As I said, I'm new to this project and recently I've found that it uses a Memcache module to save sessions. But both memcached and php5-memcached were not installed on my test server.


Adding a new content type programmatically in .install file or .module file?

Some hooks, like hook_delete are only called on the module that defines the node's content type. If you save content type to a database using node_type_save(), it might not be recognized as "defined by module" - it acts as content types created by user. Unless, of course, you will set $info['module'] to point at your module - in that case created entries should work the same way.


Tokens in blocks configuration for List only pages

1) Enable the core PHP filter module

2) Use php in the visibility setting of your block. Notice that the path 'mypath' must be registered somehow before using this code. I mean that if the path 'mypath' does not exist at all any code here will not work.

<?php
global $user;
$uid = $user->uid; // Get the logged in user id
// If the path is 'mypath/myarg' then arg(0) is 'mypath' and arg(1) is 'myarg'.
$show = (arg(0) == 'mypath') && (arg(1) == $uid); // It must return both TRUE

return $show;
?>

Alternative, use the Context module.


What you can do is to select corresponding titles from the database directly:

$sql = "SELECT l.link_title FROM {menu_links} l WHERE l.menu_name = :menu_name ";
$result = db_query($sql, array(':menu_name' => 'menu-program-menu'));
foreach($result as $object) {
    print $object->link_title;
}


How to prohibit some words and letters to use as a Drupal password?

This module should work. I have never used it before, but it should definitely have the feature to prohibit certain password strings.
Password Policy Module