texts: Dynamically add destination fields to migration - importing data when fields on destination entity are not know

texts:
I am trying to import content from JSON from an API call. This API call has different source data depending on what the call is.
For my migration from this JSON, there are set fields that I have coded into the YAML migration file under the process section. The issue I am running into is, some of the fields change, so I need a way to dynamically add these fields to the process section if they exists. Is this possible with Migration?
I think there must be some way to do if with derivers, but I am struggling at how to implement this.
Any insight would be greatly appreciated!


texts:
I have a drupal 7 codebase which I downloaded from a production server and set up locally (using PHP version 7). There is this amazons3.module file in which I have to add an extra namespace Drupal\amazons3 to get it running. If I remove the line, the code throws an error stating : Error: Class 'Drupal\amazons3\StreamWrapperConfiguration' not found in amazons3_upload_location() (line 345 of /xxx/yyy/sites/all/modules/amazons3/amazons3.module)..

Why am I having to add this code when it is not there in the production version and nor in the github codebase ?


texts: How to find out who and when created taxonomy term

texts:
Is it possible to know who and when created taxonomy term? Is that information stored anywhere?

I can't find it.


texts:
I created a profiles type called: Game Player Profile (Machine name: game_player_profile). This contains : field_firstname, field_lastname, field_profilephoto, field_zipcode.....

How do I print and style these fields to create a page with a list of the 'Game Players' First Names + Last Names + Photo.....

Thanks

J.


texts: Add custom user image field on private messages list instead of default user picture

texts:
ok, this is what I have done so far but it is still not working.

First I wanted to add senders profile picture to the private message list on each user profile page. To accomplish that, I used the following code from drupal.org forum:

https://drupal.org/node/1549540#comment-5956560

It does work on my site, but it is using the default user picture. I would like to use a different image for users profile page. So I created an image field named profile_image. I am not pretty sure what is the best approach. On this page, they are trying to change the default user profile picture by the image field but for some reason it is not working for me:

How can I display a picture from a field as the user picture rather than the drupal default with user-picture.tpl.php?

I took the user-picture-tpl.php which had the following code:

<?php if ($user_picture): ?>
  <div class="user-picture">
    <?php print $user_picture; ?>
  </div>
<?php endif; ?>

I removed it and add this code:

<?php if (!empty($user->profile_image[LANGUAGE_NONE][0]['fid'])) {
  // Load the file
  $file = file_load($user->profile_image[LANGUAGE_NONE][0]['fid']);

  $account = user_load($account->uid);

  // Note the style name is "profile_picture" as explained in your question,
  // not "profile_pic" which was in your original code
  echo theme('image_style', array('style_name' => 'people_profile_image', 'path' => $file->uri));
}

Nothing is working yet. what I am doing wrong? could you please help me?

Thanks


texts: Dynamic processing of string field based on user IP

texts: I am a relative newbie looking for guidance on how to best tackle a requirement within the Drupal 7 realm. I have an entity defined with a field containing the URL for an external resource and would like to be able to manipulate the URL string programmatically before rendering the field as a hypertext link within a view. I thought about storing the alternate URLs in the database but the format is subject to change so the dynamic approach is more attractive since it would only involve a single edit. I need to first check the $_SERVER['REMOTE_ADDR'] to determine whether or not to execute this code because if the user is requesting the resource from a location off site then a proxy link must be generated for licensing purposes. What approach would make the most sense for this use case?


texts:
I am trying to create a view, listing nodes with a specific file type.
This can be achieved using filters. But I want to do it using views argument.
Say the view page's pathe should be 'myurl.com/post/attachment/text/plain' where 'text/plain' is MIME type of the file, and should list all the nodes having txt file in file field.

How to do that?

Here are the setting of the view...

 Path: /post/attachment/%

Relationships

File Usage: File

Contextual filters

When the filter value is NOT in the URL
Provide default value
Fixed value
arg(2)


texts: Send an email notification to admin prior to poll close date

texts:
I'm using Advanced Poll module and it has a nice "Time management" feature. We can schedule when to open or close the poll.

I want to send an email notification to the administrator one day prior to poll close date. So that, admin gets notified and create an another poll.

Is there any way to make this possible with Rules module or hooks?


texts: I need to have my site visitors post comments even if they are not logged in as a member in my drupal 7 site. How do I do that? or is it better to have them sign up so they can post comments?


texts: How to access List type from an option set in conditions of the Rules module?

texts:
Iam trying to access an option set(weight_options) within which we have a List type that holds weight , represented as below

 "entity" : [ "commerce-line-item:commerce-product" ],
 "field" : "field_weight_options"

field_weight_options is a option set within which we have a field_weight which is a List type that holds values like 1lb , 2lb etc

I was able to drill through till
commerce-line-item:commerce-product:field_weight_options:set-id
(which is a option set), using Data Comparison within the Rules module.

I am not able to figure out how to access the list field_weight and its values  Eg: 1lb , 2lb which are with in the option set using Data Comparison within rules module.

Any help/pointers?


texts: How to have two commerce_file modules enabled and living together in a drupal site

texts:
I need some licensed files saved in private file system and others in public, depending on my product type.

To get two commerce_file license types, one configured to save the files in private file system and another in public, My easy and creative idea is make a copy (exactly same) of commerce_file module in a new folder and rename it with a new name. And replace all word in the files that have commerce_file word with the new module name.

Apart of this what more do I need to change in the code to have both modules enabled, and working well, living together without problems?

Surely somebody knowing the code in commerce_file module can answer this. Thanks


texts:
I have a site using OG7 and created groups to let users to access to some content as per the user membership and concent-type membership as well.

Each user has to belong to a group and I can select that group(s) for him/her in the corresponding Group-Audience list box when adding or editing user information.  I have also created content-types which should be attached to a group via Group-Visibility and Group-Audience Fields.  When creating content, let's say an Event, I just select in the group-audience list the group I want that event to stick to and also I choose private as the group visibility choice.

Now, the problem is that I need to import a huge number or nodes of different content types, say Events, and each one has to be associated to a group.  Currently I just import the content-type data using feeds modules (feeds-import) using a CSV file and once in Drupal I do the group associations by hand. I cannot find a way to import the content-type along with group association while importing the data, also I don't know how to do it directly in the database, I tried but it didnt work.  Anyone of you know how to import group-audiences? anyone knows which tables are affected when associating a group to a content-type?  Thanks in advance for your time in assisting me.


texts:
I have a module that populate commerce cart product titles.
The function looks like this:

   function spcart_get(){
  global $user;
$order = commerce_cart_order_load($user->uid);
$wrapper = entity_metadata_wrapper('commerce_order', $order);
//var_dump(commerce_line_item_load(176)->line_item_label);
$line_item_id_sp;
$cart_product_array = array();
for ($i=0 ; $i < sizeof($order->commerce_line_items['und']); $i++){
    $line_item_id_sp = $order->commerce_line_items['und'][$i]['line_item_id'];
    $line_item = commerce_line_item_load($line_item_id_sp);
    $cart_product_array[] = commerce_product_load($line_item->commerce_product['und'][0]['product_id'])->title;
}

$output = (object) array('products' => $cart_product_array);
return drupal_json_output($output);
}

but the output of the function is in ascii:
{"products":["\u05d0\u05d5\u05e8\u05d6","\u05d0\u05d5\u05e8\u05d6"]}

I want that the output json will be un regular UTF-8 letters...
What is the problem?


texts: Display Taxonomy Terms Based on user login in a select list in a view

texts:
I have created a view with taxonomy term as filter criteria.

I want to display values of taxonomy terms based on the user logged in(i.e. I want to display only the terms which are created by that user alone) in that select list.

Any help will be really appreciated.


texts: How LDAP works in Multisite with separate database?

texts: I clone dabase 1 and database 2. All users and content are cloned as is. I then use that databases for Multisite. So, our multisite is configured to have one codebase with multiple databases. Do I have to re-authenticate users in a multisite with multiple database? If so, can you tell me why and is there a work around it?


texts: How can I get a list of all connected/logged in users?

texts: I would like to make a list of all logged in users accessible through the backend. The routes are created. It is only the request to retrieve the users that I would need. Is this data in the 'sessions' table? Thank you in advance for your help


texts: Showing content associated with node reference in a view

texts:
I have created a "Node Reference Field" in a content type named "TV Shows" . ( And it is  referring to another Content Type "Episodes")

I created a view which takes the NID of "TV shows" from Contextual filters . How to  display all the fields of related "Episodes" to that "TV show ."

cheers :)


texts:
I have imported an outdated production Drupal 6.9 site to my development machine. Then, I upgraded all modules to 6.24. After a while, I imported the database of the production site (to have new nodes). The site appears to work properly on the front end. But now it does not update neither form drush, nor by calling update.php from browser. At drush I get:

    An error occurred at function : drush_pm_post_pm_update            [error]
    WD php: Table 'mysitedb.semaphore' doesn't exist              [error]
    query: DELETE FROM main_semaphore WHERE value =
    '31092233150575fa189b4d9.09364052' in /path/to/mysite/includes/lock.inc
    on line 224.

On Google Chrome, I get just a "Server error" page.

Update: I created semaphore table using this answer but it did not resolve the problem.


texts: Is Paypal payments pro gateway available for Drupal Commerce

texts:
I am aware of the module Commerce PayPal
 but according to the description it only handles redirects to Paypal and not the Payments Pro gateway which allows site users to stay on the site and have their payment processed by Paypal.

What I'm wondering is - has anybody crossed this bridge?
It seems like a pretty major issue for any commerce system worth its salt to address.

I'm also curious if there is any code out there that folks are using which may not be ready for contrib, but could be plugged into the back end of a site.

Are there any development efforts in this direction?


texts: Flush cache does not call custom theme functions

texts:
I have a Drupal 7 theme which is child of Bootstrap theme. When I flush cache from Configuration > Development > Performance, the primary menu disappears and the design of a custom menu breaks; when I flush cache from site's homepage using the the Flush all cache link, they show perfectly.

I found out that when I am in admin theme (Seven) and flush cache, the bootstrap_preprocess_page() function does not get called. In fact, no custom theme functions are called. That's why the page breaks.

I could not find the reason why this is happening. Can anyone please help me to find out the issue?


texts: Dropdown SubMenus Based on Roles Stopped Working

texts:
My site has a menu/top nav of course and I have various dropdown/sub menus.  Yesterday it was all working fine.  If you are an anonymous user, you see a particular menu item, that has a particular dropdown.  If an authenticated user, you see another menu.

Today, I looked at the page, first as an anonymous users, the top level menus are there, but when I hover the dropdown menus items do not appear.  I then logged in and same thing, the top level is there, but the hover does not display the submenus at all.

I then logged in as the admin and can see the top level menu and on hover, all the submenus appear.  So natural thought, something happened with the permissions settings, but I checked everything "seems" fine.  The only changes between today and yesterday afternoon where several updates to a stylesheet and I did add/install several modules [webform, token, date, calendar geolocation], I have not done anything to turn off the menu.  The top level is checked to show as expanded and of course, they show and function correctly when I am logged in as the ADMIN.

To explain my setup: where needed, I created two top menus for "speakers" for example:
speakers ->one ->two (permissions set to display for anonymous users)
speakers ->five ->twelve  (permissions set to display for anonymous users)

In the above example, anonymous user goes to page, hovers over speakers menu item, and should see in the dropdown [submenu items one and two] and this has been working for weeks now.  Same would apply for the authenticated user hovering over the second "speakers" and seeing [five and twelve in the submenu].

How do I debug this scenario to find out what is wrong?  I've been doing this long enough to know it is probably something I have done, but after checking permissions, checking menu visibility - oh I am also using the "Menu Per role" module that has been in place for weeks, I would like some insight on how to attack this problem.

Any suggestions would be greatly appreciated.


texts: How to create a different second level block for every menu link?

texts:
I'm creating a small project and got stuck on the following:

Im using the module Menu_block to create my navigation menu second level.
What i need is a different background for each second level. (Not every link needs a different background, but the compleet block.)
Menu_block creates one block for all the second level items.

Now is there a way to make the one block into seven (i got seven menu links) blocks or is there an other way i could do this?

For a layout of the website see the following link: https://www.dropbox.com/s/p5nr0zm3r2eatbw/layout%20website.PNG
The number 1 or 2 background is what I want to change according to the current active navigatie level 1 link.


texts:
I've created a field programmatically :
$field_storage = FieldStorageConfig::create(
  array('entity_type' => 'node', 'field_name' => 'field_desc', 'type' => 'string'));
$field_storage->save();
$field = FieldConfig::create(
  array('entity_type' => 'node', 'field_name' => 'field_desc', 'bundle' => 'mybundle', 'settings' => array('handler' => 'default', 'handler_settings' => array())));
$field->save();

But the field is disabled by default when I access to "manage form display".
My question is : how can I enable the field programatically?
thanks :)


texts: How do I run Drupal SimpleTest example from Examples for Developers from the CLI?

texts: I've been running tests from a helper_module_preprocess_html function that I trigger on reload. I think I need to level up with testing. I have a vanilla installation of Drupal, downloaded and enabled Examples and SimpleTest modules, and for the life of me I can't figure out how to get the simple test example tests to run from the command line on Ubuntu 14.14. How do I use Drupal's testing system? I'm lost and the documentation on the internet isn't helping.


texts: Update Hero image when user changes filter

texts:
Struggling a little bit here and I hope this makes sense. I'm putting together a Blog is page generated by a view. The blog posts are assigned to categories (Taxonomy Terms). I've added a contextual filter which lists the categories and updates the blog posts with Ajax (Under theme -> Advanced). What I'd like to do us update the Hero image at the top of the page when the user clicks on a category. So as well as updating the blog posts it updates the Hero image.

I've created a new Hero Image view which has a contextual filters and is limited to one post, which i've included on my blog page view inside the header. Which is pulling in the hero image.

I'm not sure whether I need to setup some sort of relationship between the Hero Image view and the Blog page view so the Hero image updates when you change the Contextual Filter.

Here is a screenshot of my Blog view:

Hope the above makes sense.

Any help would be much appreciated.


texts: What if update.php fails due to code errors?

texts:
I sometimes run into the issue, when my PHP code has errors. I run update.php, but it fails with a php error message. After that, Drupal seems to think that the database is up-to-date, but it isn't. Trouble is, running update.php again does not solve the problem.

For example, just now, it has failed to create the tables for a newly created entity. update.php does nothing, but all my Entity code – of course – fails with database errors.

I don't know how to recover from this situation, other than uninstalling and reinstalling the module, which means killing all content first.


texts: Can I run Drush in a situation where the database is on one server and the remainder of the Drupal installation is on another?

texts:
I have a setup (out of necessity not choice) where my drupal installation is on server a, and the database on which it relies is on server b.  The site is working fine, however when I run most Drush commands I get the good old:

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

On the server where everything except the database is stored, there is no mysql.  If drush isn't an option for me that's perfectly fine but I've been tearing my hair out on this one.

Many thanks in advance for any ideas.


texts: My site crashed the other day, and I was wondering if anyone could tell me how I can back up my site, so that if something ever goes wrong again, I could still have a working copy of my site.


texts:
Hello i am having a few problems with 3 menu blocks i have in a region of my theme. You can view this region on the main top of this page
http://onlinebanter.com/latest

The top block just consists of 3 menu items and when you click one the child items appear (seperate menu block level). They appear to the right of the lower level menu block though.

Ive tried giving the first menu block a fixed width

.menu-block-14 {
width:500px;
}

To see if that will 'push the other menus down' but to no avail.

Can anyone suggest something for me to try?

thanks


texts:
After installing Drupal 7, I created 2 files (beep.module and beep.info).

/**
 * @file
 * Provide a simulated beep.
 */
function beep_beep() {
  watchdog('beep', 'Beep!');
}

/*
 * Implementation of hook_action_info().
 */
function beep_action_info () {
  return array(
    'beep_beep_action' => array(
      'type' => 'system',
      'label' => t('Beep annoyingly'),
      'configurable' => FALSE,
      'triggers' => array('node_view', 'node_insert', 'node_update', 'node_delete'),
    ),
    'beep_multiple_beep_action' => array(
      'type' => 'system',
      'label' => t('Beep multiple times'),
      'configurable' => TRUE,
      'triggers' => array('node_view', 'node_insert', 'node_update', 'node_delete'),
    ),
  );
}

/**
 * Simulate a beep. A Drupal action.
 */
function beep_beep_action() {
  beep_beep();
}

name = Beep
description = Simulates a system beep.
package = Pro Drupal Development
core = 7.x
files[] = beep.module

In http://localhost/drupal/?q=admin/structure/trigger/node I see "Beep annoyingly," but not
"Beep multiple times."

Can anyone point out what I can doto see both?


texts: How do I create linked nodes without user intervention?

texts:
Suppose I have a cooking website where users can create Recipe nodes for Food nodes. For example, you might have a Cake node of type Food, and users should see an Add Recipe button on that page which takes them node/add/recipe except that the newly created Recipe node will have a reference to the parent Cake page.
I've added a Content type Entity Reference to to the Recipe node, which works fine. For programmatically generating the link I'm a bit lost though. I initially looked at using the Rules but it's still in alpha, and from the description it looks like I'd probably want to use the Rules Link module as well, but it doesn't have a version for 8.x at all.
Then I started looking at hook_ENTITY_TYPE_create, which is my current best guess for how to achieve the desired behaviour, but that still leaves me with some questions about what the best approach is;

How / Where do I capture the node reference when all I'm given is the EntityInterface type?
What is a mechanism for passing information about the reference/parent node to hook_ENTITY_TYPE_create so that I can even know which reference to store?
How do I create links or buttons on the parent Food node that cause such information to be passed on to the hook?
Lastly, is this even the best approach, or am I missing a way that doesn't involve writing code?

I don't think I need any hand-holding or code, but I'd be very grateful for some pointers in the right direction for each of the above points from a veteran.


texts:
I would like to run a check on each page load.  This only concerns the front end and not the admin dashboard.

Basically what I would like to do is:
1) User hits a URL in the drupal site.
2) A server-side check is ran. If the check passes, run some logic.

How would I accomplish this?

I'm guessing that I can use a hook, but what hook would that be?

Thanks.


texts: How do I extract filename and filepath from a file field?

texts:
Here is what I am trying to tackle: I would like to allow a zip file to be uploaded via the default filefield upload widget for a content type. I am using hook_node_presave to take the zip file and extract is using a helper function based off of the core update manager. The error I am receiving is:

  Notice: Undefined index: filename in filefield_unzip_node_presave() (line 18 of
  /sites/all/modules/filefield_unzip/filefield_unzip.module).
     Notice: Undefined index: uri in filefield_unzip_node_presave() (line 19 of
  /sites/all/modules/filefield_unzip/filefield_unzip.module).
     Exception: Archivers can only operate on local files:  >not supported in archiver_get_archiver() (line 8149 of /include
  /common.inc).

Here is my code:

/**
* @file

* Allows uploading and extracting a zip file uploaded to a file field.
*/

/**
 *
 * Implementation of hook_node_presave($node)
 *
 */

function filefield_unzip_node_presave($node) {
if($node->type == 'game') {
    if (!empty($node->field_game_files)) {
        $zipFile = $node->field_game_files['und'][0]['filename'];
        $zipDirectory = $node->field_game_files['und'][0]['uri'];

        _filefield_unzip_archive_extract($zipFile, $zipDirectory);
    }
}
}

/**
 *
 * Copy of the function used by the update manager update_manager_archive_extract($file, $directory)
 *
 */

function _filefield_unzip_archive_extract($file, $directory) {
$archiver = archiver_get_archiver($file);
if (!$archiver) {
    throw new Exception(t('Cannot extract %file, not a valid archive.', array('%file' => $file)));
}

//Remove the directory if it exists, otherwise it might contain a mixture of old files mixed with new files (e.g. in cases where files
//were removed from a later release).
$files = $archiver->listContents();

//Unfortunately, we can only use the direct name to determine the project name. Some archivers list the first file as the directory (i.e., MODULE/)
//and others list an actual file (i.e., MODULE/README.TXT).
$project = strtok($files[0], '/\\');

$extract_location = $directory . '/' .$project;
if (file_exists($extract_location)) {
    file_unmanaged_delete_recursive($extract_location);
}

$archiver->extract($directory);
return $archiver;
}


texts:
I need to downgrade Drupal 7 installation to Drupal 6, how should I handle it? I have pretty much blank Drupal 7 install (w/ bunch of users, which I really don't want to loose), but the module that I need only works on Drupal 6.

* UPDATE *

following is a module that I'd like to use w/ Drupal: Clickbank IPN | drupal.org and as you see developer(s) don't have anything other then d6 release.

Is there a way to export users from D7 and import then to D6?


texts: Scheduling a module to run at a specific time

texts:
Is there any way to schedule a particular sub-module to run at a specific time? I found hook_cron but it seems to rely on a scheduled cron job in crontab to run cron.php and then cron.php calls hook_cron. I have multiple sub-modules that I would like to schedule to run, all at different times. The scheduled times are user-inputted from the front and processed in the main module. Because of this, for hook_cron to work, I would need to pass in parameters from the main module (based on what the user inputted)

Any help is appreciated.

I am using Drupal 6


texts: OG: How to import 2 related nodes from CSV files using Migrate module?

texts:
I would like to import 2 related nodes (Organic Group and OG group content)
from 2 CSV files using Migrate module
but I cannot find a proper CSV migrate class example or module. I use Drupal 7.

OG Group
  |
  |--OG group content

file formats:

(a) OG Group file
=============================================
gid | group_title | group_body | group_admin

(b) OG group content
==================================
nid | gid | node_title | node_body

relationship:

{a.gid} 1..(one-to-many)..* {b.gid}
{a.group_admin} *..(many-to-one)..1 {users.uid}  // group admin is one of existing users uid that should have the OG group administration membership rights

Where can I find a sample CSV migration class for Migrate module ?

Migrate OG is for D6 only
Migrate Extras contains classes for OG for D7 but I could not find an example for this scenario.


texts: How does the private files folder need to be configured exactly?

texts:
In settings.php I specified as /home/username/myfiles

Under Config > File System it shows the path, but when I add a file field to content, it does not show private upload as an option. I am wondering if it is because of how I specified the path? The path exists, and is writable. So I am confused.

Any ideas?


texts:
In my custom module, I created a custom link using

function MYMODULE_menu() {
$items['addcontent'] = array(
    'title'
    => 'Confirmation page',
    'page callback'
    => 'add_content_confirmation',
    'access callback' => TRUE,
);
return $items;
}
function add_content_confirmation() {
return 'Thank you';
}

When I check mydrupal/addcontent, this link works fine

In my template.php, I added

function MYTHEME_form_alter(&$form, $form_state, $form_id) {
  if($form_id == 'my_form_id'){
    $form['actions']['submit']['#submit'][] = 'my_custom_submit';
}
function my_custom_submit()
{
  $form_state['redirect'] = 'addcontent';
}

wich redirects me to my home page.

if I write

$form_state['redirect'] = 'node/add/mycontent';

That works fine.

How can I fix it?

Thank you


texts: How can I do the dynamic select in Drupal 7 forms?

texts:
I work with drupal 7. In the following code I call the function players() which returns array of values for option. This values were defined beforehand by hand. How can I load it dynamically from the database?

 $form['officers']['officer'] = array(
'#title' => t('Select the officer'),
'#type' => 'select',
'#description' => t('Please, select the officer'),
'#options' => players(),
'#multiple' => FALSE,
'#empty_value' => ' ',
'#empty_option' => '- None -',

);

For example in the "Text Field" there is property #autocomplete which defines a path where Drupal’s automatically included JavaScript will send HTTP requests using jQuery.

 $form['team_name'] = array(
'#title' => t('Name'),
'#type' => 'textfield',
'#description' => t('Please, insert your name'),
'#autocomplete_path' => 'autofillform/teamname' ,

);

And i created the module which handles it.

<?php
function autofillform_menu() {
$items['autofillform/teamname'] = array(
'title' => 'Example autocomplete',
'page callback' => 'autofillform_teamname',
'access callback' => TRUE,
'type' => MENU_CALLBACK,
 );
 return $items;
 }
 function autofillform_teamname($string){
 $matches = array();
 $result = db_query("SELECT name FROM users where lower(name) like '".$string."%'  LIMIT 10");
 foreach ($result as $user) {
 $matches[$user->name] = check_plain($user->name);
  }
 print drupal_json_encode($matches);
 return;
 }

Are there any possibility to do the same with "Select" ?


texts:
I am new to drupal. Trying to understand the possibilities of drupal, I have installed drupal8 and followed some tutorials to create a site with a custom theme, custom modules and custom blocks.
So far so good.

Now I have this first test site working (installation in public_html), I wanted to create a second site, served by the same installation. I want to try and make a drupal8 version of an existing site of my company.

Following more tutorials, I have tried several things, but I am unable to get it working. I did the following:

my first site's URL is http://localhost, I tried to get the url http://localhost/owtest working
In public_html I have created a symlink with name owtest
In sites/ I created a directory owtest, containing a settings.php and an empty directory files/

I created a database for the new site. The first site's database name was 'DRUPAL' with user 'DRUPAL', for the new site I created database 'OW' with the same user.
in owtest/settings.php, I changed the database name to OW
I ran update.php, thereby clearing the cashes.

If I now go to 'localhost/owtest', it looks the same as the 'localhost' site; if I add content to the site, the same content appears to the 'localhost' site. It seems the new site does not use the new database.

Clearly, I am missing a required step. Who can help me in getting this to work?
My sites/owtest/setting.php now contains

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

thanks for helping me, Ruud


texts: Get the path from code inside an AJAX callback

texts:
I need the current path (or URL) inside a view hook where I alter filters.
Precisely, I need the node ID, so I use the following code.

$node = \Drupal::routeMatch()->getParameter('node');

This works. The problem is that the hook (hook_views_query_alter()) is also invoked from an AJAX callback, so the code doesn't work.

So I'm trying the following code.

$current_path = \Drupal::service('path.current')->getPath();
$path = \Drupal::service('path.alias_manager')->getPathByAlias($current_path);

This works, but on $current_path I get a string like "//my/url" instead of "/my/url", so I should remove the first character from the value in $current_path.

Is there another way to get the node ID?

Using the debugger, I notice that the only variable containing the URL is $_SERVER['REFERER'], but I don't want to use it.


texts:
I'm struggling with blocks and a custom module. What I've got so far is a module which generates a block with that code:

function commerce_bulk_invoice_block_info() {
    $blocks = array();
    $blocks['showinvoiceoptions'] = array(
        'info' => t('Define Invoice Options'),
    );
    return $blocks;
}
function commerce_bulk_invoice_block_view($block_name = '') {
    if ($block_name == 'showinvoiceoptions') {
        echo '
';
        if(!isset($_SESSION['selected_entities'])) {
            echo 'select a product first';
        } else {
            echo '
SESSION Variables:
';
            echo '
';
            print_r($_SESSION['selected_entities']);
            echo '
';
        }
        echo '
';
    }
}

My problem is, the content generated by hook_block_view is not shown in the selected region but directly after the opening body tag. And it pulls the whole head-content into the body. Anyone knows a solution for that?


texts: Adding "Create New Node" link in views pages

texts:
SO I have two content types, a "Candidate" and a "Job Opening". "Candidate" has an Entity Reference field that points to a Job Opening. I've currently got separate views for both, but on the "Job Opening" view I'd like to have a field that users can click to apply for a job, which would ideally create a new Candidate node with the Job Opening ER field pre-filled so users don't have to fill that in.

I tried adding a Custom Text field containing

Apply Now!

but I just get an "object not found" error when I click on it.

Is there any way to accomplish this be it with existing modules or built-in stuff, or am I gonna have to dive in and start coding?

Edit: So I've managed to get half of what I want. Turns out because my installation is at "/localhost/drupal", then my link needed to be

Apply Now!

So now I just need to find out how to pass a reference to the job opening its from and I'm golden.


texts: Using EntityFieldQuery's FieldCondition on file fields (or complex fields)

texts:
I see plenty of examples of using FieldCondition on basic fields but in my case I would like to query if the file field holds a specific file name.

The structure in the entity object (with language undefined) is:

$entity->field_file['und'][0]['filename']

This is what I have tried:

$query = new EntityFieldQuery();

$query->entityCondition('entity_type', $type)
  ->propertyCondition('status', 1)
  ->fieldCondition('field_file', 'filename', $tokens[1], '=')
  ->addMetaData('account', user_load(1)); // Run the query as user 1.

$result = $query->execute();

Perhaps it is having trouble because of the ['und'][0] not sure? Thanks.

Here is the detailed error:

PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'field_data_field_file0.field_file_filename' in 'where clause': SELECT field_data_field_file0.entity_type AS entity_type, field_data_field_file0.entity_id AS entity_id, field_data_field_file0.revision_id AS revision_id, field_data_field_file0.bundle AS bundle FROM {field_data_field_file} field_data_field_file0 INNER JOIN {eck_downloadable} eck_downloadable ON eck_downloadable.id = field_data_field_file0.entity_id WHERE (field_data_field_file0.field_file_filename = :db_condition_placeholder_0) AND (field_data_field_file0.deleted = :db_condition_placeholder_1) AND (eck_downloadable.status = :db_condition_placeholder_2) AND (field_data_field_file0.entity_type = :db_condition_placeholder_3) ; Array ( [:db_condition_placeholder_0] => rnd13_poster_pack.pdf [:db_condition_placeholder_1] => 0 [:db_condition_placeholder_2] => 1 [:db_condition_placeholder_3] => downloadable ) in field_sql_storage_field_storage_query() (line 582 of C:\www\sr14\modules\field\modules\field_sql_storage\field_sql_storage.module).


texts: Difference between field and field storage in configuration type?

texts:
I am exporting a content type and field associated with the synchronize option available in Drupal 8. I exported and imported the YAML code for content type successfully. When I was about to do the same for the field, I noticed a 'field storage' in the configuration type? What is the difference between the 'field' and 'field storage' configuration type and do I need to export code corresponding to both configuration type?  Below is the configuration file for the same field - 'field_countries'
The field storage configuration is as below

uuid: 2dbe8304-1cdf-4c11-8b2c-09e2a8e59213
langcode: en
status: true
dependencies:
  module:
    - node
id: node.field_countries
field_name: field_countries
entity_type: node
type: string
settings:
  max_length: 255
  is_ascii: false
  case_sensitive: false
module: core
locked: false
cardinality: -1
translatable: true
indexes: {  }
persist_with_no_fields: false
custom_storage: false

The field configuration is as follows

uuid: 74ef1365-f21e-4ac4-9ac3-de208d8ba96b
langcode: en
status: true
dependencies:
  config:
    - field.storage.node.field_countries
    - node.type.bookshare_title_metadata
id: node.bookshare_title_metadata.field_countries
field_name: field_countries
entity_type: node
bundle: bookshare_title_metadata
label: countries
description: ''
required: false
translatable: false
default_value: {  }
default_value_callback: ''
settings: {  }
field_type: string


texts: Is it always bad to pass a variable through t()?

texts:
I have a little helper function for my hook_schema:

function _bbcmap_schema_asr_field($description) {
  return array(
    'type' => 'int',
    'unsigned' => TRUE,
    'size' => 'small', // Up to ~66k with MySQL (equivalent up to ~660.00 adjusted)
    'not null' => FALSE,
    'description' => t($description),
  );
}

And then I can use it something like:

/**
 * Implements hook_schema().
 */
function bbcmap_schema() {
  $schema['la_data'] = array(
    'fields' => array(
      ...
      'mort_asr_male' =>    _bbcmap_schema_asr_field('The age standardised mortality amongst men (fixed point with scale factor 1/100)'),
      'mort_asr_female' =>  _bbcmap_schema_asr_field('The age standardised mortality amongst women (fixed point with scale factor 1/100)'),
      'incid_asr_male' =>   _bbcmap_schema_asr_field('The age standardised incidence amongst men (fixed point with scale factor 1/100)'),
      'incid_asr_female' => _bbcmap_schema_asr_field('The age standardised incidence amongst women (fixed point with scale factor 1/100)'),
      ...
    ),
  );
}

I know that the guideline is not to pass variables through t() but this seems very similar to how the menu system passes the callback's title through t() (by default). Any comments on this being good or bad style?


texts: Is there any way to "linux nice" a process to have less priority

texts: We have some high resource views that would have less impact on the overall performance if they ran at a low priority, e.g. linux nice'd to a low priority.


texts: How to get a section of the menu tree based on the current node?

texts:
I am currently struggling to wrap my head around how the menu tree and menu link services work for outputting part of a menu with some custom requirements. Admittedly I don't have to do this very often, but it seems like there must be a way.

I tried with Menu Block, but that does not seem to be able to do what I need to do.

First, when I am on level 3 and a certain content type, (or the parent route is nolink), I need to print the current level of the menu like this:

The menu links represent what is under the current page.

Second, if it is level 2+ (and not a certain content type), the section parent needs to sit on the top as a blue link, in a different treatment:

Third, if the current page in the menu is active, no siblings are printed, only this page menu link and its children:

I started here, in a menu block:

/** @var \Drupal\Core\Menu\MenuLinkManager $menu_link_manager */
$menu_link_manager = \Drupal::service('plugin.manager.menu.link');
$route_params = array('node' => $node->id());

$menu_links = $menu_link_manager->loadLinksByRoute('entity.node.canonical', $route_params, 'main');

// Attach the top parent, if we are at level 3 (for a project) or level 2 (for a basic page)
// top parent cannot go above level 3.... but also level 2?
// show the current node menu tree and its siblings
// show the siblings if the current page has no children

$parent = reset($menu_links)->getParent();
$uuid = str_replace('menu_link_content:', '', $parent);
$parent_menu_content = current(\Drupal::entityTypeManager()
  ->getStorage('menu_link_content')
  ->loadByProperties(array('uuid' => $uuid)));

$params = new MenuTreeParameters();
$params->setRoot($parent);
$params->setActiveTrail([$parent, reset($menu_links)->getPluginId()]);

$tree = $this->menuTree->load($parent, $params);
$built_tree = $this->menuTree->build($tree);

$link = end($parent_menu_content->link->getValue())['uri'];

$element = $this->menuTree->build($tree);
$build['#items'] = $element['#items'][$parent]['below'];

if ($link != 'route:<nolink>') {
  $build['#top_parent'] = $element['#items'][$parent];
}

if (empty($build['#cache']['contexts'])) {
  $build['#cache']['contexts'] = ['user.permissions'];
  $build['#cache']['tags'] = ['config:system.menu.main'];
}

return $build;

But the children of a link (in below) don't render correctly in Twig, its blank, and I am not sure if there is some easier way to do this.

top_parent is a new theme variable I have added to menu so I can render it separately in Twig.

Edit: below now renders right - I forgot to {% import _self as menus %} in my second macro.


texts: Is it possible to create a subtheme for the core Drupal  Seven theme (in drupal 7)? If so, how do I do this? I had already tried to do it a few months ago to override the templates for Simplenews but it wasn't working.


texts: 404 Not Shown For Custom Module - Drupal 7

texts:
In a hook_menu() implementation, I am defining a route for login.

function my_account_menu() {
  $items['login'] = array(
    'title' => 'Customer Login',
    'page callback'    => 'drupal_get_form',
    'page arguments'   => array('my_account_login_form'),
    'access callback' => 'user_is_anonymous',
    'type' => MENU_CALLBACK
  );

  return $items;
}

However, if I try accessing login/asdfdsa, it still loads the login page, instead of showing a 404 error.

Is there an error on the code I wrote, or in the module?


texts: How to change the Front page for the Commerce Kickstart distribution?

texts:
Just that. I changed the front page to "my-front-page". Now if I go to the front page the fields for this node aren't shown at all. Just the blocks are shown.

I guess there is a preprocess function related to the front page. The only one that I see is this one, but nothing happens if I delete this function:

function commerce_kickstart_theme_alpha_preprocess_page(&$vars) {
  if ($vars['is_front']) {
    unset($vars['page']['content']['content']['content']['system_main']);
  }
}


texts: How to use / configure the Course Requirements module?

texts:
When using the Course module, you may also want to use the Course Requirements module, so that a user cannot be enrolled in a 2nd course until a 1st course is completed.

However, it's not obvious how to actually use / configure the Course Requirements module. So how is this module supposed to be used/configured?


texts: Is there a way to filter the nodes that come from a SERVICES node Endpoint, by a field or status?


texts: How to configure feeds module JSONpath mapping, when all information is on the same (root) level?

texts:
I would like to import content with feeds module with JSONPath extensible parser and create nodes of them.

When I have a hierachical JSON with a parent, the mapping is working like a charme (e.g. context: $.article.* / source: $..title).

My problem occures, when the JSON contains a single content (that should be imported to a single node) and all relevant elements are on the first/root level. This guy had a similar problem, although in my case I even do only have one content per JSON doc (Link), but with the suggested solutions I do not get it work.

{

"identifier": "test0004",

"title": "This is a title",

"application": "Drupal",

}

I don't have any clue, what context and what source I have to define, to make it work. As context I desperately tried-I believe-everything, amongst others:

.
.*
$
$.*
$[]

And as source $.title, $title, title etc.

What I am doing wrong?


texts: Generate a Barcode from Form Data & Submit Form Data to Database (for Views)

texts:
I'm trying to create a bar code generator like the one at http://qr.insready.com/node/add/vcard . This generator is created with Drupal 7 & the Barcode contributed module (by the module's creator).

What I need my application to do is accept a number of items of user data input into a form, concatenate the field entries using tokens into the barcode input field, then generate a bar code on form submit as well as save the data into a database.

This is what I've accomplished so far. I have created a custom multi-part form module following the example in the Examples module, & got it to input data into the database. (I don't know if this will be exposed to Views, since I'm learning this as I go; it's a table I created within Drupal's database specifically to store the data.) Independently, I have created a custom content type with a barcode field that gets tokens from other fields in the form, & successfully creates a bar code encoding the data from the fields in concatenated form.

I would appreciate some pointers on getting this working together. What I need is a way of getting the barcode field into my custom form. Then it can pull data out of the other fields using tokens just as with the custom content type I created.

I can post code snippets if they are needed.


texts: What permission restricts access to run updates in Drupal 7?

texts: I have a role in my Drupal site that I don't want to access the Drupal database updates.  I can't seem to find the permission for "Run updates".  What permission restricts access to this page (update.php)?


texts: Which module for relationships in my particular case?

texts:
Possible Duplicate:
  Relation vs. References vs. Entity Reference for managing node-reference-type relationships in D7

I want to figure out which module (and, probably, strategy) will fit my needs best in such a situation.

I've built a site, there are a lot of piece's; each piece is either written or arranged by some person (or has both relations, composer and arranger); each piece can be a part of a collection (think of CD for performed piece's or book for scores in PDF).

Here piece, person, collection are types (post types, or node types in Drupal I believe); score, audio, video, text etc are taxonomies (in media tree). And each piece can have any or all media taxonomies assigned. Also there are genre taxonomies.

A person can be a conductor (if piece presents some performance by choir), soloist etc.

So, piece can be connected with person by a named "role".

Below are some links to demonstrate what I actually want to have (or something like that); the site made with WordPress (using posts-to-posts plugin).

However, I don't like what I have: that was the first my attempt to make a site, I am nor a programmer neither designer... I don't know what I am. Anyway, I don't like that site in terms of code maintainability (I guess that's my fault, not WP's), so I'd like to rewrite it; and I'd like to design new theme and have better ("overall php+mysql") performance.

So, now the question is: which module should I try for this --- Entity Reference or Relations? Or any other? Can I hope I can get better performance (php+mysql)?

Please, take a look (everything in Ukraine, but there are buttons to google-translate, SORRY):

here is Mykola Gobdych's page (conductor of Chamber Choir "Kyiv") --- below the photo there are links to other "views" (listen to pieces conducted by this person, listen to pieces performed by him, listen to his pieces --- either composed or arranged by --- etc)
some collection of piece's
a piece --- please, note, here are two performances... actually these are two piece's connected with "the same piece" relationship
listen to choir view

I really would like to try to do something like this with Drupal; however, I am very new to drupal. And I am not a programmer .)

So, please help; I will appreciate any helpful information or suggestion.

Thanks!


texts:
I am writing a module to convert serialized value stored in database by the Composed Field Module. The serialized value is like:

a:3:{i:1;s:14:"First Subfield";i:2;s:15:"Second Subfield";i:3;s:14:"Third Subfield";}

The PHP Unserialize value of above serialized data returns the following array:

print_r(unserialize('a:3:{i:1;s:14:"First Subfield";i:2;s:15:"Second Subfield";i:3;s:14:"Third Subfield";}'));
Array
(
    [1] => First Subfield
    [2] => Second Subfield
    [3] => Third Subfield
)

I called the Module as composed_views

So far I have made few files like: composed_views.info, composed_views.module,

composed_views_handler_subfields.inc contains:

class composed_views_handler_subfields extends views_handler_field {
  /**
  * Render the unserialized value.
  */
  public function render($values, $index) {
    $uns = unserialize($values) // $values = serialized data from database
    return $this->get_value($uns[$index]); // $index = array index of serialized data
  }
}

In composed_views.views.inc

For eg: The table names are field_one, field_two
The data column are field_one-composed, field_two-composed respectively

I want to Query those tables
and send the serialized data to render function defined in composed_views_handler_subfields.inc file

So, far the structure is like this:

function composed_views_views_data() {
  $data['composed_views_table'] = array();
  // The actual code I am seeking help with
  return $data;
  }

Any help how to do with this with views would be appreciated.


texts: /admin path display login box along with access denied message (drupal 7)

texts: In drupal 6 when visiting /admin, an access denied message was shown in the admin theme along with a login box. How can I do the same in drupal 7? Currently the regular theme is shown along with an access denied message.


texts: Second Contextual Filter on Calendar Module

texts:
I'm attempting to add a second contextual filter to a Calendar view generated by the Calendar module.

I'm using the entity reference module to reference all my 'Events' to 'Clients'. My desired outcome is to go to a url like example.com/client/[client-nid]/calendar/month and for the calendar to only display events that reference that client.

My Event content type has an entity reference field 'Client'. In my view, I have added a Contextual Filter for this field and set it to validate against 'Content', specifying 'Client' as the content type and Filter Value Format is Node Id.

When i use this view though example.com/client/182/calendar/month I only see a calendar with a single event on it, even though there are many nodes that reference node 182. What am i doing wrong?


texts: Views contextual filter: content has taxonomy term ID

texts:
I have a view set up to display Ubercart products with a contextual filter for Content: Has taxonomy term ID.

I then have another view in a block for choosing the taxonomy term to display all products with that term in the main view.

See below screenshots of the views settings for the main view, the contextual filter for the main view (with all available vocabularies activated), and the block view where the taxonomy term is selected.

This all works perfectly for one specific vocabulary, but doesn't work for any others - the products are not displayed in the main view. I cant find any settings anywhere which would only allow this to work for one specific taxonomy vocabulary. When i set the bock view for choosing the taxonomy term to another vocabulary, it does show in brackets how many products there are for each term, but clicking on the term does not display the products in the main view.

As I said it all works perfectly for one vocabulary but not any others, and I cant see anything anywhere which is making either of these views tied to a specific vocabulary.

What am i missing?


texts: I use the Content Approval module for queue for approval content. If users add article, there's no problem as it is unpublished then . I'm admin i publish this content later. But, then when user update the published content it isn't unpublished again. How can I do this?


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

texts: I need to override the default pages that come with forums with views. I need to still include the default info as per the screenshots. I can't seem to get the right relationships and the correct aggregation for the counts. Any insight would be appreciated.


texts: Using the PayPal option for no price with Drupal 7 Ubercart

texts:
PayPal has an option to set up a Buy Now Button with no set price. That is, this is not a free item, it allows the viewer to choose an amount, as in for a donation (I have also had a client use this to allow clients to prepay custom services from their site). This is really great for folks who want to make a donation to a non-profit with an amount that has some special significance for themselves personally.

But, Sell Price is a required field in an Ubercart Product. Has anyone found a way to allow a viewer to enter their own price?


texts:
Is it posible to add Copy node button in content page or in action copy node who is secelt.

Or here.

Thank you in advance for the help.


texts: How to create Subtheme of Omega while Omega Tools and Drush both has some disclaimer and Moved to Github?

texts:
I am a beginner in Drupal. I am using Drupal 7.
I wanted to create Subtheme in Omega.
Theses are the methods to create subtheme (With Omega Tools, Drush and Manually)in Omega.
I have install new core Drupal and installed Omega in my
sites/all/themes folder.
So, path for this would be:
"../sites/all/themes/omega"
I followed this Tutorial to create Subtheme using Omega Tools (As this is recommended for Beginners).
Omega Tools is one of the Recommended Modules to create sub theme with Omega.
In Omega Tools there is one DISCLAIMER:
"DISCLAIMER: Do not use Omega Tools with the 4.x version of Omega. Please

create your 4.x subthemes using Drush!
The Drush integration for Omega 4.x comes as part of the theme itself and does NOT require Omega Tools. Please uninstall Omega Tools if you are building a site with Omega 4.x."

So, this message leads me to the Drush where I saw the Drush project has moved to Github.
And theses are the Release Notes.
I read that we can also create sub theme with this method.

But how can I install Drush while Drush has been moved to Github? as I wanted to use Omega Tools to harness the full power of Omega.

Thanks for your help!


texts:
I try to setup View Ticker for a Drupal 7 website.

It would work if I run the following php:

<?php
$viewname = 'news_ticker' ;
print views_embed_view ( $viewname );
?>

But :

Could explain me how I choose what is displayed ?
I need to display the title of this page : http://www.esii.com/en/actualites
My site is in french & in english : can the view ticker separe the content for each language?


texts: How do I change the content type used by a view?

texts:
I bought a drupal theme which has several views on the content type 'portfolio'.
Is there a way to change the content type used by those views?


texts: I have created a new page template page--membership.tpl.php and placed it in the /templates folder inside of my theme (the same folder as my regular page.tpl.php file). I flushed the cache, but my page sitename.com/membership is not picking up the changes. (I even tried deleting all of the content of the tpl file to see if it would mess up the page, but nothing.) Any ideas?


texts: Drupal 7 custom block not showing in block list

texts:
A Drupal 7 newbie here, with the following problem.

I have enabled my block with it's dependencies, but doesn't show in the block list

Can anyone spot anything I might've missed in my code?

Any help to point me in the right direction will be deeply appreciated!

Thanks in advance!

The code is the following.

.info file

name = Bloque para el buscador - INMO
description = Bloque para mostrar el buscador geográfico de InmoAnuncios.
package = Modulos de Inmo Anuncios
core = 7.x

scripts[] = bloque_buscador.js // exist in folder

dependencies[] = inmo_node_form // enabled

.module file

<?php

/**
 * @file
 * Modulo para el buscador de inmuebles
 *
 * Este modulo provee de un bloque donde se despliega un buscador de inmuebles en el sitio
 */

/**
 * Implementa el hook_block_info()
 * Este hook le dice a DRUPAL que este bloque se puede desplegar tanto en el home page como en el sidebar
 */
function bloque_buscador_block_info() {

    $blocks = array();

    $blocks['bloque_home'] = array(
        'info' => t('Inmo Buscador (home)'),
        'cache' => DRUPAL_NO_CACHE,
    );

    $blocks['bloque_sidebar'] = array(
        'info' => t('Inmo Buscador (sidebar)'),
        'cache' => DRUPAL_NO_CACHE,
    );

    return $blocks;
}

/**
 *
 * @param type $delta
 * @return type
 * Implementa el hook_block_view()
 *
 *
 */
function bloque_buscador_block_view($delta = '') {

    $estados = db_query("SELECT * FROM estados WHERE enabled = 1;");
    $inmuebles = db_query("SELECT * FROM tipo_inmueble WHERE enabled = 1;");

    $optEstados = '';

    foreach ($estados as $estado) {
        $optEstados .= "<option value=\"{$estado->id}\">{$estado->nombre}</option>\n";
    }

    $optInmuebles = '<option value=\"0\">--Todos--</option>';

    foreach ($inmuebles as $inmueble) {
        $optInmuebles.= "<option value=\"{$inmueble->tipo_inmueble}\">{$inmueble->tipo_inmueble}</option>\n";
    }

    $contenido = <<<EOSTR

Encuentra tu inmueble ideal!

          <form action="/filtro" method="GET">

                    Busco inmuebles en:

                        Venta <input type="radio" name="operacion" id="operacion" value="venta"/>
                        Renta <input type="radio" name="operacion" id="operacion" value="renta" />

                    Tipo de inmueble?
                    <select name="inmueble" id="inmueble" style="width:150px;"> $optInmuebles </select>

                    En donde?
                    <select name="estado" id="estado" style="width:150px;"> $optEstados </select>

                    <input type="submit" value="Buscar">

            </form>

EOSTR;

  $bloque = array(
    "subject" => NULL,
    "content" => $contenido
  );
  return $bloque;
}

?>


texts: I am new to Drupal, so I want to know how do I echo number of views of a page ? or of a category ?


texts: How to enable users editing their CiviCRM profiles details from their Drupal user page?

texts:
I have a new Drupal7 instance with CiviCRM integrated. I have successfully linked CiviCRM contacts (specifically CiviMember members) to users in Drupal with the role of 'member'.

I want members to login and edit their CiviCRM profile. How do I go about doing this?


texts: How do I set up a site to use Redis as cache handler?

texts:
I'm trying to enable Redis on my Drupal site but when I check the status of the module I keep getting this warning message.

  No Redis client connected, this module is useless thereof. Ensure that
  you enabled module using it or disable it.

The steps I followed to enable Redis are the following.

I edited the config.yml file to add the following lines

installed_extras:
  - redis
  - php-redis

I enabled the Redis module
I edited the settings.php file to add the following lines

$settings['cache']['default'] = 'cache.backend.redis';
$settings['redis.connection']['interface'] = 'PhpRedis';
$settings['container_yamls'][] = 'modules/redis/example.services.yml';
$settings['container_yamls'][] = 'modules/redis/redis.services.yml';

I also tried to execute the following code in index.php and the cache appears to be working.

$redis = new Redis();
$redis->connect('127.0.0.1');
$cache = $redis->get('key');
if ($cache === false) {
  echo "miss";
  $cache = "test";
  $redis->set('key',$cache);
}
else {
  echo "didn't miss";
}
// At this point $cache is either the retrieved cache or a fresh copy, so echo it.
echo $cache;
exit();

It appears that Redis is working but for some reason it isn't used by Drupal.

How do I set up Drupal to use Redis as cache handler?


texts: Where is the documentation for the ACL module/api?

texts:
Has anyone successfully created a client module that controls node access via the ACL module? I installed this module and created my own UIs to populate the three tables: acl, acl_node and acl_user. I started to create nodes, which populated acl_node with appropriate values, but nothing else seemed to happen. No new realm in the node-access table, nothing. Have I missed a step? I can't find any documentation on this module/api. Thanks.

The notes in the nodes_access_example module (part of the examples project) encourage you to 'read up' on the ACL module. I can't find anything to read though.


texts:
I'm customizing Display Suite-suggested tpl by adding "Jump to top" links at the bottom of each teaser and I want to properly localize the link text.

Now I am unclear as per the usability of the Variable module (that had to be installed along with i18n). Can I add my own variable (say, jump_to_top_link) somewhere in the Variable admin panel, without writing my own module? Or is Variable meant only as an API for modules?

I don't want to learn module development now, but I want my custom text to be scalable and easily manageable from one place, instead of hard-coding strings and ifs.

Would anyone be willing to shed light on how to approach the problem?

Regards,
Artur


texts: Drupal 7 views: Get NID in views using contextual filters

texts:
Does anybody know how to get the nid from a node using contextual filters or filter criteria in views

WITHOUT using "Get id from url"?  I was thinking about using PHP or getting it from a node-field.

My view is a block of comments that is to be placed together with a node. The comments needs to belong to the node and linked by node ID. In this case the "Get ID from url" wont work since the node itself is listed in another view.

It is a view-block (containing comments) inside of a node that is listed in a view.


texts: Caching Drupal 7 using boost module and Varnish, yet still getting a "MISS"(

texts:
I'm trying to do a little test, so I installed Drupal7 w/ following modules (expire, boost, varnish, purge, rules and token). I'm usingvarnish-3.0.4-1.el5.centos.x86_64 in front of httpd-2.2.15-29.sl6.x86_64.

I added following into my settings.php:

// Add Varnish as the page cache handler.
$conf['cache_backends'] = array('sites/all/modules/varnish/varnish.cache.inc');
$conf['cache_class_cache_page'] = 'VarnishCache';
// Drupal 7 does not cache pages when we invoke hooks during bootstrap. This needs
// to be disabled.
$conf['page_cache_invoke_hooks'] = FALSE;

and I set following settings for varnish module inside of Drupal7:

# drush -r /usr/share/drupal7/ -l XXXXX vget varnish
varnish_bantype: "1"
varnish_cache_clear: "2"
varnish_control_key: "XXXXX"
varnish_control_terminal: "XXX.XX.XXX.XX:6082"
varnish_flush_cron: "0"
varnish_socket_timeout: 100
varnish_version: "3"
#

yet I keep getting MISS

# curl -I XXXXX
HTTP/1.1 200 OK
Server: Apache/2.2.15 (Scientific Linux)
X-Powered-By: PHP/5.3.3
Expires: Sun, 19 Nov 1978 05:00:00 GMT
Last-Modified: Thu, 24 Oct 2013 14:42:21 +0000
Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0
ETag: "1382625741"
Content-Language: en
X-Generator: Drupal 7 (http://drupal.org)
Content-Type: text/html; charset=utf-8
x-url: /
x-host: XXXXX
Accept-Ranges: bytes
Date: Thu, 24 Oct 2013 14:42:21 GMT
X-Varnish: 1527289503
Age: 0
Via: 1.1 varnish
Connection: keep-alive
X-Served-By: XXXXX
X-Cache: MISS

#

even though it seems like if I go to Configuration->Performance and then enable Caching, I'd end up with a HIT, yet Status Report would say following message (after enabling Caching) Boost will not function properly while Drupal core cache is enabled. Disable Boost or the core cache.

* UPDATE *

this is after enabling boost, as you see Cache-Control: IS in there, yet still getting MISS from Varnish(

$ curl -I http://XXXXX/node/1
HTTP/1.1 200 OK
Server: Apache/2.2.15 (Scientific Linux)
Last-Modified: Mon, 28 Oct 2013 15:53:48 GMT
ETag: "802449-1da7-4e9cf1b11461e"
Accept-Ranges: bytes
Content-Length: 7591
Cache-Control: max-age=1209600
Expires: Mon, 11 Nov 2013 15:55:46 GMT
Content-Type: text/html; charset=UTF-8
x-url: /node/1
x-host: XXXXX
Accept-Ranges: bytes
Date: Mon, 28 Oct 2013 15:55:46 GMT
X-Varnish: 1527308733
Age: 0
Via: 1.1 varnish
Connection: keep-alive
X-Served-By: XXX.XXXXX.XXX
X-Cache: MISS

$

What am I doing wrong?


texts:
I have a page that I created by View, I tried to create a template by creating node--view_page_machine_name.tpl.php, but it didn't work, the page did not change to this new template style.

How can I add more blocks/regions into a view page? Thanks.


texts: Virtual Directory for "sites" folder in IIS 7

texts:
I am running Drupal 7 on a Windows using IIS 7.5. This is not something I can change and is required by my company. Everything has been running great which is awesome.

I would like to setup the environment so that the "sites" folder is outside of Drupal Core so upgrading core will only require changing the application's Physical Path and not require copying the "sites" folder between versions. I have been doing some reading and this seems like a very easy thing to do using a Symlink for any Linux Machine.

So I have been trying a couple different configurations and have had no luck. I tried moving the "sites" folder out of the Drupal Folder and creating a Virtual Directory for the "sites" folder in IIS. This did not work, Drupal does not seem to respect the virtual directory and when Browsing the site I am asked to install. This should not be the case since I have sites that are running and working when the "sites" folder is placed inside the folder.

The second method was to use Windows and not the Web Server. I kept the "sites" folder outside of core where I had moved it and created a Shortcut. The same way you would create any shortcut on Windows OS. I took the shortcut which was named "sites" and put it in the Drupal Core folder. This will not work either and returns the same results by asking me to install.

If anyone has experience working with Drupal and IIS and has an answer it would be greatly appreciated.


texts:
How can I use the field_ui_table element in a custom module? Is it even possible to use it?

The following code doesn't show anything.

$form['menu_builder']['list1'] = array(
  '#type' => 'field_ui_table',
  '#header' => $header,
  '#options' => $options,
  '#empty' => t('No content available.'),
  '#attributes'=>array('id'=>'menu-builder-table'),
);


texts: Drupal admin area and login, Securing them with HTTPS

texts:
I've been reading a lot about this and trying many of the methods I've found and haven't yet been able to get anything working properly.

I want to be able to secure the admin area and associated login pages. So anything in example.com/admin/* or example.com/user/* etc, needs to go over SSL/TLS. We'd like this to apply to each site withing the multisite setup. So example1.com, example2.com, example3.com are all on the same server/user account.

The Setup

Drupal 7 multi site
Clean URLs enabled
PHP 5.3
MySQL v14 d5
Apache2

Notes

Securepages is not an option, as there's no stable Drupal 7 release, and using the existing dev version requires patching Drupal Core, which goes against our policy
Have tried Session 443 with no success
Have tried Secure Login with no success
An SSL cert (a self-signed one for now, while testing) is installed and works on the server for other purposes, just not Drupal.
I've read all the docs on Drupal.org about enabling HTTPS and have attempted to follow the directions there with little success
I've toggled the $conf['https'] setting in settings.php with no discernable results.

The Questions

If I enable HTTPS for everything on a site, I get a 404 for anything attempting to go through https://, which leads me to think that the rewrite rules aren't applying for the https pages. What am I missing here? Is there a rewrite condition/rule I can add to htaccess to fix this?

Is this not a solved problem in the Drupal community? Are people just leaving their admin areas unsecured, with user passwords being sent in the clear? I find this hard to believe, yet it seems that there's no built-in or commonly known solution to the problem.


texts: weird behavior on submit entity reference view widget items

texts:
When creating a content type (i use seven as admin theme) i have 2 fields they are entity reference.
I use entity reference view widget to select the items in both fields.
In first field appears a radios items list and after selecting one item when i click «submit» it works and the selected items appear as values in the field.
This is the ajax response to clicking the Submit button:

But when, after selecting one or some of the checkboxes for the second field, i press the Submit button, nothing happens.
The modal window doesn't close and the selected items don't populate the field :(
This is the response to the Submit button for field two:

Can anybody point out a clue of the problem?


texts: Responsive Image Module is only selecting fallback image style

texts:
I recently tried implementing drupal 8's Responsive Images Module.
I studied about it's basics and implemented according to the guides available online. But when i try to use it on any image on the site, its only selecting the Fallback Image Style. I have defined 5 breakpoints and 5 image styles for each breakpoint.

My breakpoint.yml is as follows:

investindia.big_screen:
  label: big screen
  mediaQuery: '(min-width: 1025px)'
  weight: 4
  multipliers:
    - 1x
investindia.tablet_landscape:
  label: tablet landscape
  mediaQuery: '(min-width: 769px)'
  weight: 3
  multipliers:
    - 1x
investindia.tablet:
  label: tablet portrait
  mediaQuery: '(min-width: 481px)'
  weight: 2
  multipliers:
    - 1x
investindia.smalltouch_landscape:
  label: smalltouch landscape
  mediaQuery: '(min-width: 321px)'
  weight: 1
  multipliers:
    - 1x
investindia.smalltouch:
  label: smalltouch portrait
  mediaQuery: '(min-width: 1px)'
  weight: 0
  multipliers:
    - 1x

Edit : Adding my responsive image style configuration for further clarification on the issue.


texts:
I Have Drupal 7.41 site installed on a vps with centOS 6 PHP 5.5 using webmin as my control panel.
I have 2 htaccess files one in the root and 1 in the sites/default/files I have tried the following in the htaccess file in the sites folder
Options +FollowSymLinks
Options +SymLinksIfOwnerMatch or
with # before each line but same result

but I still cant get images to be displayed. If I delete the htaccess file in the sites folder, I can then display the images until I run the cron and the new htaccess file is back in the sites folder and I can no longer display images.


texts: Is there a menu module through which we can create multi column drop down menus. I have tried TB Mega Menu which gives the desired result but it has some issues. The worst part is that it converts into mobile menu on resizing the window or smaller screens even if we are not designing the responsive website and there is no option to disable the mobile menu.


texts: How do I add classes to an img tag inside the node?

texts:
I want to add classes to the image that is getting displayed only inside the node. I want to do it in the Drupal way.

Here is the img tag HTML.

I want to add the classes like the below

I just want to add "medium img-polaroid" like class to the img field.


texts: Drupal6: inline style being added to content only in IE7; not by me?

texts:
I know this will sound open, but has anyone ever experienced a Menu in Drupal being assigned an inline style of display:none within IE7?

I have triple checked all my own style-sheets, all settings and fields I can think of within Drupal and the menu creation screens and my page.tpl.php file.

Somehow, only in IE7 is that inline style applied and I've no idea if this is a Drupal thing or not. I've never seen this happen.

The menu disappearing is a custom pane piece of content and it's used on another page and shows up fine so my first thought was that the pages content had a clearing issue but then in the debugging tools, I find the display:none.

It's too much to post everything, obviously but I thought maybe some ideas of what could be going on would help lead me to other areas to investigate.


texts: how to hide the tags and category in the front page

texts:
My site is http://nbmdemo.16mb.com/

How do I hide tags:featured

Also in http://nbmdemo.16mb.com/?q=node/1

Same thing with: Category: Demo Articles


texts: How do I display self-hosted video content

texts:
What I am trying to do is embed a self-hosted video on a webpage. I have the video uploaded onto the web hosting in mp4, ogv and webm formats; converted where necessary using Miro Video Converter (if that helps?).

The code I have in place on the webpage is:

<video width="90%" controls>
<source src="/system/files/HBA_ONLINE.mp4.mp4" type="video/mp4">
<source src="/system/files/HBA_ONLINE.webm" type="video/webm">
<source src="/system/files/HBA_ONLINE.ogv" type="video/ogg">
Your browser does not support this video tag - Try viewing directly  here </video>

The only format that seems to work is mp4 on Google Chrome; other browsers simply won't play the video in any format.

The silly question is; do I need to use a dedicated Drupal 7 module???


texts: Is there a way to check which wizard page has been skipped in multistep webform

texts:
I have 5 steps webform(managed by business editor) and conditionally editor have skipped entire step(from conditions section) based on end user input on previous steps, so user doesn't have to fill data into that specific step.
For an example on the 1st step editor have added a radio element - Gender
if user select gender value Male then editor added condition to skip the 2nd step so user will fill the form data into this steps. 1, 3, 4, and 5. And likewise
if user select gender value Female then editor added condition to skip the 3rd step and user will fill the form data into this flow steps 1, 2, 4, and 5.
Now as a developer I want to get this flow 1,3,4,5 or 1,2,4,5 (form which steps end user have gone trough) in my code (any submit/alter hooks) before submit the form. Because based on those steps I want to perform such action. So how can I do that?
Thanks in advance. Any suggestions are welcome


texts: Commerce Search API with Custom Search Form

texts:
I have a search form with multiple fields on my front page. After clicking on submit button,  user would be routed to search result page. The user fills out the form, clicks on a 'Search' button, and the browser replaces the front page with a results page. (Ideally, a Commerce search view). On search result page, all facets blocks are enabled.

I have created a page using Views exposed filter for front page and I am getting result as per filters. But I am not able to map that search filters with my facet search blocks on result page. Is there any way to do that ?

Another way I tried is created a custom form but not sure how to build URL so that user would be redirected to Search result page.


texts: Add a taxonomy type to a custom field using Field API

texts:
I maid an edit to make problem more clear.
I'm creating a new field type using Field API (using hook_field_info , hook_field_schema ,hook_field_widget_info , ...)

my custom field should store different types of data like :

Model  which is a text // No question here
Speed which is a number // No question here
Power again is a number // No question here
Make , This my last type should be a taxonomy term , so it can be related to a vocabulary and gets a term from user and be rendered as a taxonomy term

the question is "What steps should I take , to make it happen?"

because of some situations I have to use Field API , so modules like Field Collection ,etc wont help me.


texts: How to write test(s) with specific config to test custom access checks?

texts:
I have built a custom module that alters some of the User routes (view, edit, delete) to do 3 things:

Forbid account editing, except a user who has 'administer users' permission
Forbid account deleting, except a user who has 'administer users' permission
Forbid account page viewing (/user/{user}) unless that account being viewed has a specific role AND has a boolean field value of TRUE

The accounts are synced from a remote source and logins provisioned by SSO, so, there is no point for anyone to access edit/delete except an admin/dev checking if accounts look correct.

The first two seem straightforward enough as it requires nothing but setting up some test users with different role permissions and checking the response from an edit or delete route.

For the third, what is the best way to provide simple configuration to get the field added to the User entity under test? Do I install my entire project config (seems heavy)? Is there a way I can selectively install some config for test only? I think I would just need one or two of the 800 config files to be installed. I checked some of the core tests, but couldn't quite locate one close to what I am asking.


texts: Cannot modify language field in node form using hook_form_alter in drupal 7

texts:
I tried adding a description for the language field in a node form using hook_form_alter:

$form['language']['#description'] = t('Description');

The changes are not accepted, the language field stays as it is the description is not added. As far as i can tell this is not a problem with the hook, because changes to other fields work fine, only the language field does not change.
Any ideas what i'm doing wrong.


texts: Problem using ColorBox with Media Galllery

texts:
I want to create photo gallery using the Media Gallery module. One of the requirements given is to unpack the ColorBox jQuery plugin in sites/all/libraries.

I downloaded the file colorbox-master.zip and extracted it in sites/all/libraries so the path of colorbox is sites/all/libraries/colorbox-master

I am able to create gallery but effect of the ColorBox is not visible. What do I have to do to make the gallery photo show up in the ColorBox?


texts: Tabs for Media:youtube multiple videos of single node

texts:
I am using Media:youtube in a content type and the field in which I embed youtube videos might have multiple values.
I am trying to put those multiple youtube videos belonging to a node in tabs dynamically.

Eg: I have a node created with title: example of tabs
underneath that I have embedded two youtube videos in the node
output should be in tabs with part1 as first horizontal tab and part-2 as second horizontal tab.
Part1|part2

with part1 loaded first and i should click part2 for second video

When there are 3 videos loaded in a node, then I should have like part1|part2|part3

I think using Display Suite with a add code field which i think should have a forloop with delta values of video will solve the purpose.I have no php coding knowledge

Can someone please help me to achieve this.


texts: How can I manually add a subscription to an account using Commerce Subscription Product module?

texts: I am using the Commerce Subscription Product module 1.x and I would like to add a few accounts manually that have a subscription. How do I achieve this?


texts:
I'm new to Drupal, and I have some problems.
I need to select some fields from a node (via code), and then process the data.

[Full-size image]

Basically, I want to show the total of column "value", grouped by "category", but as each field's content type is a table, I do not know how to do it.


texts:
I'm using Drupal 7. My question regards the sanitization of the "q" parameter. We know about SQL injection, so I was wondering if this parameter may be a vector for this kind of security flaw. I've searched the Drupal core files for the $_GET['q'] string. It is used several times but I could't find any kind of sanitization. Perhaps I've missed something.
My opinion is that Drupal does not uses the $_GET['q'] inside any kind of query or if it does it will be sanitized by the database API itself.


texts: Drupal Field Hierarchy or Fields By Selection

texts:
Is there any modules that support a hierarchy for fields?  Nodes and fieldable entities in drupal seem so monolithic.  For example customers could be categorized into three categories:

Customer A
Customer B
Customer C

When customer A is selected then I only want specific fields shown according to that selection, and would be different for B and C.

I know I can do this via a hook_form_alter using the ajax callback attribute but wasn't sure if there was something already created for this.  I seen the hierarchy module but seems to be specific towards taxonomy.


texts: open atrium file attachments access permissions across spaces

texts:
Open Atrium 2. fully updated, successfully running without error messages.

I have a setup where I am using 2 spaces All Users (authenticated + space membership) and Directors (authenticated plus access to this space and All Staff space). Members may be promoted or demoted at various times due to their responsibilities.

All documents have good access control when anonymous users access the site. Nodes are not visible unless the viewer is logged in and is a member of the space that holds the node. All attachments are visible to space members when they open the node.

If a member of group All Staff guesses the url of an attachment in a node created in Directors,  my question is how to restrict/inherit permissions for attachments and media within a node? It is probably right in front of me but I am must have overlooked it.

thanks in advance,
Simon


texts: Advice on using Organic Groups for course management in an academic context

texts:
I am thinking about using Organic Groups for course management in an academic context.

Initially I was going to create an OG group per course e.g. Physics 101.
However if the users change per semester this could become tricky to manage...

There are 2 options I can think of:

Create a new group each semester e.g “Physics 101 – Semester 1, 2013”

But would soon end up with 1000’s of groups.

Somehow archive the data, clear down the group and re-enrol the next class each semester

I'm unsure how we could effectively do the archival while keeping the data available, and it seems like it would become a convoluted process

I would love to know how other users of OG handle this type of problem?

Is there any online material that would help me learn how to use OG in this way?

Thanks for your help in advance!

Joe


texts: In simple terms, what is hook_menu_alter for? I understand callbacks in general, but I'm not quite sure if this method is misnamed in a sense, as I see it used in the context of permissions rather than menus. I'm probably just confused.


texts: How to change the functionality of FILE_EXISTS_RENAME?

texts: I am using files_save_upload function to save the file. Here, I can use  FILE_EXISTS_RENAME this to rename the current file name if already this name existed. By default it rename by appending _indexes(0,1,2..). But I want to append some other things not the default one. So how can I achieve this? Thanks for any suggestions.


texts: What are the best ways for creating galleries from images stored as entities?

texts:
I have a gallery attached to node that allowed tagging of single picture.
I used Field Collection for that job.

Now I need to display those images in different structure:

User when creating a node may choose prefered display.

Also same types of displays may be used for display all images from all nodes.

Could someone give me any advice?


texts: Using tokens in an entity form conditional field

texts: Is there a module that will allow me to use token values (ie logged in user/email) as a field condition with entity forms?


texts: Multiple relationships in Views Contextual Filters

texts:
I use Views in every project, and its not that often that I run into a use case like this any more.

In the set up below, I have a Content type with two field collection fields (day guest and evening guest). I want to display the results of both field collection fields on the node, in the same view.

Both field collections share an "E-mail" field, and when a user enters their e-mail field, I want them to see their results, whether they have been added as a day guest, or an evening guest.

Here's the setup...

When I remove one of the two Contextual filters, the results show for the remaining field, and vice versa. But when both Contextual filters are added, I get no results.

Is there a way to do an AND or OR for Contextual filters?

Or in the Contextual filter options, a way to add multiple relationships like below?

While I know this is not possible in the default behaviour, it is a good example of what i'm trying to achieve, perhaps someone knows a decent workaround to the issue?


texts: How do I enable a menu link only when the user has created a node?

texts:
In my website the user can create a node. I want a menu link to appear only after the authenticated user has created the node and not before that.

Is it possible to enable a menu link only when the user has created a node?

For example, the menu items that appear when users log in are:

Item 1
Item 2
Item 3

When users add a node, I want another item that points to another page to appear in the menu. If users didn't create a node, they don't have access to the new item.

How can I do this?

I created another role when the user creates a node using the Rules module, and set permissions for the user with the new role to view the new menu item.


texts: Behaviors are only called the first time a view is loaded

texts:
On a Drupal 8 site I have a world map where the user can click on a country; a view with content is then loaded with AJAX using a custom module and the following JavaScript.

(function($, Drupal, drupalSettings, window, document) {
  Drupal.behaviors.worldmap = {
    attach(context, settings) {
      console.log('behaviors called');
      $('#map-container', context).once('addmap').each( () => {
        let map = new InteractiveMap('.interactive-map', (country) => {
          let id = settings.worldmap.yearsnids[country];
          if(!id) {
            id = 0;
          }
          console.log('id');
          let ajax_settings = {
            url: '/my_module/ajax/expand/' +
                  settings.worldmap.ctype + "-infobox/" + id,
          };
          Drupal.ajax(ajax_settings).execute();
        });
        map.init();
      });
...

I have a custom template for the view where I add a ajax link.

See the project

Clicking that link loads another view with more content.
So basically a preview is loaded when the user clicks on a country, and a link in the preview then loads the full content if clicked.

Both the preview and the content (also a view), is loaded from my_module with an AjaxResponse:

namespace Drupal\my_module\Controller;
use Drupal\Core\Ajax\AjaxResponse;
use Drupal\Core\Ajax\ReplaceCommand;
use Drupal\Core\Controller\ControllerBase;

class my_moduleController extends ControllerBase {
  public function loadContent($method, $action, $type, $nid) {
    $response = new AjaxResponse();
    // logic to determine which action and type we want to load
     ...
    $build['view'] = [
      '#type' => 'view',
      '#name' => $viewname,
      '#display_id' => $did,
      '#arguments' => [$nid],
    ];
    $response->addCommand(new ReplaceCommand($replaceClass,
                          $build, ['fadeIn']));
    return $response;
  }
}

This all works, but the link in the preview only works for the first preview loaded. In every other preview loaded, clicking the link sends the user to the actual ajax-path (eg. mysite.com/my_module/ajax/expand/my_ctype-infobox/the_actual_id), and the content that should have been rendered to the page are displayed like json in a textbox:

[{"command":"settings","settings":{"pluralDelimiter":"\u0003","ajaxPageState":
...

When the page with the map is loaded, and first time the preview is loaded, 'behaviors called' prints to the console - the link to load the full content works. On subsequent times, clicking on a country loads the preview, but behaviors aren't called at all. 'id' gets printed to the console every time I click.

This is the HTML structure:

The preview is loaded into the info-box__content div, which is outside the #map-container.


texts: Hook_user to display a message on a page

texts:
In Drupal 6, I would like to use hook_user to display a message using drupal_set_message following a user record after_update

This is all I have in my module, which I've enabled, but I think I may need something else?

function assigncoordinator_user($op, &$edit, &$account, $category = NULL) {
  drupal_set_message(t('111111'));
  switch($op) {
    case 'after_update':
      drupal_set_message(t('module is working'));
      break;
  }
}


texts: title_prefix override to h1 instead of h2

texts:
How do I override the $title_prefix that is inherited from the value of

    <h2<?php print $title_attributes; ?>><?php print $title; ?>

in panels-pane.tpl.php page. This is normally output in the page.tpl.php but since i'm using panels it becomes the above.

My stating attempt is to write a template.php preprocess function, but this adds the code to every title in the template, and just adds the h1 to the page; it does not replace the h2 with the h1 for each page title. I don't want to touch the $title value which is h2 but change $title_prefix.

// Preprocess title prefix override. h1 instead of default h2
function at_panels_everywhere_preprocess(&$vars) {
  $vars['title_prefix'] = array(
    '#type' => 'markup',
    '#markup' => '

',
  );
}

I need to replace the $title_prefix ouput to be h1 not h2 and only for the title_prefix while within the #content region.


texts: Drupal 6 Feeds: admin/build/feeds empty importers

texts:
I have a Drupal production site setup on ec2 dedicated server.

Following are the main settings:

Drupal: 6.16 MySQL: 5.1.57 PHP: 5.3.2-1ubuntu4.17 Memory Limit: 256M Webserver: Apache/2.2.14 (Ubuntu) jQuery UI: 1.8 jQuery Update: 1.3.2

ctools: 6.x-1.9

Feeds: 6.x-1.0-beta12 Feeds Admin UI: 6.x-1.0-beta12 Feeds Fast News: 6.x-1.0-beta12 Feeds Import: 6.x-1.0-beta12 Feeds News: 6.x-1.0-beta12

The problem is that if I go to admin/build/feeds, the importers list is empty. When I flush the cache (admin_menu/flush-cache), the list reappears, but after navigating different site pages, when I revisit the admin/build/feeds, the importers list is empty again.

The same happens with the Import tab at the feed node pages (I am using feed as the source content type).

I have tried the following:

Explicitly clear the cache using Drupal's cache functions
Modify the feeds_importer_load_all function to set the required ctools static variables.
Increased PHP memory limit to 512MB
Completely disable the cache.
Explicitly disable the cache with $GLOBALS['conf']['cache'] = FALSE; in hook_init
And a few other patches as well

$cache = &ctools_static(FUNCTION);
$cached_database = &ctools_static('ctools_export_load_object_all');

in function ctools_export_load_object are always empty and blank schema is returned.

None of above is solving the problem.

Does any one has experienced any similar scenario or knows what can be wrong with it? Appreciate the assistance in the matter.


texts: How to display only the first value in Views, by overriding TPL.PHP?

texts:
I am trying to override the output of one field in Views, and I need it to print only the first value of the field.

Like:

Unfortunately my knowledge of PHP and Drupal-API are very low, so I hope to get some help here.


texts: Whats causing Drupal to freeze when creating/editing a mini-panel?

texts:
I'm quite new to drupal.

Drupal has been freezing for me when I try and create or sometimes edit a minipanel. Once I select the panel layout and start adding content it just remains in the lightbox 'grayed' state and wont let me click or do anything. It's almost like it's trying to load but I've left it for an hour and it's completely frozen.

I've tried on Firefox and IE10 and get same issue. Also upgraded my drupal from 7.23 to 7.24 today so a completely new core is running but still hangs like this.

I haven't fully explored everything yet in drupal so I don't know if other sections will do this. So far it's just the minipanels section.

Does anyone have any suggestions? Thanks.


texts:
I have a content type with a number of fields, one of which is state (pending/active/complete). Users can also be assigned to a piece of content. Eg Frank is linked to content titled "Blah" with state "active".

I want to create a view that shows users who ARE NOT linked to any content with the state field "active".

So far, I figured I can show a list of users and then using relationships, I pull up and reference the content.

It is easy enough to show users linked to content that has the state field "active", but for the life of me, I cannot figure out how to show users who ARE NOT linked to content with state "active".

Any ideas?


texts: Change Views BETWEEN min/max filter to a cleaner URL format?

texts:
Is there an easy way to change the default exposed BETWEEN filter to work with:
price=1000-2000
Instead of:
price[min]=1000&price[max]=2000?
Would it be reasonable to create my own Numeric filter or am I looking at a lot of modification?


texts:
I am trying to update a user by Services module. Currently a user has UID=2 and a role ROLE1. I am trying to add ROLE2 to this user also, so that this user will have two roles: ROLE1 and ROLE2.

When I use PUT to this endpoint: user/2
with data:
  $data = array();
  $data['roles'] = array( 5 => 'ROLE2');
  $path = 'user/2';

The role of the user is updated to ROLE2 only.

Question is: how to keep ROLE1 while adding another role to that user?


texts: Save xml file produced by views data export module to a different location

texts:
I am using "views data export" module. And I am able to download the xml file.

I want to place a button "save to D:\" such that when I click on button it directly get saved to "D:\" drive .

I want to do something like this: if XML path is given

http://localhost/drupal/exhibti-dataexport.xml

I want to download the file.

If XML path is given

http://localhost/drupal/exhibti-dataexport.xml/savetoD

I want to directly save to D drive.

What I observed is when I am giving the path like this also

http://localhost/drupal/exhibti-dataexport.xml/savetoD

the file is getting downloaded.

Not able to understand the views data export module code.

Where should I modify the code in views data export module such that if xml path has arguments It should save the file to D drive.

Any help is appreciated.


texts: Drupal Commerce - Sort products in view priced lowest to highest

texts:
This seems like it should be super simple. I'm trying to sort my products by price (from lowest to highest) in my view, and no matter what I do, nothing seems to work. See below the setup of my current view. At the moment, the below settings give me the lower priced products first (e.g. it shows products ranged $4-9 before products ranged $50-90), but they're all mixed up (e.g. $4, $7, $4, $9...) when it should be $4, $4, $7, $9...

I hope that makes sense.


texts: Different domain names to site languages

texts:
I have a Multilingual Drupal 7 site. The site is in 3 languages Dutch (default), English and German. The multilingual setup is done based on the i18n module. All is setup and works great!

Dutch site: litebook.eu
German site: litebook.eu/de
English site: litebook.eu/en

But now i have 2 more Domain names i have to use: litebook.de and litebook.co.uk

I want:
- litebook.de to go to litebook.eu/de
- litebook.co.uk to go to litebook.eu/en

What is the best way to set this ups and what do i have to do exactly?

Thanks a lot!


texts: How to determine if user X has access to operation Y on node Z

texts:
How can I programatically determine whether a certain user has "view" (or any other operation) permission for a given node?

I'm trying this, but it doesn't seem to be calling the node access hooks, and it's overall pretty ugly:

$node_grant_storage = \Drupal::service('node.grant_storage');

$current_user_has_access = is_a(
  $node_grant_storage->access(
    $node,
    'view',
    \Drupal::currentUser()->getAccount()
  ),
  'Drupal\Core\Access\AccessResultAllowed'
);

Ideally I'd like something to return a boolean and not a class (I have no use for the "neutral" option here, I just want to know if a user went into the node/X page, would they get a 403 or not).


texts: Why the template_preprocess_field hook is not called for a custom template?

texts:
I'm working in a site that has implemented the template_preprocess_field() hook. I want to change the content of a field but the code works for all the nodes except for the nodes of a content type that have a custom template (node--emploi.tpl.php) It's strange because I have another template for the nodes of the content type named tarif (node--tarif.tpl.php) and in this case the hook is called.

Here the piece of code inside the template node--emploi.tpl.php file:

<div class="editor">
  <?php
  /* At this point the body's h2 do not know what the nid is, so a quick and dirty replace will set it right. */
  print preg_replace('/NO-NID[a-z0-9]*--/', $nid . '--', check_markup($field_stm_emploi_temoignage_body[0]['value'], $field_stm_emploi_temoignage_body[0]['format']));
 ?>
</div>


texts:
I at one stage had the Menu breadcrumbs module, then the Custom breadcrumbs module enabled. I have now disabled both of them, but the breadcrumbs are still displaying. Only the Home breadcrumb is displayed on every page, and on the search results page "Home > Search > Content" is displayed.

Where are my breadcrumbs coming from since I disabled both modules?

Search results page

You are here

Home ›

Search ›

Content ›

Every other page

You are here

Home ›


texts: Multiple axis voting system (star rating)

texts:
I tried Multiple Axis Voting System using Drupal FiveStar and Computed Field, but I am not able to understand the below 2 points:

Add a node reference field to the voting node type, make the targeted node type selected.
Setup the voting(aka.review) node type, add all needed field and fivestar fields for multiple axis voting. Remember set the "target" option to #3 field.

May anyone help me understanding this?