texts: How to override user_picture per comment?

texts:
I use the facebook connect plugin. By default it downloads the 50x50 pixel facebook image. It luckily stores it as the profile ID, which I can in turn use to look up the large version of the image. So I need way to:

Get the current user_picture for a comment, and then
Override it with a new url.

I have this so far:

function capewinefarms_preprocess_comment(&$variables)
{
    $comment = $variables['elements']['#comment'];
    $variables['comment_create_date'] = format_date($comment->created->value, "custom", "d M Y, H:i:s");

    $variables['user_picture'] =  'BLA';
}

The above code replaces the user's profile pic with the words "BLA". But I don't want that. So I need a way to see what the variables object looks like, so I can see where to get the current value and to change it. But if I do this:

print_r($variables);

It just bombs out and shows a blank screen (as if the variable is blank).

How do I change the user picture?


texts: How to get view expose filter input inside a panel?

texts:
I have crated a panel with a content pane and expose filter block.
Both works well.

Problem is that if i create a filter using "Simple hierarchical select" widget for taxonomy term.
i am not able to get the term id expose filter input;

I am alter the expose filter:

function utility_form_views_exposed_form_alter(&$form, &$form_state,$form_id){
    dpm($form_state['input']);
    array_unshift($form['#submit'], 'manage_custom_filters');
}
function manage_custom_filters($form, &$form_state) {
  //modify form_state values of concerned field
  $form_state['values']['shs_term_node_tid_depth'] = '91';
  //modify form_state of concerned field to pass to the view
  $form_state['view']->display_handler->handlers['filter']['shs_term_node_tid_depth']->validated_exposed_input = '91';
}


texts:
I am seeing lot of SSL errors after enabling SSL for my site.
Following is the common error related to the SSL configuration:

AH01797: client denied by server configuration: /var/www/xxxxxx/.well-known

Is this something related to any settings in our Drupal folder like creating ".well-known" folder or adjusting .htaccess settings or is it related to the Apache settings?


texts: facebook modules: Facebook client API not found at sites/all/libraries/facebook-php-sdk/src/facebook.php

texts:
I installed facebook autopost, drupal for facebook and other facebook modules. But I am received this error in all of these modules

  Failed to find the Facebook client libraries at sites/all/libraries/facebook-php-sdk/src/facebook.php

This is already asked in Failed to find the Facebook client libraries but it doesn't answer my question. This is screenshot of the CPanel

The src directory is selected. As you see Facebook.php is in there, but it still reports the error. I tried to rename the Facebook.php to facebook.php Then PHP reports the error

  Fatal error: Class 'Facebook' not found in /home/***/public_html/sites/all/modules/fb/fb.module on line 477

What is the problem?


texts: D7: Get terms from node and display other nodes with same term in block?

texts:
I have a node that has terms:

Artist1

And need a block to show all the other nodes that has Artist1 as a term

I tried this solution Display the title of related nodes from taxonomy in block

I set it to "Provide a default argument", and configured that to use the nid of the node being viewed... and nothing

this seems simple but been working at it for hours now.


texts: Integrate Webform.html.twig into existing template

texts:
I am attempting to add a webform field into an existing content type which has an associated twig template.  I can add the webform field to a new content type and/or use the default webform content type and the form displays without an issue.  If I add the webform to an existing content type the form does not display.  I tried adding the content from webform.html.twig to the existing content types template but it is still not displaying the form.  I know I am missing something simple here.  I can supply a few screenshots and or the twig files if that would be helpful

thank you for your patience.  I have had the debugging turned on for quite some time now the development version of our site.  The inspect screen appears to suggests the problem with displaying the webform field is in the page.html.twig which I have attached.  Interestingly, I tried adding a few other random fields to the page content type and they do not display either so I am fairly certain now that there is a problem with the twig template.

{#
/**
 * @file
 * Default theme implementation to display a page.
 *
 * @see academyhealth.info.yml
 * @see template_preprocess_page()
 * @see html.html.twig
 *
 * @ingroup themeable
 */
#}

    AcademyHealth
    <button class="header__menu-button"> Menu</button>

       Close

        {{ page.main_navigation }}

        {{ page.utility_navigation }}

          {{ page.search }}

  {#
    A block titled content will be set if pages are extending this template, so
    print that instead of just printing page.content. The templates that extend
    this template, call page.content and place it appropriately.
  #}
  {% set _block_content = block('content') %}

  {% if _block_content is not empty %}
    {{ _block_content|raw }}
  {% else %}
    {{ page.content }}
  {% endif %}

      AcademyHealth

Connect with Us

      {{ page.footer_social_media }}

Navigate AcademyHealth

      {{ page.footer_menu }}

Extras

      {{ page.footer_extras }}

      {{ academyhealth_address_line }} | {{ academyhealth_address_line_2 }} | Tel: {{ academyhealth_phone_number }} | Fax: {{ academyhealth_fax_number }}


texts:
Is there a way to use SQL functions with the EntityFieldQuery class?

What I am trying to do is something similar to the following code:

$query_user = new EntityFieldQuery;

$query_user
->entityCondition('entity_type','user')
->fieldCondition('MD5(user+pass)',null,$user_token,'=')

The interesting part is the EntityFieldQuery::fieldCondition() call.
Obviously this it isn't working, otherwise I would not ask this question.


texts:
I have a Drupal 6 site and am looking for a way to allow my content admins to set up repeat events. I have that set up, but all the repeats are not their own node. I want them to be their own node, so they will appear in my calendar block and in my views on their respective dates.

I've not been able to find a solution in Drupal 6. I found several modules and this one looks promising, but it doesn't seem to be working:
https://www.drupal.org/project/date_repeat_nodegen

The module's page on Drupal says:

  As part of the node editing form, you'll see a question prompting you
  to "Generate each date as a single node". Answering yes (the default)
  will ceate one node for each date in the repeating pattern you've
  specified, as determined by the Date Repeat API. Each node may be
  edited separately after creation and used in views. Answering no will
  create a single node using the repeating pattern, essentially
  disabling this feature for the node.

But once I activate the module and create a new event, I don't see this question in my form. :-(

Can anyone help me be either showing me a better way of doing this or by helping get this module working?

Thanks!


texts: On the password_confirm widget, how do I change the text of "Password"?

texts:
By default, the password change form on the user account page looks like this:

Current password
Password
Confirm password

This is bad usability because it is not clear to users that "Password" means "New password".
So I want to change the strings to this:

Current password
New password
Confirm new password

Under interface translation, it's easy to change "Confirm password" to "Confirm new password" because that string is only used for the confirm password form.  However, I cannot change "Password" to "New password" using the translation interface because this is the same "Password" used on the user login form.
So, I tried to alter this in hook_form_alter() targeting the user account page, but  $form['account']['pass'] does not contain the strings "Password" and "Confirm password":

How do I change the text "Password" only on the Password Confirmation widget?


texts: One Drupal site affecting another cloned site

texts:
I have a weird situation with cloned site, I have copied the entire content from a production server, and made a different directory for testing environment. The steps I did to clone a site is:

Copied all the contents from the main folder /www/d7/ to new folder
/www/test/
Made a separate server config in nginx to browse the content from browser
Original site can be browsed via http://d7.example.com and the copied site can be browsed via http://test.example.com, the nginx have separate logs for both
Dumped the original database after flushing drupal cache, created new database called 'test', with new username 'test' and new password 'test', imported the dumped database to new database 'test'.
Changed the database connection parameter in the file /www/test/sites/default/settings.php to accumulate newly created database.

Now, when I put the production site in offline mode, the test site also goes to offline mode, how come this is possible ? The most weird thing is if I put the site to online mode from test site, the production site also goes to online mode. I even tried creating new database, new database user and changing the settings.php still same issue.

I tried installing different modules to different sites, and the installed modules shows in their respective sites.

Can anyone tell me what's going on here ?

Update with Answer:

As Clive commented below, I changed the memcached_storage settings in settings.php file to $conf['memcache_storage_key_prefix'] = 'test_site'; and I don't have any issues now.


texts: storage_api The file could not be uploaded

texts:
I'm attempting to upload a a file using a custom context type that uses the storage class i defined thru the storage_api module.  For some reason the upload of an image to it is failing with "The file could not be uploaded."  I have the local file system as the initial container and should propagate to an s3 bucket after the upload.

I've tried the built in Content>Media> add file and that works fine.  i think the file lands in public://  However I want to use the storage class from the storage_api.

I see the following in the dblog when i attempt the file upload that fails:

  Message: The upload directory storage-field-corp-image: for the file
  field field_corp_image could not be created or is not accessible. A
  newly uploaded file could not be saved in this directory as a
  consequence, and the upload was canceled.

Not sure where to go from here.


texts: Links in map markers are for default language pages, not localized

texts:
I am building a multilingual website where a page will display all locations on a map. Each marker on a map has a link to the location's page. However, only links to English pages are displayed in markers. I have tried both Geofield Map and Leaflet to no avail.

How can I make urls in map markers to be language specific?

Given the fact that I couldn't find an answer on the web, I might have missed something simple. I am new to drupal and any help is appreciated.


texts: How to identify where a particular block come from?

texts:
I have to modify a block that appears on the home page of the website, that I did not make myself. The block appears in admin/build/block with the title "Block Title (nodeblock)", so I assume that this has  been created by the nodeblock module, but I can't find where I can edit this content.

Can someone help me to find the right administration menu to view and modify this nodeblock content ?


texts: How to get alternative text on image hover

texts:
How to display image's alternative text when an user hovers on that image.

I have come across few posts that displays popups and views, but not the alternative text of the corresponding images. Some of the modules like qTip and Beautytips looks relevant but I suppose those modules doesn't deliver my requirements. If I'm wrong, please let me know how to use those modules to get the alternative text displayed on hover.

Are there any suggestions regarding how to get alternative text on image hover (possibly without views)

Here, I've created a basic page and in the body I've added an image using advanced text editor.


texts: How to create a rule that checks an extra profile field created with the core profile module?

texts:
I have a Drupal 7 site with the Honeypot module installed. Honeypot removes or prevents many spam registrations, but not all. I have extra fields added to the profile e.g. 'profile_field1'. I'd like to build a rule using the Rules modules that either deletes an account or prevents it from being created if the content of the 'profile_field1' doesn't match a certain regular expression.
I cannot find how to create a rule that can handle an extra profile field.
What I'd like to create:

'before saving a new user account'
if profile_field1 does not match RegExPattern
then prevent account from being created

I can find how to create a condition based on the 'regular' fields in the account (such as the name), but I cannot find how to test for the extra fields.

Update 1: the field 'profile_field1' is part of the Users profile, i.e. the Drupal Profile module is enabled. This module is part of D7 and similar in functionality to drupal.org/project/profile (for D8). It's found in [drupal]/modules/profile. Configuration settings are in admin/config/people/profile.

Update 2: I checked in the database. There is no table called 'profile_field1'. The info is in 'profile_field' which defines all fields and in profile_value, which contains all values.
So, e.g. profile_field1 would be fid=1 in table profile_field. Then user 5 (uid = 5) would have a record in profile_value with fid = 1, uid = 5, value = 'content of field'.

Update 3: With the suggestions in the answer I was able to migrate the information from the old Profile to the Profile2 fields. Write up is here: https://www.drupal.org/node/2916659

Update 4: At least I can create a Rules rule now. Just wondering if this is the best:

{ "rules_prevent_spam_registration" : {
    "LABEL" : "Prevent spam registration",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "user_presave" : [] },
    "IF" : [
      { "entity_has_field" : {
          "entity" : [ "account-unchanged:profile-personal" ],
          "field" : "field_profile_field1"
        }
      },
      { "AND" : [
          { "text_matches" : {
              "text" : [ "account-unchanged:field-profile-field1" ],
              "match" : "<regexPattern>",
              "operation" : "regex"
            }
          }
        ]
      }
    ],
    "DO" : [ { "entity_delete" : { "data" : [ "account-unchanged" ] } } ]
  }
}


texts: I absolutely love the Andromeda theme for the site that I am developing, however I have to make use of two logos. The site logo in a standard position (upper left) and a logo for a parent site which needs to be positioned at the bottom right of the footer. How can I do this?


texts: Printable Templates for Views using Print Module

texts:
Any views related report can be printed using the Print module when enabled. This can be achieved by simply using /print/views-url. It uses the standard print.tpl.php.

I do not want the print version of views output to display the exposed filter. At the same time, I would not want to modify the default print.tpl.php.

Is there a way to use alternative print templates for views in the same line as for content types: print[--html|--mail|--pdf][--node--node-type].tpl.php

Thanks.


texts: Priority of execution of hooks in different modules

texts: Let's say that there is a contributed module installed in Drupal 7. It alters a SQL statement from the core. Now I have a custom module of my own which alters the same SQL statement in a different way. Now, depending on the alteration, I could have different SQL strings depending on which module hook applies before the other. For example, the first hook deletes a table "field" and the other adds the same table "field". If the first hooks executes earlier, the final SQL has the field added. If it is now the second hook which executes earlier, the extra field is added and later removed, so the SQL is completely different. How can I now the priority, any other conflicting issues and is there a way to override this apparent difficulty?


texts: How to return drupal error message in php cli

texts:
I am programmatically saving nodes with corresponding photos into a D7 content type.  It's working well sometimes, and failing on others, and I am sure it has something to do with a form field not having the right data.

Typically this would throw an error when manually uploading via the Drupal content type form, but I am using the PHP CLI.  How can I output that message to the CLI?

I tried 'print $messages' which is what is used for web pages, but, alas, that is not working.

Thanks


texts: What are the changes I should make to the .htaccess file to enable clean URLs?

texts:
What actually are the steps to clean the URL of a site.

I have made the following changes in the /etc/apache2/sites-enabled/000-default file.

<VirtualHost *:80>

    DocumentRoot /var/www
    <Directory />
        Options FollowSymLinks
        AllowOverride All
    </Directory>
    <Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride all
        Order allow,deny
        allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

What are the changes I need to do in a .htaccess file so that I could enable clean URLs?


texts:
I was trying to make my comments form show on a node type that has gallery assist but for some reason it doesnt have any options to change the value to make it show.

is there a module or some sort of way using hook form alter to force the default comments form to show on a node type?


texts: One Dependent dropdown in an other, the second getvalue does not return anything

texts:
I create one dependent dropdown into an other with ajax.
My configuration that I have cleaned up here works and I want to add the condition on the date options: if  option is 'before the', i display the form, if 'next week', not.
Could someone please explain to me why my first getValue works but not the second one?
Here is my code:
<?php

namespace Drupal\export\Form;

use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;

class TestConditionForm extends FormBase
{
  public function getFormId(): string
  {
    return 'test_condition';
  }

  public function buildForm(array $form, FormStateInterface $form_state)
  {

    $num_of_filter = $form_state->get('counter');
    if ($num_of_filter === NULL) {
      $num_of_filter = 1;
      $form_state->set('counter', 1);
    }

    $form['#tree'] = TRUE;

    $form['filter_fieldset'] = [
      '#type' => 'fieldset',
      '#prefix' => '
',
      '#suffix' => '
',
    ];

    $form['filter_fieldset']['conditiontype_container'] = [
      '#type' => 'table',
      '#attributes' => ['id' => 'conditiontype-container-wrapper'],
    ];

    for ($i = 1; $i <= $num_of_filter; $i++) {

      $form['filter_fieldset']['conditiontype_container'][$i]['field'] = [
        '#type' => 'select',
        '#options' => ['Date' => 'Date'],
        '#empty_option' => $this->t('- Select -'),
        '#ajax' => [
          'callback' => '::promptConditionTypeCallback',
          'wrapper' => 'conditiontype-container-wrapper',
        ],
      ];

      $selected_field = $form_state->getValue(['filter_fieldset', 'conditiontype_container', $i, 'field']);

      if ($selected_field == 'Date') {
        $form['filter_fieldset']['conditiontype_container'][$i]['condition'] = [
          '#type' => 'select',
          '#options' => ['before the' => 'before the', 'next week' => 'next week'],
          '#empty_option' => $this->t('- Select a condition -'),
        ];

        $filter_conditions = $form_state->getValue(['filter_fieldset', 'conditiontype_container', $i, 'condition']);
        // ksm($filter_conditions); // RETURNS NOTHING !

        if($filter_conditions == 'before the'){
          $form['filter_fieldset']['conditiontype_container'][$i]['type'] = [
            '#type' => 'date',
            '#required' => true,
            '#placeholder' => $this->t('- Enter a date -'),
          ];
        }
      }
    }

    $form['actions']['submit'] = [
      '#type' => 'submit',
      '#value' => $this->t('Submit'),
    ];

    return $form;
  }

  public function submitForm(array &$form, FormStateInterface $form_state)
  {
  }

  public function promptConditionTypeCallback(array $form, FormStateInterface $form_state)
  {
    return $form['filter_fieldset']['conditiontype_container'];
  }
}


texts: Form submit event defined with Drupal.behaviors fires several times

texts:
I want to react in JavaScript on the submission of a form but whatever I try the function is called three times:
(function ($, Drupal) {
  Drupal.behaviors.xmasEasteregg = {
    attach: function attach(context) {
      $(document).on('submit', '#aw-search-form', function(event) {
        event.preventDefault();
        var input_field = $(this).find('#edit-search-keys'),
          search_value = input_field.val();
        alert(search_value);
      });
    }
  }
})(jQuery, Drupal);

When I do it this way the alert is shown only once:
(function ($, Drupal) {
  $(document).on('submit', '#aw-search-form', function(event) {
    event.preventDefault();
    var input_field = $(this).find('#edit-search-keys'),
      search_value = input_field.val();
    alert(search_value);
  });
})(jQuery, Drupal);

Maybe I do misunderstand about JavaScript and Drupal.behaviors. My aim is that this logic is working on elements which were created / inserted by Ajax - which I think the first code assures?


texts: Hi i'm using the Commerce Shipping Postal Code Weight module. It works fine but I just want to get shipping costs in the cart page.


texts: What's the explanation for my product permission issue in a Drupal Commerce view?

texts:
I'm very confused with some permissions and product displays in Views. Maybe you can help me to understand it.

I'm trying to make a view of product displays. In the view I include a relationship for the referenced product field, so I can get fields of the referenced product like for example Image, SKU, price, ...

I save the view, and if I go to the view's page as admin I can see the view correctly, but if I visit the view as authenticated user or anonymous no items are displayed in the view.

So I went to the permissions config page, and I checked the permission "View any product of any type" for anonymous and authenticated users.

After doing so, normal users and anonymous can see the view correctly. But while configuring that permissions it says:

"Warning: Give to trusted roles only; this permission has security implications."

So I do not know if I'm doing things correctly. And I wonder how to make a view of product displays and also get the referenced product fields and make it visible for anonymous and normal users?


texts:
I want to create a dynamic website.
Where does Drupal store its data?
Is a MySQL database required to store the data?
If Drupal has its own database, does it have any limitation? I am pretty new to Drupal.

Any help would be appreciated.


texts: How to render comments at the top and the comment form at the bottom?

texts:
I'm trying to display the comments on a node at the top of the page. I've edited node.tpl.php in my theme to be:

<article id="article-<?php print $node->nid; ?>" class="<?php print $classes; ?> clearfix"<?php print $attributes; ?>>

  <?php print $unpublished; ?>
  <?php print render($content['comments']); ?>
  <?php print render($title_prefix); ?>
  <?php if(!empty($user_picture) || $title || (!empty($submitted) && $display_submitted)): ?>
    <header class="clearfix<?php $user_picture ? print ' with-picture' : ''; ?>">

      <?php print $user_picture; ?>

      <?php if ($title): ?>
        <h1<?php print $title_attributes; ?>>
          <?php if ($page): ?>
            <?php print $title; ?>
          <?php elseif (!$page): ?>
            <a href="<?php print $node_url; ?>" rel="bookmark"><?php print $title; ?>
          <?php endif; ?>

      <?php endif; ?>

      <?php if ($display_submitted): ?>

        <?php
            //By:   Mike Ghen
            //Date: 5/21/2012
            //Description: This Modifies the submitted user and date info.
            //             Code from: http://drupal.org/node/1072640
            if ($submitted) {
                echo "Submitted on " . date( "F j, Y",$node->created);
            }
        ?>

      <?php endif; ?>

  <?php endif; ?>
  <?php print render($title_suffix); ?>

  <div<?php print $content_attributes; ?>>
  <?php
    hide($content['comments']);
    hide($content['links']);
    print render($content);
  ?>

  <?php if ($links = render($content['links'])): ?>
  <?php endif; ?>

I moved <?php print render($content['comments']); ?> to the top of the page but, it makes the form to fill out a comment appear at the top of the page as well. Is there a way to render the comments at the top and the comment form at the bottom?


texts: Multi Countries / Regions / Cities website

texts:
I'm working on a social website that has been made in Drupal, built with OG, context, Spaces, Features, PURL, and many, many views.

We need to give the website a regional dimension. It was only based on a city before and now opens to several countries and cities.

The front end has been built with a huge amount of contextual blocks, listing content from many different content types & features (eg. Forum, Blog, Picture gallery, Wiki, Events, Annoucements, Highlights, magazine articles, etc...).

We are looking to the best way to add a regional dimension to the site so when you select a country / a region or a city the website would filter all content based on the selection.

Example :
When set to "world", the website, the magazine, the blogs, etc... would display content from the all world.
When set to "USA", it would display the same sections, home page, magazine, blogs, etc... but only with content from the US, from any city.
If set to "NY, USA" it would only display content from NY.

Something that makes it less simple is that only the groups are related to locations but not their content. So a group can be in NY, but to relate a picture from this group to NY we would need to implement arguments and relationships in every views. This is a heavily visited website and we do not want to impact performance too much.

The first idea that came to mind was to use something like hook_views_query_alter() and then alter any processed view. But i'm not so sure i'm going in the right direction.

Any suggestions?


texts:
Drupal 8 has RESTful web service in-built in core and since 8.2 we don't need cors module.

Now to use services we just enable and configure default.service.yml file as specified in here

However, I was not able to configure this setup to allow web service access over another domain.

My current service.yml setup for cors is:

cors.config:
    enabled: true
    # Specify allowed headers, like 'x-allowed-header'.
    allowedHeaders: ['x-csrf-token,authorization,content-type,accept,origin,x-requested-with']
    # Specify allowed request methods, specify ['*'] to allow all possible ones.
    allowedMethods: ['POST, GET, OPTIONS, DELETE, PUT']
    # Configure requests allowed from specific origins.
    allowedOrigins: ['*']
    # Sets the Access-Control-Expose-Headers header.
    exposedHeaders: false
    # Sets the Access-Control-Max-Age header.
    maxAge: 1000
    # Sets the Access-Control-Allow-Credentials header.
    supportsCredentials: false

I googled to find further detailed configuration on this but could not find one.

I am creating this for test development across two different domains.

Using pantheon dev environment for web services and localhost custom .dev domain for consuming those services.

Service access working fine using chrome CORS extension.


texts: Authorize.net - Multi-currency - disabling currency code when sending money

texts:
I have a issue processing multiple currencies in Drupal 7 Commerce with Authorize.net Gateways (version 1.0 stable).

I have Canadian store and have 2 currencies setup for my site: US and CDN funds.

Our processor is Bluepay and I have established separate US and CDN accounts.

I have noticed there are no problems processing US payments during check out. However when checking out in Canadian Currency using a Canadian Credit Card Authorize.net rejects my transaction.

Authorize.net is stating I must turn off 'currency code' in order for Canadian funds to be accepted with their gateways.

Is there a way to disable currency code in Drupal 7 Commerce? Is this even recommended if using more than 1 currency? How do most people go about processing multiple currencies in Drupal 7 Commerce via Gateways and Processors?


texts: How can I theme a form "checkboxes" element?

texts:
I've got a checkboxes field displayed on the user profile form. I'm trying to restyle that field to put the description BEFORE the checkboxes. That seems like it should be a simple thing?

So far I've got:

function MYTHEME_form_user_profile_form_alter(&$form, &$form_state, $form_id) {
    $form['my_field_id'][LANGUAGE_NONE]['#theme'] = 'checkboxes_description_before_element';
}

function MYTHEME_theme($existing, $type, $theme, $path) {
    return array(
        'checkboxes_description_before_element' => array(
            'render element' => 'element',
            'function' => 'theme_checkboxes_description_before_element'
        ),
    );
}

function MYTHEME_checkboxes_description_before_element($variables) {
    return "XYZ";
}

The checkboxes field is still stubbornly sitting on the markup generated by theme_checkboxes instead of "XYZ".

I know that the form element is getting the new '#theme' through checking with dpm().


texts:
An item in a nodequeue is a reference to a nid. In some cases you want to add some metadata to this queue item, for example an alternative title or description that is better suited in a specific listing.

One way of doing this is to create a "nodequeue item" content type that has a nodereference to the actual node. Although this would solve the problem, it wouldn't be the best user experience when administering.

Is there a better way?


texts: Fivestar multiple axis reviews and views

texts:
I want to have multiple axis comment reviews for nodes.
Example - rate a restaurant by the following criteria: food, drinks, atmosphere, location.

I want to order the nodes in a view according to the average vote.

Questions:

How can I setup the views relationship and fields to order nodes by total rating?
Should I create a separate vote tag in fivestar settings for each axis?
Is this possible out of the box with fivestar for D7?

UPDATE

To illustrate better the problem, here are the screenshots and exact numbers I'm getting.

Views settings
Views output
Calculations from reviews

UPDATE 2

Thanks to everyone who posted here.

I'm still not able to aggregate the votes correctly but I think it's due to some settings in views.

I will award the bounty and post the code/solution I used as soon as I solve it completely. I think Ayesh and junedkazi gave the correct answer saying almost the same thing. Will confirm when I solve it completely.

FINAL UPDATE

The votes are not aggregated on the nodes properly. Custom module is calculating the "overall" value for each comment and that works as it should. But when the fivestar/votingapi calculates the votes for parent node on node view page and on views listing page, it does not work. It takes into consideration only the last review, and not the rest.

Just in case, here's the calculating code I'm using in a custom module:

/**
 * Implements hook_comment_presave().
 */
function MYMODULE_comment_presave($comment) {
  // Keep these as separate variables so the code doesn't have to be
  // updated if the number of axis has been changed from admin.
  $axis_count = 0;
  $rating_sum = 0;
  // Go through all elements and check if this is a rating field.
  // Avoid hardcoding the field names (except the overall field).
  foreach ($comment as $element_id => $element) {
    if (is_array($element) && isset($element[LANGUAGE_NONE][0]['rating'])) {
      $rating_sum += $element[LANGUAGE_NONE][0]['rating'];
      $axis_count++;
    }
  }
  // Trim out eventual weird decimals
  $overall = number_format($rating_sum / $axis_count, 0);
  // Save the value in the overall field
  $comment->field_overall[LANGUAGE_NONE][0]['rating'] = $overall;
}

Please if anyone has any ideas I'd be really thankful. Even though the bounty expired, I will award it for a working solution (I don't care about the points).


texts: jQuery ajax request breaks drupal behaviours

texts:
In the Drupal commerce checkout I want to fill in the billing information automatically. I do that by attaching a javascript to that form and retrieving the information that is stored in the line item. That works great except for only one thing. The first time I click “continue on the next step” nothing happens and the page refreshes. But the second time the button does work and goes to the next pane.

It has the same strange behaviour when I load the page once, go to another page and go back. Then it works from the first time.

My javascript is rather basic and does work, but for some reason it breaks my form.

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

         var txtFullname = jQuery('input[id^=my_dynamic_id]');

        // do ajax request
        jQuery.ajax({
            type : "POST",
            url : 'http://example.com/retrieve_information',
            data : {
                'order' : settings.order_id
            },
            dataType : "json",
            success : function(data) {
                txtFullname.val(data.fullname);
            }
        });

    }
};
}(jQuery));

One thing I really have a hard time grasping (but then again I'm a Drupal beginner) is how a DOM operation can break the whole thing, especially when the only thing I'm doing is filling a simple textfield.

Is there a way in jQuery to trigger drupal to rebuild a form, because I have the gut feeling that this is the reason why it works the second time.

EDIT: It doesn't seem to have anything to do with jQuery as I have rewritten that part to use the Drupal ajax framework.

From the moment the billing information is filled in - i'm setting the values of the field  in hook_form - the submit button doesn't seem to work for the first time.


texts: Import a custom field type record and relate it to a node

texts:
I've created a module for a custom field type which selects images from cloudinary.

Is there a way to dynamically add entries as part of an import script? I've tried updating the database directly, but this is not ideal as it does not store any relations.

There is an answer for something similar, however I want to relate mine to an existing node. Is it possible with Node Export? If not, what am I doing wrong here:

My schema:

function cloudinary_field_schema() {

    $columns = array(
        'publicID' => array('type' => 'varchar', 'length' => 255, 'not null' => FALSE),
        'title' => array('type' => 'varchar', 'length' => 255, 'not null' => FALSE),
        'caption' => array('type' => 'text', 'size' => 'big', 'not null' => FALSE),
        'url' => array('type' => 'varchar', 'length' => 255, 'not null' => FALSE),
        'credit' => array('type' => 'varchar', 'length' => 255, 'not null' => FALSE),
        'keywords' => array('type' => 'text', 'size' => 'big', 'not null' => FALSE),
        'description' => array('type' => 'text', 'size' => 'big', 'not null' => FALSE),
        'primaryImage' => array('type' => 'int', 'size' => 'tiny', 'not null' => FALSE)
    );

    return array(
        'columns' => $columns
    );

}

My hook menu contains this:

function cloudinary_menu() {
    $items['cloudinary/add'] = array(
        'access callback' => TRUE,
        'page callback'  => 'add_image'
    );
}

And bad practice importer:

function add_image () {

  $new_image = array();

  //get post
  $entity_id = $_POST['entity_id'];
  $publicID = $_POST["publicID"];
  $url = $_POST["url"];
  $title = $_POST["title"];
  $caption  = $_POST["caption"];
  $description = $_POST["description"];
  $keywords = $_POST["keywords"];
  $credit = $_POST["credit"];
  $primaryImage = $_POST["primaryImage"];

  //validate
  $entity_id = htmlspecialchars( $entity_id );
  $publicID = htmlspecialchars($publicID);
  $url = htmlspecialchars($url);
  $title = htmlspecialchars($title);
  $caption = htmlspecialchars($caption);
  $description = htmlspecialchars($description);
  $keywords = htmlspecialchars($keywords);
  $credit = htmlspecialchars($credit);
  $primaryImage = htmlspecialchars($primaryImage);

  //add to new image
  $new_image["entity_id"] = intval($entity_id);
  $new_image["field_cloudinary_publicID"] = $publicID;
  $new_image["field_cloudinary_url"] = $url;
  $new_image["field_cloudinary_title"] = $title;
  $new_image["field_cloudinary_caption "] = $caption;
  $new_image["field_cloudinary_description"] = $description;
  $new_image["field_cloudinary_keywords"] = $keywords;
  $new_image["field_cloudinary_credit"] = $credit;
  $new_image["field_cloudinary_primaryImage"] = $primaryImage;
  $new_image["delta"] = 0;

  //establish if this is a valid node using entity_id
  $result = db_query('SELECT * FROM {node} n WHERE n.nid = :nid', array(':nid' => $new_image["entity_id"]));

  //if it is, update cloudinary
  if($result->rowCount() > 0) {
    $r = $result->fetchAssoc();
    $new_image["entity_type"] = "node";
    $new_image["bundle"] = $r["type"];
    $insert_id = db_insert('field_data_field_cloudinary')->fields($new_image)->execute();
    drupal_json_output($insert_id);
  } else {
    drupal_json_output(false);
  }

    drupal_exit();
}

I'm very new to Drupal so struggle a lot with this stuff! Any help greatly appreciated!


texts:
I updated a module, ran update.php, made some edits and backed up it's table for migration. And then HDD on server failed. Admins restored it from nightly backup, and from my backup as well (both was in proper backup directory). So I had new table structure and data, but old files. I uploaded module's files and it all works, but it shows I have one pending update. Update that is bound to fail as columns it's supposed to rename are already renamed.

Is there an easy way to tell Drupal manually "it's done already, don't try to run this update"?


texts: How to skip creating records with blank fields when migrating from csv file?

texts:
I have created a migration with the Migrate module that migrates data from a csv file into a custom entity. There are some rows in my csv file that don't have any data for the entity that I'm importing into, so I would like to skip the creation of those entities.

Is there a way I can do this?


texts: How should I set up revisions for this content model?

texts:
I need to manage a library of government policy documents (PDF/DOCs and metadata) such that, for a given document, a user can change any of its fields (including attached files and the title) over several edits, then mark it as a new "revision" (with values from all past revisions stored permanently).

Only admins will see/edit this data in Drupal: another PHP framework will query Drupal's DB directly for the revisions data (the simpler the data model the better).

With those considerations, how should I set up revisioning for collecting/straightforwardly querying this data? I can see a few options:

Built-in revisions on a single "Document" content type.
A "Revision" content type with a required node reference field that must point to a parent "Document" content type.
A dedicated module for managing revisions.

Any wisdom offered here would be appreciated.


texts: Twig template print all comments but not the comment form

texts:
For context:
in my template file node--some-node.html.twig i have a grid of items which have a custom comment form on them. The form creates a comment through an API. The form passes the ID of the grid item it is under to the API and the created comment then has a field_profile_id with the item's id in it. Now, in the template file I need to output JUST the comments that belong to that grid item.

When I write this into the template file:
    {{ content.field_comments }}
i get the output of all the comments that belong to this node and underneath I get the comment form (which I don't need). Ideally I would like to do everything in the same template file, so I could do something like this:

{% if entity.nid.value == content.field_comments.someComment.field_profile_id %}
{# output the comment here #}
{% endif %}

Here the entity.nid.value is the node id of the grid items I was talking about earlier.

EDIT:
Theoretically what I need to do is:

Iterate through all possible comments for this node.
Check if comment has some ID value (that a grid item might have)
If the IDs match, print out the comment, if it doesn't skip it


texts: How to Wrap the text in Source View of CKeditor

texts:
I am using CKeditor version 7.x-1.16 with Drupal 7.34.
How can I force the text to wrap in source view of the editor. I don't want the horizontal scroll bar to appear.

I managed to do that in WYSIWYG view.
Pressing the 'Enter key' in 'source view' will not solve it, since it gets overruled at the next switch between views.

See the images for differences. This is the same text as it appears when I switch between 'Source view' and 'WYSIWYG view'

This seems to be a Firefox problem, since in Google Chrome browser it is not an issue.


texts: How to detect insertion of new item(s) into Drupal's queue?

texts:
I need to trigger some code when new items are added to Drupal's queue system. My question, how to do that? How to capture that event?

Further details

I have created a custom views bulk operation which enqueues items into Drupal's queue system for further processing. Usually, the enqueued jobs would run when Cron runs. I need to execute a function when new items are added to the queue by VBO. I could query the database every minute to check for new items, but I hope it is possible to listen to that insertion event using a rule or a hook.


texts: Page template suggestions are not working

texts:
I've created a theme and have my template files in this structure

/templates/page/page.tpl.php
/templates/page/page--node-type.tpl.php

I've created a custom page template but for some reason it's not being picked up by Drupal.   I've cleared my cache and also tried adding this preprocessor function in the theme template.php file but it's still not working.

if (isset($vars['node']))
  {
    // If the node type is "blog" the template suggestion will be "page--blog.tpl.php".
    $vars['theme_hook_suggestions'][] = 'page__'. str_replace('_', '--', $vars['node']->type);
  }

Any help would be appreciated.


texts:
Does organic groups allow anonymous posts of content to groups?

I want to enable a simple workflow on my site running organic groups - anonymous users should be able to post blog entries to groups. I've got permissions set up so that anonymous can post blog entries, and blog entries are a group type, but I can't get it to let them associate a new blog post with a group.  Logged in as admin I can do this just fine.

Debugging Notes

I dug into og to see if it was a permissions issue.  It looks like og_form_add_og_audience isn't adding the og_groups array to the form.  Looking at the logic in that function, I don't see where it would add all the groups for an anonymous user.  What am I missing?


texts: How to avoid losing custom CSS/JS on a form using Ctools Modal when Validation Errors Occur

texts:
I have a regular content type form that has been customized quite a bit with a form alter. I am wanting to see about getting that form in to a ctools modal window for the creation of that content. I am able to do so, and I am able to create content. However, my form_alter customizes this form with some JS and CSS which is being added by specifying an #after_build on the form.

/**
* implements hook_form_alter to add in some custom submit and validation callbacks
*
* @form
* the activity form at node/add/activity-log
*/
function activity_log_form_alter(&$form, &$form_state, $form_id) {
 global $user;
 //activity log form
 if($form_id == 'activity_log_node_form') {
  //specify an after build function where i can add JS and CSS files
  $form['#after_build'][] = 'activity_log_entry_form_after_build';

  //change the submit buttons text value
  $form['actions']['submit']['#value'] = t('Save this task');
  $form['actions']['submit']['#weight'] = 30;
  unset($form['actions']['preview']);

  if(isset($form['actions']['delete'])) {
    $form['actions']['delete']['#value'] = t('Delete this task entry');
    $form['actions']['delete']['#weight'] = 35;
  }

  //submit handler and validation handler
  $form['#submit'][] = 'activity_log_form_submit';
  $form['#validate'][] = 'activity_log_form_validate';

  } //end check for activity log form
}

/**
 * This function is ran after the node/add/activity-log form is built. The css and js files are added here
 * because if they are added in the form alter, they won't get included when the form throws validation errors.
 *
 * @form
 * the activiyt log form at node/add/activity-log
 */
 function activity_log_entry_form_after_build($form, &$form_state) {
    //add the chosen library in there
    drupal_add_js(libraries_get_path('chosen') . '/chosen.jquery.min.js');
    drupal_add_js(libraries_get_path('chosen') . '/chosen.proto.min.js');
    drupal_add_css(libraries_get_path('chosen') . '/chosen.min.css');

    //activity log js and css
    drupal_add_css(drupal_get_path('module', 'activity_log') . '/css/activity_log.css');
    drupal_add_js(drupal_get_path('module', 'activity_log') . '/js/activity_log.js');

   return $form;
}

This works great when I browse to the normal forms create content url, and if there are validation errors, all is well. However, when using the form in the modal window, if there are validation errors, I lose my JS/CSS on form rebuild even though the form_alter and after_build are still being called. Any ideas why?


texts: How to check if 2 email fields have the same value entered during content creation?

texts:
I'm trying to create a custom signup content type and I'm wondering if there is a way to check if two email fields have the same value entered. Similar to typing in an email twice to make sure you have the correct email down.

If the two email fields are not the same an error needs to appear upon saving.

I'm not using a webform for this, it's a custom content type.


texts: Loading specific bootstrap mode in hook_menu

texts:
There is a way to define a specific bootstrap mode for a hook_menu URL (MENU_CALLBACK)?

I just want the request returns to me a result of a simple query in JSON and for that, I don´t need load the Drupal bootstrap in full mode, damaging the response performance.

Thanks!


texts: I have a view which has 5 menu tabs. I want to hide the tab if it doesn't have any results. Can anyone please help me with the suggestions.


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

If I send GET request to this url : http://example.com/rest/privatemsg/ I get all messages including messages in Inbox and Sent. Is there any way to Get messages from Inbox and Sent separately ? OR is there any way i can differentiate messages from Inbox and Sent ?


texts: create chains of views joins so one view can 'see' across more than one join

texts:
Assuming the individual joins work can we join multiple times across columns like this?... (BTW I've checked this first query and it does indeed work correctly)

SELECT *
FROM a
LEFT JOIN b
ON a.a_id = b.references_a_id
LEFT JOIN c
ON b.references_c_id = c.c_id
LEFT JOIN d
ON c.references_d_id = d.d_id

As per the following table.column structure:

a.a_id
a.a_col

b.b_id
b.references_a_id
b.references_c_id
b.b_col

c.c_id
c.references_d_id
c.c_col

d.d_id
d.d_col

Is it possible to link these together in a view so that because we have the joins defined in hook_views_data_alter() we can have the following:

pseudo-description of the Views setup:

(views setup)

"SHOW" 'a'

...

"FIELDS" > "add" > overlay menu "Add fields" >
    a: a_id
    a: a_col
    b: b_id
    b: references_a_id
    b: references_c_id
    b: b_col
    c: c_id
    c: references_d_id
    c: c_col
    d: d_id
    d: d_col

So because this is not working for me... in hook_views_data_alter()

$data['b']['table']['join']['a']['left_field'] = 'a_id';
$data['b']['table']['join']['a']['left_table'] = 'a';
$data['b']['table']['join']['a']['field'] = 'references_a_id';
$data['b']['table']['join']['c']['left_field'] = 'c_id';
$data['b']['table']['join']['c']['left_table'] = 'c';
$data['b']['table']['join']['c']['field'] = 'references_c_id';
$data['c']['table']['join']['d']['left_field'] = 'd_id';
$data['c']['table']['join']['d']['left_table'] = 'd';
$data['c']['table']['join']['d']['field'] = 'references_d_id';

... I wonder if I should be doing something bizarre like this...

$data['b']['table']['join']['a']['left_field'] = 'a_id';
$data['b']['table']['join']['a']['left_table'] = 'a';
$data['b']['table']['join']['a']['field'] = 'references_a_id';
$data['b']['table']['join']['c']['left_field'] = 'c_id';
$data['b']['table']['join']['c']['left_table'] = 'c';
$data['b']['table']['join']['c']['field'] = 'references_c_id';
$data['b']['table']['join']['c']['left_table']['c']['join']['d']['left_field'] = 'd_id';
$data['b']['table']['join']['c']['left_table']['c']['join']['d']['left_table'] = 'd';
$data['b']['table']['join']['c']['left_table']['c']['join']['d']['field'] = 'references_d_id';


texts: How to limit the products available to choose from, in the inline entity form of a product display

texts:
Drupal Commerce, when adding/editing a product display, allows for the creation of new products and the selection of existing products, using the inline entity form.

I have created a marketplace website in which multiple sellers can create their products and product displays.

Question: how to limit the available products to those created by the logged in user? When a seller creates or edits a products, he should be able to only select his own products in he 'add existing product' field.

I would have expected that the field would allow for the selection of an entityreference view, but that seems not implemented in the module.

Alternatives to accomplish the same are welcome! Thanks


texts: How to make #states work when dependant element is modified with JS .click()

texts:
We have custom JS that changes the value of some radio buttons using .click() and we have #states defined in other form elements that react to changes in those radio buttons.

The #states work fine when the radios are manually clicked but don't work when they are clicked through our custom JS .click() (the radio button values change, but the #states are not fired).

This is how the #states is defined:

'#states' => array(
  'invisible' => array(
    ':input[name="field_measure_system[und]"]' => array('value' => 'METRIC'),
   ),
),

and this is how the JS modifies the radio button:

$('a.tab-metric').click(function() {
$('#edit-field-measure-system-und-metric').click();

Thanks!


texts: Intending to select user role while creating the node to control the node visibility

texts:
I have simple requirement.

I have multiple user roles. What I want is that when I create a node, I could select a role of the user which is able to see this node.

Or may be by default all roles are selected and I could deselect them to modify the visibility.

Any module or help?

Best.


texts: How to make a rule select all users of a role?

texts:
I have a certain content type in which I have a user entity reference select list that is invisible to users/editors.

The idea is that the creator of the request has to choose a role of employees to who he sends this node, and then the other users can either accept or reject it, and only if ALL employees reject, the node would actually go to a rejected state, unlike the usual way of working with workbench.

To do this, I have the invisible user-entity reference field. Now I want to achieve the following:

When creating the node, after save, I want the reference field to automatically select all the users of the chosen role
By clicking a button 'reject', I want to remove the current user from the selected list.
When no users are selected, the node gets rejected.

Option 2 & 3 are easily done with rules. However, phase 1 is where I'm struggling. So I have the complete list of users, but now I have to "select" them, which I can do with rules by using "add to list". However, the selector only gives me the options "entities" and "site", in which site only includes "current-user", "current-page" and "feed-node".

How can I make it select all users of a certain roles?


texts:
I created a custom content pane, however, I'm having some issues trying to hide the title on the page and was wondering if anyone knew of a module for this?

Here's the quick breakdown:

I created a new custom content pane:

Above I have given the custom content pane no title, however, this is how it shows up:

I'd really like to make it look more descriptive.

If I add a title it will show on the variants > content page (image below), but unfortunately, it also shows up on the actual page as well.

Live page:

Any and all help would be greatly appreciated. Thank you!


texts: What is the recommend process for migrating a Drupal 6 Ubercart site to Drupal 7 / Drupal Commerce?

texts: I'd like to migrate a client's site from Drupal 6 and Ubercart to Drupal 7 and Drupal Commerce. Is there an easy (i.e.: no manually munging data in the database) migration path? Do I need to go to Drupal 7 + Ubercart as an interim step?


texts: Views: Display users with a gmap attachment

texts:
I have location, gmap and profile2 modules installed on my site.
In a profile type I have added a location field so that the user can add his/her location on profile edit.

I want to display all users with a map in the header. The map will have the markers for the currently displaying users.

For this purpose I have created a page view where I displayed all the users with a pager.

Then I added an attachment and select the style format as "Gmap" and in the settings I have tried both for Data source "Location.module" and "lat/long".
And attached it to the page.

But the view does not display any map.
Any one who have some idea about this?


texts: Search API display message when match not found

texts:
I had an issue before (Search API with views -> Apply filters) that has been solved already.

I have a website where i manage to create a database, display it with the views module and add a Search box with Search API.

The search module works great but i would like to know how can I make it to display a message when there's no match found. Something like "Your search didn't match any documents. Please try again."

Does anyone know how do I do that?

Thanks in advance!!


texts: Views Link Display Settings Is Not Accepting External URL

texts:
I want to add an external URL to the Views More Link Display Settings. It is also mentioned in the guide lines as well ("A Drupal path or external URL the more link will point to. Note that this will override the link display setting above."). But it is validating the URL using internal path component.

Error:- InvalidArgumentException: The internal path component 'https://www.google.com' is external. You are not allowed to specify an external URL together with internal:/. in Drupal\Core\Url::fromInternalUri() (line 410 of /var/www/drupal/web/core/lib/Drupal/Core/Url.php).

Please refer to this screenshot.

Please share if there is a way to alter the link display settings.
Thanks in advance!


texts: How to detect if pager is active on page?

texts:
Is it possible to detect programatically, if page on current URL contains some pager?

I have views with pager on my website. I can see "page" GET argument in URL, but not in first page. So I cannot detect pager by check:

<?php
if (isset($_GET['page']))
?>

Because first page (page=0) has no GET argument

I tried to use function theme_pager, I registered overriding function to theme_pager in my hook_theme_registry_alter:

<?php
$theme_registry['pager']['function'] = 'mymodule_theme_pager';
?>

But then I need to override whole function theme_pager in my custom module. I think there can be some simplier solution.
Maybe there exists some method like is_pager() or something similar?

thanks for help

//EDIT: I need to achieve, that metatags rel="prev" and rel="next" will be generated, when pager is active

//EDIT2: I found solution for pagers from views: I can get information about pager in hook_views_post_execute. It is sufficient for may case (I have only pagers from view) although it would be good to know, if there is some general solution for all pagers on website.


texts:
Since my company still focuses on D7, I haven't yet had time nor need to use Drupal 8. I am planing to step into it soon, so I browsed around to read up about it. While clicking through current API pages, I figured that there is a new link for every 8.x release.

Since Drupal 7 ended up with over 40 Releases, do we have to expect the same amount on API versions for Drupal 8? Shouldn't it be one link for all 8.x releases like it was on Drupal 6 and Drupal 7?


texts: How to add a custom attribute to the script tag via drupal_add_js?

texts:
As part of API implementation of Queue-it framework, I need to add extra custom attribute data-queueit-c into script tag, e.g.

<script
    data-queueit-c="MyClientID"
    type="text/javascript"
    src="//static.queue-it.net/script/queueconfigloader.min.js">
</script>

I'm aware you can add other attributes such as defer, however this one is custom.

I've tried the following code using drupal_add_js, but without luck:

drupal_add_js('//static.queue-it.net/script/queueconfigloader.min.js',
  [
    'type' => 'external',
    'data-queueit-c' => 'MyClientID',
  ]);

How this can be achieved?


texts: Unsubscribing from mailing list for anonymous user in simplenews

texts:
I use the Simplenews module for newsletters of my site. But I don't send out mails, rather use the module for subscribing and unsubscribing. Now for the anonymous user it gets difficult to unsubscribe since the user doesn't get any mail other than the subscribe mail. I read the comment in https://drupal.org/node/337628 #6, but I don't think I have an option here.

So I want to add an unsubscribe button to my block. How can I do that?

Drupal Version - 7.22
Simplenews Version - 7.x-1.0


texts: Return to views navigation list of nodes after editing a node in the list

texts:
I am using Views Navigation module. I have created a list of articles using views and selected "Add navigation links on node pages accessed from this view" under "Views Navigation" in Advanced. The views navigation is working fine and I can go back and forth in the views list of articles.

Now if I edit the node (while viewing a views navigation list) and submit the edited node, I was returned back to the node page without the "views navigation" links appended to the URL. Hence I cannot move back forth in the list (the list is gone; it behaves like a simple node view).

The scenario is that this views navigation list will be used by editors and moderators who may edit an article while viewing the list so they should be redirected back to this list once they edit an article.

One of the solution I am thinking is to alter node edit link using hook_menu_alter(). Is there any non-programmatic way of doing this? I have tried Rules and captured the appended URL parameters but I don't know how to alter a node edit link. Can someone please point me in the right direction?

Many Thanks


texts:
in my site I use version 7 of Drupal and Linux OS on the server, and need to hide the subdirectory of the installation when access by LINK ...
explaining better:
Current link: www.site.com/folder
I want to change for only:
www.site.com
I searched in various forums, websites and how is an old subject, I believe that there was a change in the code to hide / delete the symbolic url paste ...
In the folder / root .htaccess I created left like this:

Options + FollowSymlinks
RewriteEngine On
RewriteRule ^ (. *) $ Folder / $ 1 [L]

Thus, to access the site, only the index remains without the folder ... I want the whole site be without referencing the subfolder where it was installed ... How do I do this? thank you


texts: Items removed from Node Reference field are still displaying on the node

texts:
This problem only very recently cropped up; I've never encountered it before.

I have a content type (Resource) that contains a Node Reference field (pointing to Organization nodes) that allows multiple selections. Sometimes Resource nodes are updated, and Organizations are added to or removed from the Node Reference field.

Suddenly, after removing an entry from the Node Reference field, the Resource node still displays the removed Organization. If I go and re-add that Organization, it now shows that Organization twice. Remove it again, and it goes back to showing it just once.

I checked the database for that field (field_data_field_organization_ref), and the entry for that particular Organization has indeed been removed. So I can't figure out why it would still be showing.

This is occurring on two different Resource nodes, on two different websites built with the same configuration.

This only seems to happen when the entry is the first in the list; removing an entry from the middle of the list works just fine.

Flushing caches has no effect.

Is there any explanation for this?


texts:
I have a Country List field, on selection of country I need to show City List which is dependent on Country drop-down.

My Code is like:

$form['to_country'] = array(
      '#type' => 'select',
      '#title' => $this->t('Country To'),
      '#options' => $country_list,
      '#maxlength' => 12,
      '#size' => 64,
    );

Dependent dropdown:

$form['to_city'] = array(
      '#type' => 'select',
      '#options' => $city_list,
      '#title' => $this->t('City From'),
      '#maxlength' => 12,
      '#size' => 64,
    );

Here $city_list will be dynamic based on the country chosen from to_country field


texts: Permissions to edit content type not working

texts:
I am wondering if I have missed some place obvious. I have permissions set for the role "editor" to be able to edit several content types. It is working for all but one of these types. We are also using organic groups. I have confirmed that these nodes are set to the correct group, the editor is in that group. They can see the content, but can't edit. Is there some other hidden place where there might be a permission set that I'm not seeing?

We have D7, the path where we are editing permissions is /admin/people/permissions
and organic groups is the only "content access" on this installation.


texts: with limit(20) it runs only the first 20 values of DB

texts:
In this lines of code it selects only the first 0-20 but i want the first time select the first 0-20 and then the other(20-40) and other(40-60) and so on. How I can solve this problem?

 function something_cron()
      $query = db_select('watchdog', 'wa')
        ->extend('PagerDefault')
        ->orderBy('wid')
        ->fields('wa', array('variables', 'type', 'severity',
      'message', 'wid', 'timestamp'))
        ->limit(20);
      $result = $query->execute();

      // Loop through each item and add to $row.
      foreach ($result as $row) {
        someother();
      }


texts:
I was planning on using the user module to import more than 300 new users into my website. However, the birth date fields cannot be imported. Even before the actual import has started, I get these errors and warnings.

Warning: Creating default object from empty value in _user_import_settings_save()
(line 574 of /sites/mywebsite.nl/dev/sites/all/modules/user_import/user_import.module).

Field Birthdate is not supported

Apparently the User Import module can't handle date fields. Can this be solved with the User Import module? Or is there another module that I can use to import my users? Or do I have to php this manually?

thanks in advance


texts: drupal_add_js and variables into anonymous functions, objects undefined?

texts:
Pulling my hair out. Read a lot of stuff about scopechain and closure to tackle this one myself. And as i understand at some level, i can't get this to work.

I wrote a module for likebuttons (like facebook twitter etc). It's working ok, but I want to make it more generic and multilingual. I did the following. In my facebook function I have this:

<?php
  $lang = 'en_EN'; //

  // Load javascript
  $settings['lang'] = $lang;
  drupal_add_js(array('mymodule' => $settings), 'setting');
  drupal_add_js(drupal_get_path('module', 'mymodule') . '/js/myscript.js');
?>

This is working ok. The javascript gets loaded and the $settings['lang'] is passed to browser too (as I can see in chrome console it gives me 'en_EN' on Drupal.settings.mymodule.lang).

In myscript.js script I have the following (simplified to be a more generic question

(function() {

  var language = Drupal.settings.mymodule.lang;
  console.log(language); //undefined

}());

UPDATE:
So it's anonymous.... All those terms.
Ok, got the object inside now. Now i got to figure out how to get the 'en_EN' from the object.

Updated script:

(function(language) {

var my_var = language.settings.mymodule.lang;
console.log(my_var); // undefined
console.log(language); //Object { settings={...}, behaviors={...}, locale={...}, meer...}
console.log(language.settings); //Object {}
console.dir(language.settings) // There are no underlying objects
}(Drupal));

Here language contains the complete object drupal has passed. (I can see that in console).

Why can't I go in the object language like normal and get my value by using language.settings.mymodule.lang?

Seems like Drupal.settings is empty inside the anonymous function, but has all elements there in the DOM tree. I don't know what causes this to be an empty object inside an anonymous function.


texts: including jquery.ui 1.6 directly from theme.info

texts:
It is possible? because i've tried to include jquery ui library through drupal.org/project/jquery_ui module (followed instructions in readme.txt) but that library won't show up in source code. What's the problem?

Should i go for jquery_ui module or i can include that script through .info file?

Jquery ui version = "6.x-1.5"
Downloaded jquery ui library 1.6


texts: How to move the form label into the input field on all node edit forms

texts:
I have been able to customize it in the search form using template file. I am not able to figure out how to do this in the node creation/edit forms.
eg: http://drupal.org search box at the left top.


texts: How to log in a user and inspect their role in a functional test?

texts:
I want to write a functional test that takes some test user credentials in a remote system, and posts them to Drupal login.

So far, I have

  /**
   * These users should authetnicate via Netforum.
   */
  public function testNetforumUsersCanAuthenticate() {
    $this->drupalGet('user/login');
    $edit = ['name' => [redacted], 'pass' => [redacted]];

    $this->drupalPostForm(NULL, $edit, t('Log in'));
  }

The authentication always goes through the external system even if the local account exists in Drupal. Therefore, I cannot just create these accounts beforehand.

The account should get created when authentication passes - and then I want to look at the users roles to check if they match what I expect for the different test accounts.

What can I use to see that this was successful and then look at the roles and check them?


texts: Login from one Drupal instance on another Drupal instance

texts:
I'm working on a project that has some unconventional requirements.

Basically, I have two sites, each one with an individual Drupal installation and instance. The main site (I'll call it "master") has a lot of registered users, and the other one does not (I'll call it "slave").

I need the possibility of logging into the "master" site through the "slave" one. Like, the "slave" site would have a login form, that would connect to the "master" site and authenticate the user.

I've thought of using APIs like OAuth for this, but I didn't find any solid documentation or tutorial of how to do this with Drupal.

Observations: I can't make them multisites, they are two isolated Drupal instances. And it must work for Drupal 6.

Can anyone give me some directions?


texts: Multilingual websites- one menu for each language or one menu for all languages?

texts: On a multilingual website, why would I use the i18n_menu module to translate the menu items of a menu instead of simply making separate menus for each language?  I read Gabor Hojtsy's excellent article on the menu system in D7 but I still don't understand in what sort of use case I would want to use i18n_menu vs. simply creating separate menus for each language and setting them to display only for their respective languages.


texts: Date range field misses the minutes when they are the same

texts:
[UPDATE: RESOLVED ON MY OWN! YAY!] I've got a date range (start and end date) which I'm using to display a start and end time of an event. However, when the minutes are the same for the start and end time (with differing hours), the first time's minute digits are omitted. See the pic:

I've looked through the settings and I cannot, for the life of me, figure out how to show minutes when the minutes are the same. When I change it to be different minutes, it looks good:

I'm sure it's some simple setting that I'm just missing, somewhere. But I've searched and googled and can't figure it out. Here's my configuration:

And here is that format:

Set to that date type:

Seems fine everywhere.

It's in military time--not sure how to get an AM/PM dropdown. Don't see any options for that, but I haven't really investigated that yet. But that's neither here nor there. I'm hiding the year, month, day in this Add Event form and just using a default value.

The only modules that affect this that I'm using are Date and Date API, as well as Panelizer to display it. I'm using a custom layout with panelizer, but that shouldn't matter.

I actually do have some code in the template.php file that alters a date range, but can't see, as of yet, why that'd be screwing things up:

// template.php

function times_square_date_display_range($variables) {
  $date1 = $variables['date1'];
  $date2 = $variables['date2'];

  //if the same month, omit first num's month
  if (substr($date1, 2, -1) == substr($date2, 2, -1)) {
    $date1 = substr($date1, 0, 2);
  }
  $timezone = $variables['timezone'];
  $attributes_start = $variables['attributes_start'];
  $attributes_end = $variables['attributes_end'];
  $show_remaining_days = $variables['show_remaining_days'];

  $start_date = '' . $date1 . '';
  $end_date = '' . $date2 . $timezone . '';

  // If microdata attributes for the start date property have been passed in,
  // add the microdata in meta tags.
  if (!empty($variables['add_microdata'])) {
    $start_date .= '<meta' . drupal_attributes($variables['microdata']['value']['#attributes']) . '/>';
    $end_date .= '<meta' . drupal_attributes($variables['microdata']['value2']['#attributes']) . '/>';
  }

  // Wrap the result with the attributes.
  $output = '
' . t('!start-date - !end-date', array(
    '!start-date' => $start_date,
    '!end-date' => $end_date,
  )) . '
';

  // Add remaining message and return.
  return $output . $show_remaining_days;
}

That's pretty much all the info I have about this.

[UPDATE: It is an error with the if statement at the top of the template.php code. I used this to alter the display of date ranges and had to qualify it more  to only affect date ranges, not time ranges. Here's the code for the fix ( skip date outputs with ':' character):

if ( (substr($date1, 2, -1) == substr($date2, 2, -1)) &&
   ( strpos($date1, ':') !== true ) ) {
  $date1 = substr($date1, 0, 2);
}

Can I give myself the bounty? :) ]


texts:
I have created a view as a page that I want to only show my blog posts. I filter the Content: Has taxonomy term (= blog) to limit to my blog posts. Now I want to add a search box that can search the title and body. I've tried using Search: Search Terms and Global: Combine fields filter, but neither seems to work properly. They don't bring up any posts that match the search, even if the text is in the title, body, or the exact name of a linked taxonomy.

How can I make a search box for my view that will search the title and body?


texts:
I made change in setting.php for base url

$base_url = 'http://www.example.com/drupal

Pattern for this content type paths are

[node:title]

pathauto works ok, in the database path is exactly as pattern.

Problem starts when I want to print Content:path in view I am getting

/drupal/[node:title]

I have a problem with path field because I want to rewrite result for logo field using

[field_company_logo]

And link is http://www.example.com/company/[nid]/drupal/[node:title] instead of http://www.example.com/drupal/company/[nid]/[node:title]


texts: How do I make a panel visibility rule work when the element to check for has to be not set or empty?

texts:
I am using Drupal 7, panels and page manager modules.

In page manager I created variants on the node template for showing a particular type of node in a different fashion to different user roles. My nodes have a Term Reference field called "Alternatives" that is NOT required to be set by the users so it can be either be "empty" aka "none" or set to some data value i.e. a taxonomy term of the vocabulary "Alternatives".

I created a visibility rule on another element on the same variant to hide this "other" element, a custom content.

From the element's gear icon (on the tab "Content" in the variant section) of the custom content, I have set the visibility rule to show: Alternatives is set to "". That's exactly what I want: if Alternatives is set to "nothing", this custom content should show and now it doesn't show.

It seems that the visibility rule doesn't seem to recognise or can't check if a term reference field (Alternatives) is empty or not set. How do I make this visibility rule work?


texts: Why I can't I drop field_data and field_revision table in phpmyadmin?

texts:
I wanted to delete a filed named MyField.

So I first deleted the corresponding record for MyField in field_config table and field_config_instance table.

And now I'm trying to drop these tables by using phpmyadmin.

field_data_field_MyField
field_revision_field_MyField

But even if I drop them they are still there.
It seems that they can't be droped.

Isn't it possible to delete fields directly in DB?


texts: Hook Into Commerce Shopping Cart Before Refresh? Or Disable Refresh?

texts:
I've been trying to skin this cat for a long time so there are several related questions. Plain vanilla D7 Commerce shopping cart. HOWEVER, the line item pricing we want to use is grabbed from an external database via XML requests. It can never be determined from the Products table because there are all kinds of discounts that change all the time.

My -main- problem is that the Shopping Cart View in Commerce seems to automatically calculate and update the Unit Price and Extended Price for each line item before the shopping cart page is rendered. I've read the Commerce tutorials and apparently this is referred to as a 'Status'... calling commerce_cart_order_refresh().

I've tried using a pricing rule to get the price for each line item, but that means an http request for each line item which is dead slow.

So I added a function to hook into the Shopping Cart view BUT it seems to fire -after- the page is actually rendered (but before the visitor sees it on screen.) So the upshot is that the visitor has to hit refresh in order to get the correct pricing. IOW: when they first visit the Shopping Cart they get 0s for the pricing. They click again and they see the correct prices.

Two questions:

How do I hook into the Shopping Cart View so that my function fires -before- the form is rendered?
How do I DISABLE the automatic price update for each line item (since my function has already updated the line items and order totals.) I assume this is happening in commerce_cart_order_refresh(). Is there a way to force that calculation to FALSE?

TIA,


texts: How can I find out the machine names of user variables?

texts:
I'm creating a custom user profile page and I know how to print certain items attached to the user like

$user_profile['user_picture']

but I don't know the names of any of the other fields. Is there a way that I can view a list of user profile field machine names?


texts: can't programatically update line item on drupal commerce order

texts:
I want 'sell' a donation for custom donation amounts, and I know that to do this, I will need to use line items. I wrote the following code which I thought would do the trick, but when I go to /cart, I see that the price has remained the same.

global $user;
  if(user_is_logged_in()) {
    //$order_id = commerce_cart_order_id($user->uid);
    //$order = commerce_order_load($order_id);
    $order = commerce_cart_order_load($user->uid);
  }
  else {
    $order = commerce_cart_order_load();  //no uid since user is not logged in. attempts to load an anonymous order from the session.
  }
  //var_dump($form_state['values']['donation-custom-amount']);
  $lineItem = commerce_line_item_load($order->commerce_line_items['und'][0]['line_item_id']);
  if($form_state['values']['donation-custom-amount'] !== "") {  //if the user entered a custom amount
    $lineItem->commerce_unit_price['und'][0]['amount'] = $form_state['values']['donation-custom-amount'];
    $lineItem->commerce_total_price['und'][0]['amount'] = $form_state['values']['donation-custom-amount'];
  }
  else {
    $lineItem->commerce_unit_price['und'][0]['amount'] = $form_state['values']['donation-amount'];
  }
  commerce_line_item_save($lineItem);

I checked that $form_state['values'] was giving me the form data, and there are no errors, just no price change.


texts: Preview image after uploading using Form API

texts:
I uploaded an image file using the managed_file Form API type, but after uploading the image it does not appear as a thumbnail beside the field. What is rendered is the file name of the image with a link to the image and a small icon.

How do I show the thumbnail of the image after uploading it (like the image preview from the core Image field)?

Also how can I show a default image beside it (if it has a default value)?

This is my code:

$form['logo'] = array(
      '#title' => t('Logo'),
      '#type' => 'managed_file',
      '#required' => TRUE,
      '#default_value' => variable_get('logo', ''),
      '#upload_location' => 'public://',
      '#upload_validators' => array(
            'file_validate_extensions' => array('gif png jpg jpeg'),
            'file_validate_size' => array(0.3*1024*1024),
  )


texts: Views: What setting is available in Views to hide or skip the first entry in a multi-value field? (example skip first image)

texts:
On my site, I have created an "Images" field with "unlimited" values. I have used "image delta=0" to show only the first image as the main gallery image. I then created a grid with a contextual filter of "content: nid" to display up to 10 of the images in that field. I would like to now hide the first image from the output, so that it isn't repeated with the first/main image on the page.

I have the contextual reference working well, but I haven't been able to figure out how to skip the first image. I tried a playing around with the Image Delta settings "=1", assuming that this means to increment by 1, but when I save, my view is empty.

I'm sure this is straight forward, but I have come up empty in my attempts (literally) and searches.

Thanks,
keb


texts: How to send a custom Solr Query using Search API Solr

texts:
I'd like to send custom solr query (preferably in hook_init) using Search API Solr to a specific URL.

Something like:

function hook_init() {
  $url = "admin/luke?show=schema";
  $solr = new SearchApiSolrService(); // must have an instance of SearchApiServer
  // $httpTransport->performHeadRequest($url);
  // $response = _sendRawGet($url);
  drupal_set_message(print_r($response, TRUE));
}

How I can do achieve that? Is there any live example?

Thank you.


texts:
I need to submit data to a webform.

I receive data from POST submission from mobile application ("webservices").

So I try something like :

$form_data = array();
$form_data['values']['firstname'] = $user->field_civilite['und'][0]['tid'];
$form_data['values']['lastname'] = $user->field_prenom['und'][0]['value'];
$form_data['values']['mail'] = $user->field_nom['und'][0]['value'];

webform_client_form_submit(226, $form_data);

But this is don't do anything.

Someone have any idea to do that?


texts: How can I migrate a site to another site with a different installation profile?

texts:
How can be D8 sites migrated in Aegir between different installation profiles, and not only between platforms using the same installation profile?

There is a solution in Aegir for D6->D7 and D7->D7 migrations, documented here, but it does not work for D8->D8 migrations.

For D8 sites, the new platform appears as an option in the migrate form, but Aegir is still looking for the old profile in the new platform, and migration fails.


texts: How can I add a link to users of an organic groups in views

texts:
I have a views which lists groups (I am using drupal commons distribution). I like to add a link in this view to members of that group.
Any idea how this might be accomplished?

Thanks.


texts:
How do I display a form followed by a table in a module??

I have this:

function main_function(){
  $form = drupal_get_form("report_details_form");
  $tabb = array(
    'header' => $header,
    'rows' => $rows,
    'caption' => $caption,);
  $output = theme("table", $tabb)
  $final_output = theme("report_page", $form, $output);
  return $final_output;
}

function theme_report_page($form, $result = array()) {
  $output = '

    '. $form .'

    '. $result .'

';
  return $output;
}

What am I doing wrong? I am using Drupal 7. I need to display the form and under it the table. There is nothing wrong with $form or $output. If I return them in the main_function they will display correctly.

I don't NEED a theme, I just need to display a form and table on the same page. So if it is to demanding I can skip it, and just have the form and table displayed.

I changed the main_function a bit to this:

function main_function(){
 $form = drupal_get_form("report_details_form");
 $tabb = array(
  'header' => $header,
  'rows' => $rows,
  'caption' => $caption,);
 $output = theme("table", $tabb)

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

$build['pager'] = array(
    '#theme' => 'pager',
    '#weight' => 5,
);

return $build;

A dummy table is now displayed, but just in the first call to the page, not when the page is self called after submiting the form for first time. A custom table is then created to list all the results for a SELECT. This custom table is not displayed for some reason.


texts: Is this possible to pass some content (cck fields values) to Lightbox dialog when image belongs to the same content type is opened?


texts: Regarding en and ja language prefix in url

texts: I am creating multilingual website, I have added Japanese language and prefix for that language is ja.I have set my default language as Japanese. Now I want to disable prefix ja. I don't want that ja to be visible in url.


texts: How can I support product prices which have a precision greater than the currency's minor unit in Drupal Commerce?

texts:
Any idea how to support prices which have more decimal places than a currency supports in Drupal Commerce?

Use case is that I'm trying to build a website which has some very small parts, whose unit price can have factions of cents ie a small bearing which has a unit price of $0.05742.

Typical users would order 1000s at a time and price is rounded to nearest cent at payment time.

But a commerce_price (in USD) only supports 'whole' cents (to reflect the minor unit format). Entering 0.05472 in the price field causes rounding to 0.05 and this rounded value is also the value written out to the db.

Any suggestions?

Thanks


texts:
I want to add a product to the cart programmatically on form submit

My code below works only for root, but in my site an anonymous user can access the cart and checkout, but when submitting form with non user=1 it returns Your shopping cart is empty.

In my submit function:

$uid = ($user->uid) ? $user->uid : 0;
    $order = commerce_order_new($uid, 'checkout_checkout');

// Save the order to get its ID.
    commerce_order_save($order);

// Load whatever product represents the item the customer will be
// paying for and create a line item for it.
    $product = commerce_product_load($product_id);

    $line_item = commerce_product_line_item_new($product, 1, $order->order_id);
// Save the line item to get its ID.
    commerce_line_item_save($line_item);
// Add the line item to the order using fago's rockin' wrapper.
    $order_wrapper = entity_metadata_wrapper('commerce_order', $order);
    $order_wrapper->commerce_line_items[] = $line_item;

// Save the order again to update its line item reference field.
    commerce_order_save($order);
    //commerce_cart_order_refresh($order);
//    ym(commerce_cart_order_id($uid));
    //commerce_cart_commerce_order_load($order);
    //ym(commerce_cart_order_is_cart($order));
    //commerce_cart_product_add($uid, $line_item);
    //commerce_cart_product_add_by_id($product_id);
    //$form_state['redirect'] = 'cart';
    drupal_goto('cart');

Why does it not work correctly with non root (uid=1)?


texts: Why are my fields are out of order when viewing?

texts: I have a content type called 'article'.  I create custom fields and drag-n-drop them in the order I want.  My user fills out the fields in the order that I prefer.  User then clicks SAVE.  Now the fields are out of order when this content type 'article' is being viewed.  When user clicks EDIT, then everything is back in order, just not when viewing.  Why is this and how do I fix it?


texts: how to use user profile field information as biodata list

texts:
I have created a website where users can create their own account expanded by the profile2 module. By using it, users can enter all their information in created fields field like:

name
father's name
mother's name
education information
etc

I want to display this information publically in table view where it's possible to search, sort and filter. How would it be possible to create something like that?

I know about content types and use content type in Views module.


texts: get result of view using services from drupal 6

texts:
I am using services 3 with drupal 6 to create node of story content type.
I have a cck field that contains email id of the user who has created the node.

I have a view that takes as argument an email id and returns all the nodes that have this email id in the cck field specified above.

All I want to do is, get the result of this view over rest call using services module as I am using this for mobile app.

I have tried using service views module, but its a dev version for drupal 6 and doesn't work for me.

Any solutions to this ?


texts: Seven subtheme not inheriting correct block structure

texts:
I am using Drupal 8.

I have subthemed the Seven theme so we can add some minor customisation to the admin theme.

The new theme however is getting all the active theme's blocks thrown into - seemingly - random blocks inside its regions.

I want to create a subtheme which initially is identical to seven and can be activated across several sites with predictable block placement.

I don't want users to be put in a position were they have to go through and manually move/disable blocks after turning on the new admin theme. This is especially true given the clunky nature of adjusting block placement on the admin theme; every time you disable/delete a block and save the change it takes you back to the ACTIVE theme block page rather than the admin one...

Is there a way to do this?


texts:
So I've attached CSS with this code to my custom block:

function expressweb_newsletter_block_view($delta='') {
  $block = array();

  switch($delta) {
    case 'newsletter_popup_and_icon' :
      $block['content'] = array(
        '#markup' => expressweb_newsletter_block_content(),
        '#attached' => array(
          'css' => array(
            drupal_get_path('module', 'expressweb_newsletter') . '/css/newsletter.css',
          ),
        ),
      );
    break;
  }
  return $block;
}

I've cleard cache and I don't have CSS attached to my block traditional way (by @import or link tag). Alghough there is a reference to newsletter.css file but in jQuery code which starts with 'jQuery.extend(Drupal.settings...'. But this doesn't work. Anyone know why? Besides, what is this code for?


texts: Is it possible to create sub-node that can assign on a node?

texts: The idea is to create a chapter(sub-node) that can assign on a book(node:page). I know this can be done with taxonomy, but I dont wanna have 1000+ of taxonomy on my site. Is it possible, if so, how?


texts: Add unique class to webform radio form-item div

texts: Can anyone point me in the right direction to show, how to add a unique class to the webform select options container divs .form-item? I would like to theme these divs surrounding the each radio button with a different background image. I don't really care what the class is, numbers, the key, etc. just as long as I can target it in my css.


texts: How to combine four text fields into one column in a view?

texts:
I have four text fields in my Content Type:

First Name
Middle Name
Last/Business Name (required)
Generation

I want to combine these into one column in my view. I want the display format to be: LastName, FirstName MiddleName Generation

So only the last name is followed by a comma. The first name and middle name and generation only have spaces between them. I go to the Drupal view table settings and set the "Column" for all four fields to "Last/Business Name." But here's where I'm stuck: I know that there is a "Separator" field, but if I set it to a comma the format will be LastName, FirstName, MiddleName, Generation and that's not what I want.


texts: How to check if is anonymous user's first visit to site when using varnish

texts:
If one has a Drupal 7 site which uses varnish for caching, is there some method which would enable one to serve a different version of front-page if it is first time the anonymous user has visited the site?

As I understand it, varnish caching will not work if a session variable is used. Is there some way of doing this using client side cookies?


texts:
How do I add icons next to field names, like adding a phone icon in front of the mobile phone field?

i tried the patches shown in https://www.drupal.org/node/2050257, but they do not seem to work.

I have seen this on some websites, so I guess it should be possible.


texts: Module for sidebar menu which appears in open atrium

texts:
I wanted to know if any modules already exists for creating side bar menu which appears in open atrium. So that it expands only when required.

/** Update **/

Please see the image below. I am talking of the LHS black sidebar.


texts: How to print an entity bundle field from one with multiple values

texts:
Struggling to find the answer to this. I have an entity called "school objects" which has a bundle called "homepage". One of the fields attached to this is called "Hero banners" and it allows multiple text values.

All I want to do is print each value. I don't need to check for conditions, I don't need NIDs, I just want each value. I am not really a php developer but understand the basics of what it is doing. I was looking into the EntityFieldQuery code, but cannot get anything to print on a tpl file I am using.

The output I need, based on image attached, is simply:

images/symbol.png

Let's make a difference

Start today

All I can find after a lot of searching is complex bits of code checking for conditions and stuff that I do not need. I need some kind of array I think so that my template looks like:

Value[0]

Value[1]

Value[2]

All I got so far is this:

query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'school_objects')
  ->entityCondition('bundle', 'homepage')
  ->range(0, 14);
$result = $query->execute();

I have read the link to this on the Drupal site but cannot understand it or how to print what I need.


texts: Show available languages, but remove "Language Undefined"

texts:
I want to show the available languages, that works, but how can I hide the "Language: undefined" text if "language neutral" is selected.

Thx,
Andi


texts:
I have some html content, it comes from a external library so i can not change it, it has many <span> and <div> tags with attributes like:
<span style="color: #0000ff;">, but when i use:

$render = array(
  '#markup' => $myhtmlcontent,
);

In a render array, Drupal strips the attributes, and it keeps just <span> without the styles.

So, how can I avoid Drupal changes what I pass as markup, which doesn't need any filter because the library makes it safe, or at last make it allow styles?


texts:
I need to set up a semi-regular export of people who have signed up on our website. We're using Drupal 7. I can do a simple export of the Users table, but that doesn't include the additional custom fields we've added.

Is there a module already available in D7 that handles exporting the user database with the custom fields associated with these records?

If not, is there a simple query I can do to identify the custom fields associated with the registration process at runtime? I'd like the export to still work if my customer decides to add a new field.


texts: Automatically backing up uploaded files?

texts:
One of the news sites I'm developing is heavily reliant on its image database, which has been migrated from the old site and is ~15-20gb at this point.

It's dawned on me that it would be really bad if there was some sort of server malfunction and all of the images in that directory were lost -- they're generally created on-the-fly by one person every week from much higher-resolution versions that have been pushed so far back into a totally-disorganized archive that it would take ages to resize and upload them all again (Which isn't even going into the awful process that would be re-adding them to the site's ~15,000 article nodes).

To this end, I'm looking for a way of backing up the uploaded images folder in sites/default/files. One thought I've had is to use Subversion's WebDAV Autoversioning capability, though I'm not overly sure how I'd get the Drupal 7 filefields to use this.

I could also just write a script to rsync files between two servers once a night -- the newspaper's office has a few servers for that sort of thing.

Any thoughts what a good backup solution would be for this particular situation?

Thanks!


texts: How do I make multilangual content synchronization between two sites?

texts: I'm trying to figure out how to synchronize content between 2 sites. Before migration to D8 I was using views data export on site1, and feeds import on site2. My problem is, that in D8 I'm not able to create view where on one row will be English and French content - they can be only two separated rows. But this way I don't know how to set up feeds, to consider these 2 lines as translations of 1 node.


texts: How to send metric data to Google Analytics when a PDF is associated with multiple subsites?

texts:
We use Drupal 7 with Google Analytics and Google Tag Manager.
We have an interesting setup for our site that has a content type called "Public Resource" each of which will have a PDF associated with it.
Each "Public Resource" can be tagged with multiple tags such as: "Coal", "Plastic", "Climate".
We want an individual Google Analytics report for "Coal", an individual Google Analytics report for "Plastic" and an individual Google Analytics report for "Climate".
If someone clicks on the "Public Resource" node then Google Tag Manager looks at the DOM for the page and sends an event to GA for the "Coal" report.  If Plastic is also tagged on the page it sends an even to  GA for the "Plastic" report, and the same deal for Climate.
This sends us good metric data but not if someone from outside our site gets the link to the PDF directly.  If they do this then they don't visit the "Public Resource" node and we don't get our Google Tag Manager data that we want for our Coal, Plastic, and Climate Google Analytics reports.
What we would want is if someone had a direct link to the PDF we would like some way for Google Tag Manager to be able to know that the PDF was associated with the "Public Resource" node and the proper events sent out to Google Analytics for our "Plastic", "Coal", and "Climate" GA reports.
I can't see a way to do this but I'm hoping someone has an idea.


texts: Not_compatible_with_d7 after installing User Points Contributed modules

texts: does anyone know why it displays 'Not_compatible_with_d7' beside a number of modules in the User Points Contributed modules project after install as though it was a missing module even though they all say they are compatible with D7 (and they installed fine).