texts: Does drupal create new file in image styles?

texts: There are many images with 3000X2000 dimensions and I created a view of their content type. I also created a new image style, it is 90X70. This view displays the images in this size, but here is my question, which image size is loaded on the page load?


texts: Drupal 7 Migrate: How do I migrate a mult-field key into a single taxonomy term

texts:
Background:
I am doing a migration on Drupal 7 using Migrate 7.x-2.5.  And I am migration a Sql table into a Drupal taxonomy.  The key to my source SQL table is comprised of three fields:  element_id, scale_id, and category.

The taxonomy term name must be element_id-scale_id-category so that I can properly reference the taxonomy.  Here is some sample data:

3.A.1   RW   1   None
3.A.1   RW   2   Up to and including 1 month
3.A.1   RW   3   Over 1 month, up to and including 3 months

So the taxonomy name for the first line above will be "3.1.1-RW-1" and the description will be none.

Here is my code so far:

$query = Database::getConnection('default', 'external_db')
         ->select('ete_categories', 'ete')
         ->fields('ete', array('element_id', 'scale_id', 'category', 'category_description'))
         ->orderBy('element_id', 'ASC');

// Create the source data feed using the variable $query

$this->source = new MigrateSourceSQL($query);

//       D E F I N E       T H E       D E S T I N A T I O N

$this->destination = new MigrateDestinationTerm('ete_categories');

//       D E F I N E       T H E       K E Y S

$this->map = new MigrateSQLMap(
  //  We have to tell migrate what the source key is
  $this->machineName,
  array(
    'element_id' => array(
      'type' => 'varchar',
      'length' => 20,
      'not null' => TRUE,
      'description' => 'Element Id',
    ),
    'scale_id' => array(
      'type' => 'varchar',
      'length' => 3,
      'not null' => TRUE,
      'description' => 'Scale Id',
    ),
    'category' => array(
      'type' => 'decimal',
      'length' => 3,
      'not null' => TRUE,
      'description' => 'category',
    ),
  ),

  MigrateDestinationTerm::getKeySchema()
);

//       M A P       T H E       F I E L D S

//  So let's map the fields

$this->addFieldMapping('name', CONCAT(`element_id`,'-',`scale_id`,'-',`category`));
$this->addFieldMapping('description', 'category_description');

My Question
I can concatenate the three fields into one using command line SQL.  However, I do not know how to do this within the confine of the migration modules.(I realize that the code "CONCAT(element_id,'-',scale_id,'-',category))" is not valid migration code.)

So how do I concatenate the three fields together into a single field and set the destination field "name" equal to the concatenated fields?

Thanks


texts: Views Get Data from REST API without creating nodes

texts:
I am consuming data via a 3rd party REST API (not a Drupal site). I'd like to minimize double-duty (importing nodes from the API and then displaying that data) and just display the API data directly via Views.

How can I create a Views handler for the REST API?


texts: Why can't I override my menu in Drupal 7 with theme_menu_tree?

texts:
I'm working in drupal for the first time and I'm coming along nicely and learning as I go. I need to remove the UL and LI from my menu so I've been doing some research and "MYTHEME_menu_tree_menu_name" was suggested to override the container. As A test I'm trying this in my template.php file:

function storm_menu_tree__menu_social_media($variables) {
  return '' . $variables['tree'] . '';
}

Where "storm" is my theme name. My menu name is "Social Media" but D7 shows the machine name as "menu-social-media".

When I test this nothing is affected. What am I missing?

I should note this is a sub-theme based off Zen Theme.

--- edit ---

this is what I'm using to call the menu:

<?php
$menu_name = 'menu-social-media';
$menu_id = 'social-media';
print theme('links', array('links' => menu_navigation_links($menu_name), 'attributes' => array('id' => $menu_id, 'role' => 'navigation', 'class'=> array('links', 'inline'))));
?>


texts: How to add another color to theme color pallette?

texts:
I have custom theme which is using Color Pallette from Bartik. I want to add another color options:

 'fields' => array(
    'top-bar-' => t('Top Bar background'),
    'top' => t('Header top'),
    'bottom' => t('Header bottom'),
    'base' => t('Main background'),
    'sidebar' => t('Sidebar background'),
    'sidebarborders' => t('Sidebar borders'),
    'footer' => t('Footer background'),
    'titleslogan' => t('Title and slogan'),
    'text' => t('Text color'),
    'link' => t('Link color'),
  ),

top-bar- is id of top container (someone named it top-bar-, anyway it's best to remains the same)

In schemes array I added default color to every schema, e.g.:

    'top-bar-' => '#666666',

Now in colors.css I added:

#top-bar- {
    background-color: #666666;
}

I cleared cache but my new color pallette options doesn't appear in theme settings form :(
I read a few tutorials about this topic, but in my case it just don't work.


texts:
I have changed date formats in Views and in Drupal core Date settings, but I'm still seeing wrong date format on forum (for example in node where conversation is) at class .forum-posted-on.

In template file advanced-forum.myforumtemplate.post.tpl.php:

<?php print $date ?>

How to change date format?


texts:
I've set up my development setup and it works great but for some reason I can't get the twig cache to disable. I tried everything, but I have to run drush cr every time I change anything in twig templates, and it's driving me insane.

settings.php:

if (file_exists(__DIR__ . '/settings.local.php')) {
  include __DIR__ . '/settings.local.php';
}

settings.local.php AND setting.php:

$config['system.performance']['css']['preprocess'] = FALSE;
$config['system.performance']['js']['preprocess'] = FALSE;

$settings['cache']['bins']['render'] = 'cache.backend.null';

$settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.null';

services.yml AND development.services.yml

parameters:
  http.response.debug_cacheability_headers: true
  twig.config:
    debug: true
    auto_reload: true
    cache: false
services:
  cache.backend.null:
    class: Drupal\Core\Cache\NullBackendFactory

I am running Drupal 8.4


texts: How do I filter a view for untranslated content?

texts:
I have a site with many lessons in English, with the option to translate them into Japanese. There is a team of translators working to translate the lessons, but they need an easy way to see which lessons have not yet been translated.

Is there some way to filter or create a view that only shows content that has not yet been translated to a target language?


texts: Changing HTML5 element to military time in Webform

texts:
Would anyone be able to suggest a way that I can change the current AM/PM default 12-hour HTML5 time into 24-hour military time when using the Date/time element in Webform?
When I change it to 'Time picker input,' it does give me the 24-hour time as an output, but it's not the format I want. I like the 'HTML Time input' format and would just like to keep that but take away the AM/PM and make it 24 hrs instead of 12.


texts: hook_form_alter() and hook_nodeapi() to alter fields and insert additional data on insert

texts:
I have the code below, and I want to update the fields on my node using hook_nodeapi(). How do I set the fields on insert?

/*
 * Implements hook_form_alter().
 */

function feature_contact_form_form_alter(&$form, $form_state, $form_id) {
  if ($form_id == 'contact_form_node_form') {
    $form['field_user_agent']['#type'] = 'hidden';
    $form['field_ip_address']['#type'] = 'hidden';
    $form['buttons']['submit']['#weight'] = 1;
  }
}

/*
 * Implements hook_nodeapi().
 */
function feature_contact_form_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  if ($node->type == 'contact_form') {
    if ($op == 'insert') {
      function getRealIpAddr() {
        if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
          $ip = $_SERVER['HTTP_CLIENT_IP'];
        }
        elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
          $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
        }
        else {
          $ip = $_SERVER['REMOTE_ADDR'];
        }
        return $ip;
      }

      $ipaddress = getRealIpAddr($ip);
      $node->field_user_agent = array($ipaddress);
      $node->field_ip_address = array($_SERVER['HTTP_USER_AGENT']);
    }
  }
}


texts: Programmatically override permissions in Drupal 6

texts:
I'd like to know if there's any way to programmatically override Drupal's permissions defined in admin/user/permission.

What I've managed so far is to block a user's certain action.
However, if a user is not permitted to perform an action (eg. "create custom_type content") and my module's access callback for this action returns TRUE the result is a white page. No PHP error, warning, or log entry. If FALSE is returned, I get an access denied page, as expected.

The method I used to implement custom permission is through hook_menu_alter(). Specifically, something like this (a common one for Drupal 6):

function mymodule_menu_alter(&$items) {
  $old_access_callback = $items['node/%node']['access callback'];
  $old_access_callback_add_customContent = $items['node/add/custom_type']['access callback'];

  $items['node/%node']['access callback'] = '_custom_node_access';
  $items['node/%node']['access arguments'] = array(1, $old_access_callback);

  $items['node/add/customContent']['access callback'] = '_custom_node_access';
  $items['node/add/customContent']['access arguments'] = array(1, $old_access_callback_add_customContent);
}

function _custom_node_access($node, $old_access_callback = "node_access"){
  //check if user has permission to view the node object
  //or add new content and return TRUE or FALSE
}

Note that with 'node/%node' item, everything works as expected.
When _custom_node_access() returns TRUE for a user that have no permissions to perform the certain action (add), I get a WSD.
One way I found to avoid this behavior is to return my calculated result && user_access("create custom_type content") so that I can, at least, get an access denied page.
Do you have any suggestion for this behavior?

Finally, _custom_node_access() seems to run more than one time every time the '/node/add/customContent' path is visited. Is there any particular reason for this?

It's been only few months since I started using Drupal so it's very likely that I'm missing something about permission...


texts:
I came across this issue. I wrote an article in editor and I put there basic HTML tags like <strong> and so on. The thing is, in editor it shows right, but when I publish the article, the HTML tags dont do anything and they are displayed just like normal text.
Do you have any idea why is this happening?
Thank you for any reply


texts: Views 2 - Don't display results if user DOES NOT have a specific permission

texts:
I am trying to hide the results of a view from users who have a specific permission. For instance, Let's assume that a user has the permission "create page content". I would like for the view to show NO results to this user.

I can't restrict on roles because the user can have overlapping roles. Basically, I need the "Access" portion of views to work opposite of how it normally does.

I suspect I should be able to do this with the Global:Null argument validator, but I am having no luck. However I am assuming that has more to do with me weak php chops.

Thanks in advance.


texts: Owl Carousel does not respect Image Styles as set in node display in custom node file

texts:
I am trying to get owl carousel to respect the image style declared in the manage display setting for the content type. The code I used to output in the node is:

            <?php foreach($image as $value):?>

                    <img src="<?php print file_create_url($value['uri']);?>" class="img-responsive"  alt="">

            <?php endforeach;?>

This renders the slides all different sizes and makes it have a background and causes it to look bad. Does anyone know how to in a custom node file make it respect the image style that I have created that cause it to scale and crop the images. Thanks.


texts: Move Drupal to subdirectory - clean urls

texts:
There is a requirement to move  site from www.test.com and make it available only under URL www.test.com/newsite.

When the clean URLs are enabled and after i click to login to the administration site, the URL changes to:    www.test.com/newsite/newsite/user.It duplicates the "newsite".

The page  www.test.com/newsite/user is visible...and only after the login attemp this happens.

I have set in .htacess

RewriteBase /newsite
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

Clean URls are working normally in the rest of the site.


texts: Drush on Macbook Pro cannot read Dupal Correctly NOW RESOLVED!

texts:
Tried to get Sass & Compass working on Windows, but ran into too many problems.  Now I have purchased a vintage Macbook Pro (2008).  I finally got Drush working on Windows, but I can't seem to get Drush to work on the Macbook.

ON THE MAC: I am using a MAMP-Stack.  I tried installing Drush-6.0, but it began to ask for 'Composer' and other such further complications.  I installed Pear, but could not figure out the instructions to use Pear to install Drush. So I tried a simple install of Drush-6.0 from a Tar file Download.  I installed it to the '/Applications/MAMP/htdocs' Folder.  It could download Modules and Themes, but Drush could not do a simple Status check or Cache-Clear.  Somehow it could not interact with Drupal.

Next I tried a Zip Download of Drush-5.9.  I removed the previous Drush-6.0 from the 'htdocs' Folder with 'rm -rf drush'.  I installed Drupal-5.9 by pulling the Zip into my  Folder.  Then I did a 'chmod u+x drush' in the working directory of drush.  Then in the same HOME Folder, I edited the .bash_profile and .bashrc Files in Vim.  There is nothing in either of those two files that refers to the previous Drush Path (htdocs) from the previous installation, but now they instead point to the new installation of Drush-5.9 (In the '/Users/MY-NAME/' Folder.

However, when I try to launch Drush, Drush can do a status-report. It reports Drupal, but incorrectly reports the Garland-Theme being used, which is NOT the Default Theme.  By the way this same output happens if I am in the Omega-Theme working directory or the Drupal-Root working directory.

Drush also fails to accomplish a simple 'drush cc' (only the Drush-Cache is available to clear).  Drush cannot do a 'drush pm-list', instead I get an error message about Drush not being able to bootstrap the Drupal Database.

I read the 'read-me' in the Drush-Installation-Folder and tried to follow the prescription for changing my PHP direcory in .bash_profile.  Then trying to follow the instructions for configuring php.ini, I got lost at the point where you try to find out what version of php your Webserver is using (I presume this means MAMP, maybe not).

Now I am at a loss as what to do next to get Drush functional.  Any help is greatly appreciated.

BASH_PROFILE:

# Set Architecture flags

export ARCHFLAGS="-arch x86_64"

#Ensure user-installed binaries take presidence

export PATH=/usr/local/bin:$PATH

export PATH=/Users/ChandraSwami/pear/bin:$PATH

export PATH=/Users/ChandraSwami/Dev:$PATH

export PATH="$PATH:/Users/ChandraSwami/drush:/usr/local/bin"

export PATH="/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php5.4.24/bin:$PATH"

#Load .bashrc if it exists

test -f ~/.bashrc && source ~/.bashrc

:

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a
function*

source ~/.profile

END-BASH_PROFILE


texts: how i can create pages dynamically on users any action?

texts:
I want a page creation(dynamically), if user uplooads a design(image) which is (or its info) goes to database. The page name should be on the name of design. How can i do this?

Update:
Designs(dress designs[images] ) are submitted by the users through an application which resides on the root of drupal. Not a module of drupal. As the designs are submitted, they goes to a folder at root and relative info goes to drupal database. As i am using drupal bootstrap to get user info and a little more.
So i need a module which listens the request from application(may listen from database updation) and make page of that design with unique path.
Please guide me how to handel this situation

any hint/help is appreciated


texts: I'm looking for a way to display a menu items as images (with rollover) rather than the usual text links. I found the module Menu Icons, but as the name implies, it's designed to place the icon next to the link. Does anyone have a technique for doing this? Perhaps I have to create some sort of custom block or panel, but I thought maybe there was an easier way.


texts: Files (±50MB, audio) automatically repetitively deleted (after ± a couple of hours-days?)

texts:
Might I ask you what can be the cause and solution of:

the automatic dissapearing of "large" files (±50MB, such as an audio file) that I have manually put into the root folder of my Drupal website/installation, using a FTP-client?

Does this has something to do with CRON (just a wild guess)? Is it not smart to manually (FTP) upload files into the root folder? Should a module be used at all times?


texts: Google Map will not show on new ajax page load

texts:
I have added a styled google map V3 to a block using full html this all works fine and displays on page refresh. I'm have trouble with the map loading after linking to another page in conjunction with the ajax pages module.

All of my main menu links are ajax calls and pages load via ajax. On a page refresh the map will show, but if I click back and forth through the ajax pages the map will fail to load. I'm guessing this has something to do with this line?

google.maps.event.addDomListener(window, 'load', initialise);

Is there something I can do to make the map load even after a ajax page change? I have tried to change the load to on.load but that doesn't make a difference.

Here is the code in my block:

Thanks,

Terry


texts:
It's difficult for me to judge which module is at fault, but since I enabled Administration Views to be able to filter content by name, actions stopped working. For example:

Publish selected content gives a confirmation message that the operation was successful but the content remains unpublished.
Change author lets me select a user and then displays a confirmation message but the author remains unchanged.

Recently I have also opened an issue for the Deploy module, where the action items "Add/remove to deployment plan" did not show up until I disabled Administration Views.

Is there any secret to successfully operating those modules?
(I cannot look up the issues right now as the site seems to be temporarily down).

Module Versions

Views: 7.x-3.3
Administration Views: 7.x-1.x-dev
VBO: 7.x-3.0-rc1+11-dev
CTools: 7.x-1.0-rc2


texts: How to hide Fivestar rating field after first comment?

texts:
The accepted answer on How to limit a user to one vote when using Fivestar? doesn't work for me, but the author hasn't provided a solution yet, so I felt this is worth a new question.

My goal is exactly the same as the one in the article mentioned above: I'd like to hide the Fivestar rating field (called field_stars) in the comment form when a user comments on a node on which he/she's already commented.

Is there another solution (for example with the Rules and Flags modules)?

Edit: I already have a flag called Commented on my site and a rule that flags a node on behalf of the commentator when someone commented on it (which works perfectly). I'd really like to use it to fix this problem. I tried something, based on the information I found here:

function hiderating_form_alter(&$form, &$form_state, $form_id) {
  global $user;
  $flag = flag_get_flag('commented') or die('no "commented" flag defined');
  if ($form_id == "comment_node_stuff_form") {
   if ($form['#node']->uid == $user->uid OR $flag->is_flagged($form['#node']->uid, $user->uid)) {
      unset($form['field_stars']);
    }
  }
}

Unfortunately, it doesn't change anything (I don't get any errors either).


texts: l() Link function adding Icon before Link Text

texts:
Is there a way to pass in an icon inside the  tag of the link built by using the link (l()) function?

<icon> Link Text

I use it like so currently:

l('text','path',options)

Options all seem to be attributes of the  tag itself besides the "text". Using html =>true, I can add  before the link text:

print l(' ' . $link["link_title"]

However, I cannot check if the span isset inline there, unless I am missing something...

This works (below), but all my  have  linktext... even if span is empty, and I don't want that blank tag in there:

<?php print l(' ' . $link["link_title"],$link["link_path"],array('attributes'=> array('class'=>array($link[options][item_attributes]["class"], 'nav-link')),'html' => TRUE)); ?>

How can I add an icon, without CSS, before my link text as well as check if that span is empty?


texts:
How to combine two contents of same type and display in views?

the following picture will clear my question.


texts: Can I access node ID of the parent node of a field collection field in field-collection-item--FIELD_NAME.tpl.php

texts:
I am just hoping to get the node ID of the parent node in a field-collection-item--name.tpl.php template file.

So if my parent node name is mypage in which I have child fields of field-collection-item--name.tpl.php, I just want to access the Node ID of the parent page (mypage) in field-collection-item--name.tpl.php.

Is it possible?

Apparently somewhat yes. If I do this, I get details on the parent node. The only problem is that that data is protected. The output of this line is pasted below. All I want is [vid] value (i.e. 120)

  $var = $content["field_image_title"]["#object"];
  print_r ($var);

Output of above line

FieldCollectionItemEntity Object
(
    [fieldInfo:protected] =>
    [hostEntity:protected] => stdClass Object
        (
            [vid] => 120
            [uid] => 1
            [title] => My Parent Page Name
            [log] =>
            [status] => 1
            [comment] => 1
            [promote] => 0
            [sticky] => 0
            [vuuid] => f3c2f63d-5d86-4d94-98f3-8a1ba76ce1f9
            [nid] => 120
            [type] => subpage
            [language] => und
            [created] => 1408623334
            [changed] => 1408640101
            [tnid] => 0
            [translate] => 0
            [uuid] => 486dead0-4f72-45a3-988c-64512e6b91de
            [revision_timestamp] => 1408640101
            [revision_uid] => 1

Any help on how I can get this vid value in this protected array?

Thanks.


texts: Adding new fields using hook_field_schema_alter()

texts:
I have an entity whose field schema is already defined and now I am trying to add couple of fields to it.

But I am not sure how to code it up using schema_alter.Below is an example on how I would code the schema for the field using hook_field_schema().

function hook_field_schema($field){
  $columns = array();
  if($field['type'] == 'some_field_name'){
  $columns = array(
              'col1'=>array(
                     'type =>'text'
                     'size' => 'big'
                     'not null' => false),
              'col2'=>array(
                     'type =>'text'
                     'size' => 'big'
                     'not null' => false),
              );
  }
 //Similar for other fields
}

Confusion is on how to decompose this schema according to schema_alter.

I am following this article to implement hook_field_schema_alter()

Edit: I am using an update function to create the field (field_create_instance), since this is an already an existing module and I do not want to disable it and enabled it again.


texts: Once function not preventing behavior executing on AJAX update

texts:
I am attempting to disable 2 inputs within the Views exposed filter form upon initial page load.  However I don't want this to happen after the filter form is autosubmitted.  I have the following code, but it runs every time the filters are autosubmitted.

(function ($){

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

        $('#edit-arrival-date-datepicker-popup-1, #edit-departure-date-datepicker-popup-1', context).once('disable-dates', function(){
            console.info('Disable em once');
            $(this).attr('disabled', true);
        });
    }
};

})(jQuery);

After the initial page load I can see the disable-dates-processed class on the input in question, but the filter autosubmit causes the attribute change to run again.

What is it that I'm getting wrong ?


texts: EventSubscriber Reflection Exception, Class does and doesn't exist

texts:
A reflection error that shouldn't be happening?
Snippets:
mymodule/mymodule.services.yml
services:
  mymodule.example_ex:
    class: Drupal\mymodule\EventSubscriber\ExampleEx
    arguments:
      - '@path.matcher'
      - '@current_user'
    tags:
      - { name: event_subscriber }

mymodule/src/EventSubscriber/ExampleEx.php
namespace Drupal\mymodule\EventSubscriber;

use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class ExampleEx implements EventSubscriberInterface {
  //
}

Resulting in the fatal with the message: ReflectionException: Class Drupal\mymodule\EventSubscriber\ExampleEx does not exist in ReflectionClass->__construct(), I've tried a variety of re-namings to no avail.
By Commenting the tags key value pair from the services.yml, no ReflectionExeption occurs. But, no subscriber event occurs either..
Could it be that an unconventional class name (example): EEEExample is causing this issue?
I've gone over the code multiple times, rechecking to ensure that names are consistent and I did so again whilst rewriting the actual names for this question.


texts: One-time link without valid email address Spam Registrations

texts:
I have a D6 site that gets a lot of SPAM account registration and they all follow a pattern, however from different IP addresses (often during the following process):

1) User account is created

2) One Time registration link is used to log in

3) account page is visited

4) node/add page is visited

I am using both a Math captcha AND spamicide on the user registration form.
Users have to be verified via email.
Password Reset form also has a captcha and spamicide enabled
I have found out that some of the email addresses being used are from servers that according to their operators are not in service to send or receive email.
This often happens within 1-15 min and either from the same IPs or different IPS for the same username.

So, how are the bots logging into my site? How can they get the one-time link token without checking the email account.

EDIT: The email listed in users.mail is equal to users.init for almost all accounts. There are some that have changed but they look like legitimate users.

Any idea on how to stop this would be appreciated.

FAKE User Data:

uid     name        mail                init                modesortthreshold   theme   signature   signature_format    created access
1975    Gomez.S.    sele.99@hotmailit   sele.99@hotmailit   0   0   0           0       1359319030  0                   0


texts: Replace the file on disk while running the migration

texts:
I am changing the migration code (not written by me) to not create new files on migration but to re-use (or rewrite) the existing files.

The migration code looks like the following:

Source part:

$url = url('filename.json', array('absolute' => TRUE));
$this->source = new MigrateSourceJSON(new MultiListJSON($url), 'name', $fields);
$this->destination = new MigrateDestinationFieldCollection(
  'field_product_documents',
  array('host_entity_type' => 'node')
);
$this->map = new MigrateSQLMap($this->machineName,
  array(
    'name' => array(
      'type' => 'varchar',
      'length' => 255,
      'not null' => TRUE,
    ),
  ),
 MigrateDestinationFile::getKeySchema()
);

Destination part:

$this->destination = new MigrateDestinationFile('file', 'MigrateFileBlob');
$this->addFieldMapping('value', 'blob');
$this->addFieldMapping('destination_file', 'name');
$this->addFieldMapping('filename', 'name');
$this->addFieldMapping('destination_dir' ,'dest_dir')
  ->defaultValue('private://');

This migration is only responsible for creating of the file entities from the blob which comes from a third party service.
There is another migration that is executed after this migration and is responsible for associating the file ids of the files created by this migration.

Following the documentation of the MigrateDestinationFile, the following code could be used to replace the file on the directory:

<?php
    $this->addFieldMapping('field_my_image:file_replace')
         ->defaultValue(FILE_EXISTS_REPLACE);
?>

But, during the file migration I am not associating it with any field. Hence, it could not be used. Or I am not sure of the exact way to use it.

My main concern is (let's say) if I have a file ABC.pdf on disk (might not be associated with any entity), the migration should not create a new ABC_0.pdf.

Any pointers would be highly appreciated!


texts: Unable to set author and created time when translating node programmatically

texts:
I am adding translation to a node programmatically using a script which I run with drush scr.
Everything works as far as adding translation and copying all the fields over.  However, I am not able to set the Created time and the Author of the translation.  No error is thrown and the result is just the author and created time of the original content.  My code is below:
$node = node_load($nid);
$source_translation = $node->getTranslation($sourceLanguageKey);
$target_translation = $node->addTranslation($translationLanguageKey, $source_translation->toArray());

// Make sure we do not inherit the affected status from the source values.
if ($node->getEntityType()->isRevisionable()) {
    $target_translation->setRevisionTranslationAffected(NULL);
}

$entityManager = \Drupal::getContainer()->get('entity.manager');
$user = $entityManager->getStorage('user')->load(45986);

$translationManager = \Drupal::getContainer()->get('content_translation.manager');
$metadata = $translationManager->getTranslationMetadata($target_translation);
$metadata->setAuthor($user); // this does not work
$metadata->setCreatedTime(REQUEST_TIME); // this does not work
$metadata->setSource($sourceLanguageKey);
$node->save();

I am using the metadata object to set author, created time and source.  Both author and create time failed to set but the source was set properly.  Any idea why it is not working?  Thanks


texts: How to set an alias to a fields on a db_select?

texts:
Like it said on the title, as we use alias to fields with a static query, i want to do same thing with a dynamic query

example :

with static select : $sql = db_query ("SELECT my_super_long_field as mslf FROM {super_long_table} as slt")

How to perform same with a db_select query please ?

$sql = db_select ('super_long_table','slt')
->fields('slt',array('mys_super_long_field', 'here i want alias for long fields')

Thank you


texts: change action link on views exposed form

texts:
I have created a views exposed form. How can I change the action link, or the "Submit" button.

I use Drupal 7.


texts: Specifying a confirmation page after you signup using the Signup Module

texts: When using the Signup module, the form just reloads itself after every successful signup. Is it possible to redirect them to a different page instead of seeing the same page all over again?


texts: View contextual filter not working inside Panels

texts:
I have a view with a contextual filter of type "Raw value from URL".  This block view works fine in the page footer. But when added inside Panels & Page Manager, the view stops working. Hence it seems that Panels is somehow blocking the view from being able to access the URL.

As a test, I have the view in Panels and in the footer on the same page, and the footer view displays fine, but the Panels view does not, giving me a "Page not found" error.

I read I need a "context" in Panels to pass information to a view.  I also read that view contextual filters that use URLs don't need contexts in Panels, so I'm finding conflicting information.

Every time I try to create a Panels context, I get an error, mostly since I have no idea what to enter into the form fields.

The view looks for a value in the URL, such as /puppies/10, where 10 is the node of the puppy. Then the view will only show information for that puppy.

Most of the information out there is for Panels on Drupal 7, and there seems to be enough of a difference that I can't figure it out for Drupal 8.


texts: Creating a booking date search to connect sandbox Commerce Availability to Commerce

texts: We have tried a number of modules for a rental system, and we have stumbled upon a sandbox project called Commerce Availability which is supposed to add an availability field to Commerce line items. This sounds like something we could use, except customers would then need to be able to search dates for available items within that range. It seems like that tidbit is missing. For our (and client's) purposes, it's better and less confusing for everyone if we stick with Commerce and avoid using Rooms or Merci or AGReservations in addition to Commerce. We feel Commerce is more straightforward. How would we go about creating the date search and connecting that further to Commerce Availability and then Commerce?


texts: Get authenticated user details from a remote database

texts:
I have 2 domains say site1.com and example.com. I have separate databases for both these sites .

How could I perform or allow users from my site1.com to login to my second site example.com without registering. If a person is an authenticated user in site1.com, he or she could login to the example.com site without signing up, i.e by using the login credentials of site1.com. Are there any modules that would help or be suitable for my task?

Also I would like to know is I could access some table details from a remote database. Thanks in advance


texts: EntityFieldQuery gives error on adding propertyCondition

texts:
I have to list down taxonomy term ids which should be greater than a specific tid.
Below is the code I am using:-

$query = new EntityFieldQuery();

$tid = variable_get('last_player_update'); //last index of player update

$query->entityCondition('entity_type', 'taxonomy_term')
  ->propertyCondition( 'tid',  'value', $tid, '>=')
  ->propertyCondition('vid', 3)
  ->propertyOrderBy('tid', 'ASC')
  ->range(0, 1000);

$result = $query->execute();

On executing the script I am getting the following error:-

PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '9174 'value') AND (taxonomy_term_data.vid = '3') ORDER BY taxonomy_term_data.ti' at line 1: SELECT taxonomy_term_data.tid AS entity_id, :entity_type AS entity_type, NULL AS revision_id FROM {taxonomy_term_data} taxonomy_term_data WHERE (taxonomy_term_data.tid 9174 :db_condition_placeholder_0) AND (taxonomy_term_data.vid = :db_condition_placeholder_1) ORDER BY taxonomy_term_data.tid ASC LIMIT 1000 OFFSET 0; Array ( [:db_condition_placeholder_0] => value [:db_condition_placeholder_1] => 3 [:entity_type] => taxonomy_term ) in EntityFieldQuery->execute()

What I am missing in the above code snippet?


texts: Get data from a field using query in Computed field and use it as an array

texts:
I have a content type wherein the user will add holidays.

It has Holiday Date field(field_holiday_date).

How can I get the dates in that column using query and use it as an array in Computed field?

Thanks for you help!


texts:
I have multiple very similar drupal sites (each for a specific year of some project): 2012.somain.tld, 2013.domain.tld, etc. Their files are organized in subdirectories (2012, 2013, etc.) of public_html directory of my hosting.

I'm trying to make them all work via .htaccess settings. I write the following code for every site:

RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^2013\.domain\.tld$
RewriteCond %{REQUEST_URI} !/2013/
RewriteRule ^(.*)$ /2013/$1 [L]

The sites then open and at first everything seems fine, but then I realize that all URLs within site contain the subfolder name. What used to be http://2013.domain.tld/news/123 now http://2013.domain.tld/2013/news/123. And Drupal thinks that it is in the subdirectory and makes all paths reative to it.

What can I do to make things work properly, without this /2013/ in every URL?


texts: theme_hook_suggestions based on empty field

texts:
I'm trying to implement theme_hook_suggestions in preprocess node template based on the fact that a field (field_logo) is empty or not.

The template change is not working.

Can anyone help?

This is the code that I have so far:

function community_alpha_preprocess_node(&$vars) {
  $node = $vars['node'];
  if(($node->type == 'advertorial') && !$teaser && $node_top){
    $advertorial_type = $node->field_logo['und'][0]['tid'];
    if(!empty($advertorial_type)){
      $vars['theme_hook_suggestions'] = 'node__advertorial';
    }else{
      $vars['theme_hook_suggestions'] = 'node__advertorial__alt';
    }
  }

}

Thanks.


texts: Navigate to page with content displays page not found error

texts:
I have a URL (/url1) that I navigate to that is showing content because of the Context module.

The Context module has a condition that when the user navigates to /url1, some view blocks are rendered on the page. However, it is also rendering a "Page not found" error at the bottom of the page.

I can't figure out how to remove that message and get it to work properly. It even has the title "Page not found" on the tab with the page. The blocks render just fine in the way I want them.


texts:
I'm currently working on a views exposed form block. I want the form to auto-submit using AJAX, whenever an exposed filter is changed.

I have searched for this, but I couldn't find any tutorial or guide.
I cannot see any setting in the view, so I guess I have to implement  hook_form_alter. Is that correct, or am I missing something?


texts: Is there any module for Restful API in drupal 7 with commerce

texts:
I am working in a ecommerce website in drupal 7 by using commerce module, also developing for mobile (android/ios) application for the same project.

So that I want to send data's for mobile application, for that I am searching API integration module.

Anybody found any module or have any relevant idea?


texts: hook_inline_entity_form_table_fields_alter add custom field

texts:
Need some help with Inline Entity Form hook function hook_inline_entity_form_table_fields_alter.

I'm trying to add columns to the table that is visible when editing a specific node. I have been able to add fields and got the content to print too, but I need to add a checkbox. I've unfortunate not been able to find how to add other custom fields, so I wonder if someone has used this function before?

I guess it would be possible to add a "checkbox" fields to the content type itself, but in this case its more like a function rather than a value that I want to save.

Best,
Fever


texts:
I'm creating an issue tracking system with Drupal 7.

I have a content type called "Issue". in it there is a field "Assign To" that is a user reference field.

When a client create the issue he can specify the user that should handle it.

But when a client ads a comment to an issue, he sometimes want to change the assigned user.
Currently the only way to do it is by adding the comment, saving and the editing the issue, changing the "Assign To" field and saving.

I would like to make the "Assign To" (and the "Status") field available in the comment or as a separate component in the page.

Where should I start?


texts:
Reciently, I'm starting to work with Drupal 8, but I have some problems working with main pages. I can create a content type for all pages, but, the fields I use in to create this, must be content all posible options to input in all pages, and, for the final user, this solution can be a little confusing.

For instance, in one page I need to create a field to related another content type, with unlimited inputs, to display in this page. But, in another page, I need another related content type, with only one input.

The same case happenend for static blocks or similar.

Of course, I can create a content type for each diferent pages, but sounds like a horrible solution (I think).

I Acquainted with the suggestion template system, and I use it, but not satisfy this casuistic.

Perhaps, I'm totally wrong with the workflow of drupal and the solution is work totally diferent.

Thank you in advance.


texts: Templating an all form in detail on same page template

texts:
I need to display a form with complex HTML structure in my custom module. And not a single field had the same wrapper structure.

So I need more flexibility in my template custom.html.twig than just {{ form }}. How can I do that?

The actual markup is the following.

    {{ form }}

The needed markup is the following.

    <form class="form-horizontal" action="{{ form.action }}" method="{{ form.method }}"" id="{{form.id }}"">

{{ form.field1.label }}

{{ form.field1.input }}

{{ form.field2.label }}

{{ form.field2.input }}

{{ form.field3.input }}

            {{ form.submit }}

    <form>


texts:
I have a custom Rules action, and it returns a value to an action variable.

For it I use code below

  return array('array_added' => $item);

How can I alter this variable further?


texts:
I'm new to Drupal community and I wonder if there is a solution to regenerate all urls from http to https?

I have already tried to just regenerate and try to update $base_url in setting, nothing helped.


texts: adding multiple content elements to a page?

texts:
I am coming from TYPO3 and like Drupal a lot so far. Especially how easy it is to define custom content elements with the fields feature.

But what I kind of miss is this:

In TYPO3 you have pages which can be filled with content elements of various kinds (text, text with images, tables, forms,...). I like this a lot. It's versatile and harder to mess something up for the editors compared to simply having a "page" where you have a big text area you have to work in.

What the best way to achieve something similar in Drupal?

Edit:
Here are two example screenshots of the TYPO3 backend:
http://www.aemka.de/fileadmin/_migrated/pics/Backend_2_02.png
http://www.form4.de/typo3temp/pics/faa6f10095.jpg

Yes, it seems like those panels are exactly what I am looking for. Thank you! :)


texts: How to display view in all available languages?

texts: I need to set up a view that lists content in all available languages despite user's current language. I tried creating content translation relationships to all languages and setting fields to use these relationships, but it doesn't work. It only shows fields with the user's current language. How do I get it to list all fields in all languages?


texts:
The Date module with Views has functionality to filter dates with a granularity by Day, Months, Year, etc. but not for weeks.  So to do this with a Contextual Filter and PHP code to retrieve the current week, I tried this:

This had an output that suggested the current week was the fifth of the year which would be in February as shown here:

Yet the output is correct without any filter as shown here:

With other PHP code to filter the View by days and months, it worked great.  Yet this week filter doesn't seem to know the current week of the year.  How can I either have the Date module filter with a granularity of weeks, or input the correct PHP code to have the list filter by the current week?


texts: Changing form field title within hook_preprocess_form() does not work

texts:
I have customize drupal user registration form which I want to change some field titles.

I implemented hook_preprocess_form() within theme and changed titles of some form fields, but it didn't work.

While debugging I found that it has '#children' item already there with rendered HTML inside it. Then I tried to change that value by using drupal_render_children(), but that also doesn't work.

What is the right way?


texts: Is it possible to avoid div wrapper when I use HtmlCommand or ReplaceCommand?

texts:
I'm working on a D8 project and I have some ajax callbacks where I use ReplaceCommand and HtmlCommand.

It works fine but adds an extra div to my html.

For example I do :

$response->addCommand(new HtmlCommand('select[name="field_expert_name"]', $options));

And in my select, instead of getting just the options, I get :

<select>
  <div style="display: block;">
    <option value="1">Val 1</option>
    <option value="2">Val 2</option>
  </div>
</select>

Is is possible to get rid of this extra div?

Thanks in advance!


texts:
I have an image path like http://example.com/sites/default/files/image.jpg.

I have a download link like:

Download

So on clicking on the download it opens the image in the browser. Instead I want when I click on the Download link, it should download that image.

Is it possible?


texts: How do I implement bootstrap's panel component for a specific block / block region in my bootstrap (sub) theme?

texts:
I have a bootstrap sub-theme, and would like to render some of my blocks using Bootstrap's Panels components, so that the block would need to be wrapped something like this:

    {{ header }}

    {{ content }}

So far I've tried to implement this via the following series of dirty hacks:

Setting the css-class setting on the advanced settings of the view to panel panel-default
wrapping the header of the view in a
 block
setting the row-class parameter in the settings of the view's unformatted list format to panel-body

This almost works, but isn't quite right:

The issue is that the resulting classes aren't nested correctly:

If I manually modify the classes in my browser and set view-header to panel-heading and view-content to panel-body I get the desired effect:

So I know what I want, but how do I achieve this? I'm new to twig and I feel like there must be an easy solution to this out there, I just don't know what it is. Note that I don't want to make every block behave like this, just this one.


texts: how to display array in div structure in drupal 7?

texts:
How can I render arrays in div structure in drupal?. I am having a select list with ajax callback.Everytime I choose option, it's fields get fetched into an array. Now how can I show that array fields value?

$nodes = array();
    $output = array();
    $i=0;
    $nids = db_select('node', 'n')
      ->fields('n', array('nid'))
      ->condition('type', 'article', '=')
      ->execute()
      ->fetchCol();
    $nodes = node_load_multiple($nids);
     foreach ($nodes as $node => $value) {
      $output[$i]['title'] = $value->title;
      $output[$i]['body'] =$value->body['und']['0']['value'];
      $i++;
    }
    return output;

If I used return theme('item_list', array('items' => $output));, it is not working for me. Please help.


texts:
With a few years of Drupal 6 and 7 experience, I've happily made my first Drupal 8 installation. In my previous installations of Drupal I've used custom made PHP code that does a lookup in a personal database. I still need this in Drupal 8.

I've managed to install the PHP filter, and scripts are executed fine, but the page becomes cached, and changes in my database are not seen before I edit the page or empty the cache manually. Inconvenient, to say the least.

According to documentation, PHP filtered pages will not be cached, but evidently my page is.

Any suggestions?


texts: MailChimp + Drupal 8: How to install properly? (page could not be found)

texts:
In order to install MailChimp in Drupal 8 I followed the instructions for the MailChimp Drupal module.

  Instructions for 8.x-1.x

  The 8.x-1.x release uses version 3.0 of the MailChimp API and bundles
  the library with the module. This is a temporary solution until the
  process for installing libraries via composer is finalized in Drupal
  8.

in admin/modules/install I added mailchimp 8.x-1.3
Checked that libraries is installed (Machine name: libraries; Version: 8.x-3.x-dev)
Enabled all four modules (mailchimp, mailchimp_campaign, mailchimp_lists, mailchimp_signup)

However, when trying to configure the module at admin/config/services/mailchimp the page could not be found.

How can I resolve this issue and where should I start looking?

PHP 7.1.6-nmm1
Drupal 8.4.0-dev


texts: How to limit number of nodes a user can create per day?

texts: In order to curb ardent spammers in Drupal 6, I'd like to limit the number of forum nodes that an authenticated user can create per day. So for example ordinary users can not create more than 3 posts each day. I am wondering how can I do so? Thanks


texts: Why do I get pathauto errors when using node_save?

texts:
When I'm programatically creating nodes using the code found here I keep getting the following errors:

  Warning: Illegal offset type in isset or empty in
  pathauto_cleanstring() (line 180 of
  .../sites/all/modules/pathauto/pathauto.inc).

  Warning: Illegal offset type in pathauto_cleanstring() (line 223 of
  .../sites/all/modules/pathauto/pathauto.inc).

I have tried providing a default $node->path value, not including a value, setting the value myself using pathauto_cleanstring(), but nothing seems to work. I find it odd that I'm getting the error twice too :s

The solution to this question didn't help either unfortunately :(

Any help on this would be greatly appreciated!

UPDATE:

So, the problem had to do with the data that I was using to create the path. I'm loading an XML file using simplexml_load_file. The value I was using for the node title was a SimpleXMLElement

SimpleXMLElement Object
(
    [0] => Node Title
)

Which needed to be cast as a string before saving it as the nodes title. Thank you all for your help!


texts: Webform : how to count and live display results

texts:
Update

webform_get_submission_count isn't precise enough (we need to count into submissions)

but

<?php
if (arg(0) == 'node' && is_numeric(arg(1))) {
  $nid = arg(1);
  $node = node_load($nid);
  if ($node->type == 'webform') {
    $count = db_result(db_query('SELECT count(*) FROM {webform_submissions} WHERE nid = %d', $nid));
    $atelier_1 = "sources" ;
    $sql = "SELECT count(*) FROM {webform_submitted_data} WHERE data LIKE \"".$atelier_1."\" ;";
    $count_atel_1 = db_result(db_query($sql));
  }
}
echo $sql;
echo $count_atel_1;
?>

This webform has been submitted <?php print $count ?> times.

looks ok

end update-------------------

We'd like to use a webform so that our students should register on some workshops.

The webform works great. Now we'd like to display live the number of students that are already register in on of the workshops so that the other should know if there remains some possibilities of registration (each workshop can only accept 20 students at the same time)

I'm trying with that that doesn't work ($atelier_1 = "sources" ;) is the name of one workshop :

<?php
if (arg(0) == 'node' && is_numeric(arg(1))) {
  $nid = arg(1);
  $node = node_load($nid);
  if ($node->type == 'webform') {
    $count = db_result(db_query('SELECT count(*) FROM {webform_submissions} WHERE nid = %d', $nid));
    $atelier_1 = "sources" ;
    $count_atel_1 = db_result(db_query('SELECT count(*) FROM {webform_submitted_data} WHERE data LIKE %d', $atelier_1');
  }
}

echo $count_atel_1;
?>

Any help or suggestion welcome


texts: How to use Rules to change the value of entity reference’s field?

texts:
I have two content types (Inventory and Sales). In Sales, I referenced Inventory using the Entity reference module.

In Inventory, I have a stock_available (integer) field. In Sales, I also have the same field, so that I can automatically populate its value from Inventory using the Entity reference autofill module.

When I add a new Sales node, I want to adjust the value of stock_available  in the referenced Inventory, so that gradually it becomes zero in the referenced Inventory node.

I know how to set value/calculated value from other filed within same content type, by using the Rules module.

I have no idea how I can do same things to targeted entity reference node. I think it's possible by just rule configuration. Please let me know if something needs to change to get same output that I expected.


texts: Hide row in view if Content: Edit link field is empty

texts:
I have a page view that table format. I have Content: Edit link field. I want to hide the row that contains that field empty. The following is a screen shot for Content: Edit link settings regarding NO RESULTS BEHAVIOR:

And I want to hide the rows like in the below screen shot with no edit link:

By the way, I hide some of edit links, due to using custom module has a hook implements hook_node_access to prevent some users from editing some other user's contents (depending on roles and content ownership)


texts: Unable to Install/Uninstall a custom module

texts:
I am new to Drupal development and was working on a module. It has since gotten entirely screwed up. This is in Drupal 7. The module was adding a field type with a widget and some theming. It also created several new tables.

My module does not show up in the module list, and it does not show up in the uninstall list either. I see that it is still listed in the system table, and I had manually disabled it there (and did the clearing in the cache_bootstrap table). I removed the entire module folder at one point and have tried with it there and not there, clearing cache at each step.

Though I could live with the module still being "in the system", I would greatly prefer not to. I also have the major problem of I can not create a module with that name anymore as adding in a folder (even with a new, much simpler codebase for the module) does not make it show up in the list. To make matters worse this is a group project so it is not as if I could just start with a clean install of Drupal and start over.

So I am curious how I could remove the existing module so that I am able to "start over" with my own module?

Thanks!


texts: drupal commerce separate shipping for different products

texts:
We have a drupalcommerce website through which we sale

iptv box
qwerty key board

on adding first product it adds 15 dollars( base rate ) + 5 dollars per item in cart, so if we have 1 item in cart the shipping is 20 dollar but if we have 2 products the shipping will be 25 dollars and so on.

problem is, we want to setup separate shipping rate for qwerty key board if there is only a qwerty key board alone in cart the shipping must be 5 dollars.

I hope this can be done through shipping rules


texts:
I have two select lists, each in its own Block View.  The second list should be disabled until you select something from the first, in which case it would be populated based on the selection.  Is there any way to do this using views and contextual filters? Like, pass in a dynamic value as a contextual filter to the second block view?  Or even by using some ajax-based preprocess function?

I've searched and I always see how to do this by using a module, but I was wondering if it were possible to do this just using views because the relationship between the two Terms already exists in my Vocabulary.


texts: Unsetting a field before hook_form_alter

texts: I have a field collection with two entity reference fields that I keep hidden on a node creation form. The reference fields in the hidden field collection are slowing down the page load time. I need to block the field collection from rendering at all. From what I understand it needs to happen before hook form alter. See Question - Does unset($form['field']); in hook_form_alter stop entity reference views select list queries from running?. Any help would really be appreciated!


texts: How to use default field_image if value is not provided?

texts:
We are using Schema.org Metatag module to display meta tag attributes to the Article content type. We have a field that we using as an ImageObject using the field_image field. The field_image is setup so that if an image is not selected, then a default image will be displayed in the twig templates.

We had to add a [node:field_image:large:url] into the url field under ImageObject. When an image is selected, the correct url is added to the page. However, when the image is not selected (a default image should be used), the url field is displaying empty.

How to get the token to display the default value is the image is not added through the node edit process?

Current behavior:

"image" : {
  "@type" : "ImageObject",
   "representativeOfPage": "True",
}

Expected behavior (when image is not selected)

"image": {
  "@type": "ImageObject",
  "representativeOfPage": "True",
  "url": "https://path/to/default-image/large/cloud.jpg",
  "width": "400",
  "height": "260"
},


texts: Adding a "my messages (x)" link in the block template file

texts:
I have installed Privatemsg, and I need to output the "My messages (x)" link programmatically in block.tpl.php.

I tried the following code, but it only prints "My Messages", when I need a counter for the new messages:

print l('My messages', 'messages');


texts: Getting all the Submitted field values after the Webform is just submitted in Drupal 7?

texts:
I created a webform for which I need all the submitted fields with values on the confirmation page after the user submitted the form. I am using WebForm 7.3.

The user when confirms the information, can make any final change before submitting it (updating the existing one, I guess).

This is what I used and placed it in the template.php but sadly it doesn't work:-

function user_register_webform_submission_insert($node, $submission){
// Load information about form components
$comps = $node->webform['components'];
$fields = array();

//Extract the component info to get form_key=>cid to resolve relation
foreach($comps as $cid => $comp_info){
    $fields[$comp_info['form_key']] = $cid;
}

// Load the submitted data (field values)
$data = $submission->data;

//Prepare a user info
$user = array(
    'mail' => $data[$fields['mail']]['value'][0],
    'name' => $data[$fields['name']]['value'][0],
    'pass' => user_password(8),
    'status' => 1,
    'init' => $data[$fields['mail']]['value'][0],
    'roles' => array(2, 3),
);

$account = user_save(null, $user);
}


texts: Beginner trying to use jQuery in a custom location, but not sure where to insert the code

texts:
At the moment, I'm working on a website that requires an on-mouse over effect where the things that are going to be displayed is an image. I figure that the best way to go about this is by using jQuery.

Being a beginner at Drupal, I've noticed that all of the content in this website is generated from database calls. I was wondering if there was a module or a way to see how these calls are made so that I may be insert the correct code at the right place.


texts:
What would be the best way to add code inside the  tag of specific content type?

Display Suite is being used for layout and we are using a custom theme. Have created html.html.twig. If I add anything to the head tags of this file, of course, it shows on all the pages.

Can we create a separate template such as html--content-type.html.twig then add the code there?

If not what would be the Drupal way of adding this code to the head tags for only specific content type?

<script async
   src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
   <script>
     (adsbygoogle = window.adsbygoogle || []).push({
          google_ad_client: "ca-pub-3********",
          enable_page_level_ads: true
     });
</script>


texts:
I have defined a cck field but I don't want it to be printed out in posts body.

I print body in this way:

<?php print $node->body; ?>

but cck filed still exists. I want to use value of that field for some other purpose.

any ideas?


texts: Creating a one-time password, and send the email

texts:
We need to create a system where the user enters only an email address. For a specific domain user receives an email with a generated password, and for all other domain receives a notification email to contact support. Password used to access a protected area of the site that is not available to the public. Also, the password can be used only once, ie. each time a user enters an email address, get a new password.

Any ideas how to make this system to Drupal 7?


texts: How do I build Breadcrumbs for a certain node?

texts:
In a node preprocess hook I am getting breadcrumbs for the currently viewed node by doing the following:

$vars['breadcrumb'] = Drupal::service('breadcrumb')
    ->build(Drupal::routeMatch())->toRenderable();

This works fine as it uses Drupal::routeMatch() to get the matched route for the current request.

But I also want to get the breadcrumb for each node in a listing of several nodes. In this case I cannot use Drupal::routeMatch() since I want to get the breadcrumb for each node in the listing, not the current page. The problem is I cannot find a way of getting a RouteMatchInterface object (needed by the BreadcrumbBuilder) from a node object. I can get the url containing route information via $node->urlInfo()but there seems to be no way of getting from there to a route match either.

How can this be done?

Edit:

I found a way to get the route match for a certain node. Not sure if it's the ideal way but it gets the job done:

$routeName = $node->urlInfo()->getRouteName();
$routeParameters = $node->urlInfo()->getRouteParameters();
$route = Drupal::service('router.route_provider')->getRouteByName($routeName);
$routeMatch = new RouteMatch($routeName, $route, $routeParameters);

However passing the $routeMatch into PathBasedBredcrumbBuilder::create does not generate bredcrumbs for that route!

On closer inspection it seems that the built-in PathBasedBreadCrumbBuilder class completely ignores the passed in $routeMatch parameter and instead builds the breadcrumbs using the path of the current page, fetched using the injected RequestContext object. I think I would need to swap out this service with my own implementation which uses the passed in parameters somehow. To be continued...


texts: How to render specific block from template without rendering entire region

texts:
I'm attempting to render a specific block on a page without rendering the region. I'm assuming the machine name of the block is 23 based on the URL I get when configuring the block.

example.org/admin/structure/block/manage/block/23/configure

I'm attempting to grab the block using the information I've found here

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

My attempt at it is

$block = module_invoke('block','blockview',23);
print render($block['content']);

But I'm not having any luck.


texts:
I have mamp 6.0 installed. When trying to
drush up
and confirming "yes", I get:

  PHP Fatal error:  Allowed memory size of 33554432 bytes exhausted
  (tried to allocate 12288 bytes) in /Users/me/Sites/jla
  copy/sites/all/modules/contrib/ctools/includes/stylizer.inc on line
  911 Drush command terminated abnormally due to an unrecoverable error.
  [error] Error: Allowed memory size of 33554432 bytes exhausted (tried
  to allocate 12288 bytes) in /Users/me/Sites/jla
  copy/sites/all/modules/contrib/ctools/includes/stylizer.inc, line 911
  Your memory limit is set to 32M; drush needs as much memory to run
  as[error] Drupal.  Please check your configuration settings in
  /Applications/MAMP/bin/php/php5.4.10/conf/php.ini or in your drush.ini
  file; see examples/example.drush.ini for details. The external command
  could not be executed due to an application     [error] error. Illegal
  string offset 'site' backend.inc:1013                        [warning]
  The command could not be executed successfully (returned: PHP Fatal
  [error] error:  Allowed memory size of 33554432 bytes exhausted (tried
  to allocate 12288 bytes) in /Users/me/Sites/jla
  copy/sites/all/modules/contrib/ctools/includes/stylizer.inc on line
  911 , code: 255)

This is the result of my drush status:
 Drupal version                  :  7.10
 Site URI                        :  http://default
 Database driver                 :  mysql
 Database username               :  root
 Database name                   :  jla_d7
 Database                        :  Connected
 Drupal bootstrap                :  Successful
 Drupal user                     :  Anonymous
 Default theme                   :  jlasitetheme
 Administration theme            :  seven
 PHP executable                  :  /Applications/MAMP/bin/php/php5.4.10/bin/php
 PHP configuration               :  /Applications/MAMP/bin/php/php5.4.10/conf/php.ini
 PHP OS                          :  Darwin
 Drush version                   :  6.0
 Drush configuration             :
 Drush alias files               :
 Drupal root                     :  /Users/me/Sites/jla copy
 Site path                       :  sites/default
 File directory path             :  sites/default/files
 Temporary file directory path   :  /Applications/MAMP/tmp/php

I know that I have set a 128MB memory_limit in the MAMP php5.4.10 file.


texts: How do I call some function after an AHAH callback that adds a new item?

texts:
I've tried

'#ahah'   => array(
        "url": "/?q=content/js_add_more/pmemo/field_tracks_disks_chapter",
    "event": "mousedown",
    "keypress": true,
    "wrapper": "field-tracks-disks-chapter-items",
    "selector": "#edit-field-tracks-disks-chapter-field-tracks-disks-chapter-add-more",
    "effect": "fade",
    "method": "replace",
    "progress": { "type": "throbber" },
    "button": { "field_tracks_disks_chapter_add_more": "Add another item" } ,
        'after' : 'myJsFunction'
),

But it is not working.

I wasn't able to find any solutions to this problem.

Thanks for any help.


texts:
I need to show taxonomy groups in an exposed form to the left of a map. I am able to do that no problem; however, I have a further requirement to drill down into each taxonomy group and expose the individual markers associated with each taxonomy term.

Taxonomy term group
    - marker 1
    - marker 2
Taxonomy term group 2
    - marker 3
    - marker 4

Is there a way to make this happen?


texts: If I use something like hybridauth, can I remove password field from Drupal completely? Or at the very least make it not required during registration?


texts: How to add a class to the webform error message

texts:
When people fill in incorrectly in my webform, the error message will output as follow, e.g:

  ×

Error message

Name* field is required.

Email field is required.

Contact No. field is required.

Comment field is required.

Now, I wonder is there way I can add a CSS class to this message so that I can target this particular message that fired by this particular webform. e.g

 ........

or even more specific, add the ID to the message .e.g

  ....


texts: Path field not available in Search API View

texts: Why is the "Path" field not available in a Search API view? Is there another way to get the path for each row in this type of view?


texts: General architectural approach to Drupal for a project

texts:
Apologies for the inspecific title, but my question is a relatively generic one!

I'm relatively new to Drupal, and because I've historically had a very different approach to CMS implementation, I think I may be missing the point of the architectural qualities of Drupal.

I'm a .NET developer who's used Umbraco and EPiServer a lot, but had limited experience in Drupal.

What Umbraco offers is a way for users to organise their content in the admin panel, such that items will happily sit in a tree structure under other items.

In the case that you have a news section, you would have the following structure in Umbraco:

News landing page
- News story 1
- News story 2
- News story 3

This hierarchical approach is also easily transferrable to organising other types of content, such as slideshows for a specific page. You could have a homepage which would consist of a slideshow with four slides in it, and that slideshow could be specific to that homepage. This would look like this:

Homepage

- Slideshow
+ Slide 1
+ Slide 2
+ Slide 3
+ Slide 4

In Drupal, I've noticed that all pages sit together in a sort of "page soup" as someone else coined, and an implementation of a taxonomy is relied upon to ensure that content is organised on the front-end.

I'm aware that Drupal offers a menu structure which allows you to form this structure, but it seems like if you want to organise actual content rather than memory references to content, you're a bit lost.

Another feature I found extremely useful in Umbraco is the ability to programmatically fetch page objects, and to have access to an API allowing me to get the children of that page, and display them within the markup the way that I see fit. The filesystem for this would look like this:

Homepage.aspx
- Slideshow.ascx

This allows you to drag that slideshow.ascx control onto any page, and the control will go and get the children of its parent, and display those slideshow items automatically.

Is all of this possible within Drupal? Am I missing the point entirely? I would love a bit of direction on this, as I've been floating around the general area of content for a little while now!

Thanks for any help!


texts:
From the community documentation, create database permissions, the superuser/1 should have these permissions:

SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, LOCK TABLES, CREATE TEMPORARY TABLES

There is comment here about install.mysqt.txt that the docs may be incomplete or ambiguous. Also, my Cpanel configruation shows additional permission options that I am unfamiliar with as does the GUI program I am using for MySQL.

My question is, are there situations where modules for things like services, SOAP, REST, SPARQL, SSL, or other APIs and connecting technologies need to use the additional database permissions?


texts:
I have created a jump list with certain taxonomy terms, but it seems impossible to get the url right.

I have a URL pattern setup for these terms: /dealers/towns/[taxonomy_term]

But in the jump list I can't find a way to get this url right, there's no way to select the actual url, how can I do this?


texts: How to set the public file path to migrate site files and images through Migrate Drupal UI

texts:
I am working on migrating a drupal 7 site to drupal 8 site that has image fields in content types, as well as some pdf files that I am trying to migrate through the Migrate UI. None of those files are in private directories. I have run the migration through the core Migrate UI many times and the content, taxonomy, redirects, alias patterns all have been coming through flawlessly. I cannot however seem to get the path right for my public files to migrate at all.

I am using Acquia Dev Desktop, which by default sets the file path for the D8 site to sites/"your-website".dd/files in /admin/config/media/file-system as they have essentially 2 paths to get to your site files. I have changed this in the settings.php to sites/default/files which did not fix the problem. The Drupal 7 site files are on my local machine, and that site is a dev site also on Acquia dev desktop. The Drupal 7 site has the path set to sites/default/files in /admin/config/media/file-system.

When using the full local path :C:\Users\user\Documents\mywebsite\sites\default\files I am getting the following pattern, which makes me think that the files are not being recognized properly in the directory as I am not seeing the slashes in the path:

Source ID 1701: File &#039;//sitesdefaultfilesschematicsimagesah-00-3.5.JPG&#039; does not exist

When using sites/default/filesor sites/default/files/I am getting a double slash in the path when it shows the results sites/default/files//*

Source ID 1701: File 'sites/default/files//schematics/images/ah-00-3.5.JPG&#039; does not exist

Here is my question. What path should I be using, and is the Migrate Drupal UI designed to get the files and move them just by setting the public path for source files, or should i be manually moving the files (copy/pasting) into the D8 directory in conjunction with setting the source file public path in the UI to properly reference them?

I would really like to sort out if it's possible to migrate my files through the UI as I am not very savy with drush.


texts:
I'm executing the following code in hook_init:

function my_module_init(){
    global $user;

    $apprenticeship = user_access('prevent publishing apprenticeship job', $user);
    drupal_set_message("CHECKING permission[prevent publishing apprenticeship job]: " . $apprenticeship);
    $content = user_access('access content', $user);
    drupal_set_message("CHECKING permission[access content]: " . $content);
}

I am logged in as USER#1 and the prevent publishing apprenticeship job permission is NOT set for user#1.

However, each time my code executes user_access('prevent publishing apprenticeship job', $user) returns 1 i:e true.

As I said, that permission is not set for for the administrator role.

Can anyone help and point out what I'm missing or doing wrong?

PS:

The access content also returns 1 but that is set for the administrator role.


texts:
I have a main site with "domain access" module. It has 5 multilingual sub sites with subdomain(single database).
I want to publish content from the main site to the subsites. This is already working good with send to affiliates.
But I want some admins on the subdomain to edit some content and it should reflect on that subdomain only
i.e It should not update content in main site.In drupal6 I found module "domain override"
How I can acheive this in drupal 7


texts: Programmatically render a panels page variant

texts:
There is a Page with id: front_page, and a number of variants.

I want to programmatically load the page, evaluate the context and render the appropriate variant.

I have the following code to load the page:

$page_id = 'featured_content';
$page_storage = \Drupal::entityTypeManager()->getStorage('page');
$variant_storage = \Drupal::entityTypeManager()->getStorage('page_variant');
$page = $page_storage->load($page_id);
// ...

How can I build or render the $page?


texts: Nested OR and AND condition with db_select

texts:
How can I convert the following query with db_select

SELECT *
FROM 'my_table'
WHERE
(condition1 < "value1" AND ((conidition2 > "value2") OR (condition3 < "value3")))
  OR
(condition4 < "value5" AND ((condition6 < "value6") OR (condition7 < "value7")))

I am trying with

$query = db_select('mytable');

$query->condition(
          db_and()->condition("condition1","value1")
                 ->condition(
                             db_or()->condition("condition2","value2")->condition("condition3","value3")
                             ));
$query->condition(
          db_and()->condition("condition4","value4")
                 ->condition(
                             db_or()->condition("condition5","value5")->condition("condition6","value6")
                             ));

  $query_debugg = $query->__toString();
dpm($query_debugg);

issue is with the "AND" in between where is should be "OR", it is expected I know.how can I change it

Output String

SELECT
FROM
{mytable} mytable
WHERE ( (condition1 = :db_condition_placeholder_0) AND( (condition2 = :db_condition_placeholder_1) OR (condition3 = :db_condition_placeholder_2) ))AND( (condition4 = :db_condition_placeholder_3) AND( (condition5 = :db_condition_placeholder_4) OR (condition6 = :db_condition_placeholder_5) ))


texts: Performance issues with Migrate Cron update

texts: I am running Migrate updates with cron every couple of minutes. I don't have many nodes (less than 100) but certain of them are data-heavy. Because of the wonky way my XML is written, I am forced to update all data every couple minutes. My site is now taking a real performance hit. Is this because I am running Migrate with cron? Or is there a way to force Migrate to update via hashes or something? I can't use the highwater field because my XML isn't ordered by update time.


texts: Complex Drupal setup using Views, Entity/Node Reference and custom content type

texts:
OK, here is my setup, i will then explain what im trying to achieve:

I have a content type of DELIVERY another content type of BOOK and another content type of FEEDBACK

Now, any given user can have anywhere from 1 to 12 DELIVERY content types created (these are created using Rules automatically when they sign up). I use the Node Reference field to attach a BOOK to the DELIVERY content type, if the user has more than 1 delivery content, i will be attaching different books to each delivery content each month. When i attach a book to the users delivery, they can then create a FEEDBACK content to leave feedback under that particular DELIVERY.

So for example,

User 1
  - Delivery 1
       - Book 1
       - Book 2
  - Deliver 2
       - Book 3

I want the user to be able to create a Feedback content and select the relevant book that the feedback belongs to and once saved it should appear under the particular delivery content.

How can I achieve this?


texts: How do I use hook_update_N() to create a vocabulary?

texts:
I want to create a standard vocabulary (no extra fields) in Drupal 8.7.5 programatically, using hook_update_N. I've never used this function before. So I'm a complete newbie.

I've modified a simple delete script I was shown, but something tells me it can't possibly be this simple.

Here's my starting point:

<?php

use Drupal\taxonomy\Entity\Vocabulary;

/**
 * create vocabulary testname.
 */
function ent_create_update_8105(&$sandbox) {
  $vid = 'testname';
  $vocabulary = Vocabulary::load($vid);
  if (!$vocabulary) {
    $vocabulary->create();
  }
}

I assume that, once the script is created correctly, I simply run drush entup.


texts: How can I download protected files using the REST API?

texts:
How can we download the protected files using the REST API by using the BasicAuth?
I've tried below code with BasicAuth
var settings = {
  "url": "domain/system/files/guides/docs.pdf",
  "method": "GET",
  "timeout": 0,
  "headers": {
    "Authorization": "Basic uFGAskieuwOnRlc3R1c2V",
    "Content-Type": "application/pdf"
  },
   "data": "<file contents here>"
};

$.ajax(settings).done(function (response) {
  console.log(response);
});


texts: Can the core Profile module (it is deprecated) be used? And how will I upgrade?

texts:
The profile core module is being deprecated in D7.  It exists and operates in D7, but is hidden and can only be enabled with drush or a custom module.  Drupal.org recommends that users now use Profile2, a custom module, but my attempts to do so have met with WSOD on several attempts. In fact, after enabling the module, it will crash the site if you try to disable it.  The problem links to a core issue, but even with the recommended patch, Profile2 still has other problems I have not been able to correct yet.

In the meantime, I enabled Profile, and it has desirable features I would like to implement.  My concern is that whatever I do may be lost in the future.  Since I cannot load Profile2, I do not know if it builds on Profile or I will have to reconstruct everything later.


texts: Converting existing autocomplete field to custom Drupal field

texts:
I have an existing autocomplete field outside of Drupal that uses jQuery UI's autocomplete functionality and makes a call to a custom PHP script to parse the input and return formatted data as JSONP. I need to migrate this field to Drupal.

I've created a custom field module, but I can't figure out how to bind the JS functions if the field allows multiple values. At the moment, I have the IDs of the HTML elements I need to use set with the name-'.$delta.' to append the delta to the ID name. Is there a way to bind JS functionality to a field in Drupal like a custom field behavior call or will I need to create a function in my JS to manipulate the ID and extract the delta that way?

I need one function to run when the field is presented as a widget (node/edit), and a different function to run when the field is presented as a formatter (node/view).

Also, is there a hook to tell Drupal about my JSON service PHP file, or do I just drop it in an includes folder in my module and link to it from my JS file?


texts: Why I'm not able to debug twig templates? sites/default/files/php directory is empty

texts:
As in question. I'm following this tutorial: https://dev.acquia.com/blog/debugging-drupal-8/debugging-twig-templates-in-drupal-8-with-phpstorm-and-xdebug/25/08/2016/16586

but directory

  sites/default/files/php/twig

is always empty

I'v tried cr all, checked file system page, did drush cron, checked theme page - no errors.

I got some errors related to permissions at theme settings page, but:

  chmod 777 -R sites/default/files

seems to solved those.

Any advices?


texts: Service Userpoints : Missing required argument points

texts:
My environment : Drupal 7 & service 3.x

I use userpoints and service-userpoints. I want to CRUD userpoints.

So i create a xmlrpc server and test it by Postman from Chrome store.

The xml code is belowed:

<?xml version='1.0' ?>
<methodCall>
  <methodName>pointss.add</methodName>
  <params>
    <param>
      <value>
        <struct>
          <member>
            <name>uid</name>
            <value>
              <int>1</int>
            </value>
          </member>
          <member>
            <name>points</name>
            <value>
              <int>150</int>
            </value>
          </member>
          <member>
            <name>description</name>
            <value>
              <string>test for xmlrpc service</string>
            </value>
          </member>
        </struct>
      </value>
    </param>
  </params>
</methodCall>

"pointss" is my userpoints-api's alias

i connect successful but got the message belowed.

<?xml version="1.0"?>

                    faultCode

                        401

                    faultString

                        Missing required argument points

How can i fix my xml body?
Does anybody have experience?
Thanks a lot.


texts: After voting results not showing in poll enhancements drupal 7

texts: I have finally found a module to improve Poll so that will allow multiple users from one IP to vote, but I accountered a bigger problem, the results are not show after you press submit button. What should I do? Thanks in advance


texts:
It is possible to set a Submit function for Preview button in an add/edit node form.

I would like to see if there is a possibility to go one step backward and validate the data to be previewed.

I just and only need to know how to have access to the validation hook for Preview button. (I don't need Submit hook! I only need Validate hook for this button)


texts: Unable to generate html using theme_table in block view

texts:
I have created a block_view, In that block I want to show dynamic table.

I have written following code.

$table_headers = array(t('User'), t('Relation'),t('Period') );
foreach ($result as $row) {
            $table_rows[] = array(
            $row->name,
            $row->relation,
            $row->period_from,
           );
         }
 dpm($table_rows);

In above $table_rows array, I am getting following elements

If I am using

$table_html = theme_table($table_headers,$table_rows);
$block['content'] = $table_html;

then getting following error on page

The website encountered an unexpected error. Please try again later.

If I used

$table_html = theme('table',$table_headers,$table_rows);
dpm($table_html);
$block['content'] = $table_html;

I am getting following html on page

Please suggest were I made mistake and what should I do.


texts: Special type of nginx redirect: redirect only if $request_uri is empty

texts:
I need a special type of redirect for a Drupal 6 website. I'm thinking that the best place to do this is in an nginx config file, but please correct me if I'm wrong. I know I can do it in a template file/module by checking $_GET['q'] and then using drupal_goto(), but I don't want to load the full bootstrap only to do a redirect.

Basically, I need to redirect www.domain.com and domain.com to subdomain.domain.com ONLY if I don't have anything after the domain part. This means that domain.com/node/3 should NOT be redirected.

I hope it makes sense and thank you in advance for your help :)


texts: Features installed with profile are overridden

texts:
We are using workbench with the subpermissions module.  We have created two features which set custom permissions for workbench and for subpermissions.  If we install the workbench feature and then the subpermissions feature, both features show as Default and not overwritten.  If we install these two features last with a profile, both features show as overridden and the permissions are not correctly set.
Any idea why this is happening and how would we investigate?

thanks


texts: How to copy current user'id to a custom field when adding a new entity?

texts:
I have a custom content entity 'service' created with Drupal Console (drupal generate:entity:content).
I added my own fields to the standard ones created by DC. Of which 'seliste_id':

$fields['seliste_id'] = BaseFieldDefinition::create('entity_reference')
  ->setLabel(t('SEListe'))
  ->setSetting('target_type', 'person')
  ->setSetting('handler', 'default');

By default, the code generated by DC handles the owner of any new entity, owner_id being the id of the current user.
By design, seliste_id is the id of the other entity 'person' which is linked 1 <-> 1 to Drupal's 'user'.
So when a new 'service' is created, I'd like to "copy" its owner (i.e. the current user's id) to 'seliste_id'.
I know that I can do that in mymodule_entity_presave().
Is there a way to do that in the definition of 'seliste_id' field?
With ->setDefaultValue() or ->setDefaultValueCallback() maybe?
Any idea?


texts: How to get Panels to pass a correct date to Views (D7, Views/Panels3)

texts:
I'm trying to get a date from a node to a view pane. When someone is viewing the node, they should see a view on the right that is just a list of other nodes with the same day in the "event_date_time" field.

Here's screenshots of how everything is set up:
http://imgur.com/a/eXCMA

1) First is the pane layout. The left is the node content with event_date_time. The right top is a view panel that has no filters, so you can see all the nodes and dates. Below it is the same view panel with a contextual filter.

2) the current results. You can see the right bottom only matches the two nodes that have the exact same year, month, day, hour and minutes.

3) the contextual filter setup. It's set with granularity of days, but doesn't seem to make any difference what granularity is set. Even if it is changed to "year", it still only returns the one exact matching item. If I change one of the two matching nodes from 4:00 to 4:15, they no longer match.

4) I'm asking for the date field from the Panel context in Views

5) And it's set up in Panels to send

6) The contextual filter returns the correct 4 events that match the day, if I manually pass it a YYYY-MM-DD format.

I looked through the context and relationship options in both panels and views and can't see any other way to send or format this date. I feel like I must be missing something basic in my understanding of how this is supposed to work.

(I get the same results whether I create the contextual filter using "Content: Event Date Time" or "Date: Date (node)", and whether they are set to "date range" or "only this field".)

This is Drupal 7.22, Panels & Views both current dev.


texts: How to invite multiple users when editing user account?

texts:
I've installed the Invite module. I see that there is an extra block that you can active. When you do this you will see a block like this on your page:

But I would like to have this field on my user/edit page. And make sure that they can enter multiple e-mail addresses separated by , .

But how can I do this?


texts:
I'm creating a website and I have to give the possibility for an anonymous user to update a node. The node is recognized through the use of a code, code that I am sending to the user when the node is saved for the first time. And when I save this node (for the first time), the node is modified to ensure that it is owned by user X and not by anonymous. Ok, is a little complicated, but these are the requests from my client.

So, I send to the user a mail with this line into: http://DOMINIO.EXT/node/123/edit/codeSHA1.

My problem is that Drupal obviously tells me that access is denied to perform the edit operation (node uid is X, but I'm uid 0) when I click onto that link (in my email client).

How can I resolve this "problem"? I don't want to install TAC or TACLITE, but I can write PHP code into one of my custom module.


texts: How do I set the node path with a contextual filter?

texts:
I'm creating a simple job board for my company in Drupal 7 w/ Views.  I have a view which creates a page that lists all available jobs.  Within each job is a truncated description which I have set to trim and display a "Read More" link which goes to the details of the job posting.

To generate the "Read More" link, I am using a contextual filter which pulls the [nid] and in the 'body' section I have the "Read More" link set to node/[nid].  This works exactly the way I need it to.

The issue I'm having is that I have created another page within the view to display the full job posting.  And instead of going to www.mydomain.com/node/3166, I want it to go to something like www.mydomain.com/jobs/current/posting/3166.  (I'd like to use the nid as some jobs might have the same title).

I go into this view and set the path to 'node/%' and the view shows up formatted and everything when details are clicked, however, setting this bombs out ALL of my other content within the site.  So I tried setting the path to something like 'jobs/current/posting/%' and I just can't get it to work.

Does anyone know what I'm doing wrong and/or have a solution or workaround??  TIA


texts:
I am quite new to Drupal so this question may be very simple or basic. I created a module and I've extracted list of a custom content type for each user by using EntityFieldQuery and then I used entity_load to make the results ready. the question is how should I use the $archive_items in my template ?!?

<?php
$archive_items = entity_load('node', $archive_items_nids);
?>


texts: How to show single pop-up for whole guest session

texts:
In my site I want to place a javascript ad code( from Zedo) which is popping up one window for each page visit by the user which is quite nagging.

Ideally what I want is to pop up the ad after user leaves the site or closes the window.

At least I want is to show single pop up in the whole guest session.

I place the ad code before </body> in page.tpl.php but it gets executed for every page.

I'm thinking to make it better by using this logic:

if(time() % 3 == 0)
{
//javascript ad code here
}

At least this will reduce pop up by 3 times.

Are there any better ideas?


texts: Best way to use image styles with Media and WYSIWYG?

texts:
Up to now, I've been using the Insert + WYSIWYG + CKEditor to insert images with specific Image Styles in a wysiwyg interface. This works well, and it's very easy to select and apply image styles (including colorbox variants) using Insert.

I'm currently testing Media (7.2x) + WYSIWYG + CKEditor as an alternative, and want to make sure I understand how to best use image styles in this context.

Based on a great write-up here (http://www.58bits.com/blog/2013/03/06/how-to-add-captions-to-images-in-drupal), it looks like one way to use Image Styles with Media is to do something like this:

Create desired image styles to use in WYSIWYG editor
Add view mode(s) as needed to the Image file type
Set view mode(s) to use desired image styles under Manage File Display
Choose "Format" (view mode) when embedding Media

Ultimately, this is more powerful than Insert, since the view modes can manage more than just the image (i.e. other fields like title, alt, and more) but it's a little clunky. For one thing, you'd need to add a new view mode for each image style that you want to have access to when embedding (?)

My question: is this currently the best way to use image styles when embedding images using Media (7.2x) + WYSIWYG + CKEditor?


texts: Search template suggestions from a module

texts:
I have created a custom search module that integrates with Drupal 7 Search Interface. My module is called history_search and in the module I have two files: history_search.module and history_search.info.

These are the contents of my history_search.module:

<?php

function history_search_search_info()
{
    return array(
        'title' => 'History',
        'path' => 'history',
        'conditions_callback' => 'history_search_search_conditions_callback',
    );
}

When I try to use it, it works correctly: Drupal creates a search tab for me and uses the results data I provide. However, I can't figure out how to get it to use my template suggestion for a single search result. I created a file in my module's folder called search-result--history_search.tpl.php, however it doesn't seem to be used when I perform searches in my module. However, if I place this file in my theme, then it suddenly works fine with no problems.

So my question is, how do I get Drupal to use search-result--history_search.tpl.php when I place it in my module's folder?


texts: Where are the webform files in the D8 directory?

texts: I'm trying to manually update the D8 webform module but cannot find any directory, folder, or file named webform.  Where are the webform module files located?


texts: Is there any Drupal 7 module there, that can restrict any user, based on role/privilege, number of downloads per day. For example, 'x' type of user can download 10 files/day.


texts: Creating a second page to populate posts with tag

texts:
I think the title is maybe a little bit confusing. Basically I want to create a page that will operate sort of similar to the front page but only populate with posts that contain a specific tag.

I already attempted this by going to structure > views, created a duplicate of Front Page. Then under Filter Criteria I added a new criteria of Tags (field_tags) and entered the tag I want to use.

When I hit save though it instead just caused my front page to lose all posts and the new page to have nothing.

Is there a way to do what I'm looking for,, I'm pretty much completely new to Drupal?


texts: How to make user's access to nodes depend on the year a node relates to?

texts:
User profile is organizer of this year boat show. After registering, user can create basic pages with main photo and basic text. Afterwards, user is given another role through rules, so he can not by accident create more basic pages but can still setup images, dates, videos, announcements, which are all visible as different views contextual blocks on basic page of the user.

All is fine, except i have no idea how to setup same thing for next year? User can edit basic page, but i would rather leave past year (basic page with views blocks) somehow be archived and visible on the website and his profile, and give him option to setup data for next year.


texts: Create a view that displays only the fields from the most recent user node

texts:
To specify, I want the view to only apply to one single node and not all other nodes and only pull fields from that one particular node that was last created. As of now the view displays all the nodes and their fields with a pager, I just want it to load content from the last node created by that user.

Can anyone suggest?


texts: How do I get only one result using db_query()

texts:
I am transitioning from 'old school' PHP MySQL methods of using mysql_fetch_array(), etc. and I am trying to be more Drupally by using the Database API in my modules.

I simply want to return and print out a value. For example:

$query = db_query("SELECT zip FROM {zipcodes} WHERE city = :city LIMIT 1", array(":city" => $city));

I know the value is there, I can access and print it by using traditional methods outside the database API.

print $query->zip is not working.

The API documentation is as clear as mud.

Can someone tell me the correct way to access these values?

Is there a good tutorial anyone could recommend as well?


texts:
I've cruised around the web and it is not at all obvious how to theme custom menus.  I've looked for hours and have not found one single post that illustrates the process, from start to finish, of creating a menu and customizing its output.  It seems like this is a multi-stage process:

Create the menu through the Drupal interface.
Create a theme function in your template.php file to theme the output.
Expose this menu to a template file (somehow) by adding it as a variable.
Call the theme function on the menu in the template file.

1 is easy enough to do, the problems I run into are with 2, 3, and 4.  Looking at the default page template, I see that it exposes the main menu in the variable $main_menu.  Later down the page you can see the function theme('links__system_main_menu', array('links' => $main_menu..., which means it's looking for an appropriately named theme function somewhere and using it to generate the output.

I know if I place function theme_links__system_main_menu(&$variables) {...} in my template.php file Drupal will use that function as opposed to function theme_menu_links(&$variables) {...}.

What I don't know is how Drupal links the custom menu I created with that function.  Let's say for example that I created a menu called My Menu.  Could I create the following function in my template.php file and theme the output for that menu? function theme_links__system_my_menu(&$variables) {...}

Also, how does one make that custom menu available to a template file?  How does Drupal expose the $main_menu variable to page.tpl.php?

I think the key I'm missing here is how to embed the variable that represents my custom menu into a template page.  For the most part though I'm completely lost with what to do after having created the menu.

Thanks for the help.

EDIT: Probably should post what I'm doing.  Per my comment to BetaRide below, I need to inject customized HTML into the <li> elements of the menu items. Specifically, I'm adding Twitter Bootstrap icons.


texts: Does user_is_logged_in() check if there is at least one user logged in?

texts: Does the user_is_logged_in() method return TRUE if there is at least one user logged in? Or does it refer to the current session, and returns TRUE if the current user is logged in?