texts: drush 7 won't take a command without a site alias?

texts:
I just installed drush 7.0-dev and with it all the composer and bash-completion goodness.  The installation went well and in a new shell it (drush 7) is now my default drush.

However it doesn't seem to want to take commands without aliases.  Is this really the new behavior or did I setup something wrong?

Here is a screenshot of a simple "drush dd files" command executed in my sites drupal root path.   I compare it to the drush 6 version which works fine without an alias.

Don't get me wrong I like aliases and all but this seems a bit draconian to force you to have to use them.


texts: User defined field not updating with PHP code

texts:
I am using the uc_node_checkout and I need to set some fields that I have created. The php code is this

if (isset($order)) {
  foreach ($order->products as $product) {
    if (isset($product->data['node_checkout_nid'])) {
      $node = node_load($product->data['node_checkout_nid']);
      $node->field_productid['0']['value'] = $order->order_id;
      node_save($node);
    }
  }
}

If I create an order and add this line to the end of the php code, it dies and show a number.
die($node->field_productid['0']['value']);
When I remove that line and place and order the productid is empty.


texts:
I'm reading in Apress' Definitive guide to Drupal 7 and I'm trying to understand what they're saying. For those who have the book, on page 404 paragraph it says - and I quote - "Every path ultimately matches up to a menu item with a page callback function that has chief responsibility for displaying the page at that path."

But aren't there paths that don't match up to menu items? Or are menu items in this content different things to begin with? And menu items containing functions? How do menu items contain functions?

Maybe The Definitive Guide is a confusing book and there are better resources for understanding how module development works? (I've searched the web for many resources already and they've all been just as confusing as Apress's)


texts:
With a D6 instllation I am seeing 'Killed' returned whenever I try to clear the Drupal cache.

Verbose output gives me this:

Initialized Drupal 6.30 root directory at /var/www [notice]
Intialized Drupal site default at sites/default [notice]
Undefined variable: may_cache feed_field.module 12 [notice]
Killed


texts: How to recover from fatal error with profile2?

texts:
I deleted a profile type and I got this error

  Fatal error: Call to a member function getTranslation() on a
  non-object in
  /home/tohbadco/public_html/sites/all/modules/profile2/contrib/profile2_page.module
  on line 224

I currently cannot access my site as admin. What should I do to regain access?


texts: Drush 8.1.10 via composer only partially working with D8.3

texts:
Ubuntu 16.04
localhost
Drush 8.1.10 installed via composer as per the recommended route.
Drupal 8.3

Drush runs and completes some tasks.
 eg

drush status

  PHP executable         :  /usr/bin/php
  PHP configuration      :  /etc/php/7.1/cli/php.ini
  PHP OS                 :  Linux
  Drush script           :  /home/rich/vendor/drush/drush/drush.php
  Drush version          :  8.1.10
  Drush temp directory   :  /tmp
  Drush configuration    :
  Drush alias files      :

However when I try other commands I get errors

eg

drush up

  Command pm-update needs a higher bootstrap level to run - you will
  need to invoke drush from a more functional Drupal environment to run
  this command.                              [error] The drush command
  'up' could not be executed.

and

drush rebuild

  Command cache-rebuild needs a higher bootstrap level to run - you will
  need to invoke drush from a more functional Drupal environment to run
  this command.                          [error] Command cache-rebuild
  requires Drupal core version 8+ to run.
  [error] The drush command 'rebuild' could not be executed.

Which is very odd as I am using D8.3 as confirmed via 'Status report'.

I have tried

composer install

  Loading composer repositories with package information Installing
  dependencies (including require-dev) from lock file Nothing to install
  or update Generating autoload files

So all looks good there.

drush cc --root=http://localhost/drupal8-test1/

  Enter a number to choose which cache to clear.
  [0]  :  Cancel
  [1]  :  drush

Drush does not find my install - which is installed and running fine

My settings.php

  $databases['default']['default'] = array (
  'database' => 'drupal8-test1',
  'username' => '',
  'password' => '',
  'prefix' => '',
  'host' => '127.0.0.1',
  'port' => '3306',
  'namespace' => 'Drupal\Core\Database\Driver\mysql',
  'driver' => 'mysql', );

PATH in bash.rc

  export PATH=$HOME/.config/composer/vendor/bin:$PATH export
  PATH=/bin:/usr/local/bin:/usr/local/mysql/bin:$PATH

Seems correct to me ...?

I have tried Forcing 127.0.0.1 instead of localhost.

I am running drush from drupal root directory.

I would greatly appreciate any suggestions as to where to go next with this.
:)


texts:
When i log in to drupal doesn't matter with any account either admin or normal user. I get error Access Denied. I then again try to login and it works fine. What is that problem?
My theme was shipped with its own drupal so i guess they might have done some thing wrong.

I feel some session issue because my error messages on drupal valiation forms also occurs one page delayed. So if a submit a invalid form the page post back and hight light the fields with red color but don't show any message. When i go to any other page the error message dive comes up. This happens on both front end and admin panel forms.

Update: I forgot to mention that i am using a custom template for user login page.

Here is the code for my user login template. I am not sure if this is causing issue or something else.

<?php
     // we aren't getting messages, get them manually
            if (isset($_SESSION['messages'])) {
                echo '
';
                foreach($_SESSION['messages'] as $type=>$messages) {
                    echo "
".implode("

", $messages)."
";
                }
                echo '
';
                unset($_SESSION['messages']);
            }
?>

Login

  <?php print drupal_render_children($form) ?>

Updatd Part: I found the culprit i.e my own module

Actually i got the problem. But coudln't find the work around. I have a custom module that redirects user to paypal when he is creating account on my site. I put the $form and $form_state values in session and when the user return back from paypal i pass both variables to user_register_submit function to resume the process of creating account. For this purpose i have to put @session_start() at the start of my module file. This works fine in case of my paypal process. But because of sesion_start() my login flow is disturbed. What can i do to resolve this issue as i need session to hold form and form state


texts: How to create a module to process AJAX request?

texts:
I want to create a module to process some AJAX request like this:

$.ajax({
    url:'/?q=mymodule/path',
    dataType:'json',
    type:'POST',
    data:{'key':'abc', 'value':'123'},
    success:function(data){
        /*do somthing*/
    },
    error:function(){
        /*do somthing*/
    }
});

So which hook function should I implement?


texts: How to create hook for altering every node form?

texts:
I tried:

mymodule_form_node_alter
mymodule_form_node_form_alter

and global hook:
function mymodule_form_alter(&$form, $form_state, $form_id) {
  if ($form['#id'] == 'node-form') {
      #set message
  }
}

None from above works for me.
I need to create hook that invokes on every node form. if it possible.


texts: Varnish has no SSL support; then what to use?

texts:
As the developer of Varnish, Poul Henning, wrote back in 2011 on https://www.varnish-cache.org/docs/trunk/phk/ssl.html and again this year on https://www.varnish-cache.org/docs/trunk/phk/ssl_again.html Varnish has and will have no SSL support.

If this is true for Apache servers (note  https://www.digitalocean.com/community/tutorials/how-to-configure-varnish-cache-4-0-with-ssl-termination-on-ubuntu-14-04 has instructions on how to configure both on Nginx), then I wonder what are Varnish alternatives for Drupal sites that need to be running through HTTPS (like, for example, Drupal Commerce sites)?


texts: Sharing the same templates by importing PHP files: Where should I store those PHP files?

texts:
I want to be able to just edit standard PHP files which are then imported into many themes.

I feel like a module is an overkill, so I'm happy with just a folder of files.


texts: Drupal 7. Custom pages for displaying data

texts:
I'm juststarted with drupal and i want to create module for managing data in my custom database tables.
For example, i need to have three pages:
1) list of my subscribers
2) editing subscriber
3) adding subscriber

so, i need three pages for this:
/subscribers
/subscriber/edit/id
/subscribers/add

the question is:
do i need to create three Basic pages with such aliases in admin
and use specific templates files for each page to manage data?
or how to do it properly?


texts: Drupal commerce. How to show only products suitable for selected vehicle?

texts:
Any ideas how to tackle following scenario with Drupal Commerce?

User selects his own vehicle from select drop-downs. Vehicle consists of following attributes: vehicle type, manufacturer, year, model. Then, by clicking any product category, user gets a view of products in that category that are suitable for the currently selected vehicle.

There are 50000 products in Excel file (with unique SKU), 8500 different vehicles as csv (with unique vehicle id and each vehicle attribute in their own columns), there are going to be 800+ product categories with many subcategories (snow mobiles, scooters, engine parts, exhaust pipe systems…) Many products may fit in many vehicles.

So where to start? How to match products with vehicles? How to match products with categories? Any help is appreciated. Thank you.


texts: How do you restrict specific content types per user role

texts: I'm trying to restrict specific content types per user role so that some users can only edit certain content. I've tried configuring content access module but can't seem to restrict content types.


texts: Auto Import facebook comments into Drupal website

texts:
Using Drupal 7. When i share a node on Facebook, i wish to automatically import Facebook comments made on Facebook for that node into the node's page on Drupal. I've tried a couple of modules including Facebook comments Block

1: https://www.drupal.org/project/facebook_comments_block and Facebook comments social plugin

but they only help users to comment on your site using their facebook accounts, no way to import comments made by users on the content page when it is shared to facebook.


texts:
I am trying to hack a crowdfunding module for Ubercart so that it lets certain vital pieces of information, such as funding goals and the amount already contributed, be displayed on the project pages.

I figured that a good way to do this would be to create a view that would display this information, and then make that the default view for the relevant node-type. Unfortunately, I can't get any fields from the uc_crowdfunding table to appear in the view editor. I even followed this guide should do the trick, as was suggested in this answer.

My added code is as follows:

uc_crowdfunding.module

/**
 * Implements hook_views_api()
 */
function uc_crowdfunding_views_api() {
  return array(
    'api' => '3.0',
    'path' => drupal_get_path('module', 'uc_crowdfunding') . '/views',
  );
}

uc_crowdfunding.views.inc

    /**
     * @file
     * Views hooks for UC crowdfunding projects.
     */

    /**
     * Implements hook_views_data().
     */
    function uc_crowdfunding_views_data() {
      $data['uc_crowdfunding_products'] = array(
        'table' => array(
          'group' => 'Crowdfunding: Crowdfunding products',
          'base' => array(),
        ),
        'cfid' => array(),
        'pfid' => array(),
        'dateline' => array(),
        'target' => array(),
        'type' => array(),
      );
      $data['uc_crowdfunding_products']['table']['base'] = array(
        'field' => 'cfid',
        'title' => t('Crowdfunding product'),
        'help' => t('Data for each crowdfunding product.'),
      );

      // Let's join some tables, eh?
      $data['uc_product_features'] = array(
        'pfid' => array(),
        'nid' => array(),
        'fid' => array(),
        'description' => array(),
      );
      $data['uc_product_features']['join']['uc_crowdfunding_products'] = array(
        'left_field' => 'nid',
        'field' => 'nid',
      );

      // Here are some fields
      $data['uc_crowdfunding_products']['target'] = array(
        'title' => t('Fundraising goal'),
        'help' => t('I guess that this is the amount of money that you\'re supposed to raise, huh?'),
        'field' => array(
          'handler' => 'views_handler_field_numeric',
          'click sortable' => TRUE,
        ),
        'sort' => array(
          'handler' => 'views_handler_sort_group_by_numeric',
        ),
        'filter' => array(
          'handler' => 'views_handler_filter_numeric',
        ),
      );

      return $data;
    }

EDIT: There was also this piece of code, which I had commented out earlier for some reason:

$data['uc_products']['join']['uc_crowdfunding_products'] = array(
  'left_table' => 'uc_product_features',
  'left_field' => 'nid',
  'field' => 'nid',
);


texts: File is saved to /tmp directory, despite setting it permanent

texts:
I have a form, where I can upload a file:

function policies_edit_form($form, &$form_state, $data_array = NULL)
{
  ...
  $form['file'] = array(
        "#title" => "Document file",
        '#type' => 'file',
        '#size' => 22,
        );
  ...
}

function policies_edit_form_validate($form, &$form_state)
{
   $file = file_save_upload('file', array(
           'file_validate_extensions' => array('pdf doc docx'),
                                 ));
   if ($file) {
        // Save the file for use in the submit handler.
        $form_state['values']['file'] = $file;
    }
}

function policies_edit_form_submit($form, &$form_state)
{
  if($form_state['values']['file'] != '')
  {
    $form_state['values']['file']->status = FILE_STATUS_PERMANENT;
    $file = file_save($form_state['values']['file']);
  }
}

Despite I set the status to FILE_STATUS_PERMANENT, the file is uploaded to /tmp directory. After the upload is done, bash commands give this:

bash-4.2$ cd /tmp
bash-4.2$ ls -la 1_1.pdf
-rw-rw-r-- 1 apache apache 111531 Sep 16 16:06 1_1.pdf

And "temporary://" folder in the database:

mysql> SELECT * FROM file_managed;
+-----+-----+----------+---------------------+-----------------+----------+--------+------------+
| fid | uid | filename | uri                 | filemime        | filesize | status | timestamp  |
+-----+-----+----------+---------------------+-----------------+----------+--------+------------+
|   2 |   1 | 1.pdf    | temporary://1_1.pdf | application/pdf |   111531 |      1 | 1379333217 |
+-----+-----+----------+---------------------+-----------------+----------+--------+------------+

How can I upload it to public://policies/ folder? Should I manually set $form_state['values']['file']->uri or there is another way?


texts: Create view with all events till today + 2 more

texts:
to create block with events, which will be shown on homepage. Is it possible to create view, which will show all events, till today + 2 more, which are in future and closest to today date? Like it is shown on this diagram

2017-04-16 Event6 nonvisible

2016-09-15 Event5 visible

2014-03-12 Event4 visible

----------------- today

2013-12-20 Event3 visible

2012-12-20 Event2 visible

2009-12-20 Event1 visible


texts: How to display a field before the title when the title was printed before the node template?

texts:
This answer works when the title is printed in the node template.

However, the base node template contains this code:

<?php if (!$page): ?>
    <h2<?php print $title_attributes; ?>><a href="<?php print $node_url; ?>"><?php print $title; ?>

<?php endif; ?>

So how do I print a field before the title when the title was already printed in the page template?


texts: Saving a unpublished node without validation

texts:
I have site with a content type that has a large number of fields on it.

I would like to allow users to start to create nodes, but not have to fill out all of the fields in one sitting.  Partially completed nodes don't have to be published, but they do need to be saved in the database.

Is is possible to save the node in an uncompleted state without the validation rules running.  I am mainly interested in required fields not being required, unless the node is published.

When users finish populating nodes, the validation rules should run when the node is published.

Are there any ways to accomplish this workflow?


texts: Hide taxonomy term from a view filter where the filter results are empty

texts:
I have several nodes and several taxonomies, but only some nodes have taxonomy relationships.

My problem is that the taxonomy filter shows those terms too which don't have any node relationships at all, example:

So even if I don't have any nodes in "Category 1", the term will show up in the filter.
Is there a way to remove those taxonomy terms from the filter which have no content associated to them?


texts: Can a student gradebook be created without a custom module?

texts: I'm confused about when I need to build a module.  I'm using Drupal 8.  If I create a content type of a student, class, grades and so on, can that be done without a custom module?  Can it be done solely with content type and views?


texts: How to create a config entity that holds multiple URL values?

texts:
I have generated a config entity, and I want to do the following:

Store one or more config entities containing:

Label
Node Type
Link(s)

The objective is a lightweight form that allows admins to create breadcrumb trails for certain node types (similar to how Custom Breadcrumb in D7) that will not be added to a menu (like news, events) but still have a Breadcrumb leading back to a View page or some other page.

For the Link(s) form field, I have:

$form['links'] = [
  '#type' => 'entity_autocomplete',
  '#title' => $this->t('Link to'),
  '#target_type' => 'node',
];

The element shows up correctly and is an autocomplete. What I want to do is "Add another", so I can add more than one.

Also, how do I represent this structure in the .schema.yml file for this object? Would it be possible to also have the links sortable within the form? It would also be great if you could couple a text field to the entity autocomplete, so you could override the breadcrumb title, but I am not concerned with that right now.


texts:
Looking at my views listing, I see each has a "Type". The type effects the choices I have when adding fields. I have to create a whole new view if I want something different. Why is this? Many things are editable in the view. What are all the 'base characteristics' about a view that can't be changed?

I'm thinking about 7.x-3, but comparisons welcome.


texts: I have searched without success a module to add quiPago (italian) payment method to Drupal Commerce. Do I have search in a incorrect way ? Is there a module ?


texts: Way to have a theme-settings form input to accept numbers only?

texts:
I am creating some theme settings and am creating a form to populate them in theme-settings.php. I am using the hook hook_form_system_theme_settings_alter().

I would like to restrict or verify that only numbers can be entered into a field. I've searched online but have not found how to do this. Would anyone know what I ought to add to my code?

Code currently looks like:

$form['mysite_theme']['mysite_contact_phone'] = array(
    '#type' => 'textfield',
    '#title' => t('Contact Number'),
    '#default_value' => $default['mysite_contact_phone'],
    '#description' => t('Enter the main contact number for this site.'),
    '#required' => TRUE,
  );


texts:
On my controller for a custom page I've loaded an entity and I want to render, on the template for this custom page, only a field of the loaded entity. I would like to get the render array for this field.

Is it possible?
I don't want to create a template for this content type only for this


texts: Updating Drush when installed using pear

texts:
When I run drush self-update, I get the following message:

  A newer version of drush, 7.x-5.8, is available.  You are currently running drush version 6.0-dev. The update process depends on how you installed drush. Some common update commands are: pear upgrade drush/drush,  git pull, drush dl drush --destination=[/path/to/drush].

When I execute pear upgrade drush/drush, I get the following message:

  Nothing to upgrade

When I execute sudo drush dl drush --destination=/usr/local/bin/pear/bin (/usr/local/bin/pear/bin is the directory where Drush is found from which), I get the following messages:

Unable to create /usr/local/bin/pear/bin/drush.                                             [error]
Project drush (7.x-5.8) could not be downloaded to /usr/local/bin/pear/bin/drush.

How should I update Drush when installed with pear?


texts: Email send action fails: Cron has been running for more than an hour and is most likely stuck

texts:
I am maintaining a Drupal 6 installation. The task was to send an email to all registered users. I was using a rule set containing one rule with a default action: "send email to all users of a certain role". The rule set has been scheduled, was executed and deleted from the schedule (automatically like expected), but the task seemed to restart forever in the background: all (or probably a lot) users got the email every hour (6 times until I stoped cron). I use poormans-cron.

Please help with to answer this questions:

I suppose the mails could not be sent (~300 users) in the 60 minutes before the next cron (1h) decided that the job was still not complete and restarted it. Correct?
300 mails in 1 hour should not be a problem, but I saw somewhere, but cannot remind where, that one can set a wait time between sending mails. Is that correct? Please tell if you know where.
Can you think of something else than 1. for the reason? (I used out of the box drupal 6 functions).

The log shows:

error   cron    18/02/2012 - 12:04  Cron has been running for more than an hour and is most likely stuck.
warning cron    18/02/2012 - 11:08  Cron run exceeded the time limit and was aborted.
error   cron    18/02/2012 - 11:04  Cron has been running for more than an hour and is most likely stuck.
warning cron    18/02/2012 - 10:07  Cron run exceeded the time limit and was aborted.
error   cron    18/02/2012 - 10:03  Cron has been running for more than an hour and is most likely stuck.
warning cron    18/02/2012 - 09:07  Cron run exceeded the time limit and was aborted.
error   cron    18/02/2012 - 09:03  Cron has been running for more than an hour and is most likely stuck.
error   cron    18/02/2012 - 09:02  Cron has been running for more than an hour and is most likely stuck.
error   cron    18/02/2012 - 07:50  Cron has been running for more than an hour and is most likely stuck.
warning cron    18/02/2012 - 06:46  Cron run exceeded the time limit and was aborted.

Appendix 1, 19.2.2012
I use PHPMailer module to send the emails.


texts: How do I configure facet items to remain visible when they are selected?

texts:
I'm using Commerce Search API along with Search API and Facet API to provide a search for my products. For the server I'm using Search API Solr search.

I want to configure the facets for the search to remain visible when selected. As the facets are now, when I select one it disappears.

Although it seems that this should be an easy task to do, after searching around I couldn't find any information on how to successfully do this. If anyone has experience with this or an idea to make it work your help will be much appreciated.


texts: query to retrieve all translations and nodes of a language that has been removed from the system?

texts:
I am experiencing an issue after a language has been removed from the system. Every time I go on the admin/content page on a drupal 8 site I get:

Error: Call to a member function getId() on null in Drupal\Core\Entity\Entity\EntityViewDisplay->buildMultiple() (line 254 of core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php).

This is a known issue on drupal.org but it has not been addressed yet.
I am afraid this may be a recurring issue and I am trying to build something to clean up content causing the issue (i.e. the content language was removed from the system).

I am looking for a Drupal query that would return all the nodes(entities)/translations which has a language that has been deleted from the system. I can load all content and loop through them to check $entity->language() == FALSE or $entity->language() == NULL but that does not seem to be performant even with using the batch API. Ideally, db query that returns the IDs of the offending content would be much better.
Then I could update them to language neutral or delete the content.

I am wrote something that does something similar to the way node update translations after a language is deleted:

  /**
   * {@inheritdoc}
   */
  public function clearRevisionsLanguage(LanguageInterface $language) {
    return $this->database->update('node_revision')
      ->fields(['langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED])
      ->condition('langcode', $language->getId())
      ->execute();
  }

I repurposed the above to:

function some_helper_to_update_node_lang($lang_code) {
  \Drupal::database()->update('node_revision')
    ->fields(['langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED])
    ->condition('langcode', $lang_code)
    ->execute();
}

But the above function requires the language code, which is reasonable but I am not sure how to make this a more flexible in as much to return all content that has a removed language.


texts: Modifying the node-form in domain module

texts:
Before I start i'll confess that i'm a drupal noob..I'm implementing a requirement in drupal 6.22 with drupal's Domain Access module ( http://drupal.org/project/domain )  which unfortunately has less documentation for a person of my level.

My requirement is such that the people who typically create/add content (page/story) do not need to see the fieldset of domain module with the Domain Access Options, and the created node by default should be sent to all affiliates and published to all the Sites in affiliates list.

I felt that rather than covering up the fieldset in a theme based manner which wasn't much preferrable i felt it needed to be a form alter kind of approach.

Initially planned to use hook_nodeapi to set the $form['domain']['#access'] = FALSE, but realised that it actually does the following as per Drupal's Forms API

  "the element is not rendered and the user submitted value is not taken into consideration."

Since I require the values to be set in an invisible manner that wouldn't help.
I wish to learn the following

Is my approach of using hook_nodeapi the right way, else any other like hook_form_alter or hook_form_FORM_ID_alter a better suited one or am i totally on the wrong track.
How does one set multiple checkboxes as checked in 'checkboxes' type in drupal forms. Couldn't find examples suited to my level of IQ (:D)
If I manage to accomplish my current requirement is there a possibility where I could set some params such that only specific affiliated sites are set for a node based on the user's access and my business logic.

Any help or suggestions on this specific issue are most welcome.

Thanks and Cheers!!


texts: How can I reference field values in another field on the same entity form?

texts:
Example content type that has two fields:

Text field field_value with multiple values allowed.
A custom field field_error (defined with field type plugin) that contains few text "properties" (similar to alt and title properties of an image field). The properties are: reference and message. This is also multi-value field.

I want to achieve similar behaviour to the machine_name form element which takes it's default value by transliterating other field value. In my case this would be the field_error's field property reference to actually reference one of the values of the field field_value.

Is there a module that would help me to achieve that?

If not then I don't mind coding it myself. This challenge could be split into two separate issues:

field_error configuration that would require admin to select a target field for reference. Question: can I somehow access other field names from the content entity type for which the field is being configured? storageSettingsForm() gets only $form array and $form_state arguments.
Client side JavaScript that would use that information to dynamically build select options for reference property of field field_value. Question: is there Drupal way for accessing field values inside JS or do I have to code everything from scratch?


texts:
I'm trying to run some script from Pinterest, to validate my site.

What's happenning is I need to write in Pinterest the url of my site, but my site redirects always like this : "XXX.com/es". How can I avoid that for this test made it by Pinterest.

I also can include on HTML file given by Pinterest but that would be the same, since again my website adds the language (=es) at the end of the path.


texts:
I am trying to disable new relic on custom form. The standard way of disabling the new relic injection is:

if (extension_loaded('newrelic')) {
   newrelic_disable_autorum();
}

I am using hook_page_attachment to disable new relic javascript before the page renders:

mymodule_page_attachments(array &$attachments){
if (extension_loaded('newrelic')) {
   newrelic_disable_autorum();
 }
}

The above solution doesn't work. Is any one have similar problem and know the work around.


texts: Access violation with Drupal 7 multisite using shared DB

texts:
I'm building a Drupal 7 multisite and I want to have a separate database for each site but with some shared tables. So, I have two sites called siteone and sitetwo. I also have 3 databases - oxone (for first site), oxtwo (for second one) and oxshared (where I want to keep shared tables for both sites.

I used the following config for settings.php (for siteone), but it shows me a PDO exception... What I'm doing wrong? Will be very appreciate for any help or advice.

$databases = array (
  'default' =>
  array (
    'default' =>
    array (
      'database' => 'oxone',
      'username' => 'oxone',
      'password' => '*********',
      'host' => 'localhost',
      'port' => '',
      'driver' => 'mysql',
      'prefix' => array(
         'default'   => 'oxone.',
         'users'     => 'oxshared.',
         'users_roles'     => 'oxshared.',
         'sessions'  => 'oxshared.',
         'role'      => 'oxshared.',
         'role_permission'      => 'oxshared.',
         'authmap'   => 'oxshared.',
     ),
    ),
  ),
  'oxshared' =>
  array (
    'default' =>
    array (
      'database' => 'oxshared',
      'username' => 'oxshared',
      'password' => '**********',
      'host' => 'localhost',
      'port' => '',
      'driver' => 'mysql',
      'prefix' => '',
    ),
  ),
);

The exception is:

  PDOException: SQLSTATE[42000]: Syntax error or access violation: 1142 SELECT command denied to user 'oxone'@'localhost' for table 'users': SELECT u., s. FROM {users} u INNER JOIN {sessions} s ON u.uid = s.uid WHERE s.sid = :sid; Array ( [:sid] => _5UERN3eEWligNxBusEYCq3Lnf48pfvWDu9FDQDZUI8 ) in _drupal_session_read() (line 102 of /home/qsoul/public_html/siteone.dev.lo/includes/session.inc)

Why doesn't Drupal use the oxshared user when accessing the tables in the oxshared database, as defined in the prefix array? It uses the oxone user instead.


texts: Change the error message "An illegal choice has been detected. Please contact the site administrator."

texts:
When a user submits a content that has a taxonomy selection field and NOT make a selection, then the referenced error appears.

Now, I know exactly when, how and where the message appears, is there any way to change it so that it's actually useful for the user (i.e. "You did not select a category."), and not merely a cryptic error message that could potentially freak the user out?


texts: Changes in the way Drupal 7 handles JavaScript and jQuery

texts:
I'm currently developing a JavaScript script that runs on an administration page. I read up on the changes made in Drupal 7, namely the move from document.ready() to its own jQuery function. However, the following script doesn't work.

(function ($) {
  console.log('hello');
  $('#edit-apiusername').append('test');
})(jQuery);

console.log() is firing and I can see the output, but the simple append doesn't work. The field ID is correct.
I am not sure what I'm missing here, but I suspect it has to do with the way I'm referencing the object. Looking at Views 3 JavaScript code, I can see it's done in a similar way.


texts:
My problem is redirect after webform submission.
So I have a webform node and AJAX on this submit button (hello "Webform Ajax").
How I do redirect:
I'm just using hook_form_alter() and add to this webform "submit" special redirect function. It must be make redirect after webform submission.
In general it works if I doesn't use the "Webform Ajax" module.
But I need use the "Webform Ajax" (Do not ask me why) I'm catching a mistake.
In code I found how the "Webform Ajax" makes redirect: ctools_ajax_command_redirect() function.
Well the QUESTION: How can I "alter" this functionality?

Any Ideas how I can make redirect after submit, thanks!


texts: how to add to html.twig from a node twig file?

texts:
I need to add the article image to the post shared on facebook and twitter, this is done by meta tags added in the  as shown below

<head>
  <head-placeholder token="{{ placeholder_token|raw }}">
  <title>{{ head_title|safe_join(' | ') }}</title>
  <css-placeholder token="{{ placeholder_token|raw }}">
  <js-placeholder token="{{ placeholder_token|raw }}">

  {# RIGHT HERE  #}
  <meta name='og:image' content='{{ file_url(element['#object'].field_image.0.entity.uri.value) }}'>
  <meta name="twitter:card" content="photo" />
  <meta name="twitter:site" content="@nestle" />
  <meta name="twitter:title" content="Article Picture" />
  <meta name="twitter:description" content="A description" />
  <meta name="twitter:image" content="{{ file_url(element['#object'].field_image.0.entity.uri.value) }}" />
  <meta name="twitter:url" content="{{ base_path }}" />
</head>

I need to add meta tags in the  in the html.html.twig file, the problem is those meta tags depend on the article being shared because I need to get the URL of the image, I cannot figure out how to do it such that a block of code written in the node.html.twig file would be placed in the  in the html.html.twig file.

WHAT I TRIED
i tried adding a block in start of node file and extending the html.html file
node--article.html.twig (start of file) :

{% extends "html.html.twig" %}
{% block metablock %}
  <meta name='og:image' content='{{ file_url(element['#object'].field_image.0.entity.uri.value) }}'>
  <meta name="twitter:card" content="photo" />
  <meta name="twitter:site" content="@nestle" />
  <meta name="twitter:title" content="Article Picture" />
  <meta name="twitter:description" content="A description" />
  <meta name="twitter:image" content="{{ file_url(element['#object'].field_image.0.entity.uri.value) }}" />
  <meta name="twitter:url" content="{{ base_path }}" />
{% endblock %}

then calling this block from the html.html file like this:

  <head>
    <head-placeholder token="{{ placeholder_token|raw }}">
    <title>{{ head_title|safe_join(' | ') }}</title>
    <css-placeholder token="{{ placeholder_token|raw }}">
    <js-placeholder token="{{ placeholder_token|raw }}">

    {# RIGHT HERE #}
    {{ block('metablock') }}
  </head>

But this gives an error

  The website encountered an unexpected error. Please try again
  later.Twig_Error_Syntax: A
  template that extends another one cannot include contents outside Twig
  blocks.

I tried putting the rest of code in node--article inside a block, this does work but the metablock block gets placed in the start of every article viewport (Not what I intended) I need it to be placed only in the head tag.

Hope I was clear enough, to summarize, How can I place meta tags in the head from the node--article.html file, not the html.html file.


texts: Drupal 7: LDAP: How to fetch user information on a webform

texts:
0 down vote favorite

I have a drupal 7 webform and I want to pull the user information of the logged in user using LDAP. This information is stored on another form of my site. and so when a user opens the current form, I want to display something like this -

Hello, USER_NAME, your current status is STATUS and so on...

USER_NAME and STATUS and many other fields are stored on another form so how can I pull this using LDAP? I have already installed LDAP on my website. I searched a lot on web but could not find a working example.

Can someone help me here pls?


texts: Automatically add a new node to a drop-down menu

texts: When a user creates a node of a certain type, I want that node to be added to a drop-down menu at the top of the screen: i.e., so that when the user mouseovers the parent item in that menu, a list of all the nodes of that type is displayed. What's the best way to achieve this?


texts: System pager isn't showing for logged in users

texts:
I'm using Panels 7.x-3.2 on Drupal 7.12. I have the Panels Taxonomy term template enabled and for some reason, there's no pager being rendered below the content. You can manually append ?page=x to the URL and it works, but the pager isn't being shown.

It displays if I enable the Taxonomy Term View instead of the Panel, but I need to use Panels to handle term output in order to heavily customise the layout of terms under a specific vocabulary, so using Views for it isn't really an option.

Any ideas? I looked through the Panels settings both for the specific Panel page and the general ones, but there's no mention of pagers or pagination anywhere, so I'm completely stumped...!

EDIT
turns out this isn't Panels related. D'oh. It appears to be strictly related to Taxonomy itself. I recall having this issue before, where a Taxonomy term page should have shown a pager but didn't until I overrode the output using Views' Taxonomy term page. Not sure what's causing this but I can't find any related issues for Drupal 7.x core, so maybe it's something to do with my theme (which is derived from Zen)?

EDIT 2 (25-Apr-12)
after extensive scouring for the cause of this problem I have been able to narrow it down further, but not much. Here's what I know at this point:

It's affecting system-generated (non-Views) Taxonomy term pages
The pager is rendered to anonymous users; as soon as you log in, regardless of the account/roles/permissions, the pager disappears
Pagination itself works; you can append the ?page= parameter to the URL and it will return the specified page of content
Changing the theme to Bartik fixes the problem

Given that, you'd think my themes (I'm using a parent one and a child theme, both derived from Zen) doing some really weird stuff with page output, but there's absolutely nothing in them that could logically affect paging - especially not for logged in users. In fact, the only hooks they implement are:

template_preprocess_page() (to add some page-specific JS and CSS)
hook_form_alter() (to customise the search form)
hook_privatemsg_message_presave_alter()
theme_breadcrumb() (pretty much as written in Zen)
theme_menu_local_tasks() (also pretty much as written in Zen, which in itself is almost like the original code for it - tweaks the HTML for tabs slightly)
theme_menu_local_task() (again, just the Zen implementation)
template_preprocess_html() (to add body classes)
template_process_page() (very small if condition to specify if the page is a node or not)

Plus some other process_ and preprocess_ hook implementations to add some classes and tpl suggestions. There's absolutely no manipulation of any "pager" stuff anywhere, or nothing obvious anyway... so this has really stumped me, but it has to be something in my themes surely?

Also, just to clarify, it's definitely not a case of CSS interference as the markup doesn't even make it into the output - it's completely absent. Argh!


texts: Migrate site from dev environment to production server - 404 errors

texts:
We completed development on our dev environment and I copied the files over from the dev server to the production server through FTP.

Then through back up and migrade module, I made a back up of the SQL database. I created a new database through Plesk with the same name, username and password. I then imported the SQL database into the new server through phpmyadmin. I go to the URL and get the Site Maintenance message (which is correct, I placed the site in maintenance mode before copying the files over) but cannot navigate to any sub pages. Generally I can add /user or /admin to the end of the url and get the login screen. However all I get are 404 errors.


texts: Can I create a Twig file of a field which can be reused in many different content types with the same Twig effect?

texts:
I created a Twig file for a field of a content type and made some changes in the Twig for that field. Now I want to reuse the same field  in different content type with the same Twig effect.

Is it possible if yes then how we can achieve that?


texts:
Suppose, we have an entity "song", that has a required field, called "authors":

In the list of songs in the admin panel I want to output the list of all the authors in the search block:

//search form
$form['search'] = array(
  '#type' => 'fieldset',
  '#title' => t('Basic Search'),
  '#collapsible' => TRUE,
  '#collapsed' => !empty($search_term) ? FALSE : TRUE,
);

//song name
$form['search']['search_text'] = array(
  '#type' => 'textfield',
  '#title' => t('Search Term'),
  '#default_value' => !empty($search_term) ? $search_term : '',
);

//authors
field_attach_form('song', null, $form['search'], $form_state, NULL, array(
                      'field_name' => 'field_authors',
                      ));

//submit button
$form['search']['search_submit'] = array(
  '#type' => 'submit',
  '#value' => t('Search'),
);

In the output I get this:

How can I make the checkboxes group non-required for the search form?
Why is the order of the fields broken? I added authors before the submit button, but in the output it's below the button.


texts:
I want to migrate a wordpress blog to drupal. I create an "Article blog" content type with three fields: body, tags and categories (plus default title field). I am trying to import with Wordpress migrate (version 7.x-2.2) via url or file, both solution return same error while importing for each article:

  Illegal string offset 'translatable' File drupal_root/modules/field/field.multilingual.inc, line 176

I am using drupal 7.22 with commons profile 7.x-3.2.
All other imports (tag, categories and attachments) works fine.

Do you have an idea about how to solve my problem?


texts:
I have added two category of blogs and i want to show only one blogs of each category on front page. I found the option Home » Administer » Site building » Views.- Edit Block View.. When i change no of Items to display and save it showing error message.
 "admin/build/views/ajax/display/Block/block_2/items_per_page.Error Description: 0: "  Anyone knows about this.


texts: How to create a view grid that changes content type per row

texts:
Goal: Create a Grid that shows mixed content types and have control how those types are added to grid (ie. by row)

I have 3 content types and would like control over how they are added to a view.

Case 1: inject a row of Content Type B or C into a view of Type A based on row number.

Case 2: intersperse view with (possibly random) Content type C (think adding images to liven it up.)

Some approaches I've explored:

Display Suite View Display
Views Context Display
Panels with Context
Views embeded in views
NodeQueue

For case 1 I could just create seperate blocks but then I need to keep the view order consistent (perahps using nodequeue?) across blocks.  Do I need to pass the current node queue position as an argument to each block?

For case 2 how do I insert Content Type C images every few rows?  (I could even use css but need the grid to wrap around it.)

Important note: I'm a system builder, not a developer so prefer something that can be maintained without managing custom code but a basic views template would be fine.

Case 1

Content Type A
Content Type A
Content Type A
Content Type A
Content Type A
Content Type A
Content Type A
Content Type A
Content Type A
Content Type A
Content Type A
Content Type A
Content Type B
Content Type B
Content Type B
Content Type B
Content Type B
Content Type B
Content Type A
Content Type A
Content Type A
Content Type A
Content Type A
Content Type A
Content Type C
Content Type C
Content Type C
Content Type C
Content Type C
Content Type A

Case 2

Content Type A
Content Type A
Content Type A
Content Type A
Content Type A
Content Type A
Content Type A
Content Type C
Content Type A
Content Type A
Content Type C
Content Type A
Content Type B
Content Type B
Content Type B
Content Type C
Content Type B
Content Type B
Content Type A
Content Type A
Content Type C
Content Type A
Content Type A
Content Type A
Content Type A
Content Type A
Content Type A
Content Type C
Content Type A
Content Type A


texts: Change in view hooks file name/location in core 8.3.x?

texts:
I have a custom module that uses a couple of view hooks, and in 8.2.x I had them in my_module.views_execution.inc, in my module root directory. However, with the update to 8.3, my hooks are not being found. I'm looking at the 8.3 docs, but the incredibly verbose hooks overview page doesn't mention it, and neither does the page with the list of hooks.

So where do my view hooks need to be placed in 8.3 so they can be found?


texts:
I just finished a mobile-responsive site using an Omega sub-theme in Drupal 7. I just noticed that it is not possible to tap or double tap on an iPhone to access the search field.

I'm not sure where to begin looking for answers to this issue. Any suggestions?

Site:

http://dianalogan.com/


texts: Database in settings.php doesn't exist yet site is live. Where is the data?

texts:
I've inherited a Drupal 6 site running on an Ubuntu 10.04.4 LTS server. I'm trying to understand the configuration of it to create a local version of it work on.

I can't figure out how the data is being accessed. The settings file shows the following:

$db_url = 'mysql://root@localhost/drupal';
$db_prefix = 'dru_';

However when I list the databases, I can't find it:

mysql -u root
mysql> show databases \g
+--------------------+
| Database           |
+--------------------+
| information_schema |
| gitpull            |
| mysql              |
+--------------------+
3 rows in set (0.01 sec)

In addition running drush status says it can't find it either.

$ drush status
SQLSTATE[42000] [1049] Unknown database 'drupal'                   [warning]

The site is up and running so it's got to have access to the database somehow.

I figure I'm in the right directory because it's defined in /etc/apache2/sites-available and /etc/apache2/sites-enabled/

Any help would be greatly appreciated.


texts: Drupal commerce shopping cart pane empty for non-admin users

texts:
I have added the shopping cart pane to one of my pages so that it would show up on the review page. This works fine for the admin, but for anonoymous or authenticated users, the shopping cart pane shows up empty for the checkout page and the review page.

Is there a permission somewhere which I need to set? I couldn't find one.


texts:
I'm looking for a module, that changes the workflow of creating a node. I want to be able to have several fields in named group sections so the author of a node has some structure.

But when editing the node the author should be able to quickly jump around the forms.

So for example the Content Type "Article" has the following group sections:
Content > Images > Related Articles

In each section there are fields.

How can I do that? Are there mature modules for that case?


texts: Rendering entity reference field in the current language

texts:
I need to render an entity reference (taxonomy) field in the current language (not 'en'). I wrote the following code but the result is always in english (all referenced terms are well translated).

$entity_type = 'node';

$entity_id = 10 //

$source = \Drupal::entityTypeManager()->getStorage($entity_type)->load($entity_id);

$language =  \Drupal::languageManager()->getCurrentLanguage()->getId();
if($language != 'en' && $source->hasTranslation($language)){
    $source = $source->getTranslation($language);
}

$viewBuilder = \Drupal::entityTypeManager()->getViewBuilder($entity_type);
$output = '';
if (is_object($source) && $source->hasField($field_name) && $source->access('view')) {
    $value = $source->get($field_name);
    $output = $viewBuilder->viewField($value, $viewmode);
    $output['#cache']['tags'] = $source->getCacheTags();
  }

$output = render($output);

I don't understand why it doesn't work.
Any idea?


texts: Custom field type where entity reference is optional?

texts:
I am trying to create a field type that is a bundle of two fields. An entity reference user field, and a plain text field.

Image attached for clarity.

The idea is that the user attached to a published piece of content may have a different name at the time of the publication (marriage, divorce, name change, whatever) and has to remain intact for historical reasons. I am still linking to the same user profile, its just the visible name that is different. The most up to date name lives in the user account, but thats irrelevant.

There may be certain cases where a contributing author won't exist as a user in Drupal at all, for a handful of reasons. In this case, I do not want to fill in the reference field, but still use the plain text field. The field formatter will be updated to detect the presence of a target id or not.

The end result being something like:

Attributions: Author One, Author Two, Author Three, Author Four

I can't seem to get it to save an input though unless it has a reference value. How can you do that?

Here is my widget code:

/**
 * Plugin implementation of the 'authors_widget' widget.
 *
 * @FieldWidget(
 *   id = "authors_widget",
 *   label = @Translation("Authors"),
 *   field_types = {
 *     "authors"
 *   }
 * )
 */
class AuthorsWidget extends EntityReferenceAutocompleteWidget {

  /**
   * {@inheritdoc}
   */
  public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
    $element = parent::formElement($items, $delta, $element, $form, $form_state);

    $element['target_id']['#title_display'] = 'before';
    $element['target_id']['#title'] = 'User ID';
    $element['target_id']['#description'] = $this->t('The Drupal user id of the user to reference.');
    $element['target_id']['#weight'] = -50;

    $element['name'] = array(
      '#type' => 'textfield',
      '#title' => $this->t('Published Name'),
      '#description' => $this->t('Set the published name for this author at the time this content was published.'),
      '#default_value' => isset($items->get($delta)->getValue()['name']) ? $items->get($delta)->getValue()['name'] : NULL,
    );

    return $element;
  }

}

edit: Guess I should note that the reason for using the plaintext field here with no user id value is to preserve the listed order of the authors/contributors, which is important with the content we are dealing with.


texts: Add script on head section without module

texts:
I have a google add script Which I want to integrate on the head section. How can I add the script to the head section on drupal 7 without any module and info file? Script is below:

 (function () {

        var _onload = function(){

            if (document.readyState && !/loaded|complete/.test(document.readyState)){setTimeout(_onload, 10);return}

            if (!window.__adroll_loaded){__adroll_loaded=true;setTimeout(_onload, 50);return}

            var scr = document.createElement("script");

        };
});


texts:
I'm new to Drupal 7 and installed it on my local machine to play around.

I'd like to build a basic Job Posting Form and wanted to ask about questions/best practices regarding Drupal.

This was the process I was going to follow:

Create a new content-type "job", add a title, description and pay - all text fields.
Create a new module, then within the module build out the custom form to create a new job listing.  How do I associate the new form with the content-type?  Should I build the form code in my custom theme folder (template.php) or in a new module?
When the form is submitted, how does the data get saved?  How do I associate the submitted form with the database?  Most of the examples using the Form API only mention building the form but not how to store the data (in my example, storing the "job" as new content).

I'm not asking for you to write code for me, but I'm having a difficult time understanding the workflow and best practices for working with Forms in Drupal 7.  Any good guides on how to accomplish what I need would also be appreciated.


texts: how to update a node field value with jQuery callback the drupal way?

texts:
added the callback for jQuery to the hook_menu in my module.

// callback for jQuery with nid and new status as arguments
$items['vacancies_manage/status_callback/%/%'] = array(
    'page callback' => '_vacancies_manage_status_update_callback',
    'page arguments' => array(1,2),
    'access callback' => array('manage own vacancies'),
    'type' => MENU_CALLBACK,
);

return $items;

but how do I call this callback from the module using jQuery instead of just the link? Is there a drupal way for this?


texts:
I am using Drupal 7.17 and the Services module 7.3.2.

I set the Services module as in the following screenshots.

I followed the documentation on http://drupal.org/node/1447020.

With FireFox HttpRequester, I tried to register a new user.

I got a 500 error.

Do you have any idea?


texts: hook_path_update (and insert and delete) not getting called

texts:
I've added the following methods to my module, saved, and flushed all caches on my site. I have double checked that my module is enabled and working properly in all other respects.

function xxxxxxx_path_insert($path) {
  kpr($path);
  var_dump($path);
}

function xxxxxxx_path_update($path) {
  kpr($path);
  var_dump($path);
}

function xxxxxxx_path_delete($path) {
  kpr($path);
  var_dump($path);
}

I want to receive notifications when content path aliases are updated so that I can store some info about them for my custom module. I just put these shell methods in place to ensure I was getting the hook calls and to double check the structure of the $path variable.

Then I edited an existing piece of content. I changed the title and saved the node. Since I'm also using pathauto, that module updated the content path alias to point to a new url based on the new title. I did not receive any of the calls.

Ok, so I figured maybe the auto generation of the alias was the problem, so I edited the piece of content, disabled the auto generation of the path alias and changed the path alias to something by hand. Then saved the node. I did not receive any of the calls to the above hooks.

What am I doing wrong? Why aren't these hooks getting called?

The hook documentation for your reference: path.api.php


texts: Add values to a list (text) field that stores already content

texts:
I want to add additional values to a list field, that stores already content.

In the field configuration i get of course:

  There is data for this field in the database. The field settings can no longer be changed.

Is it acceptable to ignore this message, add my values via the textfield without touching the current ones and save the field?


texts: preventing a date form element from displaying 'day', 'month', and 'year' labels?

texts:
I have a D7 form with a date element on it. I want it not to display 'day', 'month', and 'year' elements. I looked at '#display_title' => FALSE but that doesn't work.

Can I disable the display in the form definition, or must I do this elsewhere?


texts:
I am using Editable views for fast editing of fields that change a lot.
It works fine but the edit field is way to long.
I think it must be fixed with css but I don't know how.
I am using the Corolla theme.
When I use de chrome inspector on that fields this is the result:

block input.form-text, .block input.form-password, .block input.form-file {
max-width: 400px;
width: 100%;
}

When I change the width value it has effect but it will effect al input fields with those css classes. So that is not the solution.
I tried to add a css class in field settings in de view module. I called it editable_fields and I have added it to forms.css and corolla.settings.style.css with this line:

editable_fields {
width: 30%;
}

but it has no effect.

Is there a way to make the field smaller?

It looks like this now:


texts:
I have pathauto installed on my D7 setup along with all my taxonomy terms configured.

How do I then call the alias using PHP for custom code?

EDIT: just to clear things up - I want to output the alias URL that has been created and assigned to each specific node. For example:

Terms
- Country
- City

For node #1 an alias is created as {site}/[country]/[city]

I would like to output the alias that has been created for the node so I can visit for example {site]/england/london instead of {site}/node/1


texts:
I want to use service container inside my class so I have this this:

class SomeController extends ControllerBase {

  protected $entityTypeManager;
  protected $requestStack;

  public function __construct(EntityTypeManagerInterface $entityTypeManager,RequestStack $requestStack){
    $this->entityTypeManager = $entityTypeManager;
    $this->requestStack = $requestStack;
   }

  public static function create(ContainerInterface $container) {
    return new static(
      $container->get('entity_type.manager'),
      $container->get('request_stack'),
    );
  }

  public function content() {
    $testEntityTypeManager = $this->entityTypeManager->getStorage('node')->getQuery();
    $testRequest = $requestStack->getCurrentRequest();
    //do something with these...
  }

}

What I wanted to do here is create a container for EntityTypeManager and RequestStack. Now phpStorm is giving me a warning regarding public static function create(ContainerInterface $container) and it says Method call uses 2 parameters, but method signature uses 1 parameters and I can't use it in my method content().

$testEntityTypeManager and $testRequest are just examples with which I would do something else but even now it doesn't work and phpStorm tells me getCurrentRequest().

Sure I can use them statically but that is not what I'm trying to achieve here. Any push in right direction is appreciated!


texts: Custom widget not rendered within field group

texts:
I wrote a custom module that adds a widget. This widget consists of multiple textfields and an ajax button that sends that information to an external service and gets in return and identifier that is stored locally.

However, it is not possible to render this widget within a group. (Using the field group module)
When adding it to a content type it will never be rendered within a group (as a fieldset, a tab, div or whatever), but instead before or after it.

My custom fields within the widget are bundled together by:

$form['fieldset']['field_name1']
$form['fieldset']['field_name2']

But even when they are not put together as a fieldset, it doesn't work.

How come?

Here is a code snipped of the definition of the fieldset:

$form['b2share_fieldset'] = array(
  '#type'  => 'fieldset',
  '#title'  => t('Publish data on B2Share'),
  '#collapsible'  => TRUE,
  '#collapsed' => FALSE,
  '#tree'  => TRUE,
);

$form['b2share_fieldset']['database_field_name'] = array(
   '#type'  => 'hidden',
   '#default_value'  => $b2share_fieldname,
);

The complete module can be found here.

I want to emphasize that my widget works fine. It's just always displayed outside the fieldgroup even when it is placed within the fieldgroup. Declaring it as a container as described here doesn't work either.

I also tried the patch provided here, but without success.

Also when I remove the fieldgroup and just leave the fields in there, they are always rendered outside the parent element.There aren't any status or error messages either.

I actually want to publish this as a contributed module, so I'd appreciate any help as I want to get rid of this bug, before I do that.

The problem is also described here.


texts: How to add large number of pages to a content type?

texts:
I created a content type "cities", with
Fields: Title, body, location(text field)

I would like to create about 200 pages for this content type.

I can create manually one by one. It will take a lot of time to do that. Is there faster way I can add the pages by using some bulk load methods?


texts:
function custom_user_login($edit, $account) {

  require_once $_SERVER['DOCUMENT_ROOT'] . "/mage1/app/Mage.php";
  global $user;

  umask(0);
  Mage::App('default');
  $session = Mage::getSingleton('customer/session', array('name' => 'frontend'));
  try {
    $session->login('alvaro@test.com', 'cec123');

    $session->setCustomerAsLoggedIn($session->getCustomer());
  } catch (Exception $e) {
    print_r($e);
    exit;
  }

i am using this set of code from my D7 installation to log-in to magento.But it is not loggin into either D7 or magento.

But when i run this code from a seperate simple php file outside it logs in to magento successfully. what could be the problem.


texts:
The User registration form in drupal 7 site has only one country under the country dropdown. How to add the entire list from country module?

gbctest.com/drupal7


texts: 7: How to import simple channel-level rss data to the parent feed node created by Feeds module?

texts:
The Feeds module is properly importing Child/Feed Item-level data to the generated Child-level Drupal nodes.

What I need now is to import Parent/Channel/Feed-level info to the Parent/Feed=level Drupal entity that the Feeds module also creates.

It would/should be a simple mapping that imports the Parent/Channel-level RSS feed data (channel title, channel description, channel image etc) to the Parent/Feed Drupal node that the Feeds module creates (NOT the item/child-level nodes that it also creates.)

<channel>
  <title>Some Feed Title</title>
  <description>Some description...</description>
  <image>
   <url>http://example.com/image.jpg</url>
  </image>

  <item>item info starts here....</item>
  <item>more item stuff here....</item>
</channel>

It seems the Feeds module does not account for this.

I see mention of creating a new parser (https://drupal.org/node/622700) but that is still only affecting the creation of the child/item-level nodes yes?
On that same page I see "Create a feed node programmatically" but that ignores the core Feeds child/item-level functionality yes?
I have installed the Rules module (and its Feeds patch) and am able to get from the $source object the created Parent/Channel-level node ID that Feeds generates when importing the feed, but I don't have any of the feed's data to send to that ID (I don't think anyway - there is a FeedsFetcherResult numerical value but not sure that that is of any help.)

Any assistance in pointing me in the right direction would be much appreciated! Seems like a common need related to this module but oddly haven't seen any solutions out there. Thanks.


texts: How do I show the last created node in a block, without using Views?

texts: How do I show the last created node in a block, without using the Views module?


texts:
I have created few user roles and one of them should be an expiring role, which would be active only for a period of time (something like paid subscription - if user pay for new period of time, the account becomes fully active again). I know of Role Expire, but I'm not sure it's the right think - it wasn't updated in long time and first activating the module instantly created few error messages. Similiar thing (probably) with Notifications.

Any hints how to achieve it? Use one of these modules? Or is there something more I couldn't find so far?


texts:
I have a multi database site, when I save my content type it is added in both the Laravel side database and the default Drupal database.
Now most of my code is in try catch and it does not save data in Laravel db in case of catch but it does save the content types or nodes in the Drupal db hence they show up in my views. How do I stop this in case any error occurs while saving the content type ?
eg ;

try {

        if (!empty($rec)) {
            $db->update('xyz')->fields([
                'type' => $type,
                'logo' => $img_url,
                'link' => $redirect_url,
                'status_id' => $form_state->getValue('field_status')[0]['value'],
                'site_id' => $form_state->getValue('field_site')[0]['target_id'],
                'updated_at' => $currentDateTime,
            ])->condition('id', $rec['id'])
                ->execute();
            $message = 'Content has been updated successfully to the job portal.';
            \Drupal::messenger()->deleteAll();
            \Drupal::messenger()->addMessage($message);
        }
    } catch (Exception $e) {
        //log the exception to watchdog.
        $message = 'Something went wrong to save content in job portal';
        \Drupal::messenger()->deleteAll();
        \Drupal::messenger()->addError(t($message));
        \Drupal::logger('Save-Awards and Certificates')
            ->error($e->getMessage());
    }
    \Drupal\Core\Database\Database::setActiveConnection('default');


texts:
I want to disable titles from showing on main content pages, but have them show still on blog post/article pages.  I was using a CSS rule #page-title to hide them, and was thinking of working from that, but it doesn't work as well in dynamically generated pages. Comparing a post page to a main content page, I don't see any difference in the preceding css classes and ids.

How could I quickly change this behaviour?

I'm working on a self-built custom theme that doesn't have a lot of editing done to it.


texts: Getting node view mode in field preprocess

texts:
I am trying to get the view mode of a node to use it in a field twig file by writing this function in my_theme, but it doesn't work:

function MY_THEME_preprocess_field(&$variables, $hook) {
 if ($node = \Drupal::routeMatch()->getParameter('node')) {
  $variables['view_mode_2'] = $node->view_mode;
 }
}

I don't know if the variable is correct, but when I write some echo code I see that already the if condition isn't fulfilled.

EDIT: the if condition is only fulfilled when the node is open, but not when its teaser is shown as part of a view on the front page.


texts: Programmatically change webform confirmation page

texts:
I've looked at the other similar questions but they don't answer this precise issue.

In my use case, a webform is displayed on an arbitrary entity page (such as "activity/xx"). (This is not a 'node' entity type.)

When completed I want the user to be returned to this page with no message, but we don't know what the value of "xx" is going to be when the webform is created, and the work is going to be done by non-technical staff.

It's possible to:

Create the webform;
Build the entity and select the webform;
Note the entity ID created;
Go back and modify the webform confirmation page;

But this is not good for non-techies. It's easier if they're told to go to the settings page and add a handler.

I just need to force the confirmation redirect to reload the current page.

I could probably manage if I could use tokens in the confirmation page URL, or in the settings handler but I see nothing that says I can and my testing hasn't worked.

I know I can get the source entity in a handler in the back end, so I ought to be able to jump there. I just don't want to break anything...


texts:
In my customized module, I have queried a database value, Jocelyn D. Napiñas. It contains ñ that causes my code to break. Is there any way I can display it? I tried the following code.

$data;  //Contains `Jocelyn D. Napiñas`

drupal_convert_to_utf8($data, 'us_ascii'); //Returns false

check_plain($data); //Returns ''

How will I display it as Jocelyn D. Napiñas?


texts: move fields in the user profile form in fieldsets

texts:
I want to move the email address fields in the user profile form (user/1/edit) in a custom fieldset. I have this code:

$form['change_mail'] = array(
    '#type' => 'fieldset',
    '#title' => 'change email address cake',
    '#weight' => 6,
    '#collapsible' => FALSE,
    '#tree' => FALSE,
);

$form['change_mail']['mail'] = $form['account']['mail'];
unset($form['account']['mail']);
$form['change_mail']['confirm_mail'] = $form['account']['confirm_mail'];
unset($form['account']['confirm_mail']);

But I get an error when I try to change my email address: undefined index 'mail' in user_account_form_validate() (line 1232 of /modules/user/user.module). Apparently, I can't 'unset' the fields. But I don't know how to get rid of them.


texts:
Hello I've just updated Drupal (to version 7.53) and now in Drush when I try launch the commands:
"drush @theflyingeye.org up" (to update my website)
or
"drush @theflyingeye.org cc" (to clean chache)
or
"drush @theflyingeye.org dl view" (to download a basic module, view for example)
I can just get this answer:
"Unknown engine type outputformat"

If I digit:

"drush status" (after "su aegir")
I can get:
"PHP configuration     :  /etc/php5/cli/php.ini
 Drush version         :  5.10.0
 Drush configuration   :  /var/aegir/.drush/drushrc.php
 Drush alias files     :  /var/aegir/.drush/server_master.alias.drushrc.php
                          /var/aegir/.drush/theflyingeye.org.alias.drushrc.php
                          /var/aegir/.drush/server_localhost.alias.drushrc.php

Do you have any advise please to fix this problem?


texts: How to get product attributes (weight, dimension.height..) in php

texts:
I am fairly new to drupal commerce and php so pardon the dumb newbie question. I downloaded commerce_order_ftp_export and after updating it to the devel version I was able to get it working. It ftps an xml file whenever an order is completed.

Now I needed to customize the xml so I can import it into stamps.com. I was successful at changing the shipping information, but I am having trouble getting the product weight and dimensions (width, height & length). I am updating
modules/commerce_order_ftp_export/commerce-order-ftp-export.tpl.php
and code that works looks like:

<?php $shipping_id = $order->commerce_customer_shipping['und'][0]['profile_id'];
$shipping_address = $profiles[$shipping_id]->commerce_customer_address['und'][0];
?>

  <Recipient>
    <AddressFields>
      <FullName><?php print $shipping_address['name_line']; ?></FullName>

But I don't know how to access the products, I tried dpm($products[$product['product_id']]->getPropertyInfo()) in the following code to try to get more information about the product, but it is giving me an error. How show debugging info so I can see the properties of the product or how can I write a debug test page that shows that info?

<?php foreach ($order->commerce_line_items['und'] as $key=>$line_item) { ?>
  <?php if ($line_items[$line_item['line_item_id']]->type == 'product'): ?>
  <OrderItemDetail>
    <LineNumber><?php print $key+1; ?></LineNumber>
    <?php foreach ($line_items[$line_item['line_item_id']]->commerce_product['und'] as $product) { ?>
    <ProductSKU><?php print $products[$product['product_id']]->sku; ?></ProductSKU>
    <ProductWeight><?php print dpm($products[$product['product_id']]->getPropertyInfo()); ?></ProductWeight>
        <?php } ?>
    <Quantity><?php print $line_items[$line_item['line_item_id']]->quantity; ?></Quantity>
    <Price><?php print $products[$product['product_id']]->commerce_price[LANGUAGE_NONE][0]['amount']; ?></Price>
  </OrderItemDetail>
  <?php endif; ?>
  <?php } ?>


texts: WYSIWYG CKEditor config.js not being used?

texts:
I've installed and configured the WYSIWYG module (latest dev) to use CKEditor, and I have downloaded the latest version of CKEditor (latest full release) to sites/all/libraries.  I'm able to use the editor.

I need to customize a few additional things, so I'm applying configuration changes to config.js in sites/all/libraries/ckeditor/config.js.  However, it seems like this file is not even being used or read at all.  I tested this hypothesis by adjusting the stock config.js as so:

CKEDITOR.editorConfig = function( config ) {
    // Define changes to default configuration here. For example:
    config.allowedContent = true;
    alert('Hello!');
};

alert('World!');

Whenever I load the editor, I would expect to get either one or two alerts, one saying either Hello! or World! or both.  However, no alert windows are launched.

How does one customize the configuration of CKEditor when using the WYSIWYG module?


texts: How to display date and time picker for base field on custom entity

texts:
I've made a base field on a custom entity with type "datetime" using "datetime_default" for the form display. It's displaying as only a date picker, with no time component, whereas I want it to look like this:

If I create a field in the GUI I can select between "date only" or "date and time". (The image above is the result of picking "date and time"). But I can't work out how to do this programmatically. I've tried creating fields of both types and exporting the config, but there is no difference between them, which is a mystery.

I suspect I need to put something other than "datetime_default" but I can't find any documentation on how to programmatically refer to the various date and time widgets.

public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
$fields = parent::baseFieldDefinitions($entity_type);

$fields['activity_date_time'] = BaseFieldDefinition::create('datetime')
  ->setLabel(t('Date and time'))
  ->setDescription('')
  ->setRevisionable(TRUE)
  ->setRequired(TRUE)
  ->setSettings([
    'datetime_type' => 'date'
  ])
  ->setDefaultValueCallback('Drupal\opencase_entities\Entity\OCActivity::currentDateTime')
  ->setDisplayOptions('view', [
    'label' => 'above',
    'type' => 'datetime_default',
    'settings' => [
      'format_type' => 'medium',
    ],
    'weight' => -3,
  ])
  ->setDisplayOptions('form', [
    'type' => 'datetime_default',
    'weight' => -3,
  ]);


texts: How to prevent showing background code in Drupal 7 admin?

texts:
I am seeing the following screen when i am saving or updating a node in drupal 7 admin.

I am using Drupal 7 with Seven theme.I am seeing the following texts in white screen.To get the actual i need to click back button.

  [ {"command":"settings", "settings":{"basePath":"\u002F",
  "pathPrefix":"", "ajaxPageState":{"theme":"nbiz_train",
  "theme_token":"BVOiHIMf2BoQgMAltQtiv_GRDGBYoFOGNn3hJ8eJRxw"},
  "colorbox":{"opacity":"0.85", "current":"{current} of {total}",
  "previous":"« Prev", "next":"Next »", "close":"Close",
  "maxWidth":"98%", "maxHeight":"98%", "fixed":true,
  "mobiledetect":true, "mobiledevicewidth":"480px"}}, "merge":true} ]

How can i remove this error?


texts: How can I programmatically change the parse mode?

texts:
We have a view that works with Search API and Solr search. The multiple search terms work with single quotes and with no quotes. I want to make the search terms work with double quotes as well. The issue is also listed here without a fix:
https://www.drupal.org/project/search_api/issues/2141575
I found that I can change the parse mode in the View > Query > Settings to direct method and the term with double quotes work just fine. I want to make this change using hooks. I have tried hook_search_api_views_query_alter and it does not work. Does anyone know how to change the parse mode in the query settings using hooks?


texts: Embedding a view for search and redirection

texts:
I have set up a view for searching using Search API. In my specific setup, I need this search to be context sensitive, i.e. I have several pages /foo/search, /bar/search, ... and these return different results.

Currently, I do this by making a content type which has a field containing the necessary information and additionally a search processor, which alters the query accordingly.

Additionally, I use Twig Tweak to embed the search view in this content type as described here. This works if I load the search with the query string, e.g. localhost/foo/search?search_api_fulltext=something.

My problem is now that if I click the "Apply" button in the search, I am being redirect to the page created by the view. This page is lacking the content type's data and I no longer get the context sensitive search results.

Is it possible to change this behaviour of the view's Apply button or do you know another way this could be implemented?

Thanks!


texts: Pre-select language (instead of "Language neutral") when creating a node?

texts:
With core's Locale module you can enable Multilingual support for a content type. When creating/editing a node, this gives you a Language select list with all enabled languages and "Language neutral" as options.

The default (resp. first) value for this select list is always "Language neutral".

Is it possible to have a certain language as default value instead?

At best it would be a per-content-type setting, but I'm fine with a global one, too (e.g. always using the site-wide default language as default value).


texts: how to override the HTML of the search results page?

texts:
i am trying to override the search-results page with no luck. All of the answers that i have found in google are about overriding the results template. since i am using a subtheme i want to override the whole HTML output of the page. I want to change the header, the footer etc..

Instead results page is using the page.tpl.php. So far i found this How to theme the page template for search results with no success.
Any correct way i can succeed this ?

Also i am trying to force the search to search only in specific content types and languages! Any suggestions?


texts:
Forgive me as I'm new to Drupal and am getting confused about the defaults I'm seeing between different parts of the ecosystem...

I'm using Drupal 8, Drush 9 and Composer to create my project and manage my sites.

I first run:

composer create-project drupal-composer/drupal-project:8.x-dev vanilla --no-interaction

I notice that composer keeps the modules, themes and profiles under the 'web' directory.

    "installer-paths": {
        "web/core": ["type:drupal-core"],
        "web/libraries/{$name}": ["type:drupal-library"],
        "web/modules/contrib/{$name}": ["type:drupal-module"],
        "web/profiles/contrib/{$name}": ["type:drupal-profile"],
        "web/themes/contrib/{$name}": ["type:drupal-theme"],
        "drush/Commands/contrib/{$name}": ["type:drupal-drush"]
    },

I then attempt to run drush to start moving things between different sites and servers but I notice the differences.

drush rsync %modules .

  Replace files in
  dmlb2000@X.X.X.X:/var/www/drupalvm/drupal/web/modules/ with
  /home/.../websites/vanilla/web/sites/all/modules/? (yes/no) [yes]

Why did the '@self' site alias default the modules directory to 'sites/all/modules'?
Which one should be the default location 'web/modules' or 'web/sites/all/modules'?
How can I change the '@self' alias to fix the path?


texts: Fetch user who have flagged a taxonomy term

texts:
My users can flag a taxonomy term.
I need to notify the user who have flagged a taxonomy term when a new content with the flagged taxonomy term is created. I need to do this with rules module.


texts: How can I theme the Responsive Image module in a specific Paragraph Type

texts:
I have a responsive image field inside two different paragraph types. I am on Drupal 8.3.7. I want to theme the module in one paragraph type but not the other.  I want to render a modified version of this code :

https://api.drupal.org/api/drupal/core%21themes%21stable%21templates%21field%21responsive-image.html.twig/8.2.x

I tried putting my modified code inside responsive-image--field_my_resp_image.html.twig but it is not being used. I can't seem to find the correct filename for a theming a responsive image from a specific paragraph type. Any ideas?

My goal is to render embedded CSS for a background image instead of the HTML picture element that responsive images uses. Is there a better method than what I'm attempting above?


texts: drupal contextual filter (URL argument) OR operator

texts:
So, I have a view which filters content from 3 different content types: Books, photos and articles and outputs in the same view.

All three content types have an independent "issue number" field. The view basically filters content based on the issue number. Now in order to create views for each issue, I was individually creating views for each issue. In order to pull content from multiple content types, the OR operator in the filter menu came in handy. The OR relationship is as follows (Let's take Issue 5.1 as an example) in the second group:

Content published = yes
AND
2.Content type is one of Article,books,photos

AND

field_books_issue_number = 5.1
OR
field_photos_issue_number = 5.1
OR
field_articles_issue_number = 5.1

Now, this works perfectly fine, with the only downside that I had to create a view for each issue.

Now, I want to pass the issue number as a URL argument, so that I don't have to create a view for each issue. It would rather be a wildcard path such as: /issue/% and the wildcard value would take the value from the URL (using contextual filter). To do this, I changed the filters to:

Content published = yes
AND
2.Content type is one of Article,books,photos

AND

field_books_issue_number = Not empty
OR
field_photos_issue_number = Not empty
OR
field_articles_issue_number = Not empty

and added the following contextual filter:

field_books_issue_number = Value from URL
field_photos_issue_number = Value from URL
field_articles_issue_number = Value from URL

But as we know, contextual filters have a default AND relationship, which means that only the first condition will satisfy, since the other 2 fields in the contextual filter are from different content types and the other two conditions will automatically fail for every content being filtered.

Now, my question is this:
1. Can different content types share a common field?
2. If not, can the normal filter take values from the URL?
3. If not, can we add an OR operator to the contextual filters?
4. If not, is there an easier way to do what I'm trying to do without having to create an individual view for each issue?

Hope the question is clear. Thanks in advance.

Kaushik


texts: How to populate nodes with imagefield programmatically?

texts:
I'm trying to do a mass import of images to drupal nodes in D7 and ended up with lots of funny entries in the table {files_managed}.

This is the code I use:

  chdir('/path/to/drupal/root');
  define('DRUPAL_ROOT', getcwd());
  require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
  drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

  $node = node_load(123);

  $dir = '/path/to/files';
  if ($handle = opendir($dir)) {

    while (false !== ($file = readdir($handle))) {
      $file_ext = pathinfo($file, PATHINFO_EXTENSION);

      switch ($file_ext) {
        case 'jpg':
        case 'gif':
        case 'JPEG':
        case 'jpeg':
        case 'png':
          $name_explode = explode("_", $file);
          $image_location =  $dir .'/'. $file;

          $file_temp = file_get_contents($image_location);
          $file_temp = file_save_data($file_temp, 'public://' . $file, FILE_EXISTS_RENAME);
          $node->field_ep_image = array(
            $node->language => array(
              0 => array(
              'fid' => $file_temp->fid,
              'filename' => $file_temp->filename,
              'filemime' => $file_temp->filemime,
              'uid' => 1,
              'uri' => $file_temp->uri,
              'status' => 1
              )
            )
          );
        break;
      }

    }

    closedir($handle);
  }

What is the correct way to populate an imagefield programmatically in D7?


texts: Locations updating only after saving a second time

texts:
Primary tabs
View(active tab)
Edit
Posted by P013370 on January 3, 2014 at 6:14pm
I updated the majority of my node's locations using feeds module. Everything was mapped and updated correctly. However, I have noticed that when I use proximity search many results do not appear. They only appear after I go into the affected nodes and re-update their location a bit, then save. For example, a node with a zipcode of 02108 was not appearing under proximity search. After removing the zip code and saving it appeared. I even added the zip code back again, and the node appeared under the proximity search. I have over 3,000 nodes and cannot repeat this process indefinitely. Any suggestions?


texts: Ensure that all Cron jobs work correctly

texts:
I have a Mobile APP with a Drupal 8 admin backend and I have almost 20 cron jobs running at least 15 times on the day. I'm using Ultimate Cron and Advanced queue modules for handling this. I know that to ensure that all crons running properly, the website should be opened at least once a day or make the crons on the server not on the Drupal site. But, my solution is to create one cron job on the
server hitting the website base url to just ensure that all crons will run. So, my question is, does this solution work?


texts:
I have a view which has the path set to events/%, where the wildcard will the the nid of, for example, a department. The view will display all events for a particular department.

I want to be able to change the second nid argument to be an alias, such as events/programming. I don't see this option in the standard Pathauto settings. I found a module which almost does this (only for taxonomy terms), https://drupal.org/project/view_alias, but its only for D6.

Is ther anything for d7, and if not, what would be the best hook to implement to make this change?

EDIT:
There was a suggestion to use the Extended Path Aliases module, but I was not able to get that to work properly, and requires you to hack core (or install hte PECL library). I found a different module, subpathauto, which seems to do the same thing with out core hacking and it also says that it works with views. It still didn't work, this is what happened:

Node path: node/24
Node alias: department/[nid]
View path: department/[nid]/conditions

Example alias: department/physical-therapy-department

When I use the url of department/24/conditions, I reach the view page I want and the filtered content is displayed. When I use the url department/physical-therapy-department, I reach the correct node page. When I use department/physical-therapy-department/conditions, I DO reach the view page, but it has no content. Clearly the system did not translate physical-therapy-department back to 24 for processing, and the view didn't work.

Does anyone know how to use this module properly?


texts:
I have a node type 'blog_entry' that uses a taxonomy reference (tags). The tags are created if they don't already exist, i.e. the reference field uses the option 'Create referenced entities if they don't already exist'. My node bundle as well as the taxonmy term 'tags' have both a field 'field_section', which is also a taxonmy reference.

I would like to set the 'field_section' of the taxonomy 'tags' to the same value as the one 'field_section' on my 'blog_entry' node when I create a new node.

This means: when creating a ne blog_entry I'm selecting a value for the field_section and I'm entering a new value for the field_tags. The new taxonomy value is successfully created in 'tags' but I would also like to set it's field_section to the same value as choosen for the blog_entry.


texts: How to install oAuth using PHP 7 and PECL OAuth library?

texts:
I am [unsucessfully] trying to enable the Twitter module on a Drupal 8 site that is using PHP 7 on ubuntu. The Twitter module requries oAuth to work and oAuth requires the PECL OAuth library.

If I run sudo pecl install oauth

I get back:

pecl/oauth is already installed and is the same as the released version 2.0.2 install failed

and then if I try drush en oauth

I get back:

Module oauth doesn't meet the requirements to be enabled.            [error]
OAuth module requires the PECL OAuth library.

Any help with how to configure the oAuth moudle and the PECL oAuth library?


texts: AJAX callback inserts empty div with large amounts of data - Whats happening?

texts:
Drupal 7 - Created a module that lists out a bunch of tabular data from an external oracle database. The list has a number of select boxes to narrow down criteria. After setting up the menu file I have the following callbacks:

function listAll($form,&$form_state) {
    //Page callback for drupal_get_form

    $form['semesterSelect'] = array(
        '#type' => 'select',
        '#title' => 'Semester',
        '#options' => array('Fall','Winter','Spring','Summer'),
        '#default_value' => 'Fall',
        '#ajax' => array(
            'callback' => 'callbackSemesterSelect',
            'wrapper' => 'courseListDiv',
        ),
    );

    $form['courseList'] = array(
        '#type' => 'markup',
        '#prefix' => '
',
        '#suffix' => '
',
    );

    if (!empty($form_state['values']['semesterSelect'])) {
        $form['courseList']['#markup'] = getCourseTable();
    } else {
        $form['courseList']['#markup'] = 'Select a semester';
    }

    return $form;
}

function callbackSemesterSelect($form, $form_state) {
    return $form['courseList'];
}

function getCourseTable() {

/***
* This function uses ob_start() and ob_get_clean() to return an HTML formatted table
*/

}

What I have noticed is that if my table goes over 30 or so rows the output ends up being an empty div where courseListDiv was previously. When its under 30 rows it displays the courseList element with prefix/suffix as expected. Is the output buffering causing this? is there a limit on ajax data or something in drupal that might be causing this?


texts: Views 3, empty page returns page not found instead of empty text

texts:
I am using Views 3 on Drupal 7.

I have created a view page and gave a path. I have set to display full content.
I have then added a NID contextual filter and set provide default value through PHP code. I am then using PHP to generate a list of nodes to show.

When there are nodes the page loads correctly.

When there are no nodes the page returns 'page not found'.

I have no results behaviour to print text saying no results are found, but this does not show.
I then added a header/footer and enabled 'Display even if the view has no result', these do not get displayed.

I have set a page title but this also displays as 'page not found' rather than the set title.

How can I get the view page to display even if there are no results?


texts: View showing a list of tagged nodes related to term reference field

texts:
Drupal 7

Taxonomy vocabulary = Company activity (Activity 1, Activity 2, Activity 3 ….). This vocabulary has an OG group field.

Content type 1 = Company with an entity (terms) reference field showing the list of the terms of the activity vocabulary. The widget is “radio button box” and the administrator of the Company, during the creation of the content, may tag and save the appropriate activities performed. This content type has an OG group field.
Example: Company 1 --> tag Activity 1 and Activity 2 – Company 2 --> tag Activity 1 and Activity 3

Content type 2 = Request of Service. Any Company can create a new request of service and first of all choose the needed activity in a entity (terms) reference field (fiel_tipologia_macchina) showing the list of the terms of the activity vocabulary. The widget is “selection list” – only one choice. This content type has an OG group audience field.

Now the question: In Content type 2 (request of service) I need to add a field that show the Company qualified to perform the requested service.
Example: the service requested is “Activity 1” --> show Company 1 and Company 2.

The field has to be a radio button box so the author of the request can choose the company to send the request (one or more company).

I think that I have to use a view (page or block) but I am not able to find the right relation and contextual filters (entity reference or OG).

Thank you in advance for help.


texts: Routing to production and testing Drupal installations on shared hosting account

texts:
I am having issues with routing users to different domains on a shared hosting account.  Each of these domains are separate Drupal installations with separate databases.  site is intended to be the production environment, and site1-test is where we do our development and testing of content and modules prior to upload to the main site.  Also, if it has any impact on this issue, clean_urls are enabled.

Here is my file structure

+ public_html
   + site1
   + site1-test

site1 should route to www.site1.com (or site1.com)
site1-test should route to www.site1.com/site1-test (or site1.com/site1-test)

To me, this should be fairly straightforward updating of the .htaccess files.

Here is what I have done so far:

public_html/.htaccess

Options +FollowSymLinks
RewriteEngine on
#========================================================================
# FIRST Handle the http requests first before removing the additional url junk
#========================================================================
#rule for site1.com to link to site1 directory
RewriteCond %{HTTP_HOST} ^(www.)?site1.com$
RewriteCond %{REQUEST_URI} !^/site1/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /site1/$1
#rule for site1.com/site1-test to link to site1-test directory
RewriteCond %{HTTP_HOST} ^(www.)?site1.com/site1-test$
RewriteCond %{REQUEST_URI} !^/site1-test/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ /site1-test/$1
#rule for site1.com to link to site1folder directory

#==========================================================
# SECOND Remove the additional url junk once the new url is loaded
#==========================================================
#rule for site1 url rewrite to remove /site1/index.php from the URL
RewriteCond %{HTTP_HOST} ^(www.)?site1.com$
RewriteRule ^(/)?$ site1/index.php
#rule for site1-test url rewrite to remove /site1-test/index.php from the URL
RewriteCond %{HTTP_HOST} ^(www.)?site1-test$
RewriteRule ^(/)?$ site1-test/index.php

public_html/site1/.htaccess and public_html/site1-test/.htaccess

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  #RewriteRule ^ index.php [L]
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

  # no changes within <IfModule mod_headers.c> ...

public_html/site1/sites/default/settings.php

...
$base_url = 'http://www.site1.com';
...

public_html/site1-test/sites/default/settings.php

...
$base_url = 'http://www.site1.com/site1-test';
...

public_html/site1-test/sites/default/settings.php

So, there are multiple issues that I have.  With the code listed above, all themes and login information is completely broken when visiting www.site1.com.  However, visiting www.site1.com/site1-test works fine, although there are some issues with the Testing module (cannot run tests from the web interface, though I think this issue is linked to something being wrong in my htaccess file).

If I comment out the base_url for site1.com (i.e., //$base_url = 'http://www.site1.com';) then site1.com works, however all links show up as http://www.site1.com/site1, and all navigation after leaving the front page also shows that subdirectory.

Unfortunately I don't have access to the domain registration, but I do not believe that any redirects currently exist there, simply that the domain points to the site1 subdirectory.


texts:
I am using Opigno (a LMS based on drupal) and I want to edit a page. I am looking for its HTML but when I open the code for the page this is what I found.

<?php print render($page['content']);
<?php print render($page['content_bottom']); ?>

I try to use print_r function in PHP and it displays an array of stuff.

How could I change the page if it is from php.

Thanks!


texts: How to change the default variant globally?

texts:
Is there a way to change the default variation (e.g. size, color) for thousands of Drupal Commerce products on a site? I found the Commerce Default Product Variant module that does it on a per-product basis, but I need to do it globally.

I am open to doing it directly in MySQL if it won't break anything, but I am not sure how to do so at the moment.


texts: Commerce / Rules: How to update node that references a given product when the product is updated

texts:
I am trying to follow the Commerce Product model of Node Display that references each product.

When I create a product, Rules automatically creates a Node with the same title, and references the product in the node.

However also using Rules, I would like to perform the following:

When product is updated, update the referencing Nodes Title / Published attribute
When product is deleted, delete the referencing Node

I can't figure out the way to fetch the Node Entity in Rules at all.

Thanks!

EDIT:

As per @rfay's comment below, I've attempted to go down the Bi-directional reference route, which means installing the References module and create a node_reference field in the product that points back to the node.

Unfortunately however it seems Rules is not providing the means to fetch the node entity, as it is not recognizing the existence of the node_reference field on the product by which to fetch the node from.


texts: Make some text of the calendar module multilingual?

texts:
I instaled and got running fine the 'calendar' module. I just need to make some texts multilingual.

This module generate a view which shows a monthly calendar, then you can change to weekly canlendar, day calendar and so on.

To switch between this display this module show some links above the calendar. The text for these link are what I need to make multinlingual (see picture 1)

These links are taken from the name of the display of the view (see picture 2)

How can I accomplish this.
Thanks