texts:
I am using drupal 7. I want to add the site logo on the user registration email, when new user added with my site. How can i include the logo path on the user registration settings. It doesn't support the html  tag format. I have also searched with tokens, but there is no token for including logo. How can i add the logo. Please help me.

Thanks,
Sathish


texts: Relationships in Views always 4 results also if no reference for the field

texts:
I have two content types :

meals
wine

In my content-type "meals" I have a entity reference to "wine".

Now I wanna create a views to show all meals, with a reference to wine.

I have create a views with following settings:

  FILTER CRITERIA

  = Content Type (= meals)

  = (Content entity referenced from field_wine) Content: Published (Yes)

  RELATIONSHIPS

  = Entity Reference: Wine

In my view I get all results for that. So if a wine was tagged in 2 meals, I get a view with that two meals.

My Problem now: I always wanna show 4 meals. So I want to show the 2 meals + 2 others.

If i have a wine with 1 meals. So i want so show the 1 meal + 3 others.. and so on.

Do any know how to fill the results if the missing some meals?


texts: How to redirect "relationships/received" to "user/[requestee:uid]/relationships/received?

texts:
(D7) When a user sends a friend's invitation to another user (User Relationships) the other user, once he logs in, sees a green message that informs him so-and-so sent him a friends request. There is a link that takes the viewer (requestee) to example.com/relationships/received.

However, I have created a view that displays the received requests in a different format. Of course the page view has a different path and I want the user to be redirected to: user/[uid of the requestee]/relationships/received and the requestee only to be allowed to see the requests he received.

I have created a rule (Rules module) as follows:

Event: A user relationship has been requested
Condition: Relationship has type (friend)
Action: Page redirect (user/[requestee:uid]/relationships/received)

[requestee:uid] is in the allowed replacement patterns but it doesn't work. Clicking on the link still takes the viewer to the original path.

What do I do wrong?
:)


texts: How can I add a special classes to all block of custom kind?

texts:
Is there any hook_preprocess_block or any other way to I can add my custom classes to all blocks of a custom kind?Or in the other words:
How can I target all blocks of custom kind?

For example I want to add search class to all search blocks (or target all search blocks in my theme by using default auto-generated classes by Drupal core if it be available), or add user-login class to all user login blocks and so forth in my theme without any need to create a template for every block.


texts:
Is there a way to register on my Drupal site with mobile number and password instead of email?

I would like to have my users register on my Drupal site with either mobile number and password or email and password. The confirmation code is sent to the corresponding destination and the user is activated.


texts:
I'm migrating content from a Joomla SQL source. The images are stored inside of the text as inline images.

This is how my source data looks like:

+------------+--------------------------------------------------+
|    id      |  introtext                                       |
+------------+--------------------------------------------------+
| 1          |
...
<img src="...                        |
| 2          |
...

...                               |
| 3          |
...
select('jos_content', 'content');
     $query->fields('content', array(
       'id',
       'introtext',
     ));

     $query->condition('content.state', 1);

     $query->condition('content.introtext', '%<img%', 'LIKE');

     return $query;
   }

   ...

But this query does not produce one Row per Match, it produces one row for each source row where are at least is one image. I don't know if it's possible to process this in my migration .yml file:

id: image
label: Images migration
migration_group: joomla
migration_tags:
  - Images
source:
  plugin: image
  constants:
    file_source_uri: 'public://import'
    file_dest_uri: 'public://imported'
    status: 1
destination:
  plugin: 'entity:file'
process:
  file_source:
-
  plugin: concat
  delimiter: /
  source:
    - constants/file_source_uri
    - path
  file_dest:
    -
      plugin: concat
      delimiter: /
      source:
        - constants/file_dest_uri
        - filename
  filename: filename
  uri:
    plugin: file_copy
    source:
      - '@file_source'
      - '@file_dest'
  status: constants/status
migration_dependencies:
  required: {  }
  optional: {  }
dependencies:
  enforced:
    module:
      - migrate_content

This configuration works only if there is one image per Migration Row, but there are multiple items per row. I would appreciate any help, thank you!


texts:
I'm using drupal 6 and ubercart 6.x-2.9

I've created my own template for the checkout complete page, this is so I can install conversion tracking code from adwords.

I'd like to pull the order value and insert it into the adwords snippet.

Does anyone know how to call this value?  Is there already a variable with the correct value that I can just echo/print into my template?


texts: Top level directory files like readme.txt are served by apache

texts:
The content of the top-level server directory is publicly available by the web, e.g. files like example.com/readme.txt are readable.
Is it normal? How can i disable this?

(apache, ubuntu 12.04)


texts: Switching out the autocomplete items in a user based entity reference

texts:
I'm working with an entity reference field in Drupal 8.3. It resides on a node and references users using the autocomplete widget. I have it setup to use an entity reference view for both what it is doing the lookup on and what it is showing. However no matter what modifications I seem to make to the view the auto complete always returns the referenced email address the new search criteria from the view is working ( it looks up the email by first or last name). Instead of the email however, I'm trying to instead show the users first name and last name as listed on the user entity.

I'm not sure if this is a bug in 8 as I remember this working in 7. Please let me know if there is anything I'm missing. If you need more info please just let me know. Thanks in advance for any help you can provide.


texts: How to use the filter flag in drush config:status

texts:
I am using Drush 10.3.6.
Drush config:status gives me:
# drush config:status
 --------------------------------- ------------
  Name                              State
 --------------------------------- ------------
  webform.settings                  Different
  webform.webform.contact           Only in DB
  webform.webform.example_webform   Only in DB
 --------------------------------- ------------

I am interested in filtering this to display only certain items, however the filter parameter does not work as expected:
# drush help config:status|grep Filter
  --filter[=FILTER] Filter output based on provided expression

# drush --filter='^webform\.webform\..*$' config:status
In OperatorFactory.php line 50:
  Could not parse expression ^webform\.webform\..*$

# drush --filter='webform.webform.*' config:status
In OperatorFactory.php line 50:
  Could not parse expression webform.webform.*

What is format of the expression that needs to be passed to the filter parameter?


texts: Move my project from public_html/web to public_html

texts:
I have a Drupal site installed via composer, creating a structure like

vendor/
config/
composer.json
etc/
web/core
web/themes
web/index.php
web/etc

Is there a way to change the web folder to a public_html folder so I can use it on my hosting? So the structure needs to be:

vendor/
config/
composer.json
etc/
public_html/core
public_html/themes
public_html/index.php
public_html/etc

I got it working now by using .htaccess but I started using this method with the config outside of my root folder because of the security advantages. With this method, the config is still in my root but via htaccess I point everybody to the web folder. Is this still secure enough?

So how can I change this and is it necessary?


texts: Is there a module that changes the user URL from "user/1" to "user/username"?


texts: How do I go about telling Captcha that my form exists?

texts:
I've got a drupal situation where I want to add reCaptcha to a custom form (built in an add-on module).  You can see from the captcha admin page that there is a list of forms that I can dynamically add captcha to... but my problem is that the form I created in the add-on does not appear in this list.

I'm sure I'm missing something (perhaps in the myform_block_info function?)

Does anyone know what hook I'm looking for?  Have a working example?


texts: Open Webform in a modal, but deny access to the form url

texts: I have a Webform being opened in a modal from a menu link. I want to have the modal be the only way to access the form, meaning I don't want someone to type in '/form/(name)' to the URL and access it by page. Is there a way to support opening in a modal but denying page level access in Webform?


texts:
On my user profile I have various tabs (view, my bookmarks, translate, ...). the problem ist, those tabs should only be visible for profile owner and not if I visit another profile.

Some of those tabs (bookmarks, submissions) are set via view: user/%/submissions with a menu tab - the permissions here are set. But how do I set permission for those tabs only to the current user?


texts: I have some difficulties with page.tpl.php

texts:
I've created a page.tpl.php for my website. it must only contain some blocks not the the $content. that's why I created a few blocks attached them to their region and embedded their corresponding views using print views_embed_view("VIEW_NAME","DISPLAY"); this page.tpl.php works but it has some problems.

when I create a node, after redirecting to its page it only displays this page.tpl.php while the address bar is node address, I mean page.tpl.php overrides node pages. the same problem persists for page display of views. I set a path for page display of views but by going there it again displays page.tpl.php . what is wrong with it?


texts: Using "access callback" and "access arguments" provided with hook_permission

texts:
how can I check user's access first based on some permission and if user passed this check then execute access callback function with some parameters in path, some thing like this:

$items['order/add/%node'] = array(
  'title' => 'Place new order',
  'page callback' => 'drupal_get_form',
  'page arguments' => array('order_add_form', 2),
  'access callback' => 'order_add_access',
  'access arguments' => array('place order', 2),
  'type' => MENU_LOCAL_TASK,
  'file path' => drupal_get_path('module', 'order'),
  'file' => 'order.page.inc',
);


texts:
I have been trying several configurations for trying to update a user account checkbox to uncheck it, with no success. I have been able to check it without issue.

updateCharType = function (token) {

    var obj = {
        "uid": "1",
        "name": "admin",
        "field_character_type": {"und": [{"value": 0}]}
    };
    return $.ajax({
        url: 'www.example.com/endpoint/1.json',
        crossDomain: true,
        type: 'PUT',
        data: obj,
        dataType: 'json',
        headers: {
            'X-CSRF-Token': token
        },
        error: function (XMLHttpRequest, textStatus, errorThrown) {
            console.log('user edit - failed to edit ' + textStatus);
            console.log(errorThrown);
        },
        success: function (data) {
            alert(success!);
        }
    });
}

Now, it always gets to the success portion of the code, and it seems like it is working correctly.

However the checkbox never gets unchecked. I've read a bunch of documentation, and tried a million different iterations of how the JSON should be formed - putting null, removing the [], removing the und - for some reason I am having absolutely zero luck updating this checkbox!

How do I update a checkbox on a user account with services?

EDIT:

I WAS able to get it working with a list of values for a different field:

 var fontSize = jQuery('#font-size').val();

    var obj = {
        "uid": "1",
        "name": "admin",
        "field_font_size": {"und": fontSize}
    };
    return $.ajax({
        url: 'http://example.com' + "/users/user/1.json",
        crossDomain: true,
        type: 'PUT',
        data: obj,
        dataType: 'application/json',
        headers: {
            'X-CSRF-Token': token
        },
        error: function (XMLHttpRequest, textStatus, errorThrown) {
            console.log('user edit - failed to edit ' + textStatus);
            console.log(errorThrown);
        },
        success: function (data) {
            alert("Success for user save!:) ");
        }
    });
};

Differences:

How to be a list of values, and I needed to set it to application/json

Boolean field still not working under any variations.

Also, whenever I try to uncheck the checkbox I get the following error:

Notice: Array to string conversion in DatabaseStatementBase->execute() (line 2227 of /Users/username/Desktop/Projects/example.com/includes/database/database.inc).


texts:
In Drupal 7, how I can intercept menu rendering in template.php and add pipes after menu links?

I tried using template_preprocess_menu_tree but I don't think that is what I am looking for. I want to change the HTML structure of a couple of menus.


texts: Check if entity reference field (user) contains current user

texts:
I have a node page of Project content type which contains a multiselect enitity reference field of user type called field_team. I also have a block created by my custom module which is displayed at Project type pages only. What i'm trying to achieve is to do smth like this:

if ($current_node->field_team contains $current_user->uid) {
$output = 'some_specific_content';
} else {
$output = 'you are not a team member of this project';
}

How can I check if currently viewed node contains current user in its reference field?
Will be very thankful for any help or advice.


texts: Where does Drupal store information after creating a rule?

texts:
I'm wondering where Drupal stores information in the database when one creates a rule with an event A node has been flagged and an action Grant user points to a user.

Can you help me?


texts: When using a view in "Unformatted list" format with inline fields, how can I most cleanly add a break between the fields?

texts:
I have a view like this:

Field A (Inline)
Field B (Inline)
Field C (Inline)
Field D

I would like it to display like this:

Field A label: value Field B label: value
Field C label: value
Field D

Obviously, I need to create a break after the value for Field B.  However, what is the best way to do this?  CSS in my stylesheet?  Rewrite the HTML  for the display of Field B?  Add a "Custom text" field within the view?  It seems like there must be a simpler way...

I hardly ever work with themes so I'm at a loss of how to best address even this basic formatting issue.

EDIT: I've realized that a solution that makes the view label inline but not the whole field would also work, but I don't know how to do this...


texts:
I have a Drupal site with a specialised search query page that accepts about a dozen arguments as URL query parameters, most of which are optional.

Simplified routing YML file looks like this:

my_search_results_page.content:
  path: '/my-search'
  defaults:
    _controller: '\Drupal\my_search\Controller\MySearchResultsController::content'
    _title: 'Search Results'
    location: null
    type: 'any'
    status: 'any'
    filter: 'any'
  requirements:
    _permission: 'access content'
    _access: 'TRUE'

The url query args location, type, status and filter are passed into the controller along with a bunch of others that I've ommitted for brevity. Location is a required field, hence the null default. All of the others are optional, and will get the value any if not specified in the query. This all works perfectly.

Now I have an additional requirement, to be able to create custom SEO-friendly preset URLs for specific search queries. For example, if they want to do a marketing push for widgets in London, they want a URL that looks like /widgets-in-london, which would resolve to a search results page where location is set to London and type is set to Widgets.

This seems like it could be achieved relatively easily by adding an additional routing entry to the my_search.routing.yml file for each preset URL they want, and and some extra code in my controller class to manage it. But the marketing team want to be able to create and edit these URLs on the fly, which makes a code-based solution non-optimal. But I'm at a loss as to how to do it more generally.

Can anyone help me come up with a flexible solution that will allow them to set up custom routes without them having to touch the code.

Thank you.


texts: How to fetch a list of nodes by content type in a Rules Action set?

texts:
I am trying to create a Rules Component that fetches a list of nodes based on their content type. But when I try creating it, I get a little stuck. Here's my process:

I create a rules component using "action component"
Then add an action to the component "fetch entity by property"
Select the entity type I would like to fetch "node"

I am then presented with the following:

In the value box I don't have node types nor a way to pass a text string that represents one, I have tried several ways by including introducing a text variable set to the entity type but if I try and use that as the value I get an error which says something about the variable being the wrong type.


texts:
For my view in Drupal 8 I have added a sorting criteria based on the custom field. Now, when I sort the content in the url one can see a sorting value as a name of that field.

Like ?sort_by=field_custom_value

How can I override the value of the sort criteria, so that the path doesn't look so ugly.

Expected: ?sort_by=something_different


texts: How to reduce the locally exported database size to get around my server import limit?

texts:
I am using Drupal 7 and want to export my Drupal database from local and import this database on another server.

The issue I'm facing is the exported database size is 80M and the server importation limit is 32M (I do not have any permission to increase the limit size).

Can I just truncate tables like cache_fields, menu...etc?

The watchdog table is 40M in size, can I clear it ?


texts:
Searching for cascading ajax dropdown in this forum only gives me two discussions here and the other here

I have an almost similar issue only that the form select element I'm about to create cascades down in the 'taxonomy tree'. So each dropdown that was ajaxed will again be used to trigger another dropdown--in ajax...

Here is my sample module (trimmed down to relevant parts only):

function mainswitchboard($form,&$form_state){
    $form = array('#prefix'=>'', '#suffix'=>'');
    $form['maincategory'] = array(
        '#title'=>'Firs Select',
        '#type'=>'select',
        '#options'=>_populate_dropdowns(),
        '#ajax'=>array(
            'callback'=>'maincategory_callback',
            'wrapper'=>'wrapper-div',
            'method'=>'replaceWith'
        )
    );
    return $form;
}

function maincategory_callback($form,$form_state){

   $from_element_name = $form_state['triggering_element']['#name'];

    $triggerer = $from_element_name;
    $value = $form_state['values'][$triggerer];

    drupal_set_message(time(). ' ' .$triggerer);

    $commands = array(); $arguments = array();
    if(count(_populate_dropdowns($value))) {
        $form['subcat_for_'.$value] = array(
            '#title'=>'Subcat for '.$value,
            '#type'=>'select',
            '#options'=>_populate_dropdowns($value),
            '#attributes'=>array('id'=>'subcat_for_'.$value,'name'=>'subcat_for_'.$value),

        );

         $arguments['ajax'] = array(
            'subcat_for_'.$value=>array(
                    'event'=>'change',
                    'callback'=>'maincategory_callback',
                    'wrapper'=>'wrapper-div',
                    'method'=>'replaceWith',
                    'url'=>'/drupal7/system/ajax',

            )
        );

        $commands[] = ajax_command_settings($arguments,TRUE);

    }

    $commands[] = ajax_command_insert(NULL, drupal_render($form));
    $commands[] = ajax_command_prepend(NULL, theme('status_messages'));
    return array('#type'=>'ajax','#commands'=>$commands);

}

The above code seems to work the only problem is you the second dropdown no longer produce results (although a throbber is showing when you click the second dropdown..) The second dropdown does not seem to honor the arguments variable, hence, it does not seem to call the function in its callback...

I'm stuck new drupaler...

Thanks!


texts: Add jQuery to exposed filter form on drupal 7

texts:
I've been searching around how to add jQuery to Drupal 7, but i couldn't make it work.
Here is my steps:

Step 1: I create a javascript file and put into my module under js directory.

Step 2: I added the file to my module .info

 scripts[] = js/xxx.js

Step 3: The contents of the xxx.js

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

    $("#edit-field_a",context).change(function(){
      currentValue = $(this).val();
      alert(currentValue); // no fire at all
      if(currentValue == 'a')
        {
            $('#edit-field_b').val('All');
        }
    }

}
};

})(jQuery);

All the fields are on exposed filter form.
I wish to do something like the value of the field_b select list changed based on field_a select list.

What did i miss? Is my jQuery correct?

Updates: Previous js is wrong, corrected here.

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

    $("#edit-field_a",context).change(function(){
      currentValue = $(this).val();
      alert(currentValue); // no fire at all
      if(currentValue == 'a')
        {
            $('#edit-field_b').val('All');
        }
    });

}
}

})(jQuery);


texts: Upgrade Commerce Kickstart 1 site with drush

texts:
From http://www.drupalcommerce.org/blog/9072/updating-commerce-kickstart-2 I learned that it's possible to upgrade a CK2 site using drush.

Is it possible to do a minor upgrade od CK1 using drush dl --select commerce_kickstart and selecting the proper version? I tried and failed.


texts:
When I submit forms(all forms) in Drupal 7 it shows the Your configuration settings have been saved message, but the form values are still the same as the values before submission. I have cleared the cache but the problem still exists.

Any suggestion?


texts: Create a list of taxonomy terms which filter specific nodes

texts:
I would like to add a list of taxonomy "links" within my view so when ever a user clicks a specific term, only nodes tagged with that term will show up in the view.

Is there a module that can create a navigation of taxonomy terms within a view, to filter for specific nodes?


texts: Image upload not working for "AUTHENTICATED USER"

texts:
Media module is awesome! But I can not understand why AUTHENTICATED USERS are unable to Upload images from CKEditor( http://drupal.org/project/ckeditor ) module.

I have set permission: Import media files from the local filesystem for the AUTHENTICATED USER, but still the uploader doesn't seem to work, except for the admin!

Here is a screenshot showing the Media Module inline uploader works with CKEditor while logged in as Admin:

Here is a another screenshot showing the Media Module inline uploader do not working with CKEditor while logged in as AUTHENTICATED USER:

Please give me ideas to fix this.


texts: How to get a field value and multiply it to get price in a PriceResolver

texts:
Getting my feet wet with price resolvers, and I have figured out how to set a new price for all entities that have field_discount_percentage. I am then getting the price and multiplying it for the sake of this example by .95 to get a 5% discount.
public function resolve(PurchasableEntityInterface $entity, $quantity, Context $context) {
  if ($entity instanceof ProductVariationInterface && $entity->hasField('field_discount_percentage')) {
    return $entity->getPrice()->multiply('0.95');
  }
}

What I trying to do, is to use ->getValue or  ->getString for the field_dicount_percentage so that I can set the percentage value in the field from the front end.
public function resolve(PurchasableEntityInterface $entity, $quantity, Context $context) {
  if ($entity instanceof ProductVariationInterface && $entity->hasField('field_discount_percentage')) {

    //here is where i would like to create a variable for the number value of the field, but I get lost...
    $discount = $entity->get('field_discount_percentage')->getValue()[0]['value'];

    // I have also tried this
    $discount = $entity->get('field_discount_percentage')->getString();

    return $entity->getPrice()->multiply($discount);
  }
}

I am getting empty quotes back from $discount = $entity->get('field_discount_percentage')->getString(); which is making me wonder if I cannot use a variable to a numerical field value.

InvalidArgumentException: The provided value "" is not a numeric
value. in Drupal\commerce_price\Calculator::assertNumberFormat() (line
261 of
MY-Site\web\modules\contrib\commerce\modules\price\src\Calculator.php).

So what is the best way to do this in a Drupal commerce context?
Any help would be appreciated.
:)


texts: How to programmatically add fields to a node through a module

texts:
I've followed a tutorial here about adding a field to every taxonomy and node and I'm getting an error on installing it. I can get the field, widget and formatter to work, just can't get it to install.

PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column [error]
'data.mix_page_load' in 'field list' in
/core/lib/Drupal/Core/Database/Statement.php:59

Can anyone knowledgable about this help? I don't want to use Field tools or ECK. I'm currently reading up on the Content Entity Field Definitions, but it's a lot of trial and error and no clear resolution yet.

The error only happens when I add this code to the mix_page_load.module

function mix_page_load_entity_base_field_info(EntityTypeInterface $entity_type) {
  if ($entity_type->id() === 'taxonomy_term' || $entity_type->id() === 'node') {
    $fields['mix_page_load'] = BaseFieldDefinition::create('mix_page_load')
      ->setLabel(t('Mixpanel Page Load'))
      ->setDisplayConfigurable('form', TRUE)
      ->setDisplayConfigurable('view', TRUE);
    return $fields;
  }
}

Here is the schema file

field.value.mix_page_load:
  type: mapping
  label: 'Default value'
  mapping:
    value:
      type: string
      label: 'Mixpanel Page Load'

Here is the DataType

namespace Drupal\mix_page_load\Plugin\DataType;

use Drupal\Core\TypedData\Plugin\DataType\StringData;
use Drupal\Core\TypedData\Type\StringInterface;

/**
 * The mix_page_load data type.
 *
 * The plain value of a MixPageLoadField for an entity.
 *
 * @DataType(
 *   id = "mix_page_load",
 *   label = @Translation("Mixpanel Page Load")
 * )
 */
class MixPageLoad extends StringData implements StringInterface {

}


texts: "public" not supported or disabled in libcurl error

texts:
I'm learning how to create a custom JSON migration and referring to the migrate_json_example module, I see the following code in migrate_plus.migration.product.yml.

urls:
    - 'public://migrate_json_example/products.json'
  # An xpath-like selector corresponding to the items to be imported.
  item_selector: product

Can someone please tell me how to use that public:// part of the URL?
I understand it's a path to the JSON file, but it's a relative path. I don't know how public:// is handled and how Drupal knows where to look for the files.

Both modules are installed on the same site. However, when I try using the same public:// URL in my module, I get the following error.

  Error message: cURL error 1: Protocol "public" not supported or disabled in libcurl (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) at public://migrate_stuff/resources/people1.json.


texts:
I made a date range field, and after entering some values and saving on first glance it looks ok, if i entered 20:00:00h it will display the same, but in the DB when i look at the stored values it's -2h (so 18:00:00). Anyone know why?

Also this is a huge problem when manually retrieving the values from the node, i fiddled around the time zones etc but i always get the value stored in the DB.

$node = Node::load($node_id);
$date = $node->get('field_date_ept2')->getValue()[0];
$result = \Drupal::service('date.formatter')->format($date['value'], 'custom', 'Y-m-d\TH:i:s', 'Europe/Berlin);
echo $result; // 2019-12-12T18:00:00

p.s. the timezone in my drupal 8 site is "Europe/Berlin" and the same as in my php.ini file.


texts: drupal commerce: productgroup containing the images and text

texts:
I'm working on a website which sells products (bolt 4M / bolt 5M / hinge 4cm / hinge 6cm /  hinge 8cm / etc.).

I want to have my products grouped inside productgroups(bolt / hinge / etc.) and attach an image and description to the productgroup.

When a user visits the website, i want to show a list of the different productgroups (with image/text). After clicking on a productgroup,  only the productgroup is show with the text and image, but also an dropdown from which the customer can select the specific product from this productgroup.

I installed commerce and already added products, but i'm unsure how to continue.
I did some research on the subject, but all i can find is the prefilled list: examples are the size of t-shirt or the color. Since my products are more dynamic than the prefilled list and different for every productgroup i thik i cannot use this for my benefids.

Since this is such obvious behaviour i would like to know:
1 - Is this a good approach
2 - Are some pointers/example which can help me started
3 - How should i make this productgroup

Greetings,

Eduard Witteveen


texts: Validation message on Login form not shown

texts:
I am using Drupal 7. When ever I visit site.com/user/login I could see my Login form, thats fine. But when I miss to enter any fields say name and click the login button it does not shows the validation error message. Does any one what the actal problem might be?

Thanks


texts: How to use Simple mobile redirect module

texts:
I am in a fix and not sure how to use the simple mobile redirect module. I am using Drupal 7 site which has a separate domain for its mobile version. I would like to redirect the user(accessing from mobile) to m.sitename.com. When i use my opera mini in my mobile to access the site, i am redirected to the mobile version of my site. But when i again try to access the site, it redirects to sitename.com instead of m.sitename.com. When i clear my mobile browser caches it works fine. Is there any way by which i can clear the cache automatically and redirect the user to the mobile version?

Thanks in advance


texts: Views Slideshow: keeps showing all images below slider

texts:
It shows the normal slider on top... and then all of the images that are suppose to be sliding are stacked below it.

I've gone through several different tutorials and done them all the same way, and I'm still getting this. There has to be something simple that I'm doing wrong here.. but I don't know what it is.

I wanted to post a picture, but my reputation is only a 6..

Edit:   Just realized when you hover over these they change the top slide, like thumbnails normally do.  But I have no idea how to turn them off or change them to a different size.  I created an image style for this, but it apparently isn't working.

Edit x2:  It has nothing to do with the thumbnails. It just keeps showing all content that's suppose to be cycling.  For example, it's showing every number and every title.  Is there no CSS at all with Views Slideshow to not display things?


texts: 7 embed an external website page in a node

texts:
I have two website one is in drupal 7 the other in rails.
Is it possible to have one page from the rails app to be embedded in a drupal 7 node?
The page have a graph and search form.


texts: Theme a link with l - redirect to translated version

texts:
I'd like to insert a link in my node templates that displays when viewing nodes of a particular type (news). That link should lead to the news archive (node/26). Node 26 is a normal drupal page made in swedish (with a menu item and so on). On that page a block is displayed with a viewed list of news items.

There is a translated version of node/26 - translated with normal multi language modules.

What I'd lite for the system is to redirect from node/26 to the english translated version (node/27) if the current users language is english.

I have the module Translation Redirect activated - but it does not redirect.

If a redirect can't be achieved - is there any way that the link function can create the link depending on what the current language is (preferably without if-cases for each language).

Version is Drupal 7.

Thank you very much for any replies!


texts:
How can I use drupal_add_js() to include the following script?

<script src="http://example.net/script.js" data-config="{'skin':'skins/black/skin.css','volume':50,'autoplay':true,'shuffle':true,'repeat':1,'placement':'bottom','showplaylist':false,'playlist':[{'title':'','url':'https://soundcloud.com/fosterthepeoplemusic/pumpedupkicks'}]}" ></script>


texts: How do I change the node view mode before rendering?

texts:
I have a content type with a custom view mode. How do I make sure node always get rendered with my custom view mode?

What would be the right way to programmatically change the node view mode before rendering?


texts:
Anyone knows how to render the parent items of menu and click on the parent item toggle the sub menu of particular parent menu item using menu block or any other way ??

I am using Menu block to render the block of menus and that module render the tree of whole menu with all sub levels.

I want something like this, if i render the block it should display only parent terms in blocks and on the click of the parent term it should open the sub menu of that parent item below the parent menu item.

How can i achieve this ?


texts:
I have a view in Drupal 7 site that needs some editing. In particular, there are some exposed filters on that page that require their labels to be changed. How can I do that?

I cannot seem to find where to do that. From my understanding, the filters are innate to the Views module.


texts: How to import date fields using CSV file?

texts:
I'm trying to import few nodes using feeds CSV file. I'm able to import some of the fields but I'm unable to import CCK date fields.

I have tried feeds module with uc_feeds_product_importer.

How can I import date fields?


texts: How do I go about putting standalone PHP files into Drupal 6?

texts: I want to add an extra cool PHP Class, where would I put it in Drupal, how do I make absolutely sure the code doesn't present a security risk, should I just make it into a module?


texts:
Email is now an included field in core, but the stock email for users seems to be set to private; only users with administrator privileges or the user themselves can see.

I'd like to allow other users to see this basic field, without having to create yet another email field where someone has to copy the information over from the other other simply for the ability for it to be visible.

This should be a fairly easy/common practice, but I can't find anything yet.

How do I allow regular non-admin users to view other users' emails?


texts: "Codebase is assembled with Composer instead of Drush" (but it wasn't!) message

texts:
I'm using D7 and I'm seeing the following error message any time I try to use Drush to install a module:

  This codebase is assembled with Composer instead of Drush. Use composer update and composer require instead of drush pm-updatecode and drush pm-download. You may override this error by using the --pm-force option.

Why does Drush generate that error message? The website was not built using Composer (though there are other Composer-based Drupal project on the same web server).

FWIW, using the --pm-force option works just fine. I would just understand the reason of that error message.


texts: List of users who signed-up last month, or last year

texts:
I want to get the number of users who signed-up the last month, or the last year.

Is there any module for achieving this? How can I do it using the Views module?


texts:
While I'm creating view displays for three of my content types, created first two and auto previews look fine. When I created the third one, the server kinda went down for a while. So I waited till it comes back online, I'm no longer able to auto preview any of the displays, and I'm getting the following error

Display "Master" uses fields but there are none defined for it or all
are excluded.
Display "Page" uses fields but there are none defined
for it or all are excluded.

Help will be appreciated. Thanks


texts: How do you view a log of previous visited visitors showing their IP in Drupal 7?

texts: Where do you view a log of previous visitors showing their IP address in Drupal 7?


texts: Send "Request new password" email for individual users

texts:
I'm looking for a way for the administrator users to quickly send out a password reset for a specific user. Ideally, this would be a link/check on the account edit.

I have seen and made use of the Mass Password Reset module which works per role, but I need it for individuals too.

At the moment my thought is to make a "reset password" role then have a rule along the lines of: after saving user, if user has "reset password" role, send account recovery email, remove "reset password" role, but that seems pretty convoluted. Am I missing an easy solution?

I am using Drupal 7.


texts: How I create table View of webform submissions

texts: I want to view webform submissions in table view. I created a view of webform submissions but it shows a link for the data submitted. I dont want to use link, I want only simple table view.


texts:
I am using views and I want to put a dynamic link in the header. The link is http://www.example.com/node/add/album/31
The number 31 varies depending which node it is viewing so I want it to change to whatever node id it is viewing. I'm not a coder so can anyone give me code?


texts: How to use articles attached images as background of a div

texts:
I'm doing my first site on Drupal 8 and I have a problem. I would like you to help me.

In fact I'm trying to get the articles attached images as a background for a div created in the page templates.

I wrote this code in my theme.file

function THEME_preprocess_page(&$variables, $hook) {

// Set articles attached img like background
$node = Drupal::request()->attributes->get('node');
if($node){
    if ($node->bundle() == "article") { // Content type check
        $image = file_create_url($node->field_image->entity->getFileUri()); // Creating file path from uri
        $variables['article'] = true; // Setting value true for current node is articles.
        $variables['background_img'] = $image;
    }
  }
}

and I try to get the image back with the following code in the field--node--field-image--article.html.twig template

but it doesn't work.

Can someone tell me what's wrong with this code? I would really appreciate it. Thank you.


texts: install.php displayed instead of update.php

texts:
This looks similar to

Drupal 7 keeps returning to install.php and reports no settings.php but it's all there

but I only just registered so can't comment.

This is a single site (still drupal 7.59). free_access is true, sites/defaults/settings.php is writeable by all (website on local machine to try to figure out solution.) Connection to mysql seems OK.

One clue: if I proceed to install, "Verify requirements" says things like:

  The Drupal installer requires that the ./sites/default/default.settings.php file not be modified in any way from the original download.

yet from within the nginx root directory:

# ls -l sites/default/default.settings.php
-rw-r--r--  1 root  users  26250 May  3 15:53 sites/default/default.settings.php

so where does drupal look? (I didn't find a mention of the root directory in the database...)


texts: When changing values in the database why does this not affect the view?

texts:
edit: How could i use Views bulk operations for the change of a field's value? Instead of directly editing mysql?
I have a content type, f.e  mycontentype, which has titles, like:

Title - library1
another title - library1
yet another title - library1

so i went in the db and with a MySQL command, i updated all titles to

Title
another title
yet another title

My issue here is that in a view, i have as a field, the

Content: mycontenttype

which i have set to the formatter as title link.

This brinks as the title the old title  Title - library1, but when this link is clicked, we go the the node  where the title is shown correctly.

if in the formatter i choose full content, i get again all data updated, including the correct title.

Of course i have cleared all caches, i have run update.php,

any ideas?


texts: How to do multiple file uploads from a block's form?

texts:
In the hook_block_configure of my block, I'm defining the form for my block.  I want it to have multiple file uploads, so I'm using "cardinality", but the following code isn't working for me.  I only get the one file field.

$form['background_image'] = array(
  '#type' => 'managed_file',
  '#title' => t('A Background Image'),
  '#description' => t('An image file.'),
  '#cardinality' => -1,
);

Any ideas?

I'm using Drupal 7.

Note: I don't want to just upload multiple files at once.  I want the user to be able to upload "one more file" or delete one of the existing ones.


texts:
I'm not sure how to explain this in a good way, and my title may be way off.

I am using Views Data Export module and want to export a report for a specific user, and use his/hers name in the filename.

I have created a field in my user registration called "full name". Is there a way I can use this in my views etc. like for example "%full-name"? Any way I can achieve this?

I have tried to use "Report for [user:field-navn].doc", but then I get the filename "Report for [user:field-navn].doc" as filename, and not the name in it.


texts: How to set same filter value to be searched to the different filters on the same page?

texts: I am using 3 exposed filter on same page for video, audio and album search, what I want is when I enter filter criteria for one filter all filters should take same filter criteria. Is there anyone who is having an idea to do this?


texts: Listing child terms based on relationship with parent

texts:
The premise:
I have a taxonomy listing “countries” on the first level and “country subdivisions” on the second level.
E.g.:

Canada

Ontario
Quebec
etc..

United States

Alabama
Alaska
etc..

A user is attributed to a country in the user Account Settings. E.g: John Doe is from Canada.
I would like to create an Entity Reference View that would list all Provinces related to the user attributed country.
E.g.:
List of provinces offered to John Doe while creating a node:

Ontario
Quebec
etc..


texts: Drupal / Ubercart says it's not saving CC data... then what's "_save_cc_data_to_order"?

texts:
I'm using Drupal 6, Ubercart 6.x-2.4, and the Stripe payment module.

I wanted to double-check my PCI compliance and make sure I'm not storing credit card data in my database, but I looked at my database and found encrypted CC data in the uc_orders table.

In modules/ubercart/payment/uc_credit/uc_credit.module there is a method called _save_cc_data_to_order. If I comment out this method's contents, the orders still go through my test gateway but the database is no longer populated with cc data.

Hacking up ubercart module code is an effective way to stop from saving cc data in my database, but I didn't think this should be necessary.

What is going on? I have debug mode off in admin/store/settings/payment. I don't understand why it would save ANY cc data--I don't need persisted users and turned anonymous checkout on intentionally.


texts:
Instead of creating a new route and menu:

  amustatuscode.config:
  path: '/admin/config/statuscode/config'
  defaults:
    _form: '\Drupal\amu_http_status_code_display\Form\AmuHttpStatusCodeDisplayConfigForm'
    _title: 'HTTP status code error messages'
  requirements:
    _permission: 'administer http status code'

amustatuscode.config:
  title: 'AMU HTTP status code'
  description: 'Customize HTTP status code error messages'
  parent: system.admin_config
  route_name: amustatuscode.config
  weight: 100

How can I add this form to the existing basic site settings?

  /admin/config/system/site-information


texts:
I have been running a personal dashboard on Drupal 7 for years (currently on 7.69). I rendered the dashboard in Homebox and some of the blocks use PHP (using PHP Filter) to get stock quotes, weather updates, etc.

I recently rebuilt the site in Drupal 8.8.1. I use Panels for the dashboard blocks since there is no Homebox for Drupal 8. I also added the PHP Filter module for my PHP blocks. I'll eventually put my PHP code in modules, but I'm going with PHP Filter for now. I'm using the included Bootstrap theme and caching is set to 'no caching'.

My problem is, everything runs fine when I am logged in as administrator -- the PHP code in the blocks executes every time I do a page refresh. However, when I am not logged in and I do a page refresh as an anonymous user, the PHP blocks do not update. In Drupal 7.69 the page will update for an anonymous user, which is the behavior I want. I've compared permissions between the two installations and everything looks the same. I must be missing something here.

Has anyone else used PHP Filter with Drupal 8 and run into this?


texts: Show profile fields depending on the profile users role

texts:
We are using profile2 to display users listed on our site which has different member levels. Is there an easy way to hide certain fields based on the profile2 users role. We still like them to enter the information when they complete their profile, but we only want to show this information to other visitors when the profile user has a specific member level.

If this can be done for fields, can this be done for views as well? Bascically show or not show a specific view on the user profile page, based on the users role?

Thanks


texts:
In short: Can I have a separate .htaccess file per site on a multi-site installation?

I've read quite a lot of conflicting stuff about this, including some which suggests you can put a .htaccess file in the site folder (i.e. /sites/www.site1.com/). However, some commenters seem to be saying this won't work.

As I am moving several non-Drupal sites over to a single multisite there will need to be lots of rewrites for old URLs, so this is pretty much essential for me.

Thanks,
Chris


texts: View Content:Path Rewrite Result doesn't update

texts:
The Content:Path is used to create a Read More button, that redirects the user to another page from View.

It had a previous Rewrite Result of:

<a href="[path]" class="readmore"> Read More </a>

I want the change the string to See More, so I thought it would be a easy change. Boy was I wrong.

No matter what I input into the Rewrite Results output field, it will always default to display Read More (with it's class and href). I can write gibberish, and the View wouldn't show what I wrote and default back to Read More (though preview does display accordingly).

The only time I can get it to display different is when I leave the field empty, or disable Rewrite Result functionality, which it defaults to the content path.

Can anyone explain this weird behaviour? I've done some checks if there's a hook influencing the view, but couldn't find anything.


texts: How can I check to see differences across my multisites?

texts:
Currently, we're using Acquia Content Hub to syndicate content across our sites with a spoke and wheel syndication architecture. We essentially use a single site (that content editors use to create/maintain our content) and push out content to all of our subscribing sites.

However, it seems that some of our developers implemented changes on certain sites but not all sites and this is causing differences for each of our site environments (example: All sites would have an article content type but with different fields/naming conventions for fields). These differences then end up preventing our synchronization (especially if there is a field on the main content site and not on a subscribing site) from moving past the item and then requires a clear (and re-queue) of all items to syndicate.

Is there any easy way to set up a PHP script or something to check each site for differences against the main content site for entities?

For example:

If on the main (content) site the article had 3 fields:
- Article Title
- Article Body
- Article Image

And on a subscribing site, the article had only 2 fields:
- Article Title
- Article Body

I would expect said magical script to print out some indication that on the main (content) site, there is an "Article Image" field present that's not available on the subscribing site.

Is there any way that I could accomplish this? Any and all assistance would be greatly appreciated, thanks!


texts:
I am creating content and in fields i want to categorize fields, like a heading and then its related fields.For eg this is html field i m converting into drupal 7.

Now how can i get this heading project report information and construction details in creating or viewing content


texts: How to clone an existing View and change the format from table to CSV?

texts:
I have managed to figure out how to Install the Views data export module and create a View in order to export to CSV so that I can import this into WordPress.

Someone else has already created all the Views. Here is a screenprint of how the view looks like:

What I want to achieve next is to clone these views and then convert them to CSV format from a Table format. I simply cannot see how or where this can be done.

What I am trying to do is click on the "Working Papers Other" and then clone this View. Once it is cloned I am trying to change the Format from Table to CSV.

There surely has to be a way to do this easily, else it will take an eternity to do all of these Views.


texts:
I use view & seen module make a bulletin .

How can I survey user "reading rate", I want to know:

if everyone read every article, or
which article specific person do not read yet.

Any help?


texts:
I'm trying to add an image upload to the theme settings in a theme I made. The image upload field does appear, however nothing actually gets uploaded and the image never get's saved.

in theme-settings.php I have the function

function mytheme_form_system_theme_settings_alter(&$form, $form_state, $form_id = NULL) {
    $form['banner']['banner_image'] = array(
        '#type' => 'file',
        '#title' => t('Banner Image'),
        '#description' => t('Upload a banner image'),
        '#default_value' => theme_get_setting('banner_image'),
    );
}

The image upload field does appear, but when choosing the file and clicking 'save configuration' nothing actually gets saved.


texts: IMCE with Amazon S3 loads images very very slow

texts:
I am using D7 with Amazon s3, imce, imce filefield module to upload images through CKEditor. And when I clicked on image upload button in CKEditor it is taking around 3-5 minutes to load the CKEditor popup.

Can we do something about to improve performance, or am I missing any settings, please suggest.

Using Amazon EC2 - Virtual Server Hosting, memcache.


texts:
I currently have a view that has a page display and a block display. The page is disabled, but I have exposed the form in a block, which is then displayed on the homepage of the site.

When the user selects the filters and submits, it then goes to another page with the results in the block view (filters included).

The problem I'm facing is that when the user submits the form from the homepage, the results aren't showing on the subsequent page. The query shows in the URL but it doesn't change the results.

This was working before, but has suddenly stopped working. Any ideas why this may be?


texts: How do I secure pages and related media files?

texts:
I would like to password protect Drupal pages (solved) and media files related to these pages (solved, but not optimally).  Currently the Drupal pages are secured via Drupal and the media files via htaccess.  The problem with this is the users then have to authenticate twice to get to the media content.  I've been told that the way to solve this is to create a role and restrict access to both Drupal pages and media using Private files download permission module.

I'm quite new to Drupal and am wondering if this is the normal way that people solve this problem; or is another method better/more common/etc..


texts: How to theme the Event content type node creation form in drupal 6?

texts:
I have installed Event module which gave me an "Event" content type.

I want to theme the node edit/creation form for the Event content type that automatically comes once the Event module is enabled.

I have tried defining the custom tpl to handle but it's not working. Any help would be appreciated.

Thanks.


texts: How to programmatically set permissions for a custom content type created in a module?

texts:
I have a module which creates a node type as part of hook_install. I want to be able to automatically set permission to authenticated users to create nodes.

I have tried the following code:

 /**
  * Implements hook_enable().
  */
function my_module_enable() {
  $permissions = array('create my_module_content_type content');
  user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, $permissions);
}

But I receive this error.

Notice: Undefined index: create my_module_content_type content in user_role_grant_permissions() (line 3111 of ...

If I delete the two lines of code, the module installs fine. And when I run those 2 lines of code in an "execute PHP" window after install, they work as desired.

I believe hook_install should execute before hook_enable so the content type should exist when hook_enable is run. Are permissions defined later? Thoughts on how to handle this?


texts: Can't seem to load CSS in a custom theme

texts:
I'm working on trying to add CSS to a custom theme, and it seems my logic is failing somewhere.

I'm adding simple css files in the .libraries.yml on the root of the theme (only thing in them right now is forcing a background color on the body) and not one of the css files is loading.

Where does my logic fail here?

This is in Drupal 8


texts: What would cause a duplicate session key?

texts:
I occationally recieve the following error resulting in failure of several pieces of code later in the pipeline.

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'QUyrgEInS_vO0GbrOhJffh6npb2ejlpllvS8Thn2pYY-Cu6Y9OkPd1qJuonzHQw2' for key 1:
   UPDATE {sessions}
   SET sid=:db_update_placeholder_0, ssid=:db_update_placeholder_1
   WHERE (ssid = :db_condition_placeholder_0) ;
Array (
   [:db_update_placeholder_0] => QUyrgEInS_vO0GbrOhJffh6npb2ejlpllvS8Thn2pYY
   [:db_update_placeholder_1] => Cu6Y9OkPd1qJuonzHQw2JI67BDvO85pqp50SBsXE1ZU
   [:db_condition_placeholder_0] => fMabX3y84Ngm-HcGF8MomLvLp1kmceLRIwniv_dSj_M )
in drupal_session_regenerate() (line 393 of /var/aegir/platforms/demandmetric/includes/session.inc).

I am using custom code that rougly looks like this:

drupal_session_start();
_$SESSION[''] = bunch of generated info.
Authorize linkedin
create user
$form_state['uid'] = $account->uid;
user_login_submit(array(), $form_state);
Update profile from linkedin info.

The error occurs on the user login submit part.

I suspect that drupal_session_start is causing the issue but I don't understand sessions well enough to debug this. The issue occurs 1 in about 30 users. I added the session start because the session info on line 2 doesn't get set without it.

Other suspects are memcache (very unlikely) and secure pages.

Anyone know about session that can enlighten me to how to track this issue down?


texts: Increase memory limit doesn't help in Fatal error: Allowed memory size of .../modules/views/views.module on line 416

texts:
I've switched from Drupal 7.14 to 7.15 three weeks ago and therefore,
I'm encountering a series of very sophisticated (for me) memory limit errors.
Those errors occur any time I'm trying to clear cache in performance or to run update scripts.

My hosting company has increased my memory limit in php.ini up to 126 M, 256 M, 512 M, and even 1024 M. But the errors still occur.
I've migrated my site from shared to VPS, But the error incredibly still occurs.
I have no way and no idea how to move forward.

Here are the errors:

Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 30 bytes) in /home/example/public_html/sites/all/modules/views/views.module on line 416
Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 108 bytes) in /home/example/public_html/includes/menu.inc on line 2736
Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 71 bytes) in /home/example/public_html/sites/all/modules/chain_menu_access/chain_menu_access.module on line 59
allocate 64 bytes) in /home/example/public_html/sites/all/modules/views/includes/base.inc on line 93


texts:
I'm new to the open source world (use to be all Microsoft). I've just installed Drupal on my mac, and I'm wondering which program is a popular choice for making changes in mySQL?

I can see that changes can be done in Terminal (bash) but I would have should there is an easier way. Do most people use the command line, or a GUI program?


texts: Prevent clubbing of server side error messages on top

texts:
I have inline form errors module enabled on my drupal 8 site. The server-side errors that appear on form submission are appearing as clubbed together like below:

How to change this error language and prevent clubbing for example if there would have been multiple errors the message would have been "2 errors have been found: FieldName1, FieldName2".

Is it a part of core and how to show errors in different lines?


texts: Grouping data to be displayed in the a template.

texts:
I have the following related Content types:

I am creating a view to get the following output

Resource Title
Resource Type. (If type is Quiz, then also show the following data)

Quiz Title

Option Title 1
Option Title 2

Currently, i am getting the following output

Resource Title
Resource Type
Quiz Title
Option Title 1
Resource Title
Resource Type
Quiz Title
Option Title 2

How can I group the data in the templates to get the desired result?

Thanks


texts:
I have a view which is a clone of the Product view (created for the Drupal commerce module).

In the view I set a contextual filter. But it just doesn't work as required.

It is very rare since the view is pretty simple.

Please take a look at the capture I've made:
 http://screencast.com/t/tgRPQQCm

The "Categoria" field is a Term Reference field type.

If I use other field as a Contextual Filter it works fine. Look: http://screencast.com/t/yspxMFxjA0k

Then there is something wrong with the field??


texts: How to edit webform's email field default error message?

texts:
How to edit  webform,s email  field  default error message ?
My case is:
I have to place error message just below the email field for this purpose i have used inline error message module and client side validation ,these modules worked well for me .

But the problem is that  webforms default error message of email field  commimg below the email text (say: your email address is not valide) but i dont want this default error message .suppose i want to print error message (say: you must provide a valid email address) for this i have created a custom validation function but after creating custom validation fuction my error message showing above the text box not below the textbox only default error message showing below the email field by using inline error message module that is not my requirement.

If i change the default error message(say: your email address is not valid) to  (say: you must provide a valid email address) i can acheive the desired task

But how to achieve?


texts: Querying the user list from the database

texts:
There is a need from a different team in our organization to provide a periodic export of users, roles, and users-roles relationship data in a certain Aveksa-specific format.

Where (which table(s)) are the list of Drupal 8 users and roles stored in Drupal database? I've looked at all the tables listed in the schema and examined their records, and could not find anything that resembled user/roles data.

I figure querying the database is the way to go rather than looking at the /admin/people section of Drupal and scraping the data from there.


texts: Moving a contrib module from /modules into the sites/all/modules folder

texts:
I need to run a simple fix in my Drupal 7 website. The website administrator, not being a Drupal specialist, installed the SMTP module in the root /modules folder, instead of the /sites/all/modules folder. Now I need to upgrade the SMTP module and noticed the mistake. My first impulse was to move the SMTP folder from /modules into /sites/all/modules, and then proceed with the regular upgrade.

My question is: do you think that moving the SMTP folder from root /modules into /sites/all/modules could cause any problems, like data loss or website crash?


texts: I'm working with a Drupal 6 tutorial (but building in Drupal 7) that uses the Rules module, and I notice that some of the rules the presenter is building rely upon negation (e.g. "if NOT blah-blah") Am I missing something, or is this possibility not available in the Drupal 7 version of the module?


texts: Popup modal confirmation dialog during form Validation

texts:
I have a standard From API form.  When the user clicks the submit button I'd like to popup a modal dialog with some details relate to the submitted field with a proceed ( to submission ) and cancel ( return to from ) button.

However I'm not sure where to start.  Should I add an #ajax callback on the submit button perhaps ?  Any advice appreciated.

Pseudo-code here :

function mymodule_search_form() {
  $form['code'] = array(
    '#title' => 'Search for documents',
    '#type' => 'textfield',
    '#description' => 'Enter a code',
'#access' => TRUE,
  );
  $form['submit'] = array(
    '#type' => 'submit',
'#value' => t('Search'),
'#access' => TRUE,
  );
  return $form;
 }

function mymodule_search_form_validate($form, $form_state) {
  if ($form_state['values']['code'] !== 'acceptable code') {
    form_set_error('code', 'Invalid code');
  }
  // deconstruct $form_state['values']['code']

  // popup dialog "Your code indicates BLAH BLAH". Click Proceed to continue
  // or Cancel to try again"
}

function mymodule_search_form_submit($form, &$form_state) {
  $form_state['redirect'] = 'assets';
}

Thanks


texts: Only show comments in view where the comment author has a specific role

texts:
I am trying to make a Drupal View which only shows the comments of users with a certain role. For example I have a node with content_author who has Role Y. The same user (with Role Y) placed a comment, another user with Role X posted a comment too.

I want to have a view which only displays comments from users with Role X. This does not depend on the user who is logged in, so I cannot use a contextual filter I suppose.

Did anyone manage to do something like this?


texts: How do I count the number of nodes in a View

texts:
I would like to display the number of nodes in a particular view OUTSIDE OF THAT VIEW. For example, on the home page (page--front.tpl.php) I want to insert a simple php echo statement that pulls the number of nodes in "View X", and another php echo statement that pulls the number of nodes from "View Y", etc.

function theme_get_node_count($content_type) {
     $query = "SELECT COUNT(*) amount FROM {node} n ".
              "WHERE n.type = :type";
     $result = db_query($query, array(':type' => $content_type))->fetch();
     return $result->amount;
}

The previous code does not work because I am not counting a content type. Is there a $view variable I can plugin into this function to achieve the same results?

Thanks


texts: Exporting custom configurations from Drupal

texts:
After installing a Drupal7 site, I have made several configurations/customizations over time. Now I would like to export them somehow, in order to load them to another site. But the problem is that I don't remember exactly what I have done. The Features module does not help because you have to tell it exactly what to export, but I don't remember all the changes.

I know that this is a difficult problem on Drupal7, which is expected to be solved on Drupal8. But I am asking just in case that somebody knows any tricks that can help to solve it on Drupal7.


texts: How do I call a function from a class/controller in another class/controller?

texts:
There are two modules "field_collection" and "tasks"

I have a controller called "task" from the custom module "tasks".

I'd like to use a function in this controller (this function from custom module "field_collection"). Function:

Drupal\field_collection\Entity\FieldCollectionItem::load()

But when I call this function (from custom module "field_collection") directly in the "task" controller (for the custom module "tasks"):

<?php

use Drupal\Core\Controller\ControllerBase;
namespace Drupal\tasks\Controller;

class task extends ControllerBase {

public function get_collection_field_n ( $field_collection,$the_collection_field)
{

    $field = Drupal\field_collection\Entity\FieldCollectionItem::load($field_collection)->get($the_collection_field);
    return $field;
}
}

?>

I get the error message:

PHP Fatal error:  Class 'Drupal\\tasks\\Controller\\FieldCollectionItem' not found in /var/www/pxoa_pub/modules/tasks/src/Controller/task.php on line 41, referer:

What could be wrong?


texts: Problem changing the parent group for a node

texts:
I am trying to programmatically update the parent group of a bunch of nodes. But I am not having much luck. Below is what I have tried. What am I doing wrong here?

foreach ($groups AS $group)
{
  $node = node_load($group->nid);
  $node->og_parent = 23; //I also tried "$node->og_parent = array('nid' => 23);"
  node_save($node);
  unset($node);
}

One thing to note is that all of these groups already have a parent group set. Also this is on Drupal 6.

Thanks!


texts: inline edit with editable-fields and field-collection fields

texts:
I have created a view of profile2 data, some kind like a extended user profile where users can add some personal data and other information of interest. I chose the view because in a next step of development I want to provide a profile search function. Basically I think to choose a View is the right way to go.

So when I (as a owner of a profile) call the view page (filter is set to my login UID, setup as a contextual filter) it shows up and the editable defined fields are all editable (by click). I wanted to provide a profile page view that is in-page editable (eg. functions as a form and a view, all in one). All this works great. Also I can use that view to show to anonymous users (as a search result) the profile content (non editable of course).

My problem are 2 field-collections in that profile that shows (due to the editable setting "Formatter" in the View field definition) both the "add" link and also the "edit this field" of the "editable setting" of these very 2 fields. That is redundant. I seem not to be able to find any way to switch off the second "edit this field" link. If I set these field-collections to the "default" formatter (not editable), I also get no "add" link to add values to the field collections. This is the case if the user just created an account and the collections are empty.

Now my question, how can I remove the "edit this field" link generated by the "editable" functionality? It seems, that JS add these links and I can not remove them anyhow. Is there any way I can override these two fields and remove the link (but still leave these fields in editable state)? Some theme override I could use, or somewhere within the fields template?

I played a little and defined a field template (named by the collection-field such as views-view-field--field-work-experience.tpl.php) and tried to remove the 'edit this link" or JS selector. If I now choose the formatter editable-link, (not the editable formatter) and change the code in the field template to

$markup = $row->field_field_work_experience[0]['rendered']['#markup'];
print $markup;

the "edit this field" from the editable-link module will not show up, but I get the wanted "add" link. The regular field template output

print $output;

will show both, the "add" link and the "edit this field" link.

Well, the first snippet is a dirty hack and a try and it might lead to undefined behavior. I do not like to keep up with that at all.

BTW, I have both modules installed, "editable-link" and "editable". I develop with drupal 7.

So is there any way I can remove these "editable field" links from the field-collection fields and just get the regular link "add".

I hope I described my problem clear enough, if not please let me know I try to explain more precisely.

Any help is greatly appreciated.


texts:
I have on Drupal 7 a Geofield Map Views that show a list of "Source" content on a Google Map.

I want to add on my marker on the map the information about the NID of the "Source" and I don't know how to do that.

The goal is to have my map and when I click on the marker, I get back the ID of the node and scroll down on the page to show the information about this Source.

Thanks in advance if anyone can help.


texts:
I am using the live css module, but when I try to save the css on the fly I get the error message 'The url used contains a sub-filextension which poses a security threat. Saving not allowed.'
Any idea what might be causing this?


texts: How to display an add to cart button for each product displayed in my views grid?

texts:
I am creating an online store, for which I am using the Views module (grid) for product displays.

I want a 'Add to cart'-button to appear for every product displayed. How can I do so?

Note: I can display the product, but without the 'Add to cart'-button.


texts:
I have sereval webforms et each webform send a mail with a pdf. I would like to do a template for each webform.
I use webform2pdf in Drupal 7 to send pdf by email.
How can i do that ?


texts: How to render text including video embed field

texts:
I have a formatted text field, and am using the video_embed module to allow users to embed video into that field, using the video_embed_wysiwyg submodule.
I am then trying to render the field in a block, but I simply get the JSON output in the text field:

{"preview_thumbnail":"/sites/default/files/styles/video_embed_wysiwyg_preview/public/video_thumbnails/A5jNGsBHHUE.jpg?itok=7fW8O9To","video_url":"https://www.youtube.com/watch?v=********","settings":{"responsive":1,"width":"854","height":"480","autoplay":1},"settings_summary":["Embedded
Video (Responsive, autoplaying)."]}

Here is my render array:
$text=check_markup($node->get('field_html_containing_video_content')->value, $node->get('field_html_containing_video_content')->format);

    $renderArray=[
      'content'=>[
        '#type'=>'inline_template',
        '#template'=>$text
      ]
    ];

    return $renderArray;

I've got the video embed filter enabled on the relevant text format, and have tried changing the order of the filters.
Any ideas what i am doing wrong here?
We are using a bootstrap subtheme.
Thanks for any help given.


texts: Choosing sub-term after choose term when user post article

texts:
This is my taxonomy, really large. My client want to choose in 2 dropdown menu, first one is parent term, after that, the second menu fetch sub-term which belong to parent term in first menu. How can I do? Is there any module for this case?

  Car

  BMW

  BMW1
  BMW2
  BMW3

  Audi

  Audi1
  Audi2
  Audi3

  Toyota

  Toyota1
  toyota2
  toyota3


texts: site's footer disappear when not logged in. only show up when logged in as Administrator?

texts: Need help or guidance on this.  I don't understand why website's footer disappear when not logged in as administrator.  I am using OpenPublic openomega and delta themes.  The footer is generated from the main menu links.  I just don't understand why it disappears when not logged in as administrator.  Is there an area for the main menu where I can configure how it display's the footer and set permission's for it?  thanks for any info on this.


texts: Is there an existing way to make blogs for nodes (not users)?

texts:
I want to be able to set up blogs (or blog-like things, anyway) on arbitrary nodes -- imagine that you have a content type representing an organization, and that organization's owner can create blog entries about the organzation, its activities, etc.  This would not be a lot of code to write, but I'd sure prefer to use an existing solution than hack a new one together.

Is there anything out there like that?  Any experiences to report about adapting/hijacking the existing blog module for this purpose?  Thanks!


texts: A strategy question regarding content types vs. basic pages plus taxonomy/tags

texts:
I'm having trouble deciding what makes more sense. I am building a somewhat simple site and so far it seems fairly straightforward to use the basic page content type for nearly everything and add a field for taxonomy (to associate the page with the categories of the main menu) and if needed, tags to further categorize the pages for various views and lists. But is that the best strategy? The end-user is going to have to remember to choose a taxonomy term for each page, and choose the right one. If a tag is needed, they are going to have to remember to add a tag and spell it correctly. People are notoriously unable to do simple things like this without making mistakes. So, would it be better to create separate content types for each main menu category, even if they basically are the same basic page content type? If I did separate content types, I wouldn't have to ask people to select an item in the main menu taxonomy. I would still have to ask them to tag some of the content types, but I could leave that field off for those content types that don't need tags. But then I'd be faced with having to instruct the end-user to select the correct content type before creating a new page.

What is your opinion? Is there a better strategy among these choices or perhaps even another choice I didn't consider?


texts: PHP require_once() warning with hook_menu

texts:
I'm writing a small module for learning purpose, where I try to create a module settings form using hook_menu() and form_api.
Everything look good in my code but I still getting this error message :

  Warning:
  require_once(/var/www/html/drupal/modules/system/demo_usernames_form.inc):
  failed to open stream: No such file or directory in
  menu_execute_active_handler() (line 515 of
  /var/www/html/drupal/includes/menu.inc). Warning:
  require_once(/var/www/html/drupal/modules/system/demo_usernames_form.inc):
  failed to open stream: No such file or directory in
  menu_execute_active_handler() (line 515 of
  /var/www/html/drupal/includes/menu.inc).

function demo_menu(){
    $items[]=array();
    $items['admin/config/people/usernames']=array(
        'title'=>'bad usernames list',
        'description'=>t('configure not allowed usernames'),
        'page_callback'=>'drupal_get_form',
        'page arguments'=>array('demo_usernames_form'),
        'access arguments'=>array('administer site configuration'),
        'file'=>'demo_usernames_form.inc',
        );
    return $items;

function demo_usernames_form($form,&$form_state){
    $form['bad_usernames']=array(
        '#type'=>'textfield',
        '#title'=>'Bad usernames',
        '#default_value'=>variable_get('bad_usernames'),
        '#description'=>t('Enter a list of "bad usernames" separated by commas.  If a user tries to enter one of these usernames either on account creation or when editing their account, the form will display an error message.'),
        );
    return(system_settings_form($form));

}


texts:
I've noticed that in using the default Drupal 8 API to get a feed of articles (using the REST View) the Tags field is returned as the following:

"field_tags" : [{
  "target_id" : "1",
   "target_type" : "taxonomy_term",
   "target_uuid" : "4d2cac04-a0a6-4c0a-8c13-34ba44a474f0",
   "url" : "\/site\/taxonomy\/term\/1"
}]

This returns an entity reference, but you never get the actual name of the tag. In the above instance, the name of that tag is actually Lorem. I can't seem to find a way of adding a property into the field_tags object to include the actual name of the tag. Is there a way?


texts:
I want to show a button to users with appropriate permissions. The best way to do this, I think, is in my template file. So, I have the following:

{% if user.hasPermission('create qualification content') %}
SHOW THE BUTTON HERE
{% endif %}

I know the user that this permission, I have checked the list of permissions available on site by $all = array_keys(\Drupal::service('user.permissions')->getPermissions());

But, the button will not show.

What have I missed?

Thanks


texts:
Please see the red box. In Magento there is a feature where i can create Product Templates - templates can be created for products with different fields.

I know i can create Content Types for this, but i felt that will make too many Content Types. Is there another work around this so that it's like Magento? Is there a module for it.

Thanks!


texts: Disable Panels Preview when adding new Panes in Layout Editor

texts:
Some of my pane's are causing the pane's editor to crash (some cause the grears to dissapear, some cause the add new panes element to break). We'd therefore like to disable the preview option in Panels, it looks like Panopoly has the option to do this: https://www.drupal.org/node/2171809. "Enable Previews when adding Panes"

Does anyone know how this could be done on the panels module for Drupal 7?  We're not using Panopoly.

The reason behind it not working is that Panels was written against jquery 1.4 and some of my blocks that are being previewed when adding panes to the page manager are panels 1.9+


texts:
I feel a bit dummy as I can't make it work..

I'm trying to check if a string contains substring in my twig.

{% set url = url('<current>') %}
{{ url }}

{% if 'my-delivery' in url %}
    //print something
{% endif %}

The url is printed outside the if statement but it doesn't enter the if statement and the url contains 'my-delivery'.

Any idea why it doesn't work?


texts:
For a content type, I need a field holding the value of a certain date in history. The content type will be used to hold some historic events and when the current date matches (September 17th, for example) the node will be displayed.

I know that the date module can handle such things but it is quite comprehensive and I will not be using calendars or event content types. All I need is to hold a date value and compare its day and month part with the current date's.

Is there a simple solution?


texts: Running module unit tests from CLI: "Class '..' could not be found"

texts:
I am trying to run module-provided PhpUnit tests from the CLI.

Following these instructions, so my core/phpunit.xml should be correct now.

Using this command:

cd core
../vendor/bin/phpunit modules/system/src/Tests/Installer/InstallerTranslationTest.php

I get this output:

Class 'modules/system/src/Tests/Installer/InstallerTranslationTest' could not be found in '/****/core/modules/system/src/Tests/Installer/InstallerTranslationTest.php'.

Module-provided tests in e.g. core/modules/system/tests/src/.., are found, and work correctly with the phpunit command. But tests in core/modules/system/src/Tests/.. do not seem to work, or be detected.

(I think I had this problem before, and someone told me what was missing. But I don't remember anything. Time to document this in this Q/A site.)


texts: How do I change the name of the "view" node tab for a specific content type?

texts:
I am using Drupal 8. I have a content type "hotel". I would like to change the default tab name "View" only for this content type "hotel". I can change the default tab name "View" by mymodule.links.task.yml (please see below code), but it applies to all content types.

entity.node.canonical:
  route_name: entity.node.canonical
  base_route: entity.node.canonical
  title: 'Summary'

So how do I change the default tab name "View" ONLY for a content type?


texts: Is there a module which can allow users to place the same block in multiple regions? That way I don't have to make the same View block twice.


texts: Inline entity form complex and cardinatlity

texts:
I am adding an ief type field to my form with the following

    $form['inline_entity_form'] = [
        '#type' => 'inline_entity_form',
        '#op' => 'add',
        '#entity_type' => 'my_ent_type',
        '#bundle' => 'my_bundle',
    ];

I am sure this is something under my nose that i am missing but how do i force this to complex and set a cardinality for this instance?

Grateful for any pointers
Mathew


texts:
I am creating a module with a map displaying markers. Do I need to create a page/ node or can I load the drupal theme without any page / node content and add my code.

<?php /**
 * Implementation of hook_menu.
 */
function projects_map_menu() {
  $items = array();

  $items['projects-on-map'] = array(
    'title' => 'Projects on Map',
    'page callback' => 'projects_map_page',
    'access callback' => 'user_access',
    'access argument' => array('access nodes'),
    'type' => MENU_CALLBACK,
  );
  return $items;
}

/**
 * Page callback
 */
function projects_map_page() {
//render them current theme
//custom code
}


texts:
I'm interested in adding a link in a tableselect form row. Utilizing the #options key I can only add columns with strings. I am able to add form elements in the #options array similar to the #rows array.
$rows[$nid] = [
    'edit_link' => [
        'class' => 'edit_link',
        'data' => [
            '#type' => 'link',
            '#url' => Url::fromRoute('group_manager.edit'),
            '#title' => 'test',
        ],
    ],
]

//…

$form['table'] = array(
    '#type' => 'tableselect',
    '#header' => $header,
    '#options' => $rows,
);

Implementing this example as is doesn't render this column in the table, so I assume it has failed somehow.
The 'edit_link' element works if the form is changed to a 'table' instead of 'tableselect'.


texts: How to use cache set and get to store time cron ran?

texts:
We have a new requirement where we need to run a job on a daily basis. We have setup cron to run every 1 hour. The goal is to have cron ron every 1 hour, but we want a specific job to run only if 1 day (24hours) has past since last run.

We used to use the Variables table to store the time the job was last run, but we need to change this to use the cache table. Below is the code (mymodule.module) we were reviewing, but it is not creating a cache table and not storing the appropriate date. So we need assistance in figuring out if we are using the correct logic so the job runs once everyday.

Note: $cache->data below is actually the last time the job ran.

mymodule_cron() {
     $data = '';
     if($cache = cache_get('last-run')) {
         $data = $cache->data;
         if($data <= strtotime('-1 day')) {
               //call helper function to perform some logic
               _some_func();
               $data = time();

               //set update date in cache
               cache_set('last-run', $data, 'cache'));
         }
    }
 }


texts:
I have the quiz module installed on my website. I have setup two user roles on my site, Student and Parents.

I want to make a view that shows the results of a parents children.

Now I have made two fields in the registration using the profile module.

The number of student
The number of parent

These two fields are now available both for parents and their children. How can I fetch the results of a parents children using this relationship?

I'm thinking I should I say:Show the result of the users were the field "profile_no" is the same?

Is there a better way to make relation between two users?

Thanks everyone!


texts: combining messages and content types in views

texts:
I am using the Message  module to tell people when nodes are created, deleted or edited.  Is there a way to combine the messages module with my nodes in views.

What I want to do is show a message of a node being deleted or edited, and then show some fields of this node.  I tried using tokens inside the message module, but that does not seem to do the trick.


texts: How to create html page via module drupal 7

texts:
I am new in Drupal. I have created  a form which saves the values to custom table how ever I want to display those items in a tabular format. Does any one know how  to create a custom page where I can display those items.

This is what I tried:
in module file

<?php $menu_items['user/campaigns/new_campaign'] = array(
        'title' => 'Campaigns',
        'type'=> MENU_CALLBACK,
        'page callback' => 'create_campaign_form2',
        'access arguments' => array('access content'),
        'file' => 'campaigns.create_campaign2.inc',
        'weight' => 1,
    ); ?>

in campaigns.create_campaign2.inc file:

<?php function create_campaign_form2()
{
    echo 'Some HTML here';

}
?>

But it displays only displays the text, the entire css is removed please let me know what should I do.
Sorry if the question is too basic.


texts: How to programatically create availability calendars for each node?

texts:
I'm working on a booking page on which I need to programatically add an availability calendar for each property element (node).

All the data come from external sources and is imported programatically. We have to store the availability of the properties locally and import this information from an xml that is provided to us periodically.

We are using the Availability Calendars module (7.x-5.4) and I have the functions to create the availability calendars which is provided in availability_calendar.inc, which is:

availability_calendar_create_calendar()

I've also the function that would allow me to fill the calendar with the availability data that I get from the xml file:

availability_calendar_update_multiple_availability($cid, $changes)

But I can't see how I can relate this information with the corresponding node. I use the entities API but I'm not sure which parameters I should pass to the calendar field and how to pass them.

I thought about:

$entity = entity_metadata_wrapper('node', $raw_node);
$entity->field_calendar->set( array(
                          'enabled' => 1,
                          'name' => $nodetitle,
                          'cid' => $cid,
                          ));
$entity->revision->set(1);
return $entity->save();

But I didn't find it in the documentation and I don't want to start trying things blindly.

Any advice will be welcome!

Edit:

It works exactly as it is described in this post, so solved!


texts: Drupal Elysia Cron Max execution time error, in select.inc

texts:
PHP Fatal error: Maximum execution time of 120 seconds exceeded in /var/www/domainname.com/public/includes/database/select.inc on line 1309

I have an elysia cron command that takes perhaps 10-15 minutes, in the night. The script also starts some jobs with beanstalk, so it takes a while to execute.

When it runs automatically at night I get that above error message. It doesnt make sense, because when I run the command from the terminal it works:

drush elysia-cron run elysia_cron_job_name --verbose --ignore-disable --ignore-running --ignore-time

And on line 1309 in select.inc is this:

public function addField($table_alias, $field, $alias = NULL) {
    // If no alias is specified, first try the field name itself.
    if (empty($alias)) {
      $alias = $field;
    }

    // If that's already in use, try the table name and field name.
    if (!empty($this->fields[$alias])) {
      $alias = $table_alias . '_' . $field;
    }

    // If that is already used, just add a counter until we find an unused alias.
    $alias_candidate = $alias;
    $count = 2;
    while (!empty($this->fields[$alias_candidate])) {
      $alias_candidate = $alias . '_' . $count++;
    }
    $alias = $alias_candidate;

    $this->fields[$alias] = array(
      'field' => $field,
      'table' => $table_alias,
      'alias' => $alias,
    );

    return $alias;
  }

Exactly 1309 is: 'table' => $table_alias,

I've searched the web, and I have no idea where the 120 seconds comes from. I feel like I tried everything. Can someone help?


texts: Extend Drupal 6 "form_token" & "form_build_id"

texts:
I'm posting in my website by using command line.

Below codes works just fine for me

curl -b cookies.txt -d title="$(my-own-sed-command)" -d taxonomy%5Btags%5D%5B1%5D="$(my-own-sed-command)" -d teaser_include=1 -d body="$(my-own-sed-command)" -d field_source%5B0%5D%5Burl%5D="$(my-own-sed-command)" -d changed= -d form_build_id=form-2bef00e4e4c6c53c1cedfc61e857186b -d form_token=883b4e7f69cdd1bf3311854732eff3f7 -d form_id=post_node_form -d op=Save http://www.mywebsite.com/node/add/post

Usually I will post several times a day using above command. But the problem is; sometime I will take a rest for 2 or 3 days. After 2 or 3 days, the "form_token" & "form_build_id" has expired.

In order to prevent expiration, how to extend the "form_token" and "form_build_id" to become 7 days?

Any ways are welcome; hacking the core, disable token for this node type submission, etc.


texts:
I have created a block to show the sibling terms of the term being viewed. In the twig template I am looping through the terms to display the names linked to their respective pages.

Now I unable to figure out how to get path alias.

Can any one of you please guide me how to get the path alias of a term?

Thanks


texts: Including JS after the JS specified in theme info file

texts:
The goal is to include js files for custom block from custom module after the JS specified in the themes.info file. From the moduleName.module

function moduleName_block_view($delta = ''){
  $block = array();
  switch($delta){
    case 'contact_form':{
                $block['subject'] = '';
                $block['content'] = array(
                    '#markup' => build_contact($delta),
                    '#attached' => array(
                        'js' => array(
                            'http://somepath/0.0.2/contact-0.0.2.min.js' => array(
                                'type' => 'file',
                                'weight' => 1000,
                            ),
                            drupal_get_path('module', 'moduleName').'/js/contact-config.js' => array(
                                'type' => 'file',
                                'weight' => 5,
                            ),
                        ),
                    ),
                );
...
return $block;
}

The weights work for the two JS files within the custom block as specified here. Problem is that, i am unable to make these js files be imported after the js files specified in theme.info file. How to make these file import after the theme js? Thank you for help


texts: Dashboard doesn't contain the "Customize dashboard" link

texts:
The dashboard page doesn't contain the Customize dashboard link.

A normal dashboard would appear as in the following screenshot.

How do I make the link appear is it should?


texts: 'File used may not be referenced' if form field submits same image twice

texts:
I've built a custom module with a form that allows users to define custom site wide settings such as the icons that are meant to be used.

I'm able to upload and save images into the form using managed_file elements. However if I resubmit the form without changing what files are used I receive the message:

  The file used in the First Icon Image field may not be referenced.

First Icon Image was the name of my field in that case. Everytime I change the image used I don't receive the image. It's only when I submit the form again with the same values for the image fields.

I'm handling the image field with the following code:

public function buildForm(array $form, FormStateInterface $form_state) {
    $config = $this->config('mymodule.settings');
    $form['icon1_file'] = [
                '#type'            => 'managed_file',
                '#name'            => 'icon1',
                '#title'           => t('First Icon Image'),
                '#default_value'   => $config->get('icon1_file'),
                '#upload_location' => 'public://',
    ];
}

public function submitForm(array&$form, FormStateInterface $form_state) {
    $imageid = $form_state->getValue('icon1_file');

    $file = file_load($imageid[0]);
    if (gettype($file) == 'object') {
        $file->status = FILE_STATUS_PERMANENT;
    }
    $filename = File::load($imageid[0])->getFilename();
    $this->config('mymodule.settings')
         ->set('icon1_file', $form_state->getValue('icon1_file'))
        ->save();
    $file->save();
    $this->config('mymodule.settings')
         ->set('icon1_filename', $filename)
         ->save();
}

After doing some research I saw that a possible solution might be using \Drupal::service('file.usage')->add however I'm not sure what I'd use for the entity_type and entity_id parameters if that, indeed, is the solution.

How would I prevent the "File used in the field may not be referenced" when occurs on the second time I submit the form with the same file?

UPDATE: I added

$file_usage = \Drupal::service('file.usage');

and

$file_usage->add($file, 'mymodule', 'managed_file', $imageid[0]);

to the code, but it did not resolve my issue.


texts: How to evaluate php code in a content type text field in Drupal 6

texts:
I have a content type with some fields. Normally I would user "filtered HTML" option as input format, but now I want to user "PHP filter". I've placed my php code into the field

<?php echo "test"; ?>

But all I get is this:

"PHP Evaluator" is enabled and it's the only filter applied to that input format.
Any ideas?


texts: User profile fields: Get count of fields with value XYZ

texts:
All user profiles contain these fields:

field_age (integer)
field_category (list: "Category A", "Category B", …, "Category Z")

I want to get the number of users with the value "Category A", "Category B" etc. for the landing page.

How can I get the count of users for each answer? I want to display the number on the landing page for every visitor.

The data does not need to be live data. It may be read from a file that is re-generated every 24 hours.


texts: Problems with moving my site to another server - WSOD with unfamiliar errors

texts:
I've transferred a site from one server to another (both using Webmin's backup and restore facility).

Everything appears to have transferred across fine, except for when I try to access my site, I get the WSOD. I enabled error reporting and get the following error. Unfortunately, I'm unable to comprehend what it's telling me.

  Warning: Table 'id0063_BTG.users' doesn't exist query: SELECT u., s.
  FROM users u INNER JOIN sessions s ON u.uid = s.uid WHERE s.sid =
  'dc0n9e93lvckbmskv5frobirn2' in
  /home/id0063/public_html/includes/database.mysqli.inc on line 128

  Warning: Table 'id0063_BTG.system' doesn't exist query: SELECT name,
  filename, throttle FROM system WHERE type = 'module' AND status = 1
  AND bootstrap = 1 ORDER BY weight ASC, filename ASC in
  /home/id0063/public_html/includes/database.mysqli.inc on line 128

  Warning: Table 'id0063_BTG.url_alias' doesn't exist query: SELECT
  COUNT(pid) FROM url_alias in
  /home/id0063/public_html/includes/database.mysqli.inc on line 128

I checked the Apache error log and found this:

  [Tue Jul 19 16:40:24 2011] [notice] mod_fcgid: call
  /home/id0063/public_html/index.php with wrapper
  /home/id0063/fcgi-bin/php5.fcgi PHP Warning:  PHP Startup: Unable to
  load dynamic library '/usr/lib/php/modules/intl.so' -
  /usr/lib/php/modules/intl.so: cannot open shared object file: No such
  file or directory in Unknown on line 0

Any ideas where I can start?


texts: queries with db_select don't respect integers

texts:
When I check "SHOW PROCESSLIST" in phpMyAdmin I can see lots of queries where argument-integers are being inserted as strings (with single quotation marks).

I'm wondering if this is due to the way phpmyadmin reports the queries (if it puts every argument between quotation marks) of if it is db_select that puts every argument between quotation marks.

An example of my code where integers are being used as arguments:

$select->join('taxonomy_index', 't_'.$key, 't_'.$key.'.nid = n.nid AND t_'.$key.'.tid = :tid_' . $key, array(':tid_'.$key => (int)$tid));
$select->condition('t_'.$key.'.tid', (int)$tid);

As you can see I explicitly write (int)$tid but in my query log I can see the following:

... WHERE (t_0.tid = '10') ...

The big question is: How can I be sure that integers are being treated as integers in my queries? I don't want MySQL having to transform strings to integers.


texts: Show modal modal message on form success

texts:
I have a custom form that submits via AJAX. On form error, i simply return the whole form on my callback function, and the HTML is replaced, but i want it to open a modal dialog on success. What is the best way to do this? This is what i'm currently doing (i don't like this solution because i can't clear the form values, among other things):

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

        drupal_get_messages(); // Hide the status messages

        $form_state->setRebuild(TRUE);

        if ($errors = $form_state->getErrors()) {

          return $form;
        }
        else {

          $response = new AjaxResponse();

          $title = 'Consectetur adipiscing elit';
          $text  = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.';

          $response->addCommand(new OpenModalDialogCommand($title, $text));

          return $response;
        }
      }