texts: Is there a way to display SCALD image and have it link to outside website: Drupal 7

texts:
I have created a content type that uses a SCALD atom image field.  When that content type is displayed on my site, I want the image to link to an outside website if it is clicked upon.  I don't want to use a view to make this action happen.

I can easily add a URL field to my SCALD Image atom, but I don't know how to make this link work when the image is clicked on ONLY in the full node view.

Could someone suggest a solution?


texts: How to override uc_cart_checkout_form()?

texts:
Is there a hook_checkout_form of some sort?

How can I alter uc_cart_checkout_form()? The function itself located in uc_cart.pages.inc and not the form. As I can just do this with hook_form_alter.

Please advice. Thanks.


texts: If I were to delete the latest row of the node table in the database would all traces of the latest added content be gone from my site without errors from core modules after clearing the cache?


texts: How should I fix an incorrect query in hook_update_N()?

texts:
I made a new release of a module, and soon afterwards an issue was filed that the hook_update_N() used SQL that didn't work on PostgreSQL. In this situation I can see two solutions:

(Let's say the release with the problem is 1.1 and that N=6100.)

Modify update_6100 to have a fixed query and release as 1.2. If a user with Postgres updated to 1.1, got the error, and then updated to 1.2 they still wouldn't have run the query as it wasn't put in a new hook_update_N(). However they should've seen the error when doing the update, and the issue's in the issue queue, and can include instructions on how to fix the problem. It feels ugly to modify an existing (released) update function though.
Add update_6101 that has the fixed query. In the case of this particular query however, it would be destructive to run it after the user's started using some of the new functionality. So if a user with MySQL updated to 1.1, used the module a lot, and then updated to 1.2 there would be a good chance they'd lose data. I could check what DB's being used in update_6101 so that it would only be run for users with Postgres, but that feels ugly too. Also if someone with Postgres ran update_6100, saw the errors and then fixed and ran the query manually, they also could lose data when updating to 1.2.

Note that there's no way to detect if the query has run successfully, or has never been run.

I'd like to know what people think is the best way to deal with this situation?


texts: Easiest way to add an existing site to a Drupal 6 multisite setup?

texts:
I have an existing Drupal 6 site. We've completed development but we're told it needs to be added to a multisite setup which involves moving key files and modules to different directories. Can someone please give me a few tips on how to do this or point me to a tutorial?

EDIT: would it be easier to rebuild the site from scratch (ouch) or to make the changes to the existing site? Any help would be appreciated!


texts: I have installed Drupal Commerce (7.x.1.8 version) but in user orders section when I select an order only price and total is shown. In despite of order details the message "no line items found" appears. What can I do on here to show order datails?


texts:
can it be possible to alter the exposed form , make field hidden and accept it through node form field.

for example

Both node and views exposed filter will have the common date field and this view is shown on node/add pages. Instead of showing exposed filter field (date field) I

want to pass node form's field as filter to views which is in block.This will inform user what has been created on that date and prevent duplication.

Is this possible with just hook_form_alter ?


texts:
What is the best way to remove the post date from a views created RSS feed? I have a calendar that I have created a feed for, but it is being sorted by a cck date value, making the post date not necessarily accurate.

Is there an easy way to remove this from within views (D6), or would this need to be a template change?


texts:
I am trying to populate a selec2 field on open with AJAX in Drupal 8. In my hook_form_alter, I have added the following code:
  $form['#prefix'] = '
';
  $form['#suffix'] = '
';

  $form['field_author']['widget']['#ajax'] = [
    'callback' => 'myPopulate',
    'wrapper' => 'form-ajax-wrapper',
    'event' => 'select2:opening',
  ];

which correctly calls to the callback function when I try to open the drop-down list:
function reloadOptions(array $form, FormStateInterface $form_state){
  $query = \Drupal::entityQuery('node');
  $query->condition('type', 'author');
  $query->condition('status', 1);
  $nids = $query->execute();
  $nodes = Node::loadMultiple($nids);

  foreach ($nodes as $node) {
    $options[$node->id()] = FieldFilteredMarkup::create($node->getTitle());
  }

  $form['field_author']['widget']['#options'] = $options;

  return $form;
}

The query is ok, and the way in which the options are loaded also seems ok. However, when I click on the selec2 field to open it, the ajax throbber is shown but the drop-down list does not open.
Any ideas why is this happening?
Thanks!
EDIT:
A capture of the behaviour of the selector2. As you can see, the drop-down list is not displayed after you click. However, if the ajax call is removed, it works correctly.


texts: How to override/theme suggest webform composite element table?

texts:
I have created an implementation of

hook_theme_suggestions_table_alter()

in my THEMENAME.theme file:

/**
 * Implementation of hook_theme_suggestions_table_alter().
 */

function ncon_bs_theme_suggestions_table_alter(array &$suggestions, array $variables) {
    if (isset($variables['attributes']['data-drupal-selector'])){
        if ($variables['attributes']['data-drupal-selector'] == "edit-contact-person-comp-items"){
            $suggestions[] = $variables['theme_hook_original'] . '--contact_person_comp_items_table';
        }
    }
}

I see that template suggestion is correctly added to my suggested templates:

But template file ('table--contact-person-comp-items-table.html.twig') is not loaded. Instead the default 'table.html.twig' is loaded.

So how to override template suggestion to webform composite element table?


texts: node:url token not returning clean (alias) URL

texts:
This is a follow-up question of: How to delay the execution of a rule for 5 minutes?

When not delaying the action, the node:url token does not return the alias URL, but the URL with the token ID: ...node/id. I assumed this is because this URL is simply not available yet. I have to use the clean URL, because otherwise a scraper would get a HTTP status code 302 and is unable to scrape the page correctly.

I'm using the Pathauto module to create the URL's automatically.

However, when using the sheduler, I'm still not getting the clean URL. These are my current settings:

The marked token in the screenshot should return the clean URL, but it returns the unclean /node/id one. I've already tried to change the token to [entity-fetched:url:path], but this seems to return an invalid URL (or no URL at all, is it possible to debug this?).

Why can't I get the clean URL using tokens in rules?

The weird thing is... if I edit a node instead of creating a new one, node:url does return the clean URL, but not when using the sheduler.

EDIT:

{ "rules_publish_to_fb" : {
    "LABEL" : "Publish to fb",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "rules_scheduler", "fb_autopost_entity" ],
    "ON" : { "node_insert" : [], "node_update" : [] },
    "IF" : [
      { "node_is_of_type" : {
          "node" : [ "node" ],
          "type" : { "value" : {
              "event" : "event",
              "inspiration_theme" : "inspiration_theme",
              "news_item" : "news_item"
            }
          }
        }
      },
      { "entity_has_field" : { "entity" : [ "node" ], "field" : "field_facebook_message" } },
      { "entity_has_field" : { "entity" : [ "node" ], "field" : "field_facebook_published" } },
      { "NOT data_is_empty" : { "data" : [ "node:field-facebook-message" ] } },
      { "data_is" : { "data" : [ "node:status" ], "value" : "1" } }
    ],
    "DO" : [
      { "schedule" : {
          "component" : "rules_facebook",
          "date" : "+2 minutes",
          "param_node" : [ "node" ]
        }
      }
}

And

{ "rules_facebook" : {
    "LABEL" : "facebook",
    "PLUGIN" : "action set",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "fb_autopost_entity" ],
    "USES VARIABLES" : { "node" : { "label" : "node", "type" : "node" } },
    "ACTION SET" : [
      { "entity_fetch" : {
          "USING" : { "type" : "node", "id" : [ "node:nid" ] },
          "PROVIDE" : { "entity_fetched" : { "entity_fetched" : "Fetched entity" } }
        }
      },
      { "entity_create" : {
          "USING" : {
            "type" : "facebook_publication",
            "param_type" : "link",
            "param_user" : [ "site:current-user" ]
          },
          "PROVIDE" : { "entity_created" : { "facebook_link" : "Facebook link" } }
        }
      },
      { "data_set" : {
          "data" : [ "facebook-link:field-facebook-message" ],
          "value" : "[node:field-facebook-message]"
        }
      },
      { "data_set" : {
          "data" : [ "facebook-link:field-facebook-link" ],
          "value" : "[entity_fetched:url]"
        }
      },
      { "publish_to_facebook" : {
          "USING" : { "publication" : [ "facebook-link" ], "pages" : "1247812435236072" },
          "PROVIDE" : { "facebook_publication_id" : { "facebook_publication_id" : "Facebook publication returned ID" } }
        }
      },
      { "drupal_message" : { "message" : "[entity_fetched:url]" } }
    ]
  }
}


texts: When should I use behaviors? Can I attach them to any DOM node?

texts:
I was using Drupal behaviors during a commerce project that ran some simple code after a select list changed product value.  In my head though I was thinking how is this any different than a 'change' event.

I went through Google to find out a bit more, but could only come across some things that provided very little insight, including the documentation itself.

So I am curious as to why and when to use Drupal behaviors, and if I could get a practical example. And does it only work on Drupal rendered nodes that have asynchronous functionality attached to them? Or can I attach it to anything like a regular div element? If so what would that look like?

I also noticed in the Drupal behaviors object tree, you can see all the behaviors, and are able to run them if you get all the way down to the attach object ( i.e. Drupal.behaviors.myBehavior.attach() ). Can you manipulate those?

Thanks for the insight in advance.


texts: Duplicate alias for different nodes after submitting form twice - Pathauto?

texts:
I have found this issue, in many different installations of Drupal (I'm running 7.35, but problem occurs even in 7.34 and I think every other previous ones): if I click many times quickly on submit button in node creation forms (be it in administration pages or in forum topic creation pages, I have double-checked it and it occurs in both situations), Drupal creates n nodes with the same content, generating the same alias for different nodes in the same language (content is exactly the same), I checked with this other issue Drupal duplicate alias for same node but no changes, the problem remains. I noticed that even if I don't click so quickly there are many cases in which many of the created nodes have the same URL alias.

Nodes created with "shared" alias does have "Generate automatic URL alias" unchecked, those nodes which get a different (nnnn-0, nnnn-1 and so on) have this option checked.

Another strange thing is that creation timestamp delta of nodes with the same alias is of exactly of 2ms; I think this generates some kind of problem in pathauto module.


texts: Send email notification to node author with Rules

texts:
I am trying to notify the node author of a new comment on their node.

Using Drupal 8.3

Created new reaction rule.

Send to:  comment.entity_id.entity.uid.entity.mail.value

email address is not being picked up

I get this email from system:

A message that you sent contained no recipient addresses, and therefore no
delivery could be attempted.


texts: Ability to only allow certain content to be added between a range of dates

texts:
I have a drupal 7 site that is used for registration for certain events.  We are currently using content types to collect the information.  What I need is to only allow registered users to post certain content types between a certain set of dates.  Certain roles should be able to add/edit at any time.

For example.  One of the content types is Grant.  But we only accept grants between May 1 and May 31st.

Before May 1st we'd like to have a message that states: Grants are currently not open, please check back May 1st.
After May 31st we'd like a message to state: Grants are currently closed for Spring 2018, please try again next year.  or something like that.


texts: How to disable a product variation based on date field?

texts:
I have a drupal commerce site that sells courses and events. I need to disable the events variation when the date passes so no one can buy it anymore. But, the content node should stay published even if all the product variations are disabled.

I tried with this rules "How do I use rules scheduler to disable and enable a commerce product entity based on certain date fields?", but they dont seem to work for this because the content dont get disabled.

Can somebody help me with other rule combination?

Thanks.

Marcos


texts: How can I add a extra feature to repeating date field?

texts:
I have a content type named Tasks and it has a date field.

I use this date field for weekly tasks and I want to add a simple on/off checkbox for these dates.

For example I add a weekly task for 11 November 2016 and I pick repeting option to every week.

I want this;


texts:
I'm new to Drupal 7 and I have created a content revision view. For that I have added a column of author in which I have also specified the user author relationship in view.

Problem is i am creating the content type using mobile device using web services  for this created content i have content revision view in D7 here for all the content created user name displaying as admin i,e if I check the user name column in content revision column, then it shows the same admin name for all content created through multiple users, as shown in this screen print:


texts: How to loop over OG group members from comment

texts:
I'm trying to set up a Rule to send a privatemsg to all group members when someone posts a comment on the group node itself.

One approach I've tried using existing options provided by the OG module:

**Events**
After saving a new comment

**Conditions**
Entity is a group
  Parameter: Entity: [comment:node]

**Actions**
Get group members from group audience
  Parameter: Group content: [comment:node]
  Provides variables: List of group members (group_members)
Loop
  Parameter: List: [group_members]
  List item: Current member (member)
    **Loop actions**

This method fails to find any members. I'm guessing this is because the "Get group members from group audience" function expects its parameter to be a node posted on the group rather than the node representing the group itself.

Another method I've tried is to define a new Rules action in a custom module:

/**
 * Implements hook_rules_action_info
 */
function mymodule_rules_action_info()
{
    return array(
        'mymodule_get_og_members' => array(
            'label' => t( 'Get OG members from group node' ),
            'group' => t( 'Custom' ),
            'parameter' => array(
                'nid' => array(
                    'label' => t( 'Group node NID' ),
                    'type' => 'integer',
                ),
            ),
            'provides' => array(
                'group_members' => array(
                    'label' => 'List of group members',
                    'type' => 'list',
                ),
            ),
        ),
    );
}

/**
 *
 */
function mymodule_get_og_members( $nid )
{
    $node = node_load( $nid );
    $uids = og_get_group_members_properties( $node, array(), 'members__' . OG_STATE_ACTIVE, 'node' );
    $members = user_load_multiple( $uids );
    // user_load_multiple indexes by UID which might be confusing the Rules loop. Reindex!
    $members = array_values( $members );
    dpm( $members ); // This works!
    return $members;
}

In Rules UI I've added this custom action followed by a loop. The loop suggests the provided members-list variable to iterate over and everything looks fine, yet when the Rule is run I get errors like this:

Unable to get variable group_members, it is not defined.

Unable to evaluate loop.

I've asked an overlapping question here: https://www.drupal.org/node/905632#comment-10893894

Similar posts that I've read:

How to loop over a list of Organic Group users using Rules

I can't access a provided variable in rule action

https://drupal.stackexchange.com/a/170922/58279


texts: Solr search much slower for logged in users

texts:
I've set up Solr on a Drupal installation with around 11000 indexed nodes. I'm using Apache Solr Search Integration module and the FacetAPI interface.

However, I'm finding that searches take around 2 seconds to return results when accessing search anonymously but 9 seconds when logged in! There's no obvious reason for this discrepancy -- for example, none of the content nodes have permissions applied.

I've run Profiler against both approaches and there is a big discrepancy in the number of queries issued: 216 queries and 1644ms vs 496 queries and 8545ms.

There's no similar discrepancy in time for other pages, eg loading a taxonomy page, which makes me rule out authenticated content generated within other blocks.

I'm a little lost where to start. Why would a search when authenticated be so much more complex, and what can be done to improve performance?

Edit: On deeper inspection of the queries, the cause of performance issues does appear to be related to the fact that results can't be cached for authenticated users. The 2 most expensive queries when authenticated are a drupal_lookup_path call (115ms) and menu_get_item (71ms), which compares to 0.5ms and 0.2ms executing anonymously.

Any thoughts on how to either:

(1) reduce the performance impact of operating in an authenticated context, or

(2) always execute search in anonymous context, even when logged in (there's no difference in the results which would be returned)?


texts: Facebook share in drupal7 sharethis module picking wrong thumbnail image

texts:
I using ShareThis module in a drupal7 website for a certain content type say 'news'. When a user hits a Facebook share button, the title and links are fetched correctly but the thumbnail image it chooses is wrong.  I want my fbshare to pick my news image as its thumbnail image. Pls help.

thanks.

Update: i got it worked using MPD's comment. i explicitly added og:image in my header. Below is my code. Hope it helps someone.

$element = array(
            '#tag' => 'meta',
            '#attributes' => array(
                 "property" => "og:image",
                 "content" => $imagePath,
                  ),
            );
drupal_add_html_head($element,'fb_share_image');


texts:
I have content in an RSS feed that I'm looking to import into separate nodes. I set up a feed importer, and when I run manually, all works as designed (content is imported, fields mapped properly, etc.).

That said, I need to be able to import from the RSS feed on a regular basis. Unfortunately, Elysia Cron won't work, as I don't have access to the crontab on the server. Can this be done programmatically, and on a regular basis?

Thanks!


texts: Limit node.js updates if the view is active

texts:
I have a Facebook style news feed view which updates via node.js and rules when new content is created. This all works fine however if one user is in the process of commenting on a node teaser (comments shown on node teasers on the view) and another user creates a new node, the view then updates causing the unfinished comment to be lost.

My question is: is there a way to restrict the node.js view update for the current user if the view is currently active?


texts: How do I display a fixed size Views grid regardless of the number of results?

texts: I have a Views grid that can display anywhere from 0 to dozens of results. I want to display a 3 column, 2 row grid with a pager that will always show 6 cells regardless of how many results my filter gives. How do I do that? Also, I can't find the option to display the View even if there are no results. Where is that?


texts: How do I target a specific term or node in a toked?

texts:
I am developping a site on a dev server, and I am wondering how to create hyperlinks not depending on the server the site is running on.

I have considered usig href="node/xx" and href="term/yy" but I would like to use the paths generated by pathauto.

But I cannot include the pathauto url as I am certain my client will change titles before I move the site to its final destination, and I might have to regenerate paths to do that.

So I am wondering if there is a way with tokens. Something like [node:nid:122] or [term:tid:122]


texts: Override menu name shown by Superfish in mobile view mode?

texts:
I've installed Superfish and set a new menu. All works fine but when I dive into mobile-view I see the machine-name of my menu printed on a rectangle. This could be nice sometimes but I really want to override it to something else rather than "Main Menu".

How will you change that?


texts: Drupal Json Output strange characters when pulling from other language

texts:
Hi Fellow drupal experts,

I have a problem, I developed a custom page intended to do a drupal json output :

and here is the code :

    function blogpull_menu() {

$items = array();

$items['blogpull'] = array(
    'page callback' => 'blogpull_view',
    'delivery callback' => 'drupal_json_output',
    'access arguments' => array('access content'),
    'type' => MENU_CALLBACK,
);
return $items;

}

function blogpull_view() {
    global $base_url;
    global $language;
    $query = new EntityFieldQuery();
    $query->entityCondition('entity_type', 'node')
      ->entityCondition('bundle', 'blog')
      ->propertyCondition('status', 1)
      ->propertyCondition('language', $language->language, '=') // filter by current language
      ->range(0, 5)
      ->addMetaData('account', user_load(1)); // Run the query as user 1.
    $result = $query->execute();
    if (isset($result['node'])) {
      $blog_items_nids = array_keys($result['node']);
      $blog_items = entity_load('node', $blog_items_nids);
    }

foreach ($blog_items as $key => $blog_item) {
    $arr = array('date' => date('M. j, Y', $blog_items[$key]->created), 'title' => $blog_items[$key]->title, 'description' => $blog_items[$key]->body['und'][0]['value'], 'href' => $base_url.'/node/'.$blog_items[$key]->nid);
    $arrs[] = $arr;
}

return $arrs;

}

and some how when it's loading the japanese language it is showing this strange characters :
ã‚¯ãƒ©ã‚¦ãƒ‰ã‚²ãƒ¼ãƒ äº‹æ¥ã®æ–°ä¼šç¤¾ã€Œã‚·ãƒ³ãƒ©ãƒ»ãƒ†ã‚¯ãƒŽãƒã‚¸ãƒ¼ã€ç™ºè¶³

I tied using utf-encoding, mb_encoding and so on but nothing happen

can someone help?

thank you!


texts: Creating a template file for one specific page created by a custom module

texts:
How do I call a custom theme file (stored in the theme folder) that displays on a specific page that is created by a module.

It's a module for viewing mortgages in a full-page view. The template file is called page--single_view.tpl.php

The module is named single_view and has these functions:

<?php
/**
 * @file
 * Single Mortgage Views module file
 */

 /**
 * hook_menu() add to menu
 */
 function mortgage_single_view_menu() {

  $items = array();

  $items['mortgage/%/view'] = array(
    'page callback' => 'single_view_theme', //This isn't correct but just set this way for now
    'page argument' => array(3), //pass 3rd argument of url -- 1. drupal 2. mortgage 3. %
    'access callback' => TRUE,
  );

  return $items;
 }

 /*
 * Implementation of hook_theme().
 */

function single_view_theme($existing, $type, $theme, $path){
  return array (
    'page__single_view' => array (
      'variables' => array(),
      'template' => 'page--single_view' ,
      'base hook' => 'page',
      'path' => drupal_get_path('module', 'single_view'),
    ),
  );
}

I'm guessing my implementation of hook_theme isn't correct. The page that comes up is just blank?


texts: MachineName field element: How do I use the source and exists properties?

texts:
In my custom form, I am trying to create webform entities. Since webforms need unique machine names, I'm using the MachineName (machine_name) form element. The D8 MachineName element documentation suggests that we can get the field to auto-populate based on the text input of another field, AND there can be an AJAX callback to call a function that can check to see if the machine name is unique.

Neither is working for me. These are the form elements I am using.

//----------------- general settings ------------------
$form['settings'] = array(
  'label' => ['#type' => 'textfield','#title' => 'Form Title'],
  'id'=> array(
    '#type' => 'machine_name',
    'label' => 'hh',
    '#source' => ['label'],
    '#maxlength' => 64,
    '#description' => $this->t('A unique name for this item. It must only contain lowercase letters, numbers, and underscores.'),
    '#machine_name' => array(
      'exists' => array(
        $this,
        'webform_id_exists',
      ),
    ),
  ),
);

Can anyone advise? I have a callback function named, but no idea what it should look like.


texts: Pull data into a list for custom content type?

texts:
Hopefully this is a quick question!  I'm working on a custom content type for users to create something similar to blog posts.  We'll have different authors who will be credited, so I need a drop down list so when a user writes the post, they can select the author.

The trouble is, I need to list to be auto populated from the data that is stored in a different field.  We have a content type called (you guessed it) authors.  It allows us to fill out name, field of expertise, etc.

So, how can I add an AUTHOR NAME list to my BLOG custom content type?

Thanks!
-JB


texts: Entity Background 'parallax image' positioning 'top' value issue when DOM is manipulated by other modules

texts:
I am having an issue where the calculated value for the 'top' property that applied to the parallax-slider image is excessively large and pushing the image outside of the viewport.

In my case as you can see the 'top' property is 34946px which is 5X the height of my page content (6502px). After some testing I (believe) I have narrowed it down to a result of other modules manipulating the DOM and giving a miscalculation.

I am using the Responsive Menu module as well as the Adminimal Theme and Menu modules which both manipulate the DOM and create various wrapping and spacing elements. Disabling these modules give me slightly different results (however still and issue) This seems like it must be a jQuery firing order issue and these other DOM changes are interfering with the parallax.js calculations?

To confirm I have tested the following:

I have tested with versions 1.3.1 and the most recent 1.4.2 of the
parallax.js library with the same result
it is not a background colour issue :-p
Disabling the Responsive Menu module and viewing as an anonymous user  the parallax image is still being miscalculated but the number is about 15K pixels less than my initial test.

Can anyone else confirm having issues with these or similar DOM altering modules?

Also How can I alter the module firing weight?


texts:
Here's the situation, which I suspect is pretty common:

A site is deployed where a node type has no fields added.
Lots of nodes are added.
The site is changed and a new field is added to the node type.

At this point, I've got my original nodes that do not have a value for the new field. There aren't even any field value records in the database for these nodes.

I now need to query for the nodes where this field is set to a certain value (a new or updated node) OR where it's one of the original nodes. So I'm thinking something like this (note the NULL in my array of possible values):

$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'node')
  ->entityCondition('bundle', 'my_content_type')
  ->fieldCondition('field_myfield', 'value', array('myvalue', NULL));

Unfortunately, this doesn't work, and I suspect it's due to the nature of the join. Is it possible to return results where the field is a certain value OR where there is no record of a value at all?

ps: how do I see/debug the resulting query?


texts: Using Site A to authenticate users of Site B?

texts:
Is there a module that will pass the authentication request off to a second Drupal site, ideally to an out-of-the-box services endpoint?

There are some similar questions about login integration with other systems, but I couldn't find a Drupal-to-Drupal question.


texts: How can I have multiple versions of the same form, in different pages?

texts:
There is a default Drupal 7 form called "user_profile_form". I would like to show certain elements of this form on one page of my website, and then a different set of elements from this same form on another page.

Is there a way to either:

a) have multiple versions of the same form (keeping the same ID) or
b) clone the form and then modify it (there will be two different form IDs)

Can you point me in the right direction?


texts: I have a view with two separate displays that is used in one single page. Both the displays are using a pager. To get things working I set a unique id for each pager under pager options. This works and I can use each pager independently. The problem is that the separator used in the url to distinguish between the two pagers is encoded as %2C. So my question is if there is a way to avoid this and if possible even change the character used?


texts: How to move block functions into .inc file?

texts:
I have a module that is getting pretty large and I want to move the functions that define blocks into another file to better organize my module.

I did this:

Moved those functions ( _block_configure, _block_info, _block_view, etc) to includes/blocks.inc in my module.
Put files[] = includes/blocks.inc in my .info file

This doesn't work though - the blocks disappear when I do this.  What am I doing wrong?


texts: Field image in attachment affect block settings

texts:
I created a block in views with field image and title.

Then I created an attachent after the block with title only.

The field image in block is gone after I removed the field image in attachment.

How do I make it override? I can't find the settings.


texts: How to check if page exists using page alias in D7?

texts:
In D7, how do I check whether a page exists by page alias? I've found some guy asking the same very question but I have problems with using menu_valid_path() (or drupal_valid_path() in D7) function. It always returns TRUE, no matter how weird a path I pass to it. Here is a sample code:

if(drupal_valid_path($GLOBALS['base_url'] . '/contacts')) //this exists
{
    print_r('Exists!');
}
if(drupal_valid_path($GLOBALS['base_url'] . '/weird_alias')) //this doesn't exist
{
    print_r('Exists!');
}

I get two "exists" despite the fact that /weird_alias page doesn't exist and returns a "page not found" error. I'm extremely reluctant to use drupal_http_request() because there are a lot of unnecessary things like headers, timeouts etc. Shouldn't there be an easier way to check internal paths?


texts: Key / Value fields module where you can choose the type?

texts: Is there a module which creates a field where you can choose the field type of the key and also the value during content type creation?


texts:
I use D6. Cron run often by some bots visiting example.com/cron.php Is it possible to change it somehow? Or restrict? I would like to prevent anonymous users to hit the script.I want to be able to run cron from drupal admin interface and also to run it automatically from linux crontab. I tried to set permissions to read for owner only (www-data is group) but it does not help.

Thank you.


texts:
I want to be able to allow users to rate businesses on various factors such as staff helpfulness and quality of clothing. I've been told that the best way to create the content type for the review form would be through the use of integer fields. I have now set up that content type, but am not really sure how to allow users to view/submit the review.

When I create content with the type "review," all that is displayed to the user is a comment section. They cannot see any of the selectable fields created in the content type, let alone submit them, because no values were defined by myself when the content was created. How would I go about making a displayed version of the form, with the menus exposed (in a similar fashion to exposed filters in Views, I suppose).

After the displayed form is created, I need a way to allow it to be submitted. Obviously, the review form would be useless if the information can't be submitted into the database to be later displayed in the reviewed business's page.

EDIT: A suggestion below suggests using webform, but as far as a I can tell, there is not a way to display the results of the form within another node. So, although webform presents a way to submit reviews and for me to see the results, there is no way to display them without manually inputting the average ratings into the  nodes that the reviews are related to.


texts: How do I set checkboxes programatically in a profile?

texts:
I've added a new checkbox list to my profile, and now need to import new profile from an XML file.

my checkboxes look like this....

Subscribed
[x] A
[ ] B
[x] C
[ ] D

If the XML shows they are subscribed to "A" and "C" how do I set this in the new new profile?

I'm doing simple fields like this...

$new_user = array(
  'name' => $node->Username,
  'pass' => $node->Password,
  'mail' => $node->EmailAddress,
  'status' => 1,
  'init' => $email,
  'roles' => array(
        DRUPAL_AUTHENTICATED_RID => 'authenticated user',
        3 => 'custom role',
  ),
  // Simple fields like this...
  'field_first_name' => array(LANGUAGE_NONE => array(array('value' => $node->FirstName))),
  );

user_save('', $new_user);

But how to do it for checkboxes...


texts: How to give user opportunity to select attribute by checkbox

texts:
I use exposed filters in Views to give user opportunity to chose attribute of product. After his checking filtering starts automaticly.
But problem is that format for chosing is drop menu. Is it possible to use checkboxes or radio buttons? It will be more userfriendly....


texts: Version 5.9: Which components does "drush site-alias --local" look for in ~/aliases.drushrc.php?

texts:
In version 5.9, "drush site-alias --local" returns what I consider to be non-local sites, because they each have a remote-host and a remote-user component set in  ~/aliases.drushrc.php.

I don't understand part of this excerpt from "drush help site-alias":

--local   Only display sites that are available on the local system (remote-site not set, and Drupal root exists).

What does "remote-site" refer to -- some other component in  ~/aliases.drushrc.php?

Thanks,

Glo


texts: Drupal 7: How to use CKeditor with Rules email

texts:
I'm trying to do the following to allow the CKeditor to be used with a rules-base email:

function mymodule_form_rules_ui_edit_element_alter(&$form, $form_state, $form_id) {
  $form['parameter']['message']['settings']['message']['#type'] = 'text_format';
  $form['parameter']['message']['settings']['message']['#format'] = 'full_html';
}

However, I receive the following warning among others:

Warning: htmlspecialchars() expects parameter 1 to be string, array given in check_plain()

And the email I receive contains "Array" as the body. Seems like the issue is outstanding here: http://drupal.org/node/1031160

Is there a way to convert the output of CKeditor into a string?

Right now, I'm kind of missing the days where you just told CKeditor where not to show up.


texts: How do i change the button text "subscribe", from the "simplenews" module, in drupal 8?

texts:
I'm very new to drupal and programming.

I simply want to change some text on the simplenews "subscribe"/"unsubscribe" buttons.

From past questions I understand the only solution is programmatically? I've seen the hook_page_alter() method mentioned but I am not experienced enough to get it to work.

This is my poor attempt at utilizing it:

 function MYTHEME_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'simplenews_subscriptions_block') {
       $form['New button text'] = array(
           '#markup' => '<p> New button text </p>',
       )
    }
}


texts: Add css-class based on productpages' top level taxonomy term

texts:
So I have a website (created with drupal 7) where each product is linked to a taxonomyterms. This was done so that all products can easily be divided into several different categories.

So I have a taxonomy that looks somewhat like this:

Top level item 01

Level 2 item 01
Level 2 item 02
Level 2 item 03

Top level item 02

Level 2 item 04
Level 2 item 05
Level 2 item 06

Every 'top level' term (or categorie) has links that need to be in their own color.
For Example: The product that is linked to the term 'Top level item 01' and all linked subitems need to have 'red' links. While the product that is linked to the term 'Top level item 02' and all linked subitems need to have 'blue' links.

I was thinking of adding a css class somewhere in my theme so that I could do something like:

.red a { color: #f00; }

But I can't seem to find how I should do that. Can aynone help me with that?


texts:
I am using v7.14 and with comment module, it's observed that following SQL error appeared occasionally when posting a comment, any idea about the root cause of the issue ?

The website encountered an unexpected error. Please try again later.
Error messagePDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '70-2-content_access_rid' for key 'PRIMARY': INSERT INTO {node_access} (nid, realm, gid, grant_view, grant_update, grant_delete) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5), (:db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11); Array ( [:db_insert_placeholder_0] => 70 [:db_insert_placeholder_1] => content_access_rid [:db_insert_placeholder_2] => 2 [:db_insert_placeholder_3] => 1 [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => 0 [:db_insert_placeholder_6] => 70 [:db_insert_placeholder_7] => taxonomy_access_role [:db_insert_placeholder_8] => 5 [:db_insert_placeholder_9] => 1 [:db_insert_placeholder_10] => 0 [:db_insert_placeholder_11] => 0 ) in node_access_write_grants() (line 3417 of D:\wordpress\drupal\modules\node\node.module)...


texts: I see that in views the Rewrite the output of this field option affects all rows. Is there a way, using php or something, to rewrite the output of row #4 only?


texts: Default sort order on the other table columns

texts:
I render a table with theme_table() and use tablesorting (sql) for that. It all works fine.

Except for the intial/default sort on the other tables. No user sort option defined yet. Example:

Name | Age ▼

Sort by "age" is defined in the $header. User clicks on "Name". That now gets sorted ascending. Regardless! I need descending.

Click:

Name ▲ | Age

But I need/want:

Click:

Name ▼ | Age

Studying the code that determines the default sort order, in tablesort_header, I come across the following:

else {
  // If the user clicks a different header, we want to sort ascending initially.
  $ts['sort'] = 'asc';
  $image = '';
}

I see no way to avoid this. Do you? Did I miss some parameter, option? I refuse to believe that Drupal makes such a silly assumption without letting developers override it.


texts: Why am I getting an error message in my dashboard for unprotected private files?

texts:
I have a site with Drupal 8.9
Why am I getting an error message in my dashboard for unprotected private files ?
When I go to the link it says this is for Drupal 6 and 7.
PRIVATE FILES DIRECTORY
Not fully protected
See https://www.drupal.org/SA-CORE-2013-003 for information about the recommended .htaccess file which should be added to the private:// directory to help protect against arbitrary code execution.

https://www.drupal.org/forum/newsletters/security-advisories-for-drupal-core/2013-11-20/sa-core-2013-003-drupal-core


texts: drupal not detecting function in custom module's inc file

texts:
I have a custom module, in my module call commerce_discount_add_line_item() function, it exists in commerce_discount.rules.inc,
this modules is installed correctly and status is enabled but when I call it returns:

  ( ! ) Fatal error: Call to undefined function
  commerce_discount_add_line_item().

It is strange, why has this happened?


texts: How can I add a skip button above the webform (with multistep)

texts:
I use webform with multistep for a quiz. I want to add a "skip" button (equivalent to the submit/next button in the bottom of the form) above the form so that people can go directly to the next question without having to scroll down the page like that :

"
Skip this question

My form

< Previous | Next >"

I succeeded to add an another submit button (check code below). But when I click on this button it returns to the previous step instead of going to the next step ... I don't understand why .. And I can not put it above the form.

function mytemplate_form_alter(&$form, &$form_state, $form_id) {
  switch ($form_id) {
  case 'webform_client_form_13':
    $form['submit'] = array(
      '#type' => 'submit',
      '#value' => t('skip'),
    );
    break;
  }
}

Have you got an idea for help me ?

Thanks you for advance

PS : sorry for my bad english


texts: How to ensure that features dont get overidden

texts: I tried many times with many setting in features but when i add it and enable it always its overridden and i have to go and revert it. Basically block settings and strongarm have to reverted. So is there anything that i ensure while creating features such that it does not get overridden.


texts: How do I override the taxonomy default content?

texts: I'm coding a way to display the taxonomy terms, and I don't want some of the term pages to report "There is currently no content classified with this term." I need to remove that message form the term pages with no content, but let the content be listed like normal when there is content associated with that term.


texts: How to disable change of date field value in webform

texts:
I have created a webform using Webform module. I have used field date, which I use as access date. I want user not to edit this date. Then what do I need to do?
I have tried min date and max date as today in field setting. But, I want user not to be able to select also.
Any one has an idea to disable date field or auto save today's date?


texts:
I'm using Gmap with the Clusterer option enabled, and it is working fine. However when you click the cluster it shows the marker, but no title inside the popup window. What I would like to happen is for the link to the user next to the marker in the popup.

I've already read node/329281 and it was not helpful. I was also able to identify where in clusterer2.js to make the changes, I just need to know how to rewrite the function. Any suggestions?


texts: Show users a different page (depending on their role) after logging in

texts:
In my site I have two different roles for users named recruiter and candidate. when they register their account they can choose their role (recruiter or candidate). And when they login my site I will check user is recruiter or candidate. after this check I will show them a different page (recruiter page and candidate page).

How to proceed with this?


texts: In a custom module I create a file and then use drupal_goto to download it. How can I delete the file after it is downloaded? Placing a file_unmanaged_delete after the drupal_goto doesn't get executed, and hook_file_download happens before the download for permissions checks and such. So I'm not sure how to do this. Do I have to resort to cleaning up files in a folder with cron somehow?


texts: How to get a list of modules implementing hooks?

texts:
Is it possible to get a list of defined hooks for debugging purposes?

I have implemented mymodule_datalayer_meta() for datalayer's hook_datalayer_meta(). However, as far as I can tell, it's not firing. I'd like to look up a list of hooks that modules implement so I can see if my module is actually implementing it or not.


texts: Edit view link redirected to preview link automatically

texts:
I have opened edit view option on localhost using Drupal 7. firstly, the requested page i.e http://localhost/xxx/drupal/admin/structure/views/view/products/edit/block_14?destination=node open successfully, however, It automatically redirected to edit preview link i.e http://localhost/xxx/drupal/admin/structure/views/view/products/preview/block_14. I have tried to find the problem but not able to do.

kindly assist me.

Thanks in advance.


texts: How to add a checkbox to a Content Type and act if box is set to true or yes

texts:
Module name, 'text_grabber'
Content Type, 'node' name 'essay'
**When I enable this module, I want a checkbox to be added to the ~/node/add/essay page. So when an user adds a new essay to the site they can select yes on the checkbox that will enable the text_grabber module for that specific essay.
If the user selects yes, I want to be able to add a js script specific to that essay before it is saved. This will allow me to execute code if event is triggered. Is this possible.

I think I can add a checkbox using an .install like mentioned here: Using field_create_field and field_create_instance to add a checkbox to a content type

but the other part, what can I do?? In layman's terms, I am not tremendously experienced.


texts:
I don't know what the problem is, but why don't after_update fire? I can replace it with insert and it works but this doesn't for some reason.

function maillist_user($op, &$edit, &$account, $category = NULL){
    if($op == 'after_update'){
        maillist_register_submit();
    }
}

What I am trying to do is as soon as a new user is registered to my site I want to use that uid but I can't figure out how to get that uid.


texts: page tpl pattern for a page with contextual parameter

texts:
I create a views with contextual filter and it's path is prodcuts/%, I know I can create a tpl for views but I need some more, I want to create a page tpl for this,( I want do another thing in that page  ),
what is pattern file name for this page?


texts:
I had a site in Windows installed inside xampp.  I copied the same site's folder and database from windows-xampp installation to Ubuntu's www folder (Lamp) . The menu links are not working now. localhost/sitename directs to the homepage . But when I click on any menu items , it says

  The requested URL /sitename/latest/11 was not found on this server.

I could not figure out if this is problem of localhost or menu or database?

I can't even login because users/login is also not working.

Any suggestion or any links to the articles that I should read to solve this problem  would be great. Thank you .


texts: Page refresh required to see node_save changes written in hook_node_view?

texts:
Trying to assign a target id to EntityField (field_family_log) on a node (study node-parent node) in hook_node_view(). I have added some conditions to check and assigned target_id to the node. However, to see the assigned target node, requires refreshing the page!

target node is assigned during the first page load, but to see the changes on the browser, requires page refresh/load.

Current code:

function study_node_view($node, $view_mode, $langcode) {

  if ($node->type == 'study') {

    if(!isset($node->field_family_log)) {
      $log_nid = get_family_log_if_exists($node->nid);
      if (is_numeric($log_nid)) {
          $node->field_family_log['und'][0]['target_id'] = $log_nid;
          node_save($node);
          drupal_set_message("Log assigned");
          //return $node;      //..... this line also did not help! ......
      }
      else {
          drupal_set_message('No Log created for the family');
      }
    }
  }
}


texts: How do I add watermark to the image with insert module

texts:
I use the combination of Wysiwyg and Insert modules to insert image.

How do add watermark while upload the image?

Can the watermark selected in certain taxanomy?


texts: Adding new website as multiwebsite under existing drupal website

texts:
I have an existing Drupal website. I want to add a new website as a sub website under the existing website. I want both websites to share single database / modules.

I googled about it but didn't get use full information about.

Can anyone please explain how to add a new website as a child website of existing Drupal website?

Thanks


texts:
I would like to hide the items marked in the image. But as it turns out, they aren't stored an Array as we are used to in Drupal (at least as far as I can see).
How can I unset or hide them. Hiding by using CSS isn't an option.


texts: Passing theme suggestions to radio and checkbox children

texts:
I have a simple radio button defined by with following YAML:

country:
  '#type': radios
  '#title': Country
  '#options':
    1: 'England & Wales'
    2: 'Scotland'
  '#required': true
  '#theme_suggestion': minimal

The #theme_suggestion is my addition, in my .theme file I have the following code:

function HOOK_theme_suggestions_alter(array &$suggestions, array $variables, $hook) {
  if (isset($variables['element']['#theme_suggestion'])) {
    $suggestions[] = $hook . '__' . $variables['element']['#theme_suggestion'];
  }
}

The combination of these options successfully allows me to override the twig templates for fieldset and radios e.g.:

<!-- FILE NAME SUGGESTIONS:
   x fieldset--minimal.html.twig
   * fieldset.html.twig

   x radios--minimal.html.twig
   * radios.html.twig
-->

However, these suggestions do not get passed down to the children (form_element, form_element_label and input__radio), I cannot find any documentation or examples on how to do this.


texts: Replacing field result with hook_views_pre_execute when replacing SQL query

texts:
I have a simple page view (unordered list) with just one field (content: path) and one contextual filter (nid). The view isn't displaying the right path if the language of the selected node is not the current site language.

For that reason i've decided to replace the query and try to get the aliased path of the selected node. I've used hook_views_pre_execute and already replaced the query for this view. The query already shows up in the preview section in Views UI but the result is empty now. The query works in phpmyadmin.

I can't find much documentation about this hook. How to get my query to replace the views Path field and display the result instead?

This is my SQL Query:

SELECT ua.alias AS alias
FROM
{url_alias} ua
WHERE  (ua.source = 'node/247')
LIMIT 1 OFFSET 0

This is my function from my custom module:

function views_node_path_views_pre_execute(&$view) {
 if($view->name == "global" && $view->current_display == "node_path_page") {
  $myQuery = db_select('url_alias', 'ua')
  ->condition('ua.source', 'node/' . $view->argument['nid']->value[0], '=')
  ->fields('ua', array('alias'));
  $view->build_info['query'] = $myQuery;
 }
}

EDIT:

Just fixed it myself with hook_views_post_render from views API. I know, it's just a dirty hack and i don't really like it but i need this part to be working.

function views_node_path_views_post_render(&$view, &$output, &$cache) {
 if($view->name == "global" && $view->current_display == "node_path_page") {
  $result = db_select('url_alias', 'ua')
   ->fields('ua', array('alias', 'language'))
   ->condition('ua.source', 'node/' . $view->argument['nid']->value[0], '=')
   ->execute()
   ->fetchAll(PDO::FETCH_NUM);
  if($result) $output = '/' . $result[0][1] . '/' . $result[0][0];
 }
}


texts: How to make an existing private OG group and its nodes public?

texts:
I use Drupal Commons 7.x-3.12 (uses OG 7.x-2.7). There, I have a private group with private posts. (Means, the group node uses privacy settings "Joining requires admin approval" and "Hide contributed content from non-members").

I want to make this private OG group public, and all content nodes in it.

So I tried and set "Privacy settings: Any site member can contribute" when editing the group node, and rebuilt the permissions. This made the group node publicly visible, but none of its content nodes – neither those created before nor after this change.


texts:
I just setup a new website, and when I test it in IE8 the browser totally crashes. I tried to scale the site back to almost nothing and it still crashes. It is using the Zen starter kit theme. When I load the main Zen theme it is fine.

http://vento.websitewelcome.com/~getgggco/


texts: Exposed filter for file field on filename

texts: I have a content type with a file field.  Is there a way to create an exposed filter in a view for the filename of a document in a file field?  I can get the filename to display in the view by using a file formatter or PHP, but I can't figure out how to allow the user to filter on the document filename.  I also need the filtering to be a contains, not an equal to, so they can enter partial filenames and get results.


texts: Entering inner fields after attaching a field collection entity programmatically

texts:
CONTEXT

Adding a node with its field-collection field and inner fields programmatically. Saving the node. Then trying to reach the inner fields - bam! - they are not in the array!

MORE INFO

if I am adding the node manually (not by code) and then trying to get to the inner fields - they ARE there.

[Edit] - The same problem of undefined inner field happens if saving using VBO (Views Bulk Operations module). So, can it be that the structure is bad? However, I have built the collection field using the manual interface only, not by code.

CREATING A NODE WITH FIELD COLLECTION

$node = // Creating a node
$fc_item = entity_create('field_collection_item', array('field_name' => $field_machine_name));
$fc_item->{$field_machine_name}[$node->language][$index][$value_column_name] = $field_value;
$fc_item->setHostEntity('node', $node, $node->language);
$fc_item->save(TRUE);
$node = node_submit($node);
node_save($node);

TRYING TO GET INSIDE FIELD COLLECTION JUST MADE

$value = $node->field_coll_print_authors['und'][0];
print_r($value);

I get:

Array
(
    [value] => 278 // This is the field collection item id
    [revision_id] => 1533
)

However, what I would have expect, and what I actually DO HAVE when adding a node of the same type by hand is:

Array
(
    [field_print_author_last_name] => Array
    (
        [und] => Array
        (
            [0] => Array
            (
                [value] => amir // This is the value I need
            )
        )
    )

HELP

Well, is there any function I have not called in order to attach the field collection item properly to the node? Or something else is missing?

Thanks for your help!


texts: How to add rdf mapping to custom entities?

texts: How to add specific rdf mapping (ex dcterms) to custom entity fields?


texts: How can I add commerce product automatically when saving a node 'product display'

texts:
I want to create a default product reference with the price to zero, title to node_title, sku to author_node_title. So each time I create a display product node type I haven't to fill the product reference info. If I created one display product node type -> system will create one product and auto reference that product to display product node.

Thanks in advance!


texts: Remove colons from Drupal form fields/labels

texts: How can I remove the : from appearing after every label in forms made with the Drupal Form API?


texts: How to fallback to default language when listing nodes in a view if no translation is available

texts:
I have a list of projects, mostly in english, but some are translated in French.

When i visit the French version of my website, how can I list all projects that are translated in French and if no translation is available for a specific node, display the english counterpart.

Is that something possible in the view UI ? Or I'm guessing with a hook_query_alter.

Thanks,


texts: I am using Services 3.x with Drupal 7 and trying to expose a custom field added to the User object through the services. What is the easiest way to implement it for all operations (create, retrieve, update, delete)?


texts: Trying to get my form_alter function to be more specific

texts:
I'm hiding access to a specific fieldset within the Support Ticketing System module add a ticket page. I use a form_alter preprocess function to find the page's form id as such:

drupal_set_message($form_id);

I discover the ID is:

support_ticket_node_form

... perfect so I do:

function MYTHEME_support_ticket_node_form_form_alter(&$form,$form_state,$form_id){
  $form['subscribe']['#access'] = FALSE;
}

... to hide that but the fieldset does not get hidden.

However, if I do a generic form_alter:

function MYTHEME_form_alter(&$form, &$form_state, $form_id) {
    $form['subscribe']['#access'] = FALSE;
}

... That works, the fieldset is now hidden on the page. The only thing I could think of that I am doing wrong is that it seems odd to have form_form_alter as part of the string but one is from the form ID and the other is part of the function so it should be working. Not sure what i am doing wrong. I'm guessing the generic form_alter that works for me could be dangerous as it lacks specificity and could cause issues down the road so I'd like to get this sorted out.


texts: Adding a configurable form to an entity display

texts:
I am trying to attach a configurable form with multiple fields (including text fields) to an event product entity display page so end users can enter registration information into fields on the event product page.  The idea is to allow a store owner to create several different sets of registration forms for different types of event products.  Does anyone know of a way to do this or of a Drupal 8 contributed module where something similar has been done that could be used as a reference example?

I thought there might be a way to use a custom entity bundle for the form and simply add an entity reference field to the parent entity.  Since the list of fields varies by product, the form has to have fields that can be customized by the user.

This in not a Commerce-specific question.  I just want to know how to add a site owner configurable form to an entity.


texts: Drush on windows - Command pm-enable needs a higher bootstrap level to run

texts:
I installed aquia drupal and added a core drupal folder into the sites list.

I also installed the windows installer of drush, it works ok for downloading modules but when I try to enable them I get this screen:

C:\Documents and Settings\Administrator\Desktop\drupal>drush en ctools
Command pm-enable needs a higher bootstrap level to run - you will       [error]

need invoke drush from a more functional Drupal environment to run
this command.
The drush command 'en ctools' could not be executed.                     [error]

Drush was not able to start (bootstrap) the Drupal database.             [error]

Hint: This error often occurs when Drush is trying to bootstrap a
site that has not been installed or does not have a configured
database.

Drush was attempting to connect to :
  Drupal version    : 7.9
  Site URI          : http://default
  Default theme     : garland
  Administration theme: garland
  PHP configuration : C:\Program Files\Propeople\Drush\Php\php.ini
  Drush version     : 5.0-dev
  Drush configuration:
  Drush alias files :
  Drupal root       : C:/Documents and
Settings/Administrator/Desktop/drupal
  Site path         : sites/default
  Modules path      : sites/all/modules
  Themes path       : sites/all/themes
  File directory path: sites/default/files
  %paths            : Array

You can select another site with a working database setup by
specifying the URI to use with the --uri parameter on the command
line or $options['uri'] in your drushrc.php file.

Anyone know how to solve this?

As a side note, whats the easiest way to get drush with the bash working on windows? Any good tuts?


texts: How to disabled Statistics module for role or anonym users?

texts:
I use Statistics module (Drupal core modules) on my site to get node's view count. How to disabled this function for role or anonym users?

Like that in template.php:

function MYTHEME_preprocess_page(&$vars) {
  if (!$logged_in) {
    // Code for disable Statistics module
  }
}


texts: jQuery's $(this), closest() elements with ajax commands

texts:
I have a table with this structure.

...

    Some icon

        Some Title

    Some Text
    Some Text

&nbsp;

...

...

Whenever the users click the title field, I want to show only the closest
's formHolderTd and insert my custom form to it.
I want to do this with Drupal's AJAX, but commands like ajax_command_insert() or ajax_command_html() affect all formHolderTd, not the child of the closest

.
Is there any way to add an additional jQuery's closest() or find() methods to ajax commands, or do I have to create a custom ajax command for this?

Here is my testing callback:

function load_service_form($js = NULL) {
  $output = render(drupal_get_form('servicesForm'));
  if($js) {
    ctools_include('ajax');
    $commands = array();
    $commands[] = ajax_command_html('.formHolderDiv', $output);
    print ajax_render($commands);
    exit;
  }
  else {
    return $output;
  }
}


texts: How to get translated term name from TID in views field template?

texts:
For a complex view, I need to alter the output of a localized term field: instead of putting out the TID of the term, I would like to render the localized term name.
Does someone know how to alter the {{ output -}} in template file views-view-field.html.twig?


texts:
I'm following along on the blog post "Use Views to Create an Alphabetical List of Taxonomy Terms" by Kristin Brinner http://getlevelten.com/blog/kristin-brinner/drupal-tutorial-use-views-create-alphabetical-list-taxonomy-terms and my sample does not produce the results as she shows.

Part 1 & 2: I successfully created a new view selecting taxonomy terms (create as Grid), then grouped terms alphabetically (add Taxonomy term: Name, label it "Grouping", exclude from display, rewrite to max length = 1), then under Grid-Settings use "Grouping"

Part 3, Create a Views page for each letter of the alphabet: I can't see these results, but I presume I did this correctly, using contextual filters,  (Glossary, Character limit 1)

Part 4, Create A-Z list (create a block that will display the list of first letters in a cute list above the grouping grids) isn't working. Here is what the tutorial says should be the result:

I followed along exactly with the tutorial except When the filter value IS available, the tutorial says Specify validation criteria, Basic Validation, Hide View and I do not have Hide View available.

I don't have an option to Apply, only Save. My content continues to look the same as it did previously in the exercise, i.e. like this (graphic omitted because I don't have enough clearance on this site)

However when I put "S" into the Preview with contextual filters, I get
(graphic omitted because I don't have enough clearance on this site)

So, it looks like it's almost working. Ideas? TIA


texts:
I'm using drupal 8 and the scheduler module to automatically unpublish custom content after x days have passed.

While unpublishing a boolean field from the custom content needs to be enabled/disabled.

So far I tried rules module after_a_node_has_been_unpublished_by_scheduler with Condition: Entity has field with Action: Set a data value Unfortunatelly the action does nothing.

What else could I try?


texts: How to restrict user to chat with another user based on their payment and subscription?

texts:
I'm new to Drupal. I need to make a consulting website, where I need to restrict user from chatting. The user can chat only with the consultant they paid for. User can participate in forums as they are free of cost.

Any suggestions about how to implement this?

Note: for normal chat concept, I use DrupalChat.


texts: Why do my custom javascript modules not work anymore after updating bootstrap?

texts:
I have some custom javascript modules in my Drupal site that worked perfect. Yesterday I performed an update for bootstrap and unfortunately the custom javascript modules doesn't work.
I get bellow errors to chrome developer tool console:

  Uncaught TypeError: $ is not a function

If you want to see the problem, you can here: http://www.neashmera.gr/


texts: Slideshow of images which are not a field of node

texts:
I have used FlexSlider module to create an image slider. It works perfectly. I create a content type, with image field, create several nodes of that type, and finally I create a View of that content type. In the Format of the View, I can choose the FlexSlider style, and I am done.

What I want is to use several large images, which are many (3.000) images, and instead of creating 3.000 nodes, I would like to have the images externally, in a folder and referenced by a table of its own, and do a Flexslider using the View that already have, with mimimum modifications. Is it possible to get the same effect but without using nodes? If I load the images into nodes using Feeds, it takes ages, and I have some problems, so decided to go with the images outside of the nodes. Maybe a SQL alter could do it?


texts: Batch API processes next operation if existing operation is taking too much time

texts:
I am using batch api for processing the operations.
In my operation I am sending xml request to different-different external server and waiting for its response, after getting its response I am processing it.

But sometimes it is taking too much time.
In case where it is taking too much time (If response is taking more than 2 minute). I want to process the next operation.

I checked batch_set but could found the way.
How to implement it?


texts:
I want to build a widget for a own field type. In the function formElement() of my widget I want the elements wrapped in a div. For this purpose exists the container element. So I build my form:
  public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {

    $element['myitem'] = [
      '#type' => 'container',
      '#attributes' => [
          'class' => ['my-item'],
      ],
      '#attached' => [
        'library' => [
          'mymodule/mylibrary',
        ],
      ],
    ];
   $element['myitem']['label'] = [
    '#type' => 'select',
    '#title' => t('Label'),
    '#default_value' => isset($items[$delta]->label) ? $items[$delta]->label : NULL,
    '#options' => $options_for_label,
  ];
  //… more elements

  return $element;
}

The rendering of the form looks like I wanted.  But the form entries will not be saved. There are no errors and none of the elements were attached to the entity and persisted in the database.
If I don't use the container element and place my elements direct in $element like this:
 $element['label'] = [
  '#type' => 'select',
  '#title' => t('Label'),
  '#default_value' => isset($items[$delta]->label) ? $items[$delta]->label : NULL,
  '#options' => $options_for_label,
];
//… more elements

then all will be saved.
How can I get my widget-form elements be wrapped within a div for styling?
(A similar question using container element within form widget, here with focus at form state was asked 3 years ago, but without answer :-( )


texts:
I am having a problem with my custom blocks rendering, and I want to programmatically manipulate the blocks to troubleshoot the issue.

I used this question to add this hook to my module:

function mymodule_block_view_alter(array &$build, Drupal\Core\Block\BlockPluginInterface $block) {
  drupal_set_message($block->getBaseId());
}

However, when I navigate to my site, I see only the base ids of system blocks:

- page_title_block
- system_main_block
- help_block
- local_tasks_block

My site's header and footer are made of custom blocks, so I should be seeing their ids.

How can I programmatically access my custom blocks?

Edit this is my actual code:

$ cat my_block_hooks.module
<?php

function my_block_hooks_block_view_alter(array &$build, Drupal\Core\Block\BlockPluginInterface $block) {
  drupal_set_message(__FUNCTION__ . "() id: " . $block->getBaseId() );
}

And here's a screenshot:

You can see that all the system blocks show up, but my custom block does not.

This is the custom block as I have it set up:

And here I have it placed in the layout:

And of course, I've cleared the cache many times to get to this point.

What am I doing wrong?


texts: Can I download all data from drupal.org?

texts: Does drupal.org make any data dumps available for the content it hosts? I would love a full dump of module / theme / distribution data, etc. without having to scrape the site.


texts: Drupal commerce user based percentage discount

texts:
I need to have different order total discount rates in % for each customers. The default discount is 10% for all users and it need to be override for certain users too. i.e administrator can set the different discounts such as 12% for user1 and 15% discount for user2 etc on a specific interval (between valid from and to dates). Is it possible using rules or custom module?

Please help.


texts: How can I theme individual fields in a row?

texts:
I'm having trouble doing something that I think should be relatively simple Drupal 8 views.

I have a content type called Countries. I would like to display the 3 latest country nodes on my homepage in a views block. Each country is displayed with the class "views-row" on the container div. I am using views--view--unformatted--countries--block_1.html.twig to theme the output.

I would like to output something like the following markup:

Title of node

Title of node

Title of node

The problem I'm having is accessing individual fields in the template.
If I use a view mode, I can access individual fields. If I select "show fields" in the view, I can add a field for "view result counter" and "path", which would allow me to add the "view-row-N" class and link the a tag to the node, but I can't get access to the fields individually. I have the {{ row.content }} variable, but any attempt to dig further into the variable (eg row.content.field_name) gives me nothing and calling a {{ dump(row.content) }} crashes the website.

I can't output this as a view mode for 2 reasons. I don't have access to the "view result counter" or "path" fields in a view mode and, even if I had these variables, some fields would be nested inside others (The image and title are nested inside the )

I feel this should really be as simple as

etc but I've tried everything I can think of. Am I completely on the wrong path?


texts: Drupal 8:How to add tags for custom content types

texts:
Newbie here!

I go to Structure > Content types > Add content type and create a new content type.

But how can I add tags to my new content type, just like when you go to Content > Add content > Article, you get the option to enter a title, tags and body.

How can I add the capability to add tags to my new content type?

Thanks


texts: Changing commerce_line item quantity to 3 decimal places

texts:
I need to change the precision of Drupal commerce quantities to 3 decimal places.

To do this I edited drupal_commerce_line_item and changed the quantity field from decimal(10,2) to decimal(11,3).

Is this OK? (don't want repercussions) and is there anything else I need to do?


texts: How to set multiple domains for one language

texts:
I have a multilingual site with Drupal 7 using subdomains like en.example.com to detect the language. Everything works like expected, but I have a mobile version of the website witch I want to be accessible by domains like en.m.example.com etc. How do I do this? I can set in admin/config/regional/language only one domain per language, but would have to set two in order to get that working, like:

for English:
en.example.com & en.m.example.com

for German:
de.example.com & de.m.example.com
etc.

(I would like to have the same structure as Wikipedia has.)
The problem is, that using subdomains for language selection, Drupal creates all internal links as absolute pathes. For example, a menu link will be created as:

test

and not as

test

So, I could create a domain alias with Apache, to send requests from en.m.example.com to en.example.com, but all internal links would bring the user back from  the mobile version to the normal. How can I solve this problem?


texts: how to pass param to js for custom page in drupal 8 ?

texts:
I want to pass variable to js for my custom page. Tried below code which is working fine with static value. But I m not able do same thing with existing variable of custom template.

    function test_theme($existing, $type, $theme, $path) {
        return [
            'test_template' => [
                'variables' => [
                    'nDetails' => null
                ],
            ],
        ];
    }

 function test_preprocess_page(&$variables) {
        print_r($variables['nDetails']); // its showing empty???
        $routeName = \Drupal::routeMatch()->getRouteName();
        if ($routeName == 'test.content') {
            $variables['#attached']['drupalSettings']['test']['data'] = $variables['nDetails'];
    $variables['#attached']['drupalSettings']['test']['dataa'] = "work fine";
        }
    }

class TestController extends ControllerBase {
    public function content() {
        return [
            '#theme' => 'test_template',
            '#nDetails' => "test1"
        ];
    }

Is something wrong with above code? Or there is another way to pass variable to drupal setting from controller itself?


texts: Two Similar terms are not visible in autocomplete

texts:
I categories and subcategories. Some sub-categories are the same (they have the same name). The user creates content (node-creation), but the autocomplete input shows only one term! But there are two identical!

Why? How does it change?


texts: Image field is not showing up in view/block

texts:
I am currently using Drupal 7, and I am trying to get my images to be displayed in a view on the main page. So far I have created:

Created a content type containing a title, body and image field
Created two nodes that both contain an uploaded image
A view and a block that has

fields: title, nid, and image
filtered by: published and type (set to the content type I created)

When I look at my content type I can see the name, body and the image that I uploaded. When I go to the main page, I can see my view with the content, but it only shows the name and the body; it doesn't show the image.

Is there anything I can download and/or do to make this work? I just want the images to appear within the block (in my view).


texts: Render array to markup after submitting a form

texts:
In my Drupal 7 custom moudle, i would like to output result of form as an formatted array.
Simmilar like you can print_r or printf arrays.

 $form['results'] = array(
            '#type'     => 'item',
            '#markup'   => $form_state['temporary']
)

so  $form_state['temporary'] is array, but i do not want "array" text to show up but formatted array representation, whatewer is in it.

Thanks!


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

texts:
I have a view listing all recent blog posts that have been published on the website.
These blog posts can be created either by regular authentified users or by staff members.

I need nodes published by staff members to be themed differentely to be highlighted.


texts:
I haven't changed it in /admin/structure/blocks and it is still there.

All that I can think that I installed a few modules to try them out and then disabled them and maybe that caused it.

In any case, my users can't log in and I am in big trouble.

How to go about debugging the problem?  Thanks.

Update: I am not logged in (I see "Log in or register to post comments"). Even when I load /user/logout the login block is not there (not in the HTML)

The "recent log messages" shows nothing out of the way.


texts:
I am using ubercart where I enter different price ranges.

In the left sidebar, I want to display different price ranges like:

less than 20$
21-40$
41-65$
more than 65$

So that whenever I click on one of these items all products in that price range will show up.

Does anyone have any ideas about how to do this?

Thanks.


texts:
I need to save a cookie for anonymous users in Drupal 8 when users visit the site for the first time, which will be used to display a message.

I can successfully save one using setcookie("FirstTimer", 1, strtotime('+1 year')); but I am sure Drupal 8 should have some alternatives.

I can also use the following code.

$user_is_first_timer = !isset($_COOKIE["Drupal_visitor_FirstTimer"]);

When I open it in Google Chrome, this works, but when I open it in incognito or in Firefox, there is no message. Somehow cached pages are being served.

The code is used in an implementation of hook_page_attachments().


texts:
I'm trying to delete user account via REST API.

Here is my code:

// .xml asks for xml data in response.
$service_url = 'http://www.example.com/rest/user/login';

$post_data = [
  'username' => 'test',
  'password' => 'pass',
];

// Format post data as application/x-www-form-urlencoded.
$post_data = http_build_query($post_data, '', '&');

// Set up the request.
$curl = curl_init($service_url);

// Have curl_exec return a string.
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
// Do a POST.
curl_setopt($curl, CURLOPT_POST, TRUE);
// POST this data.
curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
// Output to command line
curl_setopt($curl, CURLOPT_VERBOSE, TRUE);

// Make the request.
$response = curl_exec($curl);
$http_code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);

$xml = new SimpleXMLElement($response);
$session_cookie = $xml->session_name . '=' . $xml->sessid;

// Get token.
$curl_get = curl_init();
curl_setopt_array($curl_get, [
  CURLOPT_RETURNTRANSFER => 1,
  CURLOPT_URL            => 'http://www.example.com/services/session/token',
]);
$csrf_token = curl_exec($curl_get);
curl_close($curl_get);

// A user ID.
$id = 1500;
// The token.
$token = $csrf_token;

// Set up the curl resource
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://www.example.com/rest/user/$id?access_token=$token");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");

$response = curl_exec($ch);

// Close curl resource to free up system resources.
curl_close($ch);

It returns:

  Access denied for user anonymous

How do I need to write the code to delete a user?


texts: How to send Private Message using privatemsg_services module?

texts:
I am using privatemsg services module to create REST API of privatemsg using Services Module in Drupal 7.

I need to know how to send message and how to reply to a message ? Please tell me URL where i should send POST request and the Body of request ?


texts: How to render multiple values of node reference in the form of an ordered list without views?

texts: I have a node reference field that references another node and has multiple values. I want to get an ordered list of the output of that field and display it in the custom node template. I am rendering the node reference as a cck block. Any help or guidance would be greatly appreciated. Thanks.


texts: How to setup module install (sub-folder) paths from the *very beginning* (contrib, custom, features etc) - i.e. not move them after the install

texts:
I've seen plenty of guides saying why it's a good thing to organise modules in different folders... (and I'd agree) e.g.:

Where to put custom modules?
https://drupal.org/documentation/install/modules-themes/modules-7
http://befused.com/drupal/module-directory-structure (particularly like this guide, more folders and options to choose from)

...and how to move the modules to the new place(s) after installation

How to move installed modules from /sites/all/modules/* to /sites/all/contrib/modules/*
https://stackoverflow.com/questions/2654720/drupal-moving-module-folder
How to reorganize drupal sites/all/modules structure without symbolic links?

... but these haven't worked for me, perhaps I need to try again. My site broke, even after trying the registry rebuild and clear cache many times.

So my question is this: How can I run the installation of Drupal to set up the modules to be installed in different folders (e.g. like in examples http://befused.com/drupal/module-directory-structure )?

There doesn't seem to be anything out there if you want your module paths (sub-folders) structured in a certain way, right from the beginning. NOT after the fact.

I want the folders to be set up in the first place, right from the beginning. So example, whenever I use drush to download a contrib module, the module is placed in the contrib sub-folder: sites/all/modules/contrib for example.

Some other references:

Can Drupal be configured to find modules in other locations? - this suggests Drupal can just discover the location, I'm not so keen on this, I'd rather Drupal always know where the modules are rather than having to discover where they are.
Is it possible to change the path of modules/themes installed using an installation profile? - I just want to use the plain vanilla Drupal 7 core install. If I was going to use this option, what would be the minimum I would need to provide in a setup to have module sub-folders?


texts:
I've been evaluating drupal and I'm at a point where I have my header, footer, and sidebar set up properly. I have a basic page node type and I've created a few test pages. My test pages have been very simple, just headers and paragraph tags. What do I do when I want something more complicated?

If my client wants a certain page to have text and images split into multiple columns at different points in the page instead of just one how can I accomplish this when the only input the end user has is a wysiwyg form?

Is there a module for this type of thing or does it require knowing in advance how the client will want to layout each of the different pages and make templates for them all?


texts: Inserting PDF files via the Image icon in ckeditor. Is there a better way?

texts:
I would like to insert inline files throughout the text editor, without having to attach them all at the bottom of the page. I figured out that I can upload them via the image icon, remove the blank image, and then insert the link by browsing to the file I just uploaded. But surely there is a better way?

Can anyone share?


texts: selecting all field_data_body for all content types

texts:
We are trying to search all text_long or text_with_summary fields for all content type nodes.  I can do it for the field_data_body.  I need to expand this for all content types using text_long and text_with_summary.  I would like to iterate all nodes for all content types and select all fields in the node with the text_long and text_with_summary field type.

Here is what I use for selecting just the body.  I use a cursor to search each db which is why I have a v_db variable.  Don't worry about v_db and @j is the search string I pass to the select statement.  I wish there was a nice GUI for visualizing joins.

select "',v_db,'", ',v_db,'.node.nid, LEFT(',v_db,'.node.title,30), LEFT(',v_db,'.body.body_value,300) from ',v_db,'.node INNER JOIN ',v_db,'.field_data_body AS body ON node.nid = body.entity_id WHERE body.body_value like ',@j);

thanks


texts: node_view() doesn't populate the "content" variable when using a custom view mode

texts:
The $content variable is really useful when writing templates, but I've found that it's not fully populated when using a custom view mode.

I'm using node_view to create a render array of a node. When I use "full" or "teaser" view modes, the "content" variable of the array is populated with lots of render information as we're accustomed to using. When I specify a custom view mode, which I have defined using hook_entity_info_alter, this variable is sharply less populated.

What is special about the built in "full" and "teaser" modes that causes drupal to fully populate the render array?


texts:
How to display a warning message on all pages of the site, using rules.
When I created a rule with the action "Display a message on the site," it appears that a single time.
I hope it will display permanence and on all my pages.


texts: How to set the language for the user while it is created?

texts: How to set the language for a user while it is created from admin/people/create?


texts:
I coded some modules (basically only PHP and no alter of Drupal functions), and on mysterious way, two of my modules are producing an empty quote on top of my meta tags in the body.
This causes a 20 empty pixels on top of my page, and destroys my slider.

As mentioned, two modules are producing this; I figured out that the first module produces this when I use include_once("config/rewards.inc");. If I comment it out, everything works fine.
include_once("config/rewards.inc"); is already included in one of my other modules, but I used include_once, to include it, obviously, only once.
include_once("config/config.inc"); doesn't produce this error.

This is a screenshot of Firebug (the arrow point at the margin).

In my first module, the problem happens when I uncomment the line containing require_once("config/rewards.inc").

<?php
//      *****************************************
//      **      Donate Script for Trinity      **
//      **             by Leandros         **
//      *****************************************

//module_load_include('inc', 'donatescript', 'rewards');
//module_load_include('inc', 'donatescript', 'config');
require_once("config.inc");
//Produce problems (for some reason I dont know ^^)
//require_once("config/rewards.inc");

if(user_is_logged_in()){
global $user;
global $donatepoints;
$userip = $user->hostname;
$userid = $user->uid;
$username = $user->name;
$usernameuc = strtoupper($user->name);

//$GLOBALS['reward_items'] = $tab_rewards;
//$GLOBALS['reward_texts'] = $reward_texts;

//Get Variables from config.inc for realmd DB
$db = $realmd_DB['1']['3'];
$host = $realmd_DB['1']['0'];
$dbuser = $realmd_DB['1']['1'];
$dbpassword = $realmd_DB['1']['2'];

//Connect to realmd DB
$connect = mysql_connect($host, $dbuser, $dbpassword) or die (mysql_error());
mysql_select_db($db, $connect) or die (mysql_error());

//query overall donatepoint value
$donate_points_select = mysql_query("SELECT points FROM donate_points WHERE id='$userid'");
while($row = mysql_fetch_array($donate_points_select)) {
    $donatepoints = $row['points'];
}

if($donatepoints == 0) {
    $GLOBALS['donatepoints'] = 0;
} else {
    $GLOBALS['donatepoints'] = $donatepoints;
}

//mysql_query("INSERT INTO `donate_points` (`id`, `name`, `points`) VALUES ('$userid', '$usernameuc', '$donatepoints')");

//Close DB connection
mysql_close($connect);
}
?>


texts: In Views - If no revision is made then revision author shows the node author

texts:
I have a view with 2 columns. One shows the Node Author name and the other one shows Node Revision Author name. The problem is, when a new content is created with no revisions, the Node Revision Author Column shows the Node Author Name.

As per my expectation, if there are no revisions, then the Node Revision Author column should be empty. Is there any way to make this happen in views ?

Or

Is it possible to hide Author Name if Node author = Revision Author ?


texts: PHP evaluated in rule works locally but not on remote server

texts:
I have this code. When I run this on my local server, it works fine but when I run it on the remote server it does nothing. Not even the messages appear. I am using the devel module. Any help appreciated.

drupal_set_message('test');
dpm($node);
// send msg for skills
$arrayofprojectskills = array();
array_push($arrayofprojectskills, $node->field_project_skills['und']['0']['tid']);

$usersprofidstonotify = array();

foreach ($entity_list as $obj) {
    if ($obj->field_skills) {
        $profile1 = $obj->field_skills['und'];
        foreach ($profile1 as $innerar) {
            foreach ($arrayofprojectskills as $oneskill) {
                if (in_array($oneskill, $innerar)) {
                    array_push($usersprofidstonotify, $obj->pid);
                } else {

                }
            }
        }
    } else {
        //drupal_set_message('field skills has no values');
    }
}

$useridstonotify = array();

foreach ($entity_list as $obj) {

    foreach ($usersprofidstonotify as $user) {
        if (($obj->pid) == ($user)) {

            array_push($useridstonotify, ($obj->uid));
        }
    }
}

$arrayofprojectskillnames = array();
foreach ($node->field_project_skills['und'] as $fieldprojinner) {
    array_push($arrayofprojectskillnames, $fieldprojinner['name']);
}

$usersprofidstonotify = array();

$name = dpm($node->name);
$msg = $name;
$msg .= ' has posted a project called ';
$msg .= ($node->title);
$msg .= 'More details:';
$msg .= ($node->body['und']['0']['value']);
$msg .= ' They need the skills of ';
$msg .= implode(",", $arrayofprojectskillnames);
$msg .= 'Can you help them out YEAH!? ';
$msg .= ' If so, please sign up ';
$msg .= 'vid) . '">' . 'here';

foreach ($useridstonotify as $oneuser) {
    privatemsg_new_thread(array(user_load($oneuser)), 'Someone needs your skills', $msg);
}


texts: How to remove CSS files if the page being rendered is a front page in a theme?

texts:
I want to remove default Drupal CSS files if it is a front page in Drupal 7 theme.

Following is the code (got from http://www.grahamgilchrist.com/blog/25) that I am trying to put in the template.php for barktik1 theme. How do I check if rendering page is a front page or not? Only $css variable is passed as an argument to the theme_css_alter() function while for other process functions $variables is passed from which it is easy to determine if it is a front page or not.

function bartik1_css_alter(&$css) {

//do something to check if it is a front page
if ($is_front){
    //make a list of module css to remove
    $css_to_remove = array();
    $css_to_remove[] = drupal_get_path('module','system').'/system.base.css';
    $css_to_remove[] = drupal_get_path('module','system').'/system.menus.css';

    // now we can remove the contribs from the array
    foreach ($css_to_remove as $index => $css_file) {
      unset($css[$css_file]);
    }
    }
}

Thanks!


texts: Page Manager and Panels settings — where do they live?

texts:
I'm continuing my quest to make every piece of common site architecture into something that can be displayed in a View. Right now I'm on Panels panes and Page Manager pages.

I have a site that is most assuredly making use of Panels panes and Page Manager pages on the node display, node edit form, and a few other places. However, when I inspect page_manager_pages, or any other table in the DB that begins with page_manager_ or panels_, the table appears to be completely empty. (I'm using PHPMyAdmin, and it gives me that red cursor with an 'x' in it.)

I haven't been able to find an API call that lists all Panels panes, Page Manager pages, or other relevant data either. And when I have looked through the sites I own to see ones that do have something in the page_manager_pages or panel_panes tables, it seems to be much less than I would expect. (E.g. a large site that is heavily themed with Page Manager and Panels shows up in the db with just two entries in the page_manager_pages table.)

I've even combed through the SQL queries that Drupal does when I click "enable" on a disabled Page Manager page (e.g. the node edit form, the node display), but haven't found anything that looks meaningful.


texts: How do you check if table is empty before resetting the auto increment?

texts:
I have a database table that a user can add to and remove data from within my drupal module. What I would like to do is automatically check to see if the table is completely empty after every delete, in which case I would like to run an "ALTER TABLE" to reset the auto increment to 1. However I am having trouble building a function that does this for me.

How can I implement a function to automatically detect if all fields are empty, and automatically reset the increment without the need to go into the database and apply ALTER SQL manually?

Here is some of the code...

function achievementlist_entry_delete($form, &$form_state) {
foreach(($form_state['values']['table']) as $rows) {
    $num_deleted = db_delete('achievements')
    ->condition('achvmntID', $rows)
    ->execute();
}
    //Here I would like to check the "achievements" database, as well as ALTER TABLE
    //it is empty
}


texts:
I have a form element as follows :

$form['fieldset']['select-user'] = array(
            '#type' => 'select',
            '#title' => t('Select a user'),
            '#options' => select_user_dropdown_options(),
            '#description' => t('Select a user'),
            '#size' => 10,
            '#attributes' => array(
                'style' => 'width:600px',
                'multiple' => 'true'
            )
        );

And in the form submit handler i am processing it as follows :

    /**
     * #submit callback for node_adoption_transfer_form().
     */
    public function submitForm(array &$form, FormStateInterface $form_state) {
        $groupId = $form_state->getValue('select-user-group');
        $groupName = $form_state->getValue('group_name');
        $userId = $form_state->getValue('select-user');
        $groupName = empty($groupName) ? '' : $groupName;
        #print_r($userId);exit;
        foreach ($userId as $key => $value) {
            $query = "select * from {usergroup_user_map} where user_id=$value AND group_id ='$groupId'";
            if (count(db_query($query)->fetchObject()) > 0) {
                continue;
            } else
                db_query("insert into {usergroup_user_map} (user_id,group_name,group_id) values ($value,'$groupName','$groupId')");
        }
     }

But when am printing the $userId its only printing the last value , How to resolve this ?

UPDATE

  my issue solved .I was using '#multiple' => 'true' instead of
  '#multiple' => TRUE , my bad ;) . That saved my day ..


texts: How to insert data to custom table with Drupal 7 without coding?

texts:
I have a school assignment on Drupal 7, and I need some help.

I need to use the Views module to execute subqueries, or any other module you can suggest.

For example, I have a customer who has placed an order. On the order table there is a quantity and the product ID; on the product table there is a unit price.
I am able to use Global:Math Expression to multiple the quantity by the product ID. However, when I try and aggregate this sum to get the total price for the order, it does not work.

From what I can determine, this is because in my list of fields I include quantity, and unit price. (I can not do the math expression without them.) These are unique to each order; when I use aggregate, each row is separate (i.e. no total).

I know there is the View Calc module, by that only allows me to choose one order and find the total. I am trying to create a summary for every order a customer has made and the total prices.

Since I am not allowed to use code, this currently very difficult. Do you have any suggestion?


texts:
When a message is send to the user a message like this is shown to him :

message screenshot

  SMTP -> FROM SERVER: ...........
  SMTP -> FROM SERVER: .......
  ............................................................................
  SMTP -> FROM SERVER: .......
  SMTP -> FROM SERVER: ......
  SMTP -> FROM SERVER: .....................
  SMTP -> FROM SERVER: ................................
  SMTP -> FROM SERVER: .....................................
  Further instructions have been sent to your e-mail address.

I only want the last one: "Further instructions have been sent ..." to show. Is it also possible to personalize it ?


texts: Drush command 'omega-wizard' could not be found

texts:
I want to create a sub-theme with Omega using drush but I get a couple of errors.  I've been trying to solve these problems for a bit now and I need some help.  I'm using OS X and XAMPP as my local web server.

When I change directories into my site:

/Applications/XAMPP/htdocs/joshvocal/sites/all/themes

and run drush omega-wizard I get these errors:

The drush command 'omega-wizard' could not be found.  Run drush cache-clear drush to clear the commandfile cache if you[error]have installed new extensions.
Drush was not able to start (bootstrap) the Drupal database.
Hint: This may occur when Drush is trying to:
 * bootstrap a site that has not been installed or does not have a configured database. In this case you can select another site with a working database setup by specifying the URI to use with the --uri parameter on the command line. See
drush topic docs-aliases for details.
 * connect the database through a socket. The socket file may be wrong or the php-cli may have no access to it in a jailed shell. See http://drupal.org/node/1428638 for details.

I think the problem has something with drush not being able to connect to my database.

I've tried:

Changing my settings.php file from host: localhost to host: 127.0.0.1
Creating a symbolic link with /Applications/XAMPP/xamppfiles/var/mysql/mysql.sock /var/mysql.sock

When I run my drush status this is what is looks like:

I think this is what it should somewhat look like:

I want to know how to fix these errors and be able to run drush omega-wizard to create a sub-theme on omega.

Thank you for your time,

Josh


texts:
Does anyone know an alternative to the module "field collection" ?

While the concept of field collection is very good, I'm having trouble with the collaboration of other modules, like e.g. features or search api. So I'm looking for alternatives.