texts: .js extension for javascript file is missing

texts:
I am using below code in my custom module "my_module".

    function my_module_theme(){
        return array(
                'my_module_javascript'=>array('arguments'=>array(),),
        );
 }

 function my_module_init(){
        theme('my_module_javascript');
 }

 function theme_my_module_javascript(){
        drupal_add_js(drupal_get_path('module','my_module').'/my_module.js');
 }

After I enable the module page source is showing the javascript file without .js extension.
like src="modulepath/my_module?lrmjns"
Am I doing anything wrong? why is it skipping .js?


texts:
How can I show objects having the latest post date? I.e. if 1 was posted yesterday, and 2 -- today, then show only 2 but if they both were posted yesterday and all the others before that, then show 1 and 2.

Is it possible with Views?


texts: My MYMODULE_config_preprocess_node(&$variables) is not displaying my variables

texts:
I have 2 modules both implementing the same hook: hook_preprocess_node()

What I do is basically the same in both:

function MYMODULE_preprocess_node(&$variables) {
    $stuff_to_display = $variables['myfield'];
    $output = '';

$variables['my_stuff'] = $output;

}

When I use a debug function I can see my variable (my_stuff) there but is not rendering on the page

While is working for the first module is not working for the other.


texts:
when i am added any query code is added in blocks our taxonomy term is not working they give two kind of errors:

PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'term' in 'where clause' when i clicking on taxonomy term
Notice: Trying to get property of non-object in eval()  when i am added code in blocks
Here is my code:

$nid=arg(1);

$tid=db_query("SELECT th.tid FROM taxonomy_term_hierarchy th
INNER JOIN taxonomy_term_data td ON th.tid=td.tid
INNER JOIN field_data_field_books book ON book.field_books_tid = th.tid
WHERE td.vid = '6' AND th.parent = '0'  AND book.entity_id = $nid
")->FetchField();

print $tid->Name;
$child=taxonomy_get_children($tid);
 foreach($child as $t)
 {
$link = l($t->name, 'taxonomy/term/' . $t->tid)."<br>";
print $link;
}


texts:
I have the following code to print last month once a new month starts.

$prevmonth = date('F Y', strtotime("last month"));
print $prevmonth;

The problem I encountered recently was that last month was printed before this month (August) begins.  E.g. July was showing although it was still July 31.

Any help on this issue is greatly appreciated.


texts: Problem setting user specific cache tags on custom block with user context

texts:
I have a simple custom block with a user cache context and a specific user specific cache tag:

/**
 * Provides a 'User example' block.
 *
 * @Block(
 *   id = "user_example_block",
 *   admin_label = @Translation("User example block"),
 *   category = @Translation("Blocks")
 * )
 */
class UserExampleBlock extends BlockBase implements BlockPluginInterface {

  /**
   * {@inheritdoc}
   */
  public function build() {
    return [
      '#markup' => 'Current User ID: ' . \Drupal::currentUser()->id() . '',
    ];
  }

  /**
   * {@inheritdoc}
   */
  public function getCacheContexts()  {
    return Cache::mergeContexts(parent::getCacheContexts(), ['user']);
  }

  /**
   * {@inheritdoc}
   */
  public function getCacheTags() {
    return Cache::mergeTags(parent::getCacheTags(), ['example_user:' . \Drupal::currentUser()->id()]);
  }
}

The block output varies correctly by the logged in user but the user specific cache tag is not set correctly.

It seems the cache tag is only set once for users with the same role or permissions.

Here is how to reproduce it:

Rebuild cache (drush cr)
Login with User 100 -> The block output is correct. The correct cache tag is set (example_user:100).
Logout
Login with User 101 (same role as User 100) -> The output of the block is correct, but the cache tag was not changed, it still is example_user:100. In fact the getCacheTags, getCacheContexts methods were not even called.

What works is when I put the cacheability meta data in the build method (with the "#cache" element in the render array).

What could be the reason for this?

Thanks for any help.


texts: Administration Structure to list menu items fails to display

texts:
When I access admin/structure/menu/manage/main-menu this should show a list of all of the menu items and enable re-ordering, enabling, etc. This has stopped working and will only display the top level menu (without styles) and sometime just a blank page.

I think it is related to the number of menu items I have. Checking the database for menu_links shows almost 500 entries. Is there a way around this?

Possibly I need to think differently. I am not actually displaying all of the items on the user menu just the top two levels. But by adding node and hiding them I get the breadcrumbs for 'free'. Is there a better way to handle the breadcrumbs that would enable me to remove excess items from the menus?

Thanks in advance
Andrew W.


texts: Why does file_create_url() not work for theme images?

texts:
With the latest Drupal 6 update, file_create_url() stopped working for all the files other than public or private files.

I think the assumption is that a file must be either in the public files or in the private files directory.

How can I get the image URL for those images that are in a theme or a module directory?


texts: How do I show specific content on a separate page?

texts:
I have menu links HOME | Property(links to property content type) | NEWS. In every News there are tags which reference to the property.

I want to link "NEWS" menu item to a separate page which should display only the news list which contains the tags for the property.

For example, i am on a property page say "Property XYZ", so there is a menu item "NEWS", when i click this menu item, a new page opens and this page is showing news which contain the Tag "Property XYZ" in them.

How do I achieve this?


texts: Why to use hook_drush_help() when we have 'description' in hook_drush_command()?

texts:
When you go to create new drush commands you can define the 'description' element inside the hook_drush_command(), and if you use drush help your_command you will see this description as output.

function onlyone_drush_command() {
  $items['onlyone-list'] = array(
    'description' => dt("List the configured content types to have Only One node."),
    'aliases' => array('ol'),
    'examples' => array(
      'drush onlyone-list' => dt("List the configured content types to have Only One node."),
    ),
  );
  return $items;
}

Command:

drush help ol

Output:

List the configured content types to have Only One node.

Examples:
 drush onlyone-list  List the configured content types to have Only One node.

Aliases: ol

But once you implement the hook_drush_help() and you use drush help your_command you will see the description defined inside this hook and you'll never see again the description defined inside hook_drush_command().

function onlyone_drush_help($section) {
  switch ($section) {
    case 'drush:onlyone-list':
      return dt('This is from help');
  }
}

Command:

drush help ol

Output:

This is from help

Examples:
drush onlyone-list  List the configured content types to have Only One node.

Aliases: ol

So, why to use hook_drush_help() when we have 'description' in hook_drush_command()?


texts: Better understanding of Drupal behaviors

texts:
I read about Drupal behaviors today, and I tried writing the following code.

(function ($) {

  Drupal.behaviors.mymodule = {
    attach: function (context, settings) {
      $('#mymodule_id', context).change(function () {
        alert('Handler for .change() called.');
      });
    }
  };

}(jQuery));

Is Drupal.behaviors.mymodule the namespace?
What are the context and settings parameters passed to the Drupal behavior?
Is this the equivalent of document.ready()?
Can I attach any number of functions?
Can I define JavaScript functions which will be called somewhere?


texts: Can I make Text Field accept filtered_html?

texts:
I have a content type where a field is the common name for a USA president. In examing a legacy database I'm importing some presidents have (simple) HTML in their name. For example Dwight Eisenhower <i>Ike</i>.

I would like to support this on a content type field field_people_common_name which is a textfield created in the Field UI.

Following these directions:

https://www.drupal.org/update/modules/6/7#text_format
https://www.drupal.org/node/1087468

I've created a simple form alter hook to allow the input format of filtered_html on this form element:

function prez_people_form_people_node_form_alter(&$form, &$form_state, $form_id) {
  dpm($form);
  $form['field_people_common_name']['und'][0]['value']['#type'] = 'text_format';
  $form['field_people_common_name']['und'][0]['value']['#base_type'] = 'textfield';
  $form['field_people_common_name']['und'][0]['value']['#format'] = 'filtered_html';
  $form['field_people_common_name']['und'][0]['value']['#settings'] = array('text_processing ' => '1');
}

This appears to well, work or function:

But upon previewing the edit I get these errors:

Warning: mb_strlen() expects parameter 1 to be string, array given in drupal_strlen() (line 482 of ../htdocs/includes/unicode.inc).

Warning: htmlspecialchars() expects parameter 1 to be string, array given in check_plain() (line 1583 of ../htdocs/includes/bootstrap.inc).

Warning: htmlspecialchars() expects parameter 1 to be string, array given in check_plain() (line 1583 of ../htdocs/includes/bootstrap.inc).

Any idea how to get this to work. I'm trying to avoid embedding a text_area for simple textfield value (a name will never require a massive textarea .... yes I know I could make the textarea 1 row tall ....)


texts:
How can I alter a field's storage property? What's the correct hook to use to alter $field['storage'] = 'my_custom_storage';?

I am currently using the global db variable field_storage_default but I find that to be gross. I don't want to do it for all fields.


texts:
These are the field thats I already created:

And this is how my page currently looks like:

The first image is the background of this page.

I want to add field image on the blue line. But when I add new field of image it doesn't show the second image.

Any suggestions about how to solve this problem?


texts:
Because of some buggy handlers I need to write a hook that will:

Get location_instance table's alias from the original query
Remove location_instance table join
Remove that alias join
Remove a location table join
Add 2 new joins

Apparently views does things a little differently so I can't just $query->join() my way to freedom. How exactly do I accomplish the above?


texts: How to set alias url for image address in a content type?

texts: I added an image field for a content type and its directory is /content_type_image. it works correctly but when I add a content to this content type the uploaded image url on the website is www.mysite.com/sites/all/ .... I mean it is clear where this image is in the server directory. Is there anyway to set an alias url for files and images in order to hide such urls?


texts: External login , in case internal login fail

texts:
I have a website which needs to authenticate users using drupal users table.

If authentication fails, then I want to run the authentication against users table from another database.

lf authentication is successful , then I want to register this user inside drupal, so the next this user next time he logs in , he get authenticated from drupal users table , not the external users table.

I wish to get a complete solution for that.

the following code is my attempt :

function external_auth_form_user_login_alter(&$form,$form_state){

$form['#validate'] = array( 'user_login_name_validate' );
user_login_authenticate_validate( $form, $form_state );
if(!empty($form_state['uid'])){

db_set_active('barakah');
$result=db_query('select username,password from users where username= :name   and password= :pass',array(':name' =>$form_state['input']['name'],':pass'=>$form_state['input']['pass']));
db_set_active('default');
if(!empty($result)){
$username = $form_state['input']['name'];
user_external_login_register($username, 'external_auth');

}

}

}

but as if the code doesn't exist, nothing happens


texts: field_attach_update and field_get_items for anonymous users

texts: Is there a way to benefit from field_attach_update and field_get_items functions for both anonymous and logged in users? Or do I have to use raw $_SESSION for anonymous users and after they log in (or register) switch to fields API? Note that I want to store different data for each anonymous user.


texts: PECL uploadprogress installed - but no progress bar, just spinning gif

texts:
Pretty much same question as this.  I've set everything up - can confirm pecl uploadprogress is on, and activated from the status reports page.

But how do I see this for uploading files? I've recently enabled the handy drag and drop upload module from here - which supports the progress bar, but whenever I upload something it's just a spinning gif.  I can't find where to alter the progress indicator as mentioned in the answer in the first link above - can anyone point me in the direction?

cheers


texts: how do I organize the input fields in fieldset?

texts:
I have a node form in Drupal 7, in order to simplify it for the user I want to break it up into sections using the vertical tabs feature.

Using hook_form_FORMID_alter() I can move the fields with difficulty.tha following is my code.:

function mymodule_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'test_node_form') {
    $form['cpmonth'] = array(
      '#type' => 'fieldset',
      '#title' => t('test'),
      '#weight' => 5,
      '#collapsible' => TRUE,
    );
$form['cpmonth']['field-14sq']=array();
$form['cpmonth']['field-510sq']=array();

  }

}

"field-14sq" and "field-510sq" are my input text fields. Do you have any idea?


texts:
I have a site built with Drupal 7, and I allowed the authenticated users to see the other profiles. Till now, every thing was OK; the problem is when they click on the name of a user. They see the tab "account" by default, and I wanted them to get the tab "video" or blog entries instead.

I have the view, edit, video, account tabs, and I used the tab tamer in order to reorganize the theme, but the "Account" tab is still the default one.

How can I make the "Video" tab the default one? Where can I change it?

Please check my site.


texts: Is there a simple boolean formatter that allows custom content?

texts: I have a boolean field that stores 0 or 1. I'd like a formatter that lets me enter custom markup to display on 0, and different content to display on 1. I'm happy enough doing this in code, just thought I might be reinventing the wheel if I did.


texts: Prevent Drupal 7 from adding whitespace to the source code

texts:
I like to use HTML when adding content to the body of my nodes. I like to keep the HTML clean and uncluttered. I like HTML that has semantic meaning.

I indent using 2 spaces instead of a tab, which prevents having whitespace chaos. I indent using 2 spaces instead of 4, which makes it more compact and readable.

So I create nice, well formatted HTML, 2-space indent, save the node. Then when I come back to edit it, Drupal adds tabs whenever indent-spaces used to be and now it looks horrible and more difficult to read.

Also, Drupal removes the spaces between paragraphs that I add to make paragraph groups more readable.

How can I prevent Drupal 7 from adding whitespace to source code?


texts: Panels creates different pane number for any mini-panel inside a panel-node

texts:
It's kind of hard to explain this but I'll try in a pragmatic example:

You have a mini-panel in a block, somewhere around a panel-node (say node/1, your homepage):

in the first panel-node (your homepage) this mini-panel has a CSS class named (For example): .pane-1
in the second panel-node (your "about-us" page) this mini-panel has the CSS class .pane-6
in the third panel-node (your "customers" page) this mini-panel has the CSS class .pane-11
in the forth panel-node (your "contact-us" page) this mini-panel has the CSS class .pane 14

And so on and so forth, you get the idea.

I would like to know why Panels creates different pane classes for mini-panels that appear inside panel-nodes?... It makes the CSS development very very hard, forcing me to fill the Style.css file with different classes that all has the same properties. It is also problematic in the sense that we shouldn't and can't adding a class to the Style.CSS each time when creating panel-nodes...

What is your most efficient way to handle with this and to achieve working just with a single general class for this same pane?

Please help,

Notes:

This problem doesn't occur in Nodes, it occurs only with Panel-nodes. In regular nodes it uses the same basic panel-pane class (for example .pane-1).
I Could supply direct links for examples in my site.

Here is but a very gentle example for the inefficacy of this method Panels works with that forces filling of Style.css with repitative lines of code.


texts: Get all referencing entities two levels upstream

texts:
I have three content types. Content Type A, Content Type B and Content Type C.

Content Type A has an Entity Reference field named field_B

Content Type B has an Entity Reference field named field_C

What I want to achieve is create a view that I can use one Content Type C node to display all nodes of type A that reference this node through nodes of type B.


texts: How do you disable strict errors for PHP 5.4 & 5.5 in Drupal 7 via the settings.php file?

texts:
Currently I disabled the error messages via UI under Administration > Developement > Logging & Errors:

But I want to be able to do this via the settings.php file. How can that be done?


texts:
I some working code in hook_user_login() that awards 5 points to users for each day they log into the site.  If they log in twice in one day, points are not awarded the second time.

Originally, I thought users would login each time they visit the site but since users stay logged in between visits, they are not getting points for visiting once per day.  For example, if they log in today, they get 5 points but tomorrow and each day they visit thereafter, they don't receive any.

I would like users to be awarded for each day they visit the site whether they need to log in or not.  I wasn't able to find another hook that could do it.  Does anyone know of one or some other method of tracking user visits?


texts: Views block in custom region rendered outside of page.tpl

texts:
I have custom regions rendered inside of the node.tpl.php file which work as expected, but results in a php error when blocks created by the views module is placed in them.

 [:error] [pid 2563] [client 127.0.0.1:35606] PHP Fatal error:  Maximum execution time of 30 seconds exceeded in /filepath/sites/all/modules/devel_themer/devel_themer.module on line 333

Other blocks all work fine the regions and the views blocks work fine in all regions called by page.tpl.php. The error only occurs when the two are put together. There are no other log messages and the page just returns a blank screen so I'm not quite sure what the problem is or how to go about fixing it. I'm using the code below in template.php to make the region available outside of page.tpl.php

function smark_design_theme_preprocess(&$variables) {
  if (block_get_blocks_by_region('region_name')) {
    $variables['region_name'] = block_get_blocks_by_region('region_name');
  } else { $variables['region_name'] = FALSE; }
}

And this to call the region in node.tpl.php

<?php if ($page): ?>
  <?php if ($region_name): ?>
    <div id="region-name">
      <?php print render($region_name); ?>
    </div>
  <?php endif; ?>
<?php endif; ?>


texts: Deleted my secondary_links block; where to find another?

texts: How would I re-add a copy of "secondary links" to my Bartik-themed installation?  I seem to have deleted it a year ago when I didn't think I'd want a blogroll, but would like one now.


texts: How know if user is visitor or logged member?

texts: How can I determine programatically whether the current user is anonymous or authenticated?


texts:
Within Drupal 7 I am trying to modify the page myserver.com/admin/people/permissions/roles so that a custom role which I have added cannot be edited. In other words, I'd like it to be locked like the anonymous and administrator roles.

I have found one possible solution at http://drupal.org/node/397480 but I think it is a Drupal 6 fix.

I've tried modifying the render array for the content directly, but also can't figure that out quite right.

Here is the closest I've been able to get it. Any suggestions or solutions will be much appreciated.

function access_group_preprocess_page(&$variables) {
  //check to see if the current page matches the path specified
  $match_path = explode('/', 'admin/people/permissions/roles');
  $match = TRUE;
  for ($i = 0; $i < count($match_path); $i++) {
    if ($match_path[$i] != arg($i)) {
      $match = FALSE;
      break;
    }
  }

  //if there is a match, modify the page
  if($match){
    //define the locked roles
    $locked_roles = array(DRUPAL_ANONYMOUS_RID, DRUPAL_AUTHENTICATED_RID,);
    $access_group_role = user_role_load_by_name(ACCESS_GROUP_ROLE);
    if ($access_group_role) $locked_roles[] = $access_group_role->rid;
    kpr($locked_roles);

    kpr($variables);

    //recreate the render array for the table
    $header = array(
        t('Name'),
        array(
            'data' => t('Operations'),
            'colspan' => 2
        )
    );
    foreach (user_roles() as $rid => $name) {
      $edit_permissions = l(t('edit permissions'), 'admin/user/permissions/'. $rid);
      if (!in_array($rid, $locked_roles)) {
        $rows[] = array($name, l(t('edit role'), 'admin/user/roles/edit/'. $rid), $edit_permissions);
      }else{
        $rows[] = array($name . " <em>(locked)</em>", '', $edit_permissions);
      }
    }

    //$form = user_admin_role(array(), array(), );
    //$rows[] = array(drupal_render($form['name']), array('data' => drupal_render($form['submit']), 'colspan' => 2));
    $form = $variables['page']['content']['system_main'];
    $rows[] = array(
      array(
          'data' => drupal_render($form['name']) . drupal_render($form['add]']),
          'colspan' => 3,
      ),
    );

    $output = drupal_render_children($form);
    $output .= theme('table', array(
        'header' => $header,
        'rows' => $rows,
    ));

    $variables['page']['content'] = $output;
  }
}


texts: Increasing PHP memory limit (Possible Drupal override?)

texts:
Problem

I've recently come across a problem with my dev version of Drupal where I realised the php memory limit isn't high enough.

I've changed the main php.ini files but they seem to be ignored and I can only increase the memory limit by putting the following line into sites/default/settings.php:

ini_set('memory_limit', '500M');

Could there be something Drupal related which is overriding the main settings (that I'm then overriding in settings.php) as this is happening in multiple environments?

Set-Up

Windows 7, XAMPP:

Altered php.ini in C:/XAMPP/php/php.ini

memory_limit=500M

Ubuntu(10.04), Apache, PHP, MySQL

Altered php.ini in /etc/php5/apache2/php.ini

memory_limit=500M

Ubuntu(12.04), nginx, PHP-FastCGI, MySQL

Altered php.ini in /etc/php5/cli/php.ini
(checked this was correct ini file using php --ini)

memory_limit=500M

I have a php.ini in my drupal root, but it has

memory_limit = -1

which I'm pretty sure is no limit.


texts: Why do I have to refresh before embedded YouTube video will show?

texts:
I just uploaded a YouTube video using the embed code. Each time I visit it, the video will only show on the second page load (when the page is refreshed). This is on a Drupal 7 site using AdaptiveTheme as the base theme with very minor CSS changes.

I'm half just posting here so that no one else spends 45 minutes banging their head against input filters before realizing the problem isn't there. But if anyone knows why this is the case, I would love an explanation.


texts:
I created pages for brands that I sell on my shop. Each product is associated with a brand taxonomy term. I created a view block that displays pages of brands. The block is displayed throughout the store and displays the entire list of brands. How to display only those brands related to product pages?

I know we need to use contextual filters, but I do not know how to configure.


texts: Latitude/Longitude processing to avoid Null Island entries

texts:
I have to display some 8k points on a map rendered by a view on my site.

Since those locations will be updated quite often i decided to use a custom entity (lets call them "Structures"), so i could make all the data heavylifting manually on the db.

I managed to display my Structures locations on a Leaflet Map and everything went fine.

BUT! Some of my Structures don't have a latitude/longitude, and they are stored with a 0,0 value and they are therefore shown in the infamous Null Island.

I could fix this by bounding regions or exluding them from view but i wanted to try something a bit more complex.

What i would like to do is to process my data to call a geocoder in the (0,0) case to ask Google to find location based on address (wich i have).

Where (or when) should i do my scripting?

On the database, prior to manual import? (simple, but outside-Drupal solution)
Working with the Entity API to update values? (is it even possible since i'm importing data manually?)
Right before the data is shown? So with Leaflet API or IP GeoLocation View&Maps?


texts: Link to create new node with taxonomy term from url already selected?

texts:
I need to make a link to create a new node. I need this link to appear on taxonomy term pages so I was going to put it in a block. Nodes can be tagged with taxonomy terms.

How can I make it so the create node form has the term (from the page the link was on) already selected? So if you were on mysite.com/term/1 and and clicked the create node link, the node would have term 1 already selected.

Ive found this module but its in dev for D7 so there another way?
http://drupal.org/project/prepopulate

Thanks


texts: JS File's `attach` method not always executed when loaded through block template

texts:
We are using a custom barrio sub theme and have some JS files we attach to our template files using the {{ attach_library('custom_barrio/my_js_library') }} line at the top of our twig templates.
Generally, our js files are something like
(function ($, Drupal) {
  "use strict";

  Drupal.behaviors.coursesBehaviors = {
    attach: function (context, settings) {
      ... code here....
    }
  }
}

If we attach the library in a page template, we have no issues, however, when we attach the library in a block template the attach method doesn't always execute, thus our js never executes.
I've confirmed that the js file exists in the scripts on the browser, it just never gets "attached" by Drupal.
Why does the Drupal attach method not always execute for blocks?


texts: How should I configure the trusted hosts setting?

texts:
I am trying to add the Trusted Host setting. I copied the code directly from the settings.php file, making sure I removed the * and changed the example to my domain.  Using the first example

$settings['trusted_host_patterns'] = array(
  '^www\.example\.org$',
);

The site would not load....got an error stating domain was disallowed

Today using this code
and

$settings['trusted_host_patterns'] = array(
  '^example\.org$',
  '^.+\.example\.org$',
);

I am getting an unexpected error and the site won't load

This is a new site on a shared host.  It can't be this difficult!  I must be missing something!


texts:
I'm using Drupal 7.x. I have achieved to make it work without clean URLs.

Investigating, I have understood that I should create a vhost for each drupal site and enable clean URLs with the following code.

if (-e $ REQUEST_FILENAME) {
     rewrite ^ / (. *) $ / index.php? q = $ 1 last;
}

Alternatively, I could use this code.

location / {
         [... ]
         error_page 404 = @ drupal;
         [... ]
}

location @ drupal {
         rewrite ^ (. *) $ / index.php? q = $ 1 last;
}

However, I've also seen that without creating a vhost can enable clean URLs (like Apache).
I tried on both lines in my setup but I do not get a result.
When I enable clean URLs it always displays the word Nginx (The localhost).

What is the right way to enable clean URLs?

This is my configuration in /etc/nginx/sites-available/default.

server {
        listen   80; ## listen for ipv4; this line is default and implied
        listen   [::]:80 default ipv6only=on; ## listen for ipv6

        root /usr/share/nginx/www;
        index index.php index.html index.htm;

        # Make site accessible from http://localhost/
        server_name localhost;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to index.html
                try_files $uri $uri/ /index.html;
                # Uncomment to enable naxsi on this location
                # include /etc/nginx/naxsi.rules
        }

        location /doc/ {
                alias /usr/share/doc/;
                autoindex on;
                allow 127.0.0.1;
                deny all;
        }

        location /images {
                root /usr/share;
                autoindex off;
        }
        # Only for nginx-naxsi : process denied requests
        #location /RequestDenied {
                # For example, return an error code
                #return 418;
        #}

        #error_page 404 /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
                root /usr/share/nginx/www;
        }

        #Pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ \.php$ {
                try_files $uri =404;
                #fastcgi_split_path_info ^(.+\.php)(/.+)$;
        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini

                # With php5-cgi alone:
                #fastcgi_pass 127.0.0.1:9000;
                # With php5-fpm:
                fastcgi_pass unix:/tmp/php5-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;
        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        location ~ /\.ht {
                deny all;
        }
}

I have not created any vhost on my server; neither do I know how.


texts: Letting users login with facebook to an existing account

texts:
My client wants to add FaceBook integration into an existing site. I've successfully setup fboauth and openid_selector. New accounts can login without an issue. However, we liked to let an exiting user authorize a login from Facebook to their account.

I can see how to do this using openid_selector's http://yoursite.com//user/xxx/openid. Might there be a way to duplicate this for FaceBook authentication?

Update: I found this node https://drupal.org/node/1624374. It seems that if a user is already logged into Drupal and then clicks the FB connect button, FBOauth will link the accounts. Though I'd prefer to have something like this managed through an interface like openid_selector (pictured in this post).


texts: How do I make a user profile field a link

texts:
I've created a custom field for users on a site I'm working on that is for their website url. I want to make this field actually link to the website the users enter upon signing up.

Using Drupal 7, customized Bartik theme. The field is a standard text field.

I've tried doing a custom field template for that field, and I've tried editing the page-user.tpl.php file, neither worked.


texts: Remove the special characters (like %20) from URL

texts:
Is it possible to replace the URL encoded characters for space,?,etc. with the exact character ? Because one of the content in my site takes the following URL and it doesn't looks so nice!

  https://expatchoice.asia/eat-drink/restaurants-casual/ana-intercontinental-tokyo%E3%80%80ana%E3%82%A4%E3%83%B3%E3%82%BF%E3%83%BC%E3%82%B3%E3%83%B3%E3%83%81%E3%83%8D%E3%83%B3%E3%82%BF%E3%83%AB%E3%83%9B%E3%83%86%E3%83%AB%E6%9D%B1%E4%BA%AC


texts: How to bring the REMOTE ID of a commerce payment into the checkout completion page?

texts:
We're running on Drupal 7.72 and using Commerce and Commerce Webform to take payments on the website.
We would like to display the REMOTE ID (seen below) on the checkout completion page. We are not able to find any tokens for this purpose readily available in the replacement patterns.
How would we go about trying to achieve this?
Apologies - I'm pretty new to using this module.


texts: how to add custom additional password suggetions descriptions points in drupal 7?

texts: I want to add few more suggestions points to existing password suggestions description in drupal 7 while registering new user. So tell me is it possible to modify it ?


texts:
I need to add about 64 custom fields to the user object. These fields will be filled when the user is created and updated from a 3rd-party database when the user logs in.

How would I go about making these modifications? Would I subclass the user or just make a new module to do this?


texts: How can I add background music to an existing Drupal 7 website?

texts:
I have a nice little website built with Drupal 7. It's very basic, nothing crazy going on.

The client is demanding there be background music playing on the site. I have pleaded with them not to do this, but they are insistent and they are also signing the checks. :)

What is the best way to add background music to an existing Drupal 7 site that won't stop playing between pages? For any given solution what are the consequences to search engine friendliness and impact in general to the structure of Drupal?

Looking only for solutions to the music problem as not having music on the site isn't an option here.


texts:
How can I display a list of preprocess block variables so I can conditionally include a library? Using the 'plugin_id' doesn't seem to work and when I echo all of the variables all I see is a blank page. Is there a Drupal page that will show me what all the variables are for blocks?
My custom block module is called, 'leaflet_block'.
function leaflet_block_preprocess_block(&$variables) {
  echo "<pre>"; print_r($variables); echo "</pre>"; // shows a blank page

  if ($variables['plugin_id'] == 'leaflet_block') {
    $variables['#attached']['library'][] = 'leaflet_block/leaflet_block';
  }
}


texts: How to change the values of a customer_profile address field in the validation function?

texts:
In my checkout form, I have 2 customer profiles: billing (default) and shipping (from commerce shipping module).

Basically, I need to emulate the commerce_shipping 7.x-1 option "copy shipping information from billing", but i need to do that manually in a validation function (the values depends from few factors).

My code:

function MYMODULE_form_commerce_checkout_form_checkout_alter(&$form, &$form_state, $form_id)
{
    // [...cut...]
    array_unshift($form['buttons']['continue']['#validate'], '_MYMODULE_validate_checkout');
}

function _MYMODULE_validate_checkout($form, &$form_state)
{
    // a custom checkbox i added in MYMODULE_form_commerce_checkout_form_checkout_alter
    if($form_state['values']['b2s'] == 1)
    {
        form_set_value(
            $form['customer_profile_shipping']['customer_profile']['#value']->commerce_customer_address,
            $form['customer_profile_billing']['customer_profile']['#value']->commerce_customer_address['und'][0],
            $form_state
        );
    }
}

But i get this error:

Notice: Undefined index: #parents in form_set_value() (line 2514 di /httpdocs/includes/form.inc).

Recoverable fatal error: Argument 2 passed to drupal_array_set_nested_value() must be an array, null given, called in /httpdocs/includes/form.inc on line 2514 and defined in drupal_array_set_nested_value() (linea 6440 di /httpdocs/includes/common.inc).

I also tryed:

$form_state['values']['customer_profile_shipping']['customer_profile']->commerce_customer_address['und'][0] = $form_state['values']['customer_profile_billing']['customer_profile']->commerce_customer_address['und'][0];

and i dont get any errors, but it doesnt works.

Any idea?
Basically, for now i just need to copy billing address into shipping address when my b2s checkbox is checked (when i understand how to do that, i will add my custom logic)


texts: Error using Drupal Feeds to upload a comment in a text field

texts:
I am loading data from a CSV file into a content type and everything is working fine except when I try to import a long text field / comment field.  The data in the comment field should be treated as straight text.

Here is my data I am trying to upload via feeds:

LP 8/28/13 strategy:  extend to 2020. LP 4/8 LL First Allied rejected concept. LP 4/17 meeting: 5 yrs. LP 9/24/14 strategy: 10 yrs.3/2-Spoke w/Jordan Raines-First Allied last week. Submitted LOI on 3/2.

When I try to upload this, I receive the error message:

SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect string value: '\xFFexten...' for column 'field_store_comments_value' at row 1

SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect string value: '\xFFexten...' for column 'message' at row 1

So my question is, how do I get Feeds import of a text string into a long text field to ignore the date strings in the comment?  I do not want the dates treated as dates.  I want the dates to be treated as a string of characters.

Or what am I doing wrong?

The CSV file has a comment in it.  I know the Feeds map is correct because I put the test "This is a test comment" in the csv and it loaded fine.  But when I put the full comment in, it does not work.

Any thoughts?

Thanks,

Dennis


texts: Unable to get Video + VideoJS to play MP4s on ANY Android device

texts:
This is a multi-part question - I'm running Drupal 7.14, w/ Video Module 7.x-2.9 and VideoJS Module 7.x-2.2, configured a Content Type to upload only MP4s, and Manage Display to use Video settings, where the Players for all Formats are set to VideoJs - and I get videos to playback on all modern browsers - chrome, firefox, safari, ie, iphone/ipad, windows 8 smart phone, just NOT any of the android devices.

I actually tested a Samsung Galaxy S1 Tablet w/ Adobe Flash 6.3 installed, and I still couldn't get the VideoJS 3.0 Flash Fallback [that I normally get on Firefox].

Anyways, the other part of the question is where to actually put my .htaccess file in a multi-site installation that I have my mime type set to video/mp4 .mp4? I'm guessing this may have something to do with it on Android?

I've scoured videojs forums, video/videojs module bug tracking, and couldn't really answer this question. Any advice would help. ALso, I don't have autoplay enabled as a setting on Video Module.

Thanks,


texts:
jcart is a great shopping cart that uses a php class inside a jcart.php file. The cart is being displayed

<?php $jcart->display_cart();?>

I managed to create a module to list the product items and the form with 'add to cart' button, also to include the jcart.css and jcart.js inside everypage. The only thing I need to include more are:

the mymodule/jcart/jcart.php

I tried to include it in my header of html.tpl.php but I get an error while displaying $jcart->display_cart(). The error is:

  Fatal error: Call to a member function display_cart() on a non-object
  in...

To add a class to the form: class

If there is someone could help I would appreciate it.


texts: How to split taxonomy checkboxes on node edit form

texts: I figured how to do it on node output, but i can not figure how to add css for specific field, in this case taxonomy checkboxes, 50 of them, and split in 4 columns on node edit form.


texts: How to create add custom style to specific view in drupal

texts:
Please check this site

I am trying to create rounded corner rectangle on right hand side where products are listed. This is currently working because I modified view-view-grid.tpl.php. Doing this has changed everywhere wherever I was using grid. I want to add this style only to a particular view. How can I achieve this in views.  I also want to modify style of each category displayed within the box eg. Product category should be bold or some different color.

I am beginner so please let me know steps or some good references.


texts: How do I prevent NaN from appearing in the drupal form field?

texts:
For this field, if a user enters a space and leaves the field, the field fills with NaN, any idea how I can prevent that from happening?

if (variable_get('variable', DEFAULT) === 1) {
$basics_form['number_of_things'] = array(
  '#type'          => 'textfield',
  '#title'         => t('Number of things'),
  '#description'   => t('How many of this thing are there?'),
  '#size'          => 5,
  '#required'      => FALSE,
  '#attributes'    => array('class' => 'basics-tab__input--small'),
  '#prefix'        => '
',
  '#suffix'        => '
',
  '#default_value' => isset($v->field_number[0]['value']) ? $v->field_number[0]['value'] : NULL,
);

}


texts:
I am using the views php module and want a custom label.

The label field doesn't allow php to be entered, how would I go about changing the label?


texts:
In a node type hotel I have an entity reference field to a node type offer. For the offer node.tpl I need to output some fields of the referencing node type hotel.

I have no idea how to get these fields inside the referenced node.


texts: How to use the Menu Badges to show the number of recieved messages via Privatemsg?

texts:
I use Privatemsg on my site to allow users to communicate with one another. New messages appear in the "Inbox" tab.

I also have the Menu Badges module installed to have a count of unread messages displayed in a badge. The Tab Menu Badges edit page does not list the inbox path (it's /messages/received). It lists other paths like /messages/list, /messages/blocked, /messages/sent, etc. (all being Privatemsg paths). But there is no path for Received messages.

So, I cannot display a badge on the inbox tab.

Is this a common error? Is there a fix or a workaround for this?


texts: I cannot see the Rules event "Page is going to be viewed"

texts:
I am looking for rules event "Page is going to be viewed" but I cannot see it; is there something I am missing?

I'm using rules 7.23, I have panels enabled, and I want to use it to redirect authenticated users to another page when they click on the front page.


texts: How can I have non-exact locations on a map?

texts:
I'm using GMap to help users find other people in their area. But I'd like to let users have some privacy only making their city and zip code available in the map, but still have the full address in the database for mailing purposes. How can I do this? The position of the pin on the map should also be only based on city and zip, as obviously it could be pretty precise as to location.

For example, let's say the president registers on our site. He enters his full address, 1600 Pennsylvania Ave NW, Washington D.C., DC 20500. An administrator can now look that up and mail him our newsletter.

Another user in the D.C. area is looking for people to meet up with. They look and see a pin on the map for a user POTUS. The click on the pin and it only displays a partial address, Washington D.C., DC 20500. And the pin's location isn't exact, so the user can't tell from its placement the exact address of POTUS. But it is enough that the user knows they are nearby, so they send a user to user message to get in touch.

Any solutions for non-exact pin locations would be fine. If it was slightly randomized. Or perhaps all pins in a zip-code are grouped into one with a link for "# users in the 20500 area" which takes the user to a full list.

If this can be done with something other than GMap, that is fine.


texts: how to retrieve refrencing parent id with EntityFieldQuery

texts: I am very new to EntityFieldQuery. I understand how you create a query with this class. However, I have a node which is referenced (with Entity Reference) by a parent node. I would like to use EntityFieldQuery to retrieve the parent id. Can this be done?


texts:
I'm running Drupal 7 along with the Google Analytics module. I have an eCommerce Marketplace setup with store fronts and unique products per store. I'd like to have analytics per store so that each store owner can see the traffic coming to their page/products.

I'm using Organic Groups to setup the stores with Group Type: Store and Group Content: Products. I have custom variables setup relating to the Group Reference.

My question is:

How can I filter page requests in Google Analytics to specifically those relating to a certain group/store so that when a store owner views their analytics they are only seeing the requests for their "pages"?


texts: Kint breaks in template and doesn't allow me to view anything

texts:
In my template I am trying to view the contents of Childen in a form template.
<form{{ attributes }}>
  {{ kint(children) }}
</form>

However, the result I get is a useless broken kint message, that doesn't allow me to expand any of the fields or view any other information.

Any ideas?


texts: Is there a way to integrate revisioning with Panels + CTools content types?

texts:
I'm using CTools content types to make highly customized Panels panes. The panes together form a Panels Node (I'm using the Panels default module for this).

The Panels node itself can be revisioned, but these revisions do not include changes to the content that lives in the panes. It seems that the content of the panes themselves cannot be revisioned.

Is there a way to use revisions/workflow/workbench/anything to control the publishing flow of the panes?


texts: how to reinitiate a default field value every time the content edition is loaded?

texts:
i have a field that , if opt-in, send notifications.
I would like that when editing the content , the value is always reinitiated to opt-out, sitll leaving the possibility for the editor to opt-in again

this code below does it but then it is not possible to save an opt-in nomore

use Drupal\node\NodeInterface;

function mymod_entity_load(array $entities, $entity_type_id)    {

  foreach ($entities as $entity) {
    if ($entity instanceof NodeInterface) {
      if($entity->bundle()=='evenement'){
         $entity->field_notif=0;
      }
    }
  }
}


texts: How do I create a simple breadcrumb with pathauto?

texts:
I'm using Pathauto to setup my url paths like this:

www.blah.com/parent1/parent2/page-name

I want my breadcrumbs to mirror this on every page:

Home >> Parent1 >> Parent2 >> Page Name

I've installed custom breadcrumbs but it wants me to create a custom breadcrumb for each content type. Can I just create one to use site wide? Preferable add via a block or view.


texts: How do I change the edit form layout for a custom field type

texts:
I created an Address custom field type, with two text fields (street and city).

When I add a new Address field on a content type, I get this form inside the edit page.

How can I change the layout of the form above?

For example, I would like to add some space between the Street text line and the City label, or display both fields on the same line.

This is the code for the AddressDefaultWidget class.

/**
 * Field type widget implementation.
 *
 * @FieldWidget(
 *   id = "AddressDefaultWidget",
 *   label = @Translation("Address select"),
 *   field_types = {
 *     "Address"
 *   }
 * )
 */
class AddressDefaultWidget extends WidgetBase {

  /**
   * Define the form for the field type.
   */
  public function formElement(
    FieldItemListInterface $items,
    $delta,
    Array $element,
    Array &$form,
    FormStateInterface $formState
  ) {

    // Street

    $element['street'] = [
      '#type' => 'textfield',
      '#title' => t('Street'),
      '#default_value' => isset($items[$delta]->street) ?
          $items[$delta]->street : null,
      '#empty_value' => '',
      '#placeholder' => t('Street'),
    ];

    // City

    $element['city'] = [
      '#title' => t('City'),
      '#type' => 'textfield',
      '#default_value' => isset($items[$delta]->city) ?
          $items[$delta]->city : null,
      '#empty_value' => '',
      '#placeholder' => t('City'),
    ];

    return $element;
  }

}


texts: What is the correct way to programatically set node type options?

texts:
I learned yesterday that the correct way to create a node type is by implementing hook_node_info inside a .module file. Before I had been programatically creating node types in a .install file via node_type_save, like this:

// Create node type
$type = array(
  'type' => 'fruits',
  'name' => st('Fruits'),
  'base' => 'node_content',
  'description' => 'Contains information about fruits.',
  'custom' => 1,
  'modified' => 1,
  'locked' => 0,
);
$type = node_type_set_defaults($type);
node_type_save($type);

I had also been setting the node type options in the .install file, like this:

// Set 'fruit' options.
variable_set('node_preview_fruit', 0);                     // Set 'Preview before submitting' to 'Disabled'.
variable_set('node_options_fruit', array('status'));       // Set 'Default options' to 'Published'.
variable_set('node_submitted_fruit', 0);                   // Unset 'Display author and date information'.
variable_set('comment_fruit', COMMENT_NODE_CLOSED);        // Set 'Default comment setting for new content' to 'Closed'.
variable_set('menu_options_fruit', array('navigation'));   // Set 'Available menus' to 'Navigation'.
variable_set('menu_parent_fruit', 'navigation:0');         // Set 'Default parent item' to '<Navigation>'.

Is this the correct way to programatically set node type options: like this, inside the .install file, even though the node type itself is created inside the .module file?


texts: How can I change the order of elements printed in my twig template?

texts:
I have a simple twig template that looks like this:

{%
  set classes = [
    'region',
    'region-' ~ region|clean_class,
    'row',
    '' ~ region|clean_class,
    elements.system_main ? 'controller-page',
  ]
%}

{% if content %}
  <div{{ attributes.addClass(classes) }}>
    {% if elements.system_main %}
      {{ elements.system_main }}
      {% set elements = elements|without('system_main') %}
    {% endif %}
    {{ content }}
  </div>
{% endif %}

The main variable I am concerned with are content and elements. In the above I am trying to print elements.system_main before the rest of the content, and then remove it from the elements variable. But even though I do that it is still being printed out with the content variable.

I can't figure out why elements is being printed out at all, because the content variable only has the markup from my controller. But when I don't print the content variable it doesn't print any of the elements. How is it possible that elements.system_main can be printed out a second time after I have deleted it? I have used kint to debug the elements variable and it shows that system_main has successfully been deleted.

I am also unable to print content|without('system_main') because content is only markup.


texts:
I'm using Drupal 7 and Commerce Kickstart 2.0-rc1.
I can't find a way to remove the possibility for a user role to use the "Quick Edit" button in admin/commerce/manage-products . I tried using hook_permission() but, despite the permission is taken into account, the button is still here and still works.

Is there a clean way to remove this action from the drop-down list ?

Thanks.


texts: How do I create a catalogue list that links through to my individual product nodes?

texts:
I have taken Ryan Szrama's advice from a question I asked on how to display products and have now got that working. I have also built a catalogue list of all my products using views.
I now need to link the two up, so that if a user views the catalogue they can click through from there to the appropriate individual product node. How do I do this, or am I missing something?

To be specific: I have a view called 'catalogue' that is a list of books using a table, and I have a view 'book' that is an unformatted list that contains more detail on each book (like cover image, author etc). This view returns all books initially. I want the title in the list to link through to the book view and filter that view using ISBN (SKU) for an individual book. I can create the link, but I am not sure how to correctly format it. Currently the link looks like this: /book?isbn=123456789 (I have also tried /book?sku=123456789). This link just returns a full unfiltered list of the view.


texts: Field groups not showing when nested using field type HTML

texts:
I'm using Drupal 7.34, Profile2 module, Field groups 7.x-1.4.

When building a form with nested field groups and using the fieldset field type, my form renders properly.

When I configure my form like this:

It renders into this, showing nothing but the Title and Save button:

There is nothing in the generated HTML as well, i.e. not hidden div's or something. The HTML markup just isn't there.

When I configure my form like this (changed nested fieldgroup element from HTML to Fieldset):

It renders into this, showing all:

My goal is to have some nested HTML elements, which I am able to style in a theme. Am I doing something wrong with nested HTML elements?

Thanks,
Eric


texts: How can I restrict selectable terms in a term reference field to only show those which have been used earlier by the same user?

texts:
I have a node (type = List) with 2 fields, Term Name and Body.
Body is a long text type field and Term Name is a entity reference field, which is a drop down with a list of Term in Vocabulary Vocab.
Let’s say Terms are Term1 and Term2 in Vocab.
My Requirement is:

user creates new content Node 1. Term Name field should display all the Terms in Vocabulary Vocab. user selects the Term1 and saves the content.

user creates new node Node 2, Term Name field dropdown should display only Term1. as values.

So in short, if there is any node created by a user, Term Name field should contain on term selected in already created node. if there is no node created by user all term names should be displayed.
Any idea how I can achieve this? I am using Drupal 7.x


texts: Entity Validation API: Retrieve parent field entity while validating

texts:
I'm using the Drupal 8 Entity Validation API. I've implemented my Constraint and ConstraintValidator classes and added them as a constraint against the relevant entity field.

If I understand the validate method signature for ConstraintValidator correctly, I'm given a list of fields ($items) and the constraint ($constraint). However, I need to retrieve the parent entity in my logic.

How can I get the parent entity while with the validation API?


texts:
Have followed all the steps at http://www.packtpub.com/comment/reply/7089 to create a custom module.

I am able to create it and it is showing under the Modules and is getting enabled. However as the purpose of this module is to create a new block it is not doing so. Its not showing under the Structure/Blocks. Any reasons?

name = First
description = A first module.
package = Drupal 7 Development
core = 7.x
files[] = first.module

;dependencies[] = autoload
;php = 5.2

/**
 * @file
 * A module exemplifying Drupal coding practices and APIs.
 *
 * This module provides a block that lists all of the
 * installed modules. It illustrates coding standards,
 * practices, and API use for Drupal 7.
 */

/**
 * Implements hook_help().
 */
function first_help($path, $arg) {
  if ($path == 'admin/help#first') {
    return t('A demonstration module.');
  }
}

/**
 * Implements hook_block_info().
 */
function first_block_info() {
  $blocks = array();

  $blocks['list_modules'] = array(
    'info' => t('A listing of all of the enabled modules.'),
    'cache' => DRUPAL_NO_CACHE,
  );

  return $blocks;
}

/**
 * Implements hook_block_view().
 */
function first_block_view($block_name = '') {
  if ($block_name == 'list_modules') {
    $list = module_list();

    $theme_args = array('items' => $list, 'type' => 'ol');
    $content = theme('item_list', $theme_args);

    $block = array(
      'subject' => t('Enabled Modules'),
      'content' => $content,
    );

    return $block;
  }
}


texts:
I want to sell files as product using ubercart.

How to add files using product content type?

I want user to pay for the file first and then get file downloaded.

Is it possbile?Then how ??

Also i want each role called 'vendor' to have there own payment details and get paid from buyers. Is that possbile?

Thanks.


texts: Can I use the function menu_tree() in Drupal 7 to customize a menu and add CSS classes? I've tried to customize a main_menu by adding CSS classes: Is it the right way?


texts: Form altering and ajax registration module

texts:
I've altered forms in template.php and everything is displaying like I wanted, but when form is validating in my popup and some inputs are not filled, It shows error messages and default form template.

My code:

function default_form_alter(&$form, &$form_state, $form_id) {
  if ($form['#id'] == 'user-register-form') {
    $form['account']['pass']['#type'] = 'password';
    $form['account']['pass']['#title'] = NULL;
    $form['account']['pass']['#attributes']['size'] = 60;
    $form['actions']['submit']['#value'] = 'Zarejestruj się';
    $form['account']['mail']['#description'] = t('');
    $form['account']['name']['#description'] = t('');
    $form['account']['pass']['#description'] = t('');
    $form['user_name']['und'][0]['value']['#attributes']['placeholder'] = t('Imię');
    $form['user_lastname']['und'][0]['value']['#attributes']['placeholder'] = t('Nazwisko');
    $form['user_job']['und'][0]['value']['#attributes']['placeholder'] = t('Stanowisko');
    $form['user_company']['und'][0]['value']['#attributes']['placeholder'] = t('Nazwa firmy');
    $form['account']['mail']['#attributes']['placeholder'] = t('E-mail');
    $form['account']['name']['#attributes']['placeholder'] = t('Nazwa użytkownika');
    $form['account']['pass']['#attributes']['placeholder'] = t('Hasło (min. 8 znaków)');
    $form['user_name']['und'][0]['value']['#title'] = NULL;
    $form['user_lastname']['und'][0]['value']['#title'] = NULL;
    $form['user_job']['und'][0]['value']['#title'] = NULL;
    $form['user_company']['und'][0]['value']['#title'] = NULL;
    $form['account']['mail']['#title'] = NULL;
    $form['account']['name']['#title'] = NULL;
    $form['account']['pass']['#title'] = NULL;
    $form['user_agreement']['und']['#title'] = NULL;
    $form['user_marketing1']['und']['#title'] = NULL;
    $form['user_marketing2']['und']['#title'] = NULL;
    $form['user_agreement']['und']['user_agreement_agree']['#title'] = NULL;
    $form['user_marketing1']['und']['user_marketing1_agree']['#title'] = NULL;
    $form['user_marketing2']['und']['user_marketing2_agree']['#title'] = NULL;
    $form['user_name']['und'][0]['value']['#weight'] = 0;
    $form['user_lastname']['und'][0]['value']['#weight'] = 1;
    $form['user_job']['und'][0]['value']['#weight'] = 2;
    $form['user_company']['und'][0]['value']['#weight'] = 3;
    $form['account']['mail']['#weight'] = 4;
    $form['account']['name']['#weight'] = 5;
    $form['account']['pass']['#weight'] = 6;
    $form['user_agreement']['und']['#weight'] = 7;
    $form['user_marketing1']['und']['#weight'] = 8;
    $form['user_marketing2']['und']['#weight'] = 9;
        $form['actions']['#weight'] = 10;
  }
}

EDIT:
I noticed the form is changing ID to user-register-form--2, user-register-form--3 etc. everytime form is not filled + messages are not printing...


texts: Drupal7 multilevel tree taxonomy term views at display

texts:
I want to display multilevel tree structure view in taxonomy terms views page. I used view tree module but it shows only the last parent child structure only if I use order list: ex.: I have  as default parent. I want to have output of my view just like the taxonomy vocabulary page.

root
Grand Parent 1
--Parent 1.1
---Child 1.1.1
----Child 1.1.1.1
---Child 1.1.2
--Parent 1.2
---Child 1.2.1
Grand Parent 2
------Parent 2.1
----------Child 2.1.1
----------Child 2.1.2
------Parent 2.2
----------Child 2.2.1
----------Child 2.2.2

but the result I am getting for view tree module is

Grand Parent 1
Grand Parent 2
Parent 1.1
Child 1.1
-------Child 1.1.1.1
Child 1.1.2
Parent 1.2
-------Child 1.2.1

likewise. In view tree module I am able to get the tree view just for last two levels like
Child1.1
---child1.1.1.1
 and that to be if I use Ordered list else it just change the look and feel. I tried to follow How to show terms in a Views in its hierarchical structure? but its solved till the level2
Grand Parent 1
--Parent 1.1
but not the entire n level.


texts: Views Filter nodes and show referencing nodes

texts:
I have 2 content types: HotelPack and Event

The HotelPack content type has an entity reference field that references to an Event

In the view I want to show all the Events and filter them by Category (using an exposed filter)

I also want to show in the View all the HotelPacks that contain the matching Events

Any idea would be appreciated. Thanks a lot


texts:
I'm trying to add an RSS feed to a LDAP Query view, but I keep getting and error message.

"Row style plugin requires specifying which views fields to use for RSS item."

Is there a way to show an RSS feed from LDAP in Views?

UPDATED WITH IMAGE


texts:
I have a Views Slideshow block on the home page, and everything seems to be running properly.

The issue is why a deleted slideshow node is showing on the home page slideshow. Strange thing is that I did Run Cron and Clear All Caches, but the deleted slideshow node shows up on the home page with http url and not https. Anyone having the same issue?

-- - - update info for questions @ Oct 6, 2:25pm - - --

PS: I found out that all other blocks are not showing the latest update, even the basic block with text only.


texts: How to allow users who have cancelled their accounts to re-activate / re-enable them?

texts:
If a user cancels their account on a Drupal 7 site, is there a way to allow them to re-activate their account without requiring administrator intervention?

If a user has second thoughts and wants to rejoin the site using the same e-mail address, I would like to make it easy for them.  I have set the Account cancellation method to Disable the account but keep the content.


texts:
I have a working Drupal 8.3.7 installation and use the rules3.0alpha module.

I add a reaction rule that is applied After saving new comment.

That's all.

Now, when I try to save a comment, I get an error:

TypeError: Argument 1 passed to Drupal\rules\Plugin\Condition\EntityHasField::doEvaluate() must implement interface Drupal\Core\Entity\FieldableEntityInterface, string given in Drupal\rules\Plugin\Condition\EntityHasField->doEvaluate()

What's wrong?


texts: Drupal, Crawlers, and Migrating from a Query string based site to a Clean URLs site

texts:
I have a (potentially huge) problem that I did not anticipate.  I just built a beautiful new site for the organization I work for.  It is a massive improvement over the previous site.  The site is also, I'd say, larger than average.

The previous site utilized query strings to navigate around the site, and in a really awful, highly customized fashion.  Basically all page URLs looked something like /index.php?page=/path/to/page.php&stuff=4|5|3|1.

The new site utilizes clean URLs.

Now the problem.  Crawlers from all over are rampaging through the site and causing high CPU utilization (~50% at all times).  I have caching enabled as well as JavaScript and CSS aggregation.

Here's an example URI from the access log:

/?p=1%7C26%7C31%7C33%7C2%7C7&page=publications.php

In the current scheme that should just return a 404 in my opinion because that literally represents nothing.    Instead it's returning 200 OK which is wrong in so many ways, but technically is right because you do in fact get the home page back.  In fact, every single "page" that the crawlers look at right now 90% of the time it's getting back the homepage because it's either looking at /index.php?querystring or /?querystring where of course Drupal does nothing with the query string and just returns the homepage!

I'm not entirely sure how to communicate the correct HTTP status codes to the crawlers.  Any advice is much appreciated at this time.  I now understand why Google implores you to build sites with clean URL schemes...


texts:
I have a video link and the video is there in my FTP. I need to migrate videos from mysql to DRUPAL database. Video complete path is stored in mysql database at present. In this process I  dont want to transfer videos from this FTP, instead I want to link somehow to the video-upload field of my content type. Is this achievable ? Is there a module to do this? I have used feeds module for migration but int that I can not migrate videos.

Content type: Sports
Fields: Sports Type(Text) and Sports Video(Video upload)

I have a video link in my existing database. I want to migrate or somehow link the video to the Sports Video field.


texts: Checkout not redirecting to PayPal upon submission of form in IE and Firefox

texts:
I've searched high and low for an answer to my problem, but haven't found one. I'm using the Commerce PayPal EC module to allow users to purchase ads on my site. It works well in Chrome and Safari, but for some reason in IE and Firefox, when the user clicks "Buy Now", they don't get re-directed to PayPal; instead, they just stay on the page with the form. Very frustrating.

The cause of this is not because they've already submitted a form (which should never be a cause anyway, since I want users to be able to submit as many orders as they want). Also, it's not because of the settings of a single computer because I've tried submitting orders in IE and Firefox on multiple computers, and each time clicking "Buy Now" doesn't re-direct me to PayPal. Can anyone tell me what's going on?


texts: How to have SimpleSaml create a new account only when the user doesn't have a Drupal account already?

texts:
I'm new to Simplesaml...I feel like I'm missing something obvious in the configuration. Could someone point me in the right direction?

Drupal - 7.53

simpleSAMLphp Authentication - 7.x-2.0-alpha2


texts: Contextual link in Product Display type to allow me to edit the referenced Product?

texts:
I have a Product Display node and it has the following contextual links: Edit, Delete and Manage Display.

The Edit link allows to edit the Product Display node.  I need to add another contextual link to allow me to edit the product referenced by the product display.

Please take a look a this image:


texts:
I have two custom modules well just call them one and two for now, both have a hook onto hook_node_insert(). However, module two also has a hook into module one that is initiated by it's hook to node_insert(). So here is what the code would look like:

//one.module
one_node_insert($node) {
    //some code here
    module_invoke_all('one_complete', $node);
}

//two.module
two_node_insert($node) {
    //some code here
}
two_one_complete($node) {
    //some different code here
}

What order do the hooks get called if the weight for module two is 0 and the weight for module one is -1? Logically I would think the order would be:

one_node_insert->two_one_complete-> two_node_insert

But from just a little bit of testing it seems to be

one_node_insert->two_node_insert->two_one_complete

So my question is does drupal some how run hooks in levels? In other words does it run all functions directly hooked to node_insert before it continues down the line of other hooks?


texts: Can I redirect the user to some other page if the result of a view is empty?

texts: How do I redirect the user to some other page, when the view returns empty result?


texts:
I have a custom module which has some custom blocks in. My blocks display in the block page so they are being registered with hook_block_info.

However my modules are not displaying anything on the screen. I have added a dpm('hit') at the the top of hook_block_view for my module but nothing is being displayed.

I have added hook_block_view_alter to my module and see that the blocks are being displayed there but with the $data parameter being null/empty.

I have run my code through the coder module and it is not seeing any errors.

What could be going wrong?


texts: Send email with profile2 fields with account email token in rules

texts:
I am trying to send an email to users contains information they put into their profile2 fields when they registered on the website.

My problem is that their is no email field token available in rules and I was wondering if their is a way to expose the account email token so that I send emails to the user.

The rule I have setup is as follows and I have exported the rule which can be found below.

Event: After saving a new profile

Actions: Send HTML e-mail

{ "rules_email_banking_details" : {
    "LABEL" : "Email Banking Details",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "mimemail", "profile2" ],
    "ON" : { "profile2_insert" : [] },
    "DO" : [
      { "mimemail" : {
          "key" : "[site:name]",
          "to" : "[profile2:field_account_email]",
          "subject" : "Banking Details for accounts that you must make a  payment to.",
          "body" : "[profile2:field_name_of_your_bank]",
          "language" : [ "" ]
        }
      }
    ]
  }
}

If anybody has some advice that could help it would be much appreciated.


texts:
I am getting the following error after uploading files in server:

  The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script.

For development purposes, I am using the following server URL: http://dev.example.mhd.co.us.

I am not able to access site when it has its .htaccess file; when I remove the .htacess file, it works fine. I am using the default file that comes with Drupal. I need to enable the clean URLs on the site.; mod_rewrite is enabled.

Is there anything else I need to configure?
Do you have any idea about why I have problems?


texts: How can I display conditional fields on page view?

texts:
I want to display one of two fields on page render, depending on which field was selected on save.

I have a content type with a paragraph field called Banner Header. Banner header has a field group called Callout links. Callout links contains three items:

A field that accepts a single link.
A field that accepts multiple links.
A select list radio button called Callout Link Control.

Here is the custom paragraph code for my banner header:

{# initiate the printing of the banner #}
{{content.field_banner}}

    {# print out the title of the node #}

{{ node_title }}

           {{content.field_leadin}}

    {# If there is content in the field_callout_icon or field_callout_text #}
        {% if content.field_callout_icon.0 or content.field_callout_text.0 %}

                {% if content.field_callout_link_control.0 == 'A single large button link' %}

                {% endif %}
                {% if content.field_callout_link_control.0 == 'Multiple small button links' %}

                        {% if content.field_callout_link.0 %}

{{content.field_callout_link.0}}

                        {% endif %}
                {% endif %}

                   {{ content.field_callout_icon }}
                   {{ content.field_callout_text }}

        {% endif %}

Depending on which radio button is selected, I want to display the corresponding Callout Link field: either field_callout_link or field_small_callout_button_link.

I've tried this a couple different ways. As you can see my my code, I attempted to control the way the fields display with twig.

I have also tried the conditional_fields module and set the following dependencies:

Cond. 1

Target Field: field_callout_link
Controlled By: field_callout_link_control
Description: !disabled
Value: [corresponding radio button is selected]

Cond. 2

Target Field: field_small_callout_button_link
Controlled By: field_callout_link_control
Description: !disabled
Value: [corresponding radio button is selected]

The behavior I see is that only the field field_callout_link displays on page render - regardless of which radio button is selected.

How can I control which field(s) display when the page renders based on radio button selection?


texts: A page to display various membership types to choose from?

texts:
I am completely newbie to Drupal, currently using Drupal 7.x

Though I am experience hard-core IT professional, I am trying to learn Drupal.

I have a simple requirement to display a page when user clicks on "Create new account".

The page should display three columns giving details of  three types of memberships, basic, premium and enterprise. Three memberships should be display in three columns and at the bottom of column there should be button "Register" which should take user to fill registration details.

Please could you guide me how to do that.

Regards
TD


texts: How I can add an optional parameter in REST API URL

texts:
How I can add an optional parameter in drupal 8 REST API URL

"canonical" = "/content/get/{id}"

But I have to add value for id here, How I can make this id optional


texts: How to hide a sub level menu from being expanded?

texts:
When a menu is active, drupal displays the sub-menus of the active menu, but because I use the sub-menus in a separate block via the "menu block" module, I don't want the sub-menu to be shown. How can I do it on server side?

Is there an easy drupal way to do it without touching the theme_menu_link? If not, Is there a way to do it in a module rather in template.php? beside, can some one show me how to write the code?


texts: Using Migrate Plus API to select items from a JSON array

texts:
Im novice in drupal i'm i need to solve the following error in my migration import.

For Example, nid:

[
    {
       nid: [
           {
             value: "110538"
           }
       ],
       uuid: [
           {
             value: "a90278c4-8bac-4539-b0c7-a6f62ed11975"
           }
       ],
       vid: [
          {
            value: "110595"
          }
       ]
    }
]

What sort of field selector is needed to get nid value?

Im have the following migrate:

source:
  plugin: url
  data_fetcher_plugin: http
  data_parser_plugin: json
  urls: https://example.com/rest/article
  ids:
    nid:
      type: integer
  item_selector: /
  fields:
    -
      name: nid
      label: 'Nid'
      selector: nid
    -
      name: title
      label: 'Title'
      selector: /title
  constants:
    source_base_path: 'https://example.com/'
process:
  nid: nid
  title: title
  type:
    plugin: default_value
    default_value: 'article'
destination:
  plugin: 'entity:node'
migration_dependencies: null

when i'm trying run the migration import, has occurred the following error:

 [warning] array_flip(): Can only flip STRING and INTEGER values! EntityStorageBase.php:264
 [warning] Illegal offset type ContentEntityStorageBase.php:955
 [warning] Illegal offset type in isset or empty EntityStorageBase.php:250

In Connection.php line 729:

  Placeholders must have a trailing [] if they are to be expanded with an array of values.


texts: How to disable aggregation from either drush or PHPmyadmin?

texts:
I've been searching for this and ALL I found deals with Drupal 7. Old drush command drush vset preprocess_js 0 doesn't work for Drupal 8 and the "variable" table in DB doesn't exist in 8...

Yet, I can't disable aggregation in my D8 site for some reason and want to disable it from either drush or DB.

Do you know a way?


texts: media_internet_get_provider(): Unable to handle the provided embed string or URL

texts:
Drupal 7 instance/Media 2.x module won't play nice with media on various internet services (youtube, vimeo, etc.).

Originally (media 1.x) it worked with Media:YouTube & Media:Vimeo. I disabled these and tried Media:oEmbed. Still, my instance won't recognize the service calls.

This is the function that fails in Media/media_internet_get_provider for Vimeo:

function media_internet_get_provider($embed_string) {
  foreach (media_internet_get_providers() as $class_name => $nothing) {
    $p = new $class_name($embed_string);
    if ($p->claim($embed_string)) {
      return $p;
    }
  }
  throw new MediaInternetNoHandlerException(t('Unable to handle the provided embed string or URL.'));
}

It's the original code.
Any ideas on how to troubleshoot/fix would be appreciated.


texts:
I want to make the options for a (secondary) term reference autocomplete field dependent on the values chosen in another (primary) autocomplete term reference field. How can I limit the options in the secondary term reference field?

I have two vocabularies called chapter and sub-chapters. In the sub-chapters vocabulary, I have an additional term reference field linking each sub-chapter to the chapter in the chapter vocabulary. (I wanted to use two separate vocabularies, rather than a single hierarchical vocabulary to make it easier to use separate exposed views filters).

On my main content form, I want to limit the sub-chapters available in the autocomplete field to the values chosen in the primary chapters autocomplete field.

I have looked at many different modules for achieving this and haven't found any that will work with my scenario so need to write some code to achieve this. I need to use autocomplete fields as there are so many terms to choose from for both the primary and secondary fields. I have been using the autocomplete deluxe widget for the primary field but I can just use the standard autocomplete widget if this makes it easier.

Can anyone give me a rough outline of the basic code I would need to write in order to achieve this?

I guess there will need to be an update of the options of the secondary term reference field whenever the values are altered in the primary term reference field using AJAX?


texts:
I would like to add a style-able Subscription box which will consist of a Heading, text field and a styled button in form of an image. Upon pressing the submit button I would like the user to be presented with some options in form of checkboxes as well as the option if they would like html or plain text email format.

How would I go about adding this to my drupal 7 site?


texts: How do I create an everybody list of statuses?

texts:
I'm implementing a Facebook/Yammer like front page, and I have downloaded and installed the Statuses (Social Microblog) module.
This works well, but for the life of me I can't get the status block to work as I would like. Can anyone help?

All I need is a status page as front page, where everyone can post and see those posts.

I have the latest release of the module for Drupal 7 (7.x-1.0-beta1), the Flags, Views and Facebook-style Statuses Tag Suggestions modules installed.


texts: How to change the positioning of Drupal blocks when a theme is enabled?

texts:
I am developing a Drupal 7 theme. I want to change the position of the blocks when a user set my theme as default.

In my theme the main menu is positioned in left sidebar. Suppose the current theme of the user has main menu in the header block, when a user enables my theme, the main menu should go to the left sidebar.

Basically I want to position the block using code when my theme is set as default.

Any way to implement this?


texts: Is there a module (or combination of) that will create a personal, but public, user gallery upon user registration automatically? Ideally with a link to the gallery from their profile?


texts: Change block configuration before render the block programmatically

texts:
I have a view that display some nodes and some of this nodes have a menu voice connected to them with sub menus.

main menu:
-node 1  [mid:407]
--node 2
--node 3
-node 4  [mid:219]
--node 5

I want my views display something like:

node 1 data + the submenu
--node 2
--node 3

node 4 data + the submenu
--node 5

I installed the module menu_block and I created a block that display all the child of a menu voice and I tryed to change the 'parent' setting it programmatically and display the block like this:

$block = block_load('menu_block', 1);
$render_array = _block_get_renderable_array(_block_render_blocks(array($block)));
print_r($render_array['menu_block_1']['#config']);

$render_array['menu_block_1']['#config']['parent'] = 'main-menu:219';
$render_array['menu_block_1']['#config']['parent_mlid'] = 219;
print_r($render_array['menu_block_1']['#config']);

$output = drupal_render($render_array);
print $output;

the 2 output of the print_r are

Array
(
    [parent] => main-menu:407
    [title_link] => 0
    [admin_title] =>
    [level] => 1
    [follow] => 0
    [depth] => 0
    [depth_relative] => 0
    [expanded] => 0
    [sort] => 0
    [parent_mlid] => 407
    [menu_name] => main-menu
    [delta] => 1
)
Array
(
    [parent] => main-menu:219
    [title_link] => 0
    [admin_title] =>
    [level] => 1
    [follow] => 0
    [depth] => 0
    [depth_relative] => 0
    [expanded] => 0
    [sort] => 0
    [parent_mlid] => 219
    [menu_name] => main-menu
    [delta] => 1
)

but when I render the block he still display the sons of the 'main-menu:407' menu items
--node 2
--node 3

How can I really change the config programmatically?


texts:
Ever since I switched to a brand new retina MacBook Pro, I'm not able to setup a new Drupal installation anymore...

I use MAMP and I configure my vhosts.conf so I can work on virtual hosts (like dev.newproject.com). But whenever I try to install a new Drupal installation, it looks like the setup is confused...

Normally, you have

 1. Choose profile
 2. Choose language
 3. Verify requirements
 4. Set up database
 5. Install profile
 6. Configure site
 7. Finished

But for some reason, after step 5, het installation goes back to step 1 or 3 or whatever step... When I look in my database, it looks like Drupal has been installed and also a settings.php file was created, but I'm in an infinite set-up loop...

Has anyone ever experienced such weird behaviour? And how can I fix this?


texts:
I can alter every form submit in Drupal with this hook:

  hook_form_alter

On the user_pass_reset form there is a button for auto-login from a link.

I need to add some custom logic just after the user click on the button "Login".

Here's how I tried to do that :

function tools_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id){

   if($form_id == 'user_pass_reset')
    {
        $form['actions']['submit']['#submit'][] = 'tools_compte_mot_de_passe_reset_submit';
        $form['#submit'][] = 'tools_compte_mot_de_passe_reset_submit';
    }
}

I have set the 2 form methods because I trying to understand which is called.

  My custom submit :

function tools_compte_mot_de_passe_reset_submit($form, \Drupal\Core\Form\FormStateInterface &$form_state)
{
    exit();
}

My custom submit is never called... if I try on a different form, that works, but not on this one.

Where i am wrong ?


texts:
I have a drupal8 site running in docker environment. I want to make some bdd test with Behat.
My behat.yml file looks like:

default:
  suites:
    default:
      contexts:
        - FeatureContext
        - Drupal\DrupalExtension\Context\DrupalContext
        - Drupal\DrupalExtension\Context\MinkContext
        - Drupal\DrupalExtension\Context\MessageContext
        - Drupal\DrupalExtension\Context\DrushContext
  extensions:
    Behat\MinkExtension:
      goutte: ~
      selenium2: ~
      base_url: http://mysite.test
    Drupal\DrupalExtension:
      blackbox: ~
      api_driver: 'drupal'
      drupal:
        drupal_root: '/home/desktop/Projects/mysite/app/web'
      region_map:
        header: "#header"

And my .feature file:

@api
Feature: Test account menu links

  Scenario: Make sure that logged in users see the account menu
    Given I am logged in as a user with the "authenticated" role
    And I am on "/"
    Then I should see the link "My account" in the "header" region
    And I should see the link "Log out" in the "header" region

I am using the Drupal API driver but I get an error of

  Undefined class constant 'MYSQL_ATTR_USE_BUFFERED_QUERY'.

I think this means it can't access my database, but what else should I define in my Behat file or in my docker-compose.yml file? I have tested a story when access is not required, e.g. a contact page submission and that goes smoothly.


texts: Do I need a custom content type, entity, module or field?

texts:
I'm working on a product information manager, and I have a content type of product which needs to reference stock and price levels for each supplier from a different database - these are stored as separate sqlite databases (one for each supplier) and managed outside of drupal.

I would like to reference the prices and stock levels without actually importing them all into the drupal database, instead pulling from the external database, but I'm a little confused how to structure this? One product can have many suppliers.

Do I need a separate entity to manage the pulling of the data (possibly one entity for each supplier) then somehow attach to the product node (manufacturer and part number would be used to search the supplier db), or, would it be considered a field, or a module with options set specifying the database location for each content type. Each product node shouldn't have to specify its list of suppliers.

The data would need to be shown when a node is displayed - I would like the data to be accessible from within views, but also searchable, e.g. display products where stock level < 3 for supplier xyz.

I'm thinking an entity wouldn't be correct as an input of manufacturer and part number would be needed before the data can be pulled?


texts: How to prevent display of specific paragraph types (bundles) on nodes

texts: I have a content type with a paragraph field which has many paragraph types available.  For one of these paragraph types, I do not want it displayed in the node because I am displaying it using a view in a different region.  The view works great but I cannot figure out how to prevent the specific paragraph type from displaying on the node. I've tried to removeItem from the render array using various hooks in .theme, but this removes it from the view as well.  I have also tried to remove the paragraph type from the paragraph field in the node template using a loop in twig.  I feel like there has to be an easier way.


texts:
Currently I have a common.module for storing common functions.  This file is getting way to long and I'd like to start breaking it up by similar functionality or by class:

common.inc
common.query.inc
common.taxonomy.inc
Node.php
etc...

I thought I could add files[] entries to my common.info file but this doesn't seem to source these files.

I need these files to be always sourced: on any page load, on full drupal bootstrap, and on update.php.


texts:
I have multiple values for a field in a node, and am displaying only the top 5 using CSS, however, I would like to display the full list of values on a separate page with a, 'View More' link to that page.

My initial reaction would be to create a views page, but how would I associate that view page with a specific node, and then how would I link to that views page from the original node?

The example:

The main node would be a content type for, 'Author'
Another content type that get's referenced from Author are, 'Publication'
The Author's node will display the top 5 Publications and then have a View More link to the full list of publication.

Is there any better way to accomplish this? All thoughts will be much appreciated.


texts: Limit the search to only one content type

texts:
I'm trying to setup a search for only one content type; I've tried to google it and I saw so many stuff that I don't know which one to test and as I don't want to install too many modules just to test things. I'm not actually even sure that I have to install something else to achieve that.

Do you have any hint or best implementation example please?


texts: How can I copy some content from one site to another site?

texts:
I have two sites i'm working on (one in D8 8.4.5, the other in 8.5.0).
I'd like to "copy" some elements from one to the other.
For example, some nodes or some menus (with their links, of course) or some users.

How do I do that?

With configuration sync and database tables export/import?


texts: Show nodes contaning same company term in Views

texts:
I need to show a block on a node page which will show all nodes containing same company name taxonomy term.

What is the way to do it? I've tried adding a field_company term relationship but it's not working.

A product whose company term contains Samsung so when this product(node) is viewed I want to display other products from same company Samsung.


texts:
I am using Profile2 on my site, with 3 different Profile2 Profiles set up: A, B & C. These are matched to roles A, B and C.

Users can only create and edit a profile that matches their role, though C users may also have A or B profiles.

While logged in as an administrator, I accidentally added a Profile2 Profile  of type C to a users account who only has role A. (Admins can add profiles of any type to existing users.)

I cannot for the life of me find a way to delete the C Profile for this A user. What am I missing? Isn't there any admin tool to remove Profile2 data from a user? The Profile2 page to edit the C Profile only has a "Save" button at the bottom, not a "Remove" or "Delete" button.


texts: Why does the eMail in my Rules Component use a theme that differs from page-theme?

texts:
I use the Rules module to send follow-up emails, which works fine.

In the past I used a different theme for my site, and somehow this theme (call it "old-theme" for now) is applied when a follow-up email is sent (Mime Mail).

How do I apply the current site-theme to my Rules Component?


texts: Implementing hook_entity_type_build causes 500 error on cache clear

texts:
I recently attempted to display custom form modes based on the currently logged in user. My searching led me to implement hook_entity_type_build. However, I am finding that even just having this function declared with an empty body is causing an internal 500 error whenever I clear the cache using Devel > Cache Clear :
[Tue Sep 15 14:29:21.472533 2020] [php7:error] [pid 13440] [client address:port] PHP Fatal error:  Allowed memory size of 536870912 bytes exhausted (tried to allocate 65536 bytes) in /path/to/drupal/core/includes/errors.inc on line 62, referer: http://example.com/node/123

My module has a couple other hooks implemented, but I've verified that adding / removing this empty function body to myModule.module directly causes / removes the crashes:
function myModule_entity_type_build(array &$entity_types){
      #causes crashes just by existing!
}

I'm still developing the site so it barely has any content on it at all... What in the world could cause an empty hook declaration to use so much memory (~500MB) on cache clear?? Any advice on where to look next is greatly appreciated!


texts: How to delete a content type, programmatically?

texts:
I programmatically created a content type during a module installation (using field storage configuration).

I want to delete that content type while uninstalling the module.

Is there any way to do this with Drupal 8?


texts:
Curious, is there a module or technique I can use to easily allow my clients (who log in with a limited role) to manage fields visible in any given view?

Actually there are two specific content types and two specific page views -- which I would love to give them the capability to customize to their liking.


texts:
Quick question,
Has anyone made their own OAuth server and then tied drupal logins into it?

My boss is asking me if it's possible to run our own internal OAuth server that we can use for multiple things, mobile app, internal app and our website. but they don't want to use the drupal site for the oauth service.

Everything i've found so far is a module that lets you use OAuth in drupal but it makes drupal the OAuth server instead of having Drupal hit an external oAuth service.

Any help would be appreciated.


texts:
I have an external MS SQL Server database that I can display some of its contents within the Drupal 7 views module via the Views Database Connector module.

How can I within Drupal 7 make updates to an external MS SQL Server database?


texts:
I am having trouble reloading a page through Ajax from custom JS. There is a form which will change with your choices and this changes are made by Ajax.

How I can change the select list "Leistung" from the code so the price would be updated by Ajax?

As you all know I can't simply write $("select").click(); it doesn't work. Also I tried .trigger() and .mousedown(), actually .mousedown() would work if I use it for the submit button but I wanna change select list value and nothing works there.

What I think is I have two options: I could simulate a REAL click on the select list (which I know I can't), and the other way is to somehow tell the Ajax to reload after changing the select list value.

To be more clear:
That select list is the target that I wanna change. I mean if I click on the third row of the table, that click function should change the value of the select list and here is the problem! the Ajax won't reload the price!


texts: Let user join an organic group during site registration

texts:
I would like my users to be able to select a preexisting Organic Group to join when they are registering to use my site. Is this possible? How should I do this?

I already have the groups set up, and the permissions are set so that so that non members can 'Subscribe to group (no approval required)'.


texts: Is there a module for drupal7 that can create galleries from ftp? basically I upload a bunch of folders containing images in them by ftp. I want drupal to auto populate from ftp to create galleries.


texts:
I am using Page Manager and Panels, providing custom node panels with selection rules by type (e.g. one panel variant for article-, one panel variant for blog-content type). This works smooth so far, styling is also neat. But, how can I get more power over the rendering of elements?

There are multiple ways to render specific elements: adding fields, using token, using a custom view only rendering specific fields, using rendered node entity with view mode. using custom panel content with placeholders etc.

What is the best approach here? It would be great to have the ability to add a custom (something) pane element that can be styled in a *.tpl.php.

My current approach would be using display suite, creating view modes for different parts / panel regions and using theme hook suggestions for adding custom node.tpl.php for each view mode. It would not need to invoke views, which is pretty much a overkill?! rendering, additional queries...) and can use already cached entities.

function mytheme_preprocess_node(&$vars) {
  if ($vars['node']->type == 'my_content_type' && $vars['view_mode'] == 'panel_region_left') {
    $vars['theme_hook_suggestions'][] = 'node__my_content_type__panel_region_left';
  }

  if ($vars['node']->type == 'my_content_type' && $vars['view_mode'] == 'panel_region_right') {
    $vars['theme_hook_suggestions'][] = 'node__my_content_type__panel_region_right';
  }
}

I am not sure how well this will be cached and how much resources it will consume. Any advice would be grateful.


texts: Webform validation are working but they some error

texts:
When I login and page redirects to home page, it shows this notice:

  Notice: Undefined index: submitted in web_alter_form_validate() at line 19

Here is my code:

function web_alter_form_alter(&$form, &$form_state, $form_id){

    if($form_id) //Change webform id according to you webformid
      {
        $form['#validate'][]='web_alter_form_validate';
        return $form;
      }

}

function web_alter_form_validate($form,&$form_state){

    if($form_state['values']['submitted']['title']){

      $val_title = $form_state['values']['submitted']['title'];
      if(preg_match('/[\'^£$%&*()}{@#~?><>,|=_+¬-]/', $val_title) !== 0){
        form_set_error('title', 'Special character are not allowed in form title.');
      }
    }
    // Then use regular expression to validate it.
    // In above example i have check if phonefield is empty or not.
}

I have set validations on webform title.


texts: Why cannot edit views because "The requested page could not be found."

texts:
I am having a sudden error on a drupal site I inherited in that I cannot edit views anymore, any of them. One moment I am able to open a view for editing by clicking the edit link on the all views list and the next moment the edit link results in

  The requested page could not be found.

for all views.

The only change I made was to change the display on a field from do not display to display for a specific view. I then updated the view and saved it. At first the save did not work, but then I clicked again and it saved. The field I wanted displayed but now I cannot reach the edit screen for any of the views.

The log only references the 404 error, but nothing as to why, my apache log is equally unhelpful in determining why this has become the case suddenly.

The rest of the site, so far as I can tell, is running as usual and I can still list the views and see the actual views when going to their paths.

Update (problem solved but question remains): I drush cc all (cleared the cache) and the view edit pages are reachable again.
Though for future reference, what might be the reason that this happened? I feel like this isn't the first time I've found Drupal acting unpredictable and that clear the cache sets it straight.


texts: Inject service(s) into Drupal unit test?

texts:
I am writing a unit test upfront for a service that does not exist yet. Let's just say it is called ResponseFormatter.

I want to start adding unit tests for what I expect this service to do. How do I inject it to a UnitTestCase, or reference it?

Example, I am trying to do something like:

class FormatterTest extends UnitTestCase {

  /**
   * @dataProvider responses
   */
  public function testThisWorks($response, $expected) {
    // the following line I want to call a service,
    // ex. like $this->responseFormatter->format($string);
    $clean = html_entity_decode(strip_tags($response));
    $this->assertEquals($expected, $clean);
  }

  public function responses() {
    return [
      ['not-set', 'not-set'],
      ['foo', 'foo'],
      ['&amp; #93 bar', '& #93 bar'],
    ];
  }
}