texts:
I have a region page_intro where I display a view, with some CSS on it. When the view is empty (return no result), the region is still displayed (All html code before and after {{ page.page_intro }}). Is there a way to compltetly remove it when the view is empty ?

template :

{% if page.page_intro %}
    {# #page-intro #}

                {# #page-intro-inside #}

                    {{ page.page_intro }}

                {# EOF: #page-intro-inside #}

    {# EOF: #page-intro #}
{% endif %}

I'm on Drupal 8.2.0 version.


texts: An exposed filter works only with certain taxonomy terms (weird to me)

texts:
I have a "commercial property" and "residencial property" node types.
One for offices, cellars, etc and the other to houses, apartments, etc

They share some fields (price, address, etc) and also a field that I called "Kind of property" that is a taxonomy dictionary:

Kind of property:

Office
Cellar
House
Apartment
Estate

I have a View that works like a "Property search" and I have exposed the field "Kind of property". I created a menu for each one, so the visitor can go to "Sales - Apartments" and the View will show all the available apartments that are on sale.

This is the example URL for Apartments on sale: http://www.asir.com.co/inmuebles/buscar?asignacion[]=Venta&field_tipo_de_inmueble_tid=18

See that "asignacion" is a field that I use to mark the property if it is for sale or for rent (in this case Venta means Sale)

And also see that "field_tipo_de_inmueble_tid" point to the taxonomy term that is on the field "Kind of property".

The issue that I'm having is that field_tipo_de_inmueble_tid=18 works good, and also field_tipo_de_inmueble_tid=19 workds good, but if field_tipo_de_inmueble_tid=20 then it dosen't work and the view result is empty. (18 = Apartments, 19 = Houses, 20 = Estates, wich are the taxonomy terms).

I checked the nodes and there are nodes created that are using the termin id 20, but the View is not showing them so don't know how to troubleshoot this, any idea?

Thanks a lot for your time!


texts: After "?" redirect, the url is cut, why?

texts:
I am using the Anonymous Redirect module to redirect example.com to example.com/login.

But when I refer a link like
example.com/525?some=node/227 and log in, the url will be cut to example.com/525

I don't know why the url is cut after "?" or "&".

Any solutions for this one?


texts: What top tips you have for designing drupal themes?

texts:
I would like to use a 960 grid system master theme to create my own custom Drupal 7 subtheme for generic audience.

What should I consider when designing professionally looking Drupal themes ?

What is the most important when designing with end user experience in mind ?


texts: Display summary of paragraph text field in twig

texts:
I have a paragraph type called News. In this paragraph type I have a text field (field_news_intro ) with a summary. How do I display the summary in a twig template?
content.field_news_intro.summary seemed logical, but it doesn't return anything.
My template is called paragraph--news.html.twig

  {{ content.field_news_intro.summary }}

  {{ content.field_news_intro }}


texts: How to make node delete confirmation inline?

texts:
I need to know how to override the normal delete node confirmation (preferably for a specific content type). My site has one content type that users are able to delete and right now it forward them to an unstyled /delete/ page to do so.

I'd like the same functionality but with an inline delete confirmation on that content type, ideally without additional modules.

Edit: Just realized I would have to manage permissions to account for deleting the content. May need to do it directly bypassing regular methods


texts: how can I debug theme.theme file in my theme using phpstorm?

texts: I want to set breakpoints in the theme.theme file and debug some variables but I cannot do that as this file isn't a php file. How can I debug this file?


texts: How to redirect into a specific page variant

texts:
I installed panels, page manager, ctools and page manager redirect.

I made a (panel) page say foo1
- admin/structure/pages/add with variant type Panel. In this I put 5 variants named foo1variant1, foo1variant2, foo1variant3, foo1variant4, foo1variant5,

I also setup a page manager redirect say foo2:
- admin/structure/pages/add with variant type redirect.
In the end I should give the url it should go to foo1 en into foo1variant3, .

How to do this?


texts: How can I use Drush to sanitize a database on a remote server?

texts:
I'm on Pantheon and I want to run some custom SQL queries to sanitize my dev server.

I have the queries in a file, custom_sanitize.sqlqueries.

It looks something like this:

UPDATE user__field_useragent SET field_useragent_value = 'Sputnik';
UPDATE node__field_useragent SET field_useragent_value = 'Sputnik';
UPDATE node_revision__field_useragent SET field_useragent_value = 'Sputnik';

TRUNCATE TABLE watchdog;

Goal

I want to run these queries on a remote server with a single Drush command.

My Current Workaround

I connect to the database with Sequel Pro, cut and paste the queries in, and run them.

What I tried

Based on the Drush 8 sql-query documentation, I tried to execute my file like this:

drush @alias.dev sql-query --file=custom_sanitize.sqlqueries

This fails:

failed to open stream: No     [warning]
such file or directory drush.inc:904

I assume this is because my local drush calls the remote drush on the server, and the file path is different.

So then I tried to input the content of the file this way:

`drush @alias.dev sql-connect` < custom_sanitize.sqlqueries

This fails with the following message:

-bash: PTY: command not found

So then I tried inputting the queries in at the command line:

drush @alias.dev sql-query "UPDATE node_revision__field_useragent SET field_useragent_value = 'Sputnik';TRUNCATE TABLE watchdog;"

This also fails:

PTY allocation request failed on channel 0
Command not supported as typed.

I also tried using hook_drush_sql_sync_sanitize(), but I couldn't get my hook picked up by the drush on Pantheon.


texts: Hide contents from the Group members in Organic group

texts: Though it somehow contradict general rule of the Organic groups module but Is there any way in organic group so that we could hide content of one user from the group members?


texts: Alter Existing Route - Bypass/override entity permission

texts:
I added a custom access check to a JSON API endpoint so that only users who provide a token can POST/PATCH updates on a media endpoint.  I followed this documentation in order to alter an existing route using RouteSubscriber:alterRoutes() and a custom access check.

Everything is working properly with my custom access check.  I have a custom condition which will either forbid or allow access based on a condition:

public function access() {
   $valid = $this->validateToken($token);

   if ($valid) {
     $access = AccessResult::allowed()
   } else {
     $access = AccessResult::forbidden('The access token is invalid');
   }

   return $access;
}

If the user does not fulfill the appropriate condition, then access is denied through my custom access check.

However, if the custom access check allows access, the default entity permissions are still being applied.  I get a 403 Forbidden error saying:

The current user is not permitted to upload a file for this field. The following permissions are required: 'administer media' OR 'create media' OR 'create [machine_name] media'

When I allow access, I want whichever user who provided the correct token to be able to create a particular entity (including anonymous users).  How do I override the entity permission system so that whoever fulfills the condition has access to create the entity?

Can I dynamically add the permission to this user to create this particular entity for just this request?

Right now in my alterRoutes() function I am setting a requirement for my _custom_access.  Do I also need to set an additional requirement for _entity_access or _entity_create_access?


texts:
Is there a way to insert a PHP date into a title of a view block like so?

Thanks!


texts: boost module - no file to Disallow: /boost_stats.php

texts: I have followed the installation guidelines and installed Boost, but where it states to add a line 'Disallow: /boost_stats.php' for robots.txt doesnt seem to make sense as I dont have a boost_stats.php file in root for search engines not to follow anyway. Do I really need to add this line?


texts: Drupal_goto => POST $result as node Title

texts:
In order to be able to add a new node whenever a searched string is not found, I've added the following code in my theme directory as search-results.tpl.php.

<?php if ($search_results): ?>

<?php print t('Search results');?>

  <ol class="search-results <?php print $module; ?>-results">
    <?php print $search_results; ?>

  <?php print $pager; ?>
<?php else: ?>
  <?php drupal_goto('node/add'); ?>
<?php endif; ?>

After clearing the cache, this works fine.

Is it possible to POST the searched string to the node/add section? For example, if I am looking for "car" and the string is not found, I should be redirected to node/add  with "car" showed as node title.


texts: Using the Panopoly and Commerce Kickstart distributions together

texts:
I want to create an e-commerce site, and also have the ability to easily create landing pages, using the wonderful responsive layouts of the panopoly landing page editor.

What is the easiest way to go?

Install panopoly on top of commerce kickstart distribution?
Install commerce modules on top of the panopoly distribution?
Edit the distrubtion makefile - like someone did with other distributions.

How to do it successfully? And did somebody do it?


texts: Extra "mystery" markup being printed to page

texts:
I have a strange thing happening. If you see this page:

http://morningsidecenter-teachablemoment.org/teachable-moment

you will see a pretty much broken super fish nav (that until earlier tonight was working.) If you inspect the element you will find numerous empty  being printed to the page...

I went through and undid all the work i had done, but to no avail. Has anyone ever encountered this sort of thing? I've combed over my .tpl files to see if there is anything strange going on, but I cannot see anything (though it is late). Also, when I am logged in the error does not present itself, nor does it on interior pages for that section; click on any item in the sub menu, and you will see the nav is not broken, and no extra markup in the form of empty  tags...

thoroughly flummoxed...


texts:
I've created a settings page for my theme, and I'd like to be able to set the frontpage from there, but I don't know how I can change the frontpage in code?

This is the setting:

$node_type = "page";
$result = db_query(
    'SELECT n.nid, n.title FROM {node} n WHERE n.type = :type',
    array(':type' => $node_type)
);
$options = array();
foreach ($result as $record) {
    $options[$record->nid] = $record->title;
}

$form['static_nodes']['front_page_id'] = array(
    '#type'        => 'select',
    '#title'       => t('Frontpage'),
    '#options'     => $options,
    '#description' => t('Set the page used as the frontpage.'),
    '#default_value' => theme_get_setting('front_page_id'),
);


texts: Create a view to list contents according to taxonomy & content type

texts:
I have vocabulary with these terms

Countries

India
USA
UK
...

Sports

Soccer
Hockey
Cricket
....

And I have following content types

News
Events
Article
...

I need to create view that will show listing of content(s) as per the following path

for example:

/sports/soccer/news

/countries/india/news

or

/news/sports/soccer

/news/countries/india

Thanks for the help


texts: How do I delete cookies when users log out? How can I do this with out modifying any core module?


texts:
I want to setup the Two-factor Authentication (TFA) configuration automatically for each user that signs up in my site. Is that possible?

Because from what I have tried till now, all the users for whom I want TFA to be active needs to be configured individually. But shouldn't the ideal situation be such that the TFA will get active per user as soon as the user gets in the system?

What am I missing here? Isn't this a very obvious requirement?


texts: How to Change "USER has no blog entries" Text

texts: When you click on a user's blogs link and there are none he message "USER has no blog entries." comes up. I want to change that. I have tried using string overrides within settings.php but it does not seem to work. I used !username for the user as it is a link but nothing.


texts: Is it possible autoload PHP classes in themes?

texts:
Does the namespace, class name and naming convention work like it does for modules?

These links don't seem to mention it:

https://www.drupal.org/docs/develop/standards/psr-4-namespaces-and-autoloading-in-drupal-8
https://www.drupal.org/node/2349803


texts:
I'd like the ability to change a View's filter value prior to rendering, specifically add a taxonomy filter to certain pages. The reason I need this, is to have one Views block, and the ability to filter based off the URI, without adding a contextual taxonomy id to the URI. I haven't been able to find a way to handle this in any hook, but I think that's where I should be looking. I've been using the MODULE_views_pre_view hook without any luck.

Right now, the only way I've gotten around this is to duplicate the Block over and over again, and it's starting to get messy.

I've found several articles, but they're all for Drupal 7.


texts: Purpose of the Tag field on Add View page?

texts:
Under the Tag field on the Add View Page is such note:

  Enter an optional tag for this view;
  it is used only to help sort views on
  the administrative page.

But I also noticed that when I fill this field out another template becomes available with tagname in it's name. I should say that that might be quite handy in my case, when I kinda need to narrow the hit to specific views only. Can I perhaps use this feature to granulate templates for the views?

Any other usage case for the Tag field?


texts: How can I fix the "Could not delete temporary file"?

texts:
I'm getting below error when run cron:

  The specified file could not be deleted, because it is not a valid URI. More information is available in the system log.

Due to TMP files, my site will be crashed, again we will restored site and unable to clean TMP files in my live site.


texts: GeoIP - Error: Class 'Database' not found in _registry_check_code()

texts:
On my Drupal 7.78 I installed the GeoIP module https://www.drupal.org/project/geoip
I followed the steps in the Install.txt
1. Enable this module as usual.

2. Install one of the Maxmind php API:
   - GeoIP2 [https://github.com/maxmind/GeoIP2-php]:
     -- # phar package:
          Download the latest phar package:
          https://github.com/maxmind/GeoIP2-php/releases
          Place the file geoip2.phar here:
          sites/all/libraries/GeoIP2-phar/geoip2.phar

3. Download one of the GeoLite database files (matching the API):
   - GeoIP2: http://dev.maxmind.com/geoip/geoip2/geolite2/#Downloads
   - Legacy: http://dev.maxmind.com/geoip/legacy/downloadable/

On step 3 I downloaded the file GeoLite2-ASN.mmdb from maxmind.com
4. Create the directory 'sites/all/libraries/geoip' and extract the database
   file into this directory.
   You can use other locations too e.g. to share a database with varnish or
   other tools - to do so you can configure the path to the database to use in
   the module configuration (admin/config/system/geoip).

After step 4 I get the following error:
Warning:  stream_wrapper_register(): class 'TYPO3\PharStreamWrapper\PharStreamWrapper' is undefined in /home/customer/www/mydomain/public_html/misc/typo3/phar-stream-wrapper/src/PharStreamWrapper.php on line 509

Error: Class 'Database' not found in _registry_check_code() (line 3503 of /home/customer/www/mydomain/public_html/includes/bootstrap.inc

Before step 4 there was no error, what am I doing wrong? why do I get this error? how can I fix it?


texts:
I wanted a way to only insert items into the Queue when it was not already added. I want to have a large queue and work my way through it, simply adding as required. Previously I was deleting the queue and recreating on a set time table.

I couldn't find any way of doing this, or any discussion other than 'it's not possible.

I created the method below. I have not used it for huge queues yet, but I post it here in the hope that better options if available might get posted too.


texts: How to add attachment in views slideshow

texts:
Goal: Putting text as an attachment on views slideshow

Theme: Bootstrap

Drupal: 8

Content type: Slideshow which has two fields: image and text

Added two nodes of the content type.

Created a slideshow block using views and bootstrap carousel. Slideshow is working just fine. Slideshow just displays the image/slide field.

Below shows just the views block for slideshow.

Now, I like to put the text field as an attachment (putting the text on top of image in the slideshow) to the views block.

Views > Add > attachment > after that I am lost. I am not sure what setting to use to put the corresponding text field on each image slide.

Below shows I added the attachment in view but when I visit my site, I only see image slideshow and I do not see the text (slide-img) on the slideshow as an attachment.

Please advise.


texts: Performance Considerations When Setting the Cookie Expiration Date

texts:
Are there any performance considerations to take into account when setting a Drupal cookie to expire 10 or 20 years in the future?

I know it's not possible to set a cookie to never expire as per the cookie specification, but I saw people showing ways to set a cookie expiration date of 2038 on this Stack Overflow thread:

https://stackoverflow.com/questions/3290424/set-a-cookie-to-never-expire/3290474

I  know Drupal has a sessions table in the database. I went through ours and saw that the records were not too long.

I'd expect the sessions table to get longer once we set garbage collection far into the future.

I guess one consideration to take into account for Drupal would be the database resources like memory and hard drive capacity and also average number of users every month.

The only other drawback would be MySQL would have to look up the session record for each hit. With an extremely long table we might start seeing performance degradation. We currently have about 1000 records with the default Drupal cookie and garbage collection settings.

I guess one approach we could take would be to set the cookie to expire far into the future and then see fast how the sessions table fills up.

I guess what I'm asking is are there any other performance considerations that I have not mentioned that I need to be aware of?

Also, would Drupal create a new session record in the DB for each hit by a spambot? I know they are constantly searching the web for places to spam and that Google Analytics may not be reliable for counting the number of hits in this situation. These can add up pretty fast.

This question is for Drupal 7 but any advice on Drupal 8 is also welcome.


texts: How to filter content in Views based on multiple term custom fields?

texts:
I'm trying to find a way to filter Views through contextual filters based on custom taxonomy term fields. Here is an example:

Content type: Article
Taxonomy vocabulary: Tags
Tags custom field: UniqueString

When I create an article, I assign tags to it. To every tag (taxonomy term) I assign an unique string. Example:

Article title: John Smith's best songs
Tags: John | Guitar
UniqueString for tag John: uid1
UniqueString for tag Guitar: uid2

Now I want to display articles that are tagged with both John and Guitar. This works:

Contextual filters:

Content: Has taxonomy term ID
Content: Has taxonomy term ID

View page path: views/taggedby/%/%

Path views/taggedby/john/guitar will display:

John Smith's best songs

However, I want to filter based on UniqueString value and not on tag names:

Relationships:

Content: Taxonomy terms on node

Contextual filters:

(term) Taxonomy term: UniqueString
(term) Taxonomy term: UniqueString

View page path: views/taggedby2/%/%

Path views/taggedby2/john/guitar will display an empty view. What's confusing is that everything works when there is only one filter and the path is views/taggedby2/%, so there has to be a way to make it work with multiple filters as well. E. g. if I change View page path to views/taggedby2/% and use guitar as an argument, it will display:

John Smith's best songs

How to make it work with two (or more) arguments?


texts: Adding protection against hotlinking to .htaccess breaks generation of styled images

texts:
Drupal 8.3.4, Apache, Image Magick toolkit (via Imagick module).

I recently discovered some annoying hotlinking to my site siphoning my bandwidth and decided to disable it. Added the following to /sites/default/files/.htaccess:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://[my-domain] [NC]
RewriteRule .(gif|jpg|jpeg|bmp|zip|rar|mp3|flv|swf|xml|php|png|css|pdf)$ - [F]

The hotlinking stopped (my images don't display on rogue pages anymore), my site in general seems to be working well BUT styled images stopped being generated. Any attempt to access a styled image not yet generated results in error 403.
Evidently the lines in the .htaccess somehow interfere with the toolkit (or its Drupal wrapper) operation but I can't figure out in what way. One thing that is clear is that as soon as I revert the .htaccess back to default things start working (including hotlinking) and as soon as I reintroduce those lines both hotlinking and styled image generation stop working.
Will appreciate any insight.


texts: How to use Taxonomy to tag/categories content?

texts:
I installed and enabled the Taxonomy module, created an Event content type, and a "International Competition" node of that type. I want to apply the tags senior, male, and annual to this event.

I can't figure out how to do this. I've tried reading the documentation for the Taxonomy module but can't figure out where in the CMS I am supposed to associate tags to a node.


texts: Give permissions to user of the same role

texts:
I'm working in a site and I've to set node permissions (edit) so that a user can edit a node that is owned by a user of the same role.
If I have the role "redactor" I can edit any node that is owned by a user that as the role "redactor".
Is there a module that do this?

Or I've to write a custom module?


texts:
One of my clients insists on using WAMP for hosting Drupal 7. I've always been using Ubuntu for development, but now I have to work with WAMP. I do much Drush administration with sql-dump and modifying Drupal from the command line. I tried Drush on windows, but it is PITA to use.

What are some ways to use Drush as close as possible to the Linux versions? For some reasons, some Drush commands don't properly work on Windows. I usually use drush sql-dump > backup.sql, but in Windows there is no equivalent to that.


texts: Validation after all other validations were successful

texts:
I have a form with several form fields and two validation handlers.

function my_module_my_form_validate_integer($element, &$form_state) {
 // validation stuff
}

function my_module_my_form_validate($form, &$form_state) {
  // even more validation stuff
}

I'd like to validate a form field, but only after all other validations were successful. Is there a way to do that?


texts: "Image Upload Button" section remove after click on upload

texts:
I am trying to edit users's  profile page in Drupal 7. I have an image upload button there, but it remove (hide) after click on upload button .

But If i login with admin its working fine, means image upload section is not hiding on upload click.

Any suggestions ?

Thanks


texts: How to return a specific value when using entity_load?

texts:
I want to loop through Paragraph bundles and return a string (image path uri string).

I can view the Paragraph arrays as such:

foreach ($variables['field_paragraphs'] as $i) {
  $entity = entity_load('paragraphs_item', array($i['value']));
  dpm($entity);
}

This returns each Paragraph bundle as an multidimensional array. I want to take the value of each uri key and place them in their own array.

To that effect I have tried $image_path = $entity['ParagraphsItemEntity']['field_image']['und']['0']['uri'];, but it returns nothing.

I've also tried making a function.

  function array_column_recursive(array $haystack, $needle)
    {
        $found = [];
        array_walk_recursive($haystack, function ($value, $key) use (&$found, $needle) {
            if ($key == $needle) {
                $found[] = $value;
            }
        });
        return $found;
    }
    print(array_column_recursive($entity, 'uri')[0]);

This gives me an error message.

  Fatal error: Cannot redeclare array_column_recursive();

(It doesn't seem to matter what the function is named; it will always have this error.)

Would anyone know how to simply get a value from a multidimensional array in Drupal?


texts: Variable passed into a preprocess function has incorrect data or or an unexpected format

texts:
I wanted to change some of the forum’s topic's preprocessing. So I copied template_preprocess_forums() into a custom module (myModule), and renamed the function myModule_preprocess_forums().

I get an error that a method cannot be used on a string, $topic. I inspected. When the code is looping through the array $variables['topics'], it expects each array item to be an object.  However, in $variables['topics'] there are items that are strings and arrays and no topic objects.

To debug, I inspected $variables['topics'] in the Forums module, but all the  items are objects, as expected.

Why would the values passed to myModule_preprocess_forums() differ from what template_preprocess_forums() implemented by the Forums module gets?


texts: All of my content nodes are showing up as public /content dump pages?

texts:
I'm not sure if I can explain this correctly, I just started working in Drupal 7 last week, and I'm working with an established site.

We sell products. Each individual model is classified as a content type, but does not have its own URL. Somehow we have /content pages (like ourwebsite.com/content/model#) visible to the public that contain all of the information on each model, just dumped into an ugly list. These pages are ranking in Google and getting traffic. I don't know why they are visible, I've tried turning off URL alias and it doesn't work. I know I can do redirects, but we have over 1500 models and that would take a very long time. I'm wondering if there's a node or view setting somewhere that I'm missing.

Thank you!


texts:
I have boost set up and uses the following site URL structure :

www.website.com/postcode/suburb+name

So sometimes the Suburb Name might have a space it in. So in that case, all urls use "+"

Now when I check the actual cache file Boost created I get :

/cache/normal/www.website.com/postcode/suburb name

So boost is creating the cached file, but when I visit the page I can see it isn't being used.

However, if I manually rename the cached directory to :
/cache/normal/www.website.com/postcode/suburb+name

(I manually replaced the directory "space" character, with the "+")

Boost will now serve up the cached file.

So is there a better way to handle urls with spaces, %20, + in it with Boost?


texts:
Its drupal 7 wesite.

suppose:I have a domain . url --> www.pqs.com

I need a multisite with this url. I have two sections in this site one is Civil construction and another is Electromechanical .

When i load the URL ,there will be a landing page loaded .This landing page contains two links, one is Civil construction and another is Electromechanical .

so the url for each section maybe www.pqs.com/civil    &  www.pqs.com/electromech.
The design layout ,contents and menus for both sections are different.

Is it really a multisite?   I don't want subdomains for this.

How can i accomplish this in drupal 7 by a professional manner?

Please suggest me an effective method.

-------------------------------My Edits---------------------------------------

i found multisite_wizard and installed in my test server.
Remark: i installed the site in my test server pqs.com/prosq/ . prosq is the drupal installed folder.
In Sites.php file i entered the following line:

$sites = array('pqs.com/prosqa/Civil'; => 'Civil','pqs.com/prosqa/MEP'; => 'MEP' );

When i configuring the module i am stuck on the following step:
 Create sites folders inside sites/ folder
Also i saw this message:

  Hint: the folders names should be the same as values of domain-folder
  array in the site.php file Folders to be created:
  pqs.com/prosqa/Civil,pqs.com/prosq/MEP

I created Civil,MEP in sites folder and refresh the config page.But i still saw the same.Please help me.


texts: Published checkbox field displaying in form footer instead of node options

texts:
In d8.4:

The Published checkbox field, which is part of the publishing options set of fields, is displaying at the bottom of the node edit form instead of with the other publishing options fields.

See screenshot:

I've tried reposition using the Field Group module and also unsetting the form with unset($form['options']['status']); and other variations with no success.

All I'd like is for that field to be included in the promotion options fieldset with the rest of the options.

The field is displaying in div.layout-region-node-footer - I' can't track down where that themeing is taking place.

Any help would be appreciated.


texts: How can I prevent users from entering invalid e-mail addresses at registration?

texts:
Sometimes users mistakenly input the wrong e-mail address upon user registration.  When this happens, they are unable to activate their account, because the password is e-mailed to their e-mail address (or, in my case, I'm actually using Logintoboggan, but they still need to click the link in their e-mail before their account can be activated).

Often in this situation, the user will realize their mistake and simply re-register.  This is ok, but then I have to clean up the accounts that never get activated, which is a pain.  I've noticed that the Drupal 7 registration will accept a bad domain in the e-mail address by default (for example, yahoo.co.jap, which is an invalid TLD).  When I realized this, I thought surely someone has already written a module to cover this use case (making sure users input a valid e-mail address on registration), but I was unable to find it.  Does such a module exist?


texts:
So I have an entity reference field on a node, the widget is a select-box.

I want so that an user can choose one of their own authored nodes as a reference OR if an admin is logged in, they can choose any content. So admins should be able to bypass this restriction (with a permission, role or something).

I tried building a view based on this, but the contextual filter seems to be the problem. I can't really do any either/or kind of thing with contextual filter.


texts: Can I use content affiliation without using a real subdomain with Domain Access?

texts:
The Affiliated Content system invoked by Domain Access is perfect for my need to allow multiple "sub-sites" to run from one Drupal installation (i.e a multi-site approach to each part of a larger organization).

However, I can't use subdomains. Is it still possible to Domain Access to partition my D7 site into "domains" of ACLs, users, content, etc. if I'm only allowed to edit the path after "hostname/"?


texts: How to display custom field using Views module at front end

texts:
I have created custom content type having below fields

Title, Description, Small Image, Large Image and Category

I am using Views module to display that content  (only small image) in Grid format with 4 columns. Issue is that i don't find any option (Settings of my view) to display only custom field  at front end. The only thing i can see is title is being displayed in grid format.

Does that mean Views module does not show custom fields created for a custom type content at front end?

*SOLVED*

Never mind guys. I got solution. Once you go to your view (created using views module) edit page then at the bottom of the page there is a section called Content having options to add custom fields in view.


texts: How to translate the description metatag for a view

texts:
I have a multilingual site based on drupal 7 with Internationalization i18n and Metatags modules.
I made a multilingual view and it works fine, I could translate all entities except the view-description (and of course the metatag description).
I would like to have for each language a different meta tag description of the view.

As I can read in this issue, it seems there is still no solution.

Is there any workaround?
Thank you for replying.


texts: Options in facets disappear when more than one value is selected

texts: We have setup a custom search with Search Api and Search API Solr Search. In a facet we want to allow the selection of multiple values, with the normal link widget. We have configured the facet to use the OR operator. Everything works as expected until we select more than one value. With more than one value selected, the search result is still correct, but all other options disappear. This is not the behaviour we want, we would like to continue displaying all options, in the same way it works after the user selected a single element.


texts: Flush cache of individual node when updated?

texts: Is there any way to have an individual node's cache flushed if it gets updated? (instead of having to flush drupal's entire cache to show the changes to anonymous users immediately? (Rules or a module maybe?)


texts: DOMPDF not showing images and writing empty tmp files via print module

texts:
I recently moved a Drupal 7 website from my development server to my pre-production server, and the rendering of the images from both the Body field and various images fields stopped working.

I now see "Image not found" and the URL of the image (which is working when I click on it by the way) on the generated PDFs.

The URLs from the Body field look like this "/mywebsite/sites/default/files/myimage.jpg" and the URLs of the "Image" fields are complete URLs with "http://mydomainname.com/mywebsite/……".

www-data has access to the images files and can also write in /tmp.
And it does, actually, every time I generate a PDF with images. But the files are empty:

$> find /tmp -name "*dompdf*" -ctime -1 | xargs ls -lArth
-rw------- 1 www-data www-data 0 janv.  4 15:30 /tmp/ca_dompdf_img_0DlQ4V
-rw------- 1 www-data www-data 0 janv.  4 16:01 /tmp/ca_dompdf_img_Tyvv8w
-rw------- 1 www-data www-data 0 janv.  4 16:27 /tmp/ca_dompdf_img_pa4m4V
-rw------- 1 www-data www-data 0 janv.  4 16:27 /tmp/ca_dompdf_img_5RzNHk
-rw------- 1 www-data www-data 0 janv.  4 16:28 /tmp/ca_dompdf_img_T21gUJ
-rw------- 1 www-data www-data 0 janv.  4 16:29 /tmp/ca_dompdf_img_OmWxt2
-rw------- 1 www-data www-data 0 janv.  4 16:33 /tmp/ca_dompdf_img_SmA57m

I tried checking "Access images via local file access" in the "print" configuration page, but with no luck.

This may be an issue related to the server configuration, since it was working before on the development server, but I'm running out of ideas…


texts:
I'm learning Drupal Commerce with a Commerce Kickstart installation. I understood in part the way products are displayed, with variation types and content types.

Have made some changes like visible/hidden product fields, and change the order product fields are displayed. But didn't get how, for example, in

http://demo.commerceguys.com/ck/bags-cases/commerce-guys-laptop-bag

the bag image stay positioned left side and others product fields right side.

I'm running Drupal 7 and Commerce Kickstart 2

Edit: See that image go left side because the variation type field is images. I've created variation type with variation type field image. If set do that way, the image stay in the same column as the other fields.


texts: What is the best practice to index remaining content with solr?

texts:
First please forgive me if this a recurrent question (I cannot find a solution otherwise).
I want to avoid waiting my cron to index remaining content with solr.
What is the best solution to have all the content automatically indexed??

I have done an alternative solution: I have created a cron job on my server where I run every two minutes the drush solr-index command.

What do you think about this solution? (Is it heavy to call every 2 minutes even if no content found?)

Thanks for your advices


texts:
Drupal 7.

Can anyone spot what could be wrong with this function?  I'm just trying to pull a taxonomy term or its parent.  The taxonomy is called "pubissue."

In template.php:

 function ain_core_getpubname() {

// Load the node from unaliased url
if ((arg(0) == 'node') && is_numeric(arg(1))) {
$node = node_load(arg(1));}

// first find out if it's level two or not
$query = "SELECT t1.tid, t1.parent FROM taxonomy_term_hierarchy t1 JOIN field_revision_field_pubissue t2 ON t1.tid = t2.field_pubissue_tid WHERE t2.entity_id = ".$node->nid;

    $result = mysql_query($query);
    print_r(mysql_fetch_assoc($result));

        $mytid = $row["tid"];
        $myparent = $row["parent"];

    if ($myparent == 0) {

        // No parent, top level
        $query = "SELECT t1.name FROM taxonomy_term_data t1 WHERE tid = ".$mytid;

        $result = mysql_query($query);
        $row = mysql_fetch_assoc($result);
            $pubname = $row["name"];
    }

    else {

        $query = "SELECT t1.name FROM taxonomy_term_data t1 WHERE tid = ".$myparent;

        $result = mysql_query($query);
        $row = mysql_fetch_assoc($result);
            $pubname = $row["name"];

        }

print $pubname;

}

Then in my node.tpl.php file:

    <div class="<?php print $node->type; ?>-pubname"><?php ain_core_getpubname() ?>

OK, so going with the suggestion below:

function ain_core_getpubname() {

// Load the node from unaliased url
if ((arg(0) == 'node') && is_numeric(arg(1))) {
$node = node_load(arg(1));}

// first find out if it's level two or not
$query = "SELECT t1.tid, t1.parent FROM taxonomy_term_hierarchy t1 JOIN field_revision_field_pubissue t2 ON t1.tid = t2.field_pubissue_tid WHERE t2.entity_id = ".$node->nid;

    $result = db_query($query);
    $row = db_fetch_array($result);

        $mytid = $row->tid;
        $myparent = $row->parent;

    if ($myparent == 0) {

        // No parent, top level
        $pubname = db_query("SELECT t1.name FROM taxonomy_term_data t1 WHERE tid = ".$mytid)->fetchField();
    }

    else {

        $pubname = db_query("SELECT t1.name FROM taxonomy_term_data t1 WHERE tid = ".$myparent)->fetchField();

        }

print $pubname;

Still not working.  Will continue to troubleshoot, I think I am on the right track.  Thanks again.


texts: 7 Ubercart hook_order for PayPal Paments Pro payment received

texts:
I've got Ubercart set up with Paypal Payments Pro and it is all working well, however, I want to set up the system so that when a payment is received (captured) in PayPal (after which the site successfully receives an IPN), an email is sent to our manufacturing plant to fulfill the order (including the order details, shipping address, etc.).

I am aware of hook_order but I'm not sure how to use it in this scenario (i.e., upon IPN), or whether there might be an easier way to accomplish this (without code, i.e., using Actions). It is OK if we have to code it, that is not a problem. Only want to know my options.


texts: Number of items in cart empty in only one vocab, for anonymous users

texts:
I use this code below to show the total number of items in the commerce cart block:

function mymodule_block_view_alter(&$data, $block) {

      if ($block->module === 'commerce_cart') {
        global $user;
        if ($order = commerce_cart_order_load($user->uid)) {
          // Count the number of product line items on the order.
          $wrapper = entity_metadata_wrapper('commerce_order', $order);
          $quantity = commerce_line_items_quantity($wrapper->commerce_line_items, commerce_product_line_item_types());
          if($quantity > 0){
            $data['content'] = ('Varukorg ('.$quantity.')');
          }else{
            $data['content'] = ('Varukorg (0)');
          }
        }
      }
    }

So if the total number of items is for ex. 3 I have a link that says

  Varukorg (3)

This works perfectly when logged in, and for the most part also for anonymous users. But when an anonymous user tries to look at products in a certain category (a taxonomy view), the $quantity variable gets the value zero. And the text shown is:

  Varukorg (0)

I have 7 vocabularies with quite a few terms, that I use to show products of different kinds. So why does my code above work for most of the vocabs, but not for all? I have read the post about "Disable SQL rewriting" (https://www.drupal.org/node/1269054#comment-6380586), but in my case this did not help.

I can just type /cart after the web root, which opens the cart with the correct content. It's just the $quantity variable above that gets the wrong value when an anonymous user is looking at certain taxonomy views, but not others.

Can anyone see what I am doing wrong?

UPDATE: Apparently, in the taxonomy pages where I cannot get the total number of items in the cart, the global $user variable does not work... I put this as the first lines in the function:

function mymodule_block_view_alter(&$data, $block) {
  global $user;
  drupal_set_message(t('User %uid',
    array('%uid' => $user->uid)));

And I get no message on the pages where I get the zero value. But on all the pages where the total number works, the message is shown. So why have I no access to the global $user, on just a few taxonomy pages, when not logged in?

UPDATE 2: I am an idiot... the problem was that some pages got cached by Boost the first time they were visited and of course, after that, they would still show that same page... Please close this question and sorry about the noise.


texts:
I'm building a custom dependent dropdown form with 2 select inputs.

I've managed to build the form inputs and update them accordingly, but I'm not able to get the dependent select's value in the submit hook.

I think this happens because I changed (via AjaxResponse()/ReplaceCommand) the $form in the AJAX callback, and as such, the second input values aren't updated in the $form_state.

My problem is that I have no simple way of knowing which options will be available either in the first-level select nor in the dependent select, since they come from a 3rd-party API.

Is there any way I can trigger the update of the #options in the dependent select, without having to render the nested dropdown and changing the $form so that the nested values are available in the submit hook?

Or, alternatively, is there anyway I can update the $form_state so that it knows the newly added #options of the second select?


texts: Problem with Go back link after submission of Webform

texts:
I programmatically created  a custom contactform using webform and it render into another page.Webform submission and redirection working in good.

But i can't come back to my contact page by clicking Go back link in the redirected page.


texts: Invoking Drupal core tests from within a custom module .test script

texts:
I am writing a simpletest test script, where I would like to enable my module, and then invoke a Drupal core test to ensure that my module is producing core-compliant results (in particular, I render a pager alternative to core's, and would make sure that, at its minimal setup, is equal to core's one).

Is there a way to do that?

Thanks for help

mondrake


texts: Multiple pagination of arbitrary array of objects

texts:
I have an array with this structure:

$things = array('term1' => array(Object, Object, ... Object),
                'term2' => array(Object, Object, ... Object),
                'term3' => array(Object, Object, ... Object),
                 .... etc...

I want to be able to generate output like:

Term1

* Object 1
* Object 2
* ... etc ...

 < 1, 2, 3 > (<-- that's pagination :D)

Term2

* Object 1
* Object 2
* ... etc ...

 < 1, 2, 3 >

Which each list of things paginated (assuming there are more than x of them).

Is there a way I can achieve this?

A template function I can pass each of the individual arrays of Objects into to get pagination?

If it matters, this is all taking place inside a block, in D7.


texts: User tabular data entry to build a budget worksheet?

texts:
I am trying to build a budget worksheet where users can enter their budget information and save that until the next time they need to update it.  Each user will only have access to their budget sheet.

I spent approximately 16 hours on trying to get Sheetnode and PHPExcel to work, but that is really buggy in my humble opinion (may also be my lack of knowledge).

I'm not really looking for a "how-to" but rather someone point me in another direction where I could possibly find success.  I don't really know what keywords to search in google for what I need to do, but I keep stumbling upon webform, which is a nice module, but does not do what I need at all.


texts: Module to edit field data on multiple instances/nodes (in bulk)

texts:
I've a need to allow my client to easily edit the price field for the projects (content type). In total there're about 1.5k nodes and he wants to change the price once and that it would be applied to all the 1.5k projects/nodes.

Is there a way to do it using some of the existing modules in an easy way, so that an amateur could make the change? Or can it be achieved by custom module, if so could you give some instructions in terms of how should it be done programatically?

I'm not a developer, but will pass it to my colleague, who's a developer. He tried to code a custom module, but it takes about 18min to update the field data for 1.5k nodes... So apparently something is not right.

Thanks.


texts: How to display a twig template via a controller's render array

texts:
I'm trying to do something you'd think was simple, but I don't find good documentation for it.

I'm trying to create a controller that displays a twig template.

I've done the following so far:

1) In my module directory, I've created a templates/ directory.  It contains a field-permission-description.html.twig file, containing mostly HTML text.  So far, I don't even have any {{ twig_variables }} in it:

Field permision text will be here.

2) I have a theme function in my MY_MODULE.module file:

/**
 * Implementation of hook_theme
 *
 * Since we have a lot to explain, we're going to use Twig to do it.
 */
function MY_MODULE_theme($existing, $type, $theme, $path) {
    return [
      'field_permission_description' => [
        'variables' => [
          'stuff' => NULL
        ]
      ]
    ];
}

3) In my controller, the function returning the render array looks like this:

  /**
   * A simple controller method to explain what this example is about.
   */
  public function description() {
    $build = [
      'description' => [
        '#theme' => 'field_permission_description',
        '#stuff' => 'some stuff',
      ]
    ];
    return $build;
  }

I clear the cache with drush, and go to the page. There's no error, even in the watchdog, but the content region of the description page is blank; the template does not render.

It's not a problem with the controller, since if I substitute something else (say, just a little HTML in a #markup key), it renders fine.

There's been a couple of answers a year or two ago, but these all have things that no longer work as of RC1.

What do I need to do to get a twig template to render the way I'm trying to do here?


texts:
i have three field to show in views: title,body,desc.
in desc
I choose rewrite results and then put those
[title]
[body]
but nothing shows up. i used inspect element by chrome, desc is here but empty.


texts: How can I concatenate two fields in a view?

texts:
I have a view set up to use the unformatted list type. I'm pulling in about 10 different fields, but would like to concatenate two of them onto a single line in the display. Is this possible?

Example: fields are Content: Session Number, Content: Title, Content: DateTime, Content: Speaker. Right now, all of them render onto separate lines. I'd like for the Session Number  and Title to be concatenated onto a single line, so I get S3 | My Session Title.


texts: Why am I not seeing CKEditor buttons on prod?

texts: Okay, so I configured the Full HTML text format and added some buttons to CKEditor locally in a Lando environment. Then I exported the configuration with drush cex, committed it, pulled and imported on production with drush cim. However, even though changes can be seen in admin/config/content/formats/full_html, buttons aren't there when creating content. Any ideas? I also cleared caches. I even changed permissions on sites/defaultrecursively to 777 before clearing caches through the UI.


texts: What hook should I use to attach a script to a content type?

texts:
I have this function from a standalone php script that redirects the user based off the user agent. In the process of merging this into Drupal and the script only needs to execute for a specific content type. Not 100% sure what is the best hook to use: hook_node_presave(), hook_load() or hook_node_view()?

Or should I run this as a template pre-process since this script requires the JS window.location embed?

Part of the code attached:

$web_user_agent = $_SERVER['HTTP_USER_AGENT'];
$current_page = $_SERVER['REQUEST_URI'];

if (!$web_user_agent = '[User Agent Placeholder]') {

    die;

} else {

    echo('<script type="text/javascript">

    if(self==top) {

            window.location = "'. $redirect_url .'";

    } else {

    }
    </script>');
    die;
}


texts: Allow users to upload files and attach to specific nodes

texts:
Here's what I'd like to do:

I have nodes A, B, C, and D

I want users to be able to upload files using a file field on node D, but then for those files to actually show on nodes A, B, or C, depending on what the user specifies during the upload process. So node D is just acting as an upload form of sorts -- it wouldn't show any of the uploaded files.

Is this possible to do with existing modules?


texts:
Is there a straightforward solution to do the dynamic select statements against another database on the same server? I fooled around with attempting to modify the documentation example to no avail.

// Create an object of type SelectQuery and directly
// add extra detail to this query object: a condition, fields and a range
$query = db_select('custom_module_db', 'table_foo')
  ->condition('table_foo.id', 0, '>')
  ->fields(array('id', 'field_1', 'field_2'));

$result = $query->execute();

My current database setup looks like this

AWS RDS Server
 ->production drupal database
   ->Drupal Installation Tables
 ->custom module database
   ->Custom Module Tables

Clarification the below method works fine against the custom module database without adding a specific settings reference for that particular database.

So was looking to see if I can use the db_select() function in the same way as db_query() without needing to go in and add another database reference.

 $data_set = db_query($query='SELECT * FROM custom_module.db.table_foo WHERE ......)

Then grabbing the resultset by

$results = $this->WeightedAverageFunction($data_set->fetchAll())


texts: How to give access to delete his own comments

texts:
I am using Drupal 7 and want user should be able to delete his own comment. I know that is it not supported by drupal 7 due to threading.
You can provide edit permission from "admin/people/permissions" but there is no option to provide permission of delete.

Thanks in Advance

Ref : https://www.drupal.org/node/777696


texts:
I am facing what I think it is a strange behavior...

I have a Basic Page with PHP code in it. In this PHP code, I have some "Print".

Now, no matter the page I am displaying on the website, I got those prints in the bottom of my page...

Is that normal? How can I change that?

Regards!


texts:
I work on a Drupal 7 intranet site for a large company. The firewall on the server it is housed on currently does not allow any access to the Internet. I've been upgrading Drupal core and modules by downloading them to my pc and accessing the server with remote desktop client.
What are the most minimal holes that we'd have to punch in the firewall for Drush to be able to download updates from drupal.org.
Would just opening up port 22 do the trick?


texts: webform select options validation unique

texts:
I need to prevent two different users from choosing the same option from a webform select options component. In the validation only validation required available, no unique validation.

For example: my select contains the following: 1|1, 2|2, 3|3. AnnonUser1 chooses option 2. AnnonUser2 should be presented with 1|1 and 3|3.

How can I validate unique for this select options component. I tried webform validation, but it does not provide unique validation for select options component as well.


texts: Drupal CAS redirection after login is failed

texts: I have been working on CAS SSO with drupal 7 and the authentication perfectly works and cas redirect to drupal when I install drupal and CAS in different machine. But when I put both drupal portal and the CAS server in the same machine and tried to login. It go to cas to authenticate and after it returns from drupal I see the dead white screen does anybody help?


texts: How to access a custom field in a field twig loop?

texts:
I have a content type article which have a field repeatable "related content"

I use a field twig where I have this  loop

{% for item in items %}
    {{ item.content }}
{% endfor %}

It works very well : it displays title of the article and a link to the content.

I would like also to display some subfields associated with this content but I'm not successful.

I’ve tried things like  :

{{ item.content.field_date_mise_a_jour_article.value }}

but obviously it doesn’t work. item.content only contains url and title.

How can I do that ?

In node--article.html.twig, i can access the related content subfield like that :

{{ node.field_suggestion_articles.entity.field_date_mise_a_jour_article.value }}

How can I do the same in

field--field-suggestion-articles.html.twig


texts: Comment subject field too large breaks the page layout

texts:
I activated a contributed theme and I am doing some little customization. At the moment I have a 2 columns layout (content + second sidebar). Originally the theme was designed with a much larger content column hence after reducing its size I realized the comment subject field was too large for the content column.

Looking in the theme style.css file was of no help. I am trying to reduce the size of the comment subject field from 60 to 40 in the following portion of HTML code:

<input id="edit-subject" class="form-text" type="text" maxlength="64" size="60" value="" name="subject">

but I do not understand where/what part of drupal php code generates it. I am also afraid I will meet the same problem once the contact form is enabled.

Any help?


texts: Is it possible not to have $_GET values in views' exposed filters?

texts:
I can't seem to find a setting to do this nor am I familiar with any hook to implement this. Is it even possible?

I don't want to use ajax though.


texts: How to print and/or manipulate individual image attributes and suppress width and height via the image.html.twig template

texts: I had to get rid of the width and height attributes in my images and wanted to learn better the possibilites of Twig in Drupal.


texts: Does install.php open a connection with ANSI ON?

texts:
Please accept my warm regards . I need some guidance and light to move ahead.

I am from SQL Server background and has been doing some work on Linux machine offlate and making it connect with SQL Server. I have succesfully installed FreeTDS and can connect to Windows SQL Server machine. Now, I installing Drupal in Linux and during its installation it creates multiple tables in the database.

After creating few tables it quits. I traced and found that it stopped because it needed ANSI settings ON to create an index on the table date_formats  but found it off. I cannot set it at my DB because it chooses the client settings at the runtime.

I am not sure if Drupal install.php opens a connection with ANSI off settings because this causes the index creation to fail. Please help to investigate it.

Regards
Chandan Jha


texts: --root required for all drush 8 commands and I don't know why

texts:
Does not work:

root@deftig-web001:/var/www/1.websiteserver.net/platform# drush status --uri=dev052
 PHP executable         :  /usr/bin/php
 PHP configuration      :  /etc/php5/cli/php.ini
 PHP OS                 :  Linux
 Drush script           :  /var/www/vendor/drush/drush/drush.php
 Drush version          :  8.1.11
 Drush temp directory   :  /tmp
 Drush configuration    :
 Drush alias files      :

Works:

root@deftig-web001:/var/www/1.websiteserver.net/platform# drush status --uri=dev052 --root=/var/www/1.websiteserver.net/platform
 Drupal version                  :  7.59
 Site URI                        :  dev052
 Database driver                 :  mysql
 Database hostname               :  127.0.0.1
 Database port                   :  3306
 Database username               :  root
 Database name                   :  dev_dev052
 Database                        :  Connected
 Drupal bootstrap                :  Successful
 Drupal user                     :
 Default theme                   :  t_heftig
 Administration theme            :  t_heftig_admin
 PHP executable                  :  /usr/bin/php
 PHP configuration               :  /etc/php5/cli/php.ini
 PHP OS                          :  Linux
 Drush script                    :  /var/www/vendor/drush/drush/drush.php
 Drush version                   :  8.1.11
 Drush temp directory            :  /tmp
 Drush configuration             :
 Drush alias files               :
 Install profile                 :  heftig
 Drupal root                     :  /var/www/1.websiteserver.net/platform
 Drupal Settings File            :  sites/dev052/settings.php
 Site path                       :  sites/dev052
 File directory path             :  sites/standaard/files
 Private file directory path     :  sites/standaard/files/private
 Temporary file directory path   :  /tmp

But since I'm executing from the Drupal root, I don't see why --root is necessary. What am I doing wrong?

Drupal: 7.59
Drush: 8.1.11


texts:
I basically have a content type of companies and another of events. I would like to have a page with a select list of all companies and a select list of all events so that the user can choose what company is attending what event. This will need to allow multiple combinations.

Example: Company 1 will be at Event 1 and Event 2.

There will need to be list of all companies attending the selected event.


texts: simplesamlphp_auth installation fails on Centos 8-server

texts:
I am trying to install simplesamlphp_auth to Centos 8/Drupal 8 server according the instructions on:

https://www.drupal.org/docs/8/modules/apigee-developer-portal-kickstart/integrate-simplesamlphp-
authentication

When I run the given command I get the following output:

composer require drupal/simplesamlphp_auth:3.x-dev drupal/simplesamlphp_custom_attributes --prefer-dist
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Using version ^1.0 for drupal/simplesamlphp_custom_attributes
./composer.json has been updated
> DrupalProject\composer\ScriptHandler::checkComposerVersion
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - don't install drupal/simplesamlphp_auth 3.x-dev|install drupal/simplesamlphp_auth dev-3.x
    - Installation request for drupal/simplesamlphp_auth 3.x-dev -> satisfiable by drupal/simplesamlphp_auth[3.x-dev].
    - Conclusion: remove simplesamlphp/simplesamlphp v1.17.7
    - Conclusion: don't install simplesamlphp/simplesamlphp v1.17.7
    - drupal/simplesamlphp_auth dev-3.x requires simplesamlphp/simplesamlphp ^1.18.2 -> satisfiable by simplesamlphp/simplesamlphp[v1.18.2, v1.18.3, v1.18.4].
    - Can only install one of: simplesamlphp/simplesamlphp[v1.18.2, v1.17.7].
    - Can only install one of: simplesamlphp/simplesamlphp[v1.18.3, v1.17.7].
    - Can only install one of: simplesamlphp/simplesamlphp[v1.18.4, v1.17.7].
    - Installation request for simplesamlphp/simplesamlphp (locked at v1.17.7) -> satisfiable by simplesamlphp/simplesamlphp[v1.17.7].

Installation failed, reverting ./composer.json to its original content.

So it seems, that for some reason the new enough simplesamlphp-package is not installable.

I have tried (in vain, though) to harvest the web about this problem, which should not be totally uncommon IMHO.

Any hints how to tackle the problem?

wbr

Hank


texts: How do I change the label and help text of the publishing status checkbox?

texts: We recently updated our site to Drupal 8.4 and the widget for publishing a node has changed from a dropdown to a checkbox. Now, how do I change the label and help text of the checkbox? It cannot be changed in the field UI.


texts: Is it possible to hook_form_alter by path?

texts:
I have a basic hook_form_alter working but the issue is I cannot do it by form id as the id might be different in various environments, i.e. local, dev, production. So the usual method of altering by targeting a form ID is not ideal then.

I figured I could do this by path (as that won't change) but none of the usual methods work. I'd like to keep this in code so that's why I'm not simply changing the UI for this setting.

Here's my basic alter which works:

function MYMODULE_form_alter(&$form, &$form_state, $form_id) {
  $form['submitted']['donation']['amount']['#title'] = t('My new title');
}

However, if I do this, it does not work:

function MYMODULE_form_alter(&$form, &$form_state, $form_id, $host) {
  $host = $_SERVER['HTTP_HOST'];
  if ($host == "m.local.dev/donate" or  $host == "m.live.com/donate") {
  $form['submitted']['donation']['amount']['#title'] = t('My new title');
   }
}

I'm guessing what I'm trying to do is not even possible and therefore I'll try to figure out a different method.


texts: How do I rename a field for an existing content entity type?

texts:
I created a content type, and I used it.

/**
 * @ContentEntityType(
 *   id = "program_permission",
 *   label = @Translation("Program permissions storage"),
 *   base_table = "program_permissions",
 *   admin_permission = "administer site configuration",
 *   entity_keys = {
 *      "id" = "id",
 *   },
 * )
 */
class ProgramPermission extends ContentEntityBase implements ProgramPermissionInterface
{

  /**
   * {@inheritdoc}
   */
  public static function baseFieldDefinitions(EntityTypeInterface $entity_type)
  {
    $fields['id'] = BaseFieldDefinition::create('integer')
      ->setLabel(t('ID'))
      ->setDescription(t('The ID of the entity.'))
      ->setReadOnly(TRUE);

    $fields['download'] = BaseFieldDefinition::create('string')
      ->setLabel(t('Download'))
      ->setDescription(t('Download operation.'))
      ->setRequired(TRUE)
      ->setSettings(array(
        'type' => 'varchar_ascii',
        'max_length' => 1,
        'default' => self::TYPE_OPEN,
      ));

I need to rename the download field to program_download. How can I achieve this?


texts: How to I hide menu items based on its access to different roles?

texts:
I have a site with the following users

Administrator
Author
Normal user(authenticated user)

and the modules used for the following task are Nice Menu, Menu token and Print.

The site contains of books and the option shown for every book page is shown in fig.

Administrator and Authors will have access to every option.
Authenticated user is not able to Edit Page and access the Page History.

By configuring the print module and using tokens I have accomplished the task, but it shows an "Access Denied" error when an authenticated user tries to select that option.

Is there a way to hide the "Edit Page" and "Page History" option for authenticated user and keep it visible to Admin and Authors?

Thank you in advance,
Ajit


texts: Fields not appearing in View Rest API unless Bypass group access control

texts:
I have a simple content type with lots of fields that I am attempted to expose via the views api. When calling from Postman as an unauthenticated user some of the fields are coming up empty. The view doesn't have any relationships and the field type is Text(long).
When I goto permissions under group and Enable "Bypass group access control" the fields return as expected but obviously I don't want leave this open.


texts: Fetch Book field values on child level only once

texts:
I'm working on a project where I use the core Book functionality to create my sites structure. I have three content types:

Reader
Issue
Article

Where Issue is a child of Reader, and Article is a child of Issue.
For this project I creates multiple custom modules to:

Set books access permissions
Change the books frontpage
Set the books theme
Add custom css settings per book

For all these modules I create a field in the Reader content type. But I want all its child nodes to also be affected by these field settings.
Now to do this I use the following code (example is taken from my custom css module):
if ($node->bundle() == 'reader') {
    //if reader
    $book = $node;
} else if ($node->bundle() == 'edition' || $node->bundle() == 'article') {
    //if edition or article
    //get parent book
    $book = Node::load($node->book['bid']);
}

//get textcolor from book
$textColor = $book->get('field_textcolor')->getValue()[0]['color'];

But since I'm doing this in all my module I thought...this is not good for performance because I'm using Node::load multiple times for the same thing. So I want to improve this method, if necessary.
So is there a way to either:

Get the parent books field in a better way inside the modules?
Or, create global variables from the parent Book field values, so I have to only fetch them once for every website visit/visitor?


texts:
i was wondering is it possible to create custom menu named arguments in D7. I can do this

function MY_MODULE_menu(){
  $items['my/callback/%user'] = array(
    ...
    'page callback' => 'MY_MODULE_callback',
    'page arguments' => array(2),
    ....
  );
}

and it will load the user entity. So instead i want to do this:

function MY_MODULE_menu(){
  $items['my/callback/%my_entity'] = array(
    ...
    'page callback' => 'MY_MODULE_callback',
    'page arguments' => array(2),
    ....
  );
}

and my custom entity to be loaded.


texts: Getting a list of altered fields when saving a node

texts:
I need to trigger some logic to recalculate certain computed fields based on what fields may have been altered when a user updates a node. So I'm looking to create a function that returns a list of of fields the user has updated.

I've come pretty far by using hook_node_update().

Currently the process is like this.

My hook_node_update looks roughly like this:

function hook_node_update($node) {
  $old_node = node_load($node->nid);

  // Figure out what fields have been altered.
  $altered = _get_altered_fields($node, $old_node);

  // Recalculate the fields *after* node save.
  drupal_register_shutdown_function('_process_fields', $node, $altered);
}

And the _get_altered_fields function:

function _get_altered_fields($node, $old_node) {

  $changed = array();

  if ($old_node-> field_somefield != $node-> field_somefield) {
    $changed[] = 'somefield';
  } elseif ($old_node-> field_someotherfield != $node-> field_someotherfield) {
    $changed[] = 'someotherfield';
  }

  return $changed;
}

The problem with the above is that I get 'false positives' (i.e. 'someotherfield' gets registered as changed even though it is not) because the $node object does not have the exact same data structure as $old_node, which was fetched from the database. In general $node has more attributes - especially if it is a taxonomy field - such as 'vid', 'weight' and 'rdf_mapping'.

I tried creating a normalize function where I unset those attributes, but it gets very messy. I figure someone must have done this before me. Any suggestions how to do this in a clean way?


texts:
I am building a form with tabledrag and ajax "add more" and "remove item" buttons.

I tried different variations with '#type' => 'button' and '#type' => 'submit'.

Currently, pressing one of those ajax button always triggers form validation and then a form rebuild. (this means every element is processed twice).

If a user wants to add a bunch of items with required values, then validation errors will block and disrupt the "add more" mechanic, or they will show up with the error colors, which is all undesirable.

I experimented a bit with '#limit_validation_errors', but I am not sure this does what I need. If I understand correctly, this only suppresses the error output, but the actual validation is still executed.

I looked at drupal_process_form(). The validation and rebuild happens here:

  $form = form_builder($form_id, $form, $form_state);

  // Only process the input if we have a correct form submission.
  if ($form_state['process_input']) {
    drupal_validate_form($form_id, $form, $form_state);
    [..]
      $form = drupal_rebuild_form($form_id, $form_state, $form);

This means the form is processed one time, then it is validated, and later it is built and processed again.

For my purposes, the entire validation and rebuild could be skipped.
I managed to implement the "add more" mechanic in a value callback, so I don't need a #submit handler on the ajax "add more" button.

The code in drupal_process_form() suggests that I could skip the validation and rebuild by setting $form_state['process_input'] = FALSE. However, this also suppresses the detection of $form_state['triggering_element'], which means that ajax_form_callback() won't work correctly anymore.

I might figure something out here, but perhaps there is something simpler that I missed.

I think the problem is the same as described here, https://www.drupal.org/project/drupal/issues/2476569.
But I am not going to wait for this issue to be done for D8 and backported  to D7. I am looking for something I can do right now.


texts: Problem while using the user_reference field in my bundle

texts:
I am creating an entity for my D7 Module and trying to include a user_reference auto-complete field in it. The autocomplete-field shows up correctly with the add-more option since I have set cardinality to unlimited.

However, nothing shows up in auto-complete suggestions and it doesn't accept any of the user-instances.

Even more annoying is that when I go and check the field settings in
Home » Administration » Structure » Content types » » Manage fields
and click on Save without making any changes, the suggestions start appearing correctly as they should.

I have written down the following settings for the field and the instance.

field :

'vocabulary_authors' => array(
      'field_name' => 'vocabulary_authors',
      'type'        => 'user_reference',
      'settings' => array(
        'referenceable_roles' => array('2','3'),  // for authenticated user + administrator
        'referenceable_status' => array('1'),    // for active
      ),
      'default_widget' => 'user_reference_autocomplete',
      'default_formatter' => 'user_reference_default',
      'cardinality' => FIELD_CARDINALITY_UNLIMITED,
    ),

instance :

'vocabulary_authors' => array(
      'field_name'  => 'vocabulary_authors',
      'label'       => $t(' Authors'),
      'bundle' => 'vocabulary',
      'entity_type' => 'node',
      'description' => '',
      'required'    => FALSE,
      'widget' => array(
        'type'    => 'user_reference_autocomplete',
        'settings' => array(
         'autocomplete_match' => 'starts_with',
        ),
      ),

Please help me out here. I think I am I missing out on some required settings.


texts: Remove config when uninstalling custom module

texts:
I have made a custom module with a config/install folder containing many yml files from a drush configuration export.
When activating the module , it does install the configuration.
How can i delete all this config when i uninstall the module ?


texts:
I'm currently setting up a template for comments and I want to use the url from the parent_permalink variable but I can't see from the documentation how to extract it (was hoping to use regex).

{{ parent_permalink|replace({'Parent Permalink' : 'Link' }) }}

Alternatively, I tried instead to change the visible text of the link 'Parent permalink' by using the replace() filter but this converted the entire variable to a string.

I'm kinda lost at this stage and would appreciate some help.


texts:
When I delete/cancel a user account from admin, I got the attached error.
It is saying that the table cache_entity_profile2 is not found. Yes, the table does not exist actually. I am using the modules entity cache and profile 2.
The error is not generated every time, but very often.


texts: How do we replace the token  in a custom module?

texts:
I am using the following in my custom module but the token is not being replaced. Is this a namespace issue?

$token_service = \Drupal::token();
$post_login = $token_service->replace('<front>');


texts: Internal Server Error outside of frontpage with Temporary file creation error

texts:
I tried to deploy a drupal 8 site (8.9.6) that worked fine on my drupal VM on to an uberspace7 shared hosting server. The frontpage does come up flawless, but once I try to go anywhere else (e.g. login, or just another content) an internal server error occurs.
THe PHP error log shows:

[07-Oct-2020 19:55:32] WARNING: [pool www] child 29743 said into stderr: "NOTICE: PHP message: > Uncaught PHP Exception Drupal\Core\File\Exception\FileWriteException: "Temporary file 'temporary://file9u5aCX' could not be created." at /var/www/virtual/$USER/staging/docroot/core/lib/Drupal/Core/File/FileSystem.php line 521"

the appache error log shows basically the same:

[Wed Oct 07 19:55:32 2020] [error] [pid 31659] mod_proxy_fcgi.c(860): [client IP-adress] AH01071: Got error 'PHP message: Uncaught PHP Exception Drupal\Core\File\Exception\FileWriteException: "Temporary file 'temporary://file9u5aCX' could not be created." at /var/www/virtual/$USER/staging/docroot/core/lib/Drupal/Core/File/FileSystem.php line 521\n'

I figured it might be an .htaccess error, maybe RewriteBase or something, but changing that did produce other errors and the error message does also not fit. The tmp directory is in ~/tmp and permissions should be correct, it also works fine for the production site. So I am not shure were to look. Any hints in the right direction appreciated.


texts: Error when trying to extend a db_select query

texts:
I'm trying to add a field to my query by using addField(). However, whenever I add this to the query I get a whitescreen and an apache error message on the line after. Any help in resolving this would be much appreciated.

Apache error log:

PHP Fatal error: Call to a member function extend() on a non-object

db_select query:

$query = db_select('z_revision', 't')
    ->fields('t', array('drupal_user_id'))
    ->addField('t', 'z', 'category')
    ->extend('PagerDefault') # error on this line
    ->extend('TableSort')->orderByHeader($header)
    ->limit(30)
    ->execute();

Ideally this would give me a two column table with headers 'drupal_user_id' and 'category' - all the rows in the category column having 'z' as a value.


texts: How do I limit the number of images displayed in a teaser?

texts:
I have a site with an image field that allows for unlimited images. I want the first image in the field to be shown in the teaser (for both listing and views). Is there a configuration option that will let me do this?

I'd rather not put in a self-written module (as it means I have to maintain it myself).


texts:
Can someone tell me that how can I call theme function, in Drupal 8, within other hook function?

Of course, we should write hook_theme function.

For example (in Drupal 7): theme('THEME_NAME');

What is wrong in below snippet:

function theme_sometheme($variables) {
   $another_theme = array('theme' => 'another_theme_for_test', 'arg1'  => 'value');
   return '<div>'. drupal_render($another_theme) . '</div>';
}

Note: Above code is not rendering anything.


texts: Drupal forum post not showing on forum index

texts:
I posted a new topic in the Drupal "Post installation" forum. When I clicked "Save", I got a new page with my post at the URL

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

The post is in a red box on that page. When I go back to the forum index, the post is not listed there. It's also not listed when I go to my profile and click on "Your posts".

I don't see any message that the post is awaiting approval nor anything in my dashboard saying that my account needs anything.

What's going on? I'm not likely to get a response if people can't see my post!

Thanks for your help.


texts: Configure visibility of block based on URL parameters

texts:
Is it possible to display a block only on a URL without any parameters? E.g. on:

my.site.org/search

but not on:

my.site.org/search?q=term

When I configure a block ('/admin/structure/block/manage/myblock') and set visibility for pages at: '/search' (see the picture), then the block is displayed on the page '/search?q=term' as well.


texts:
I'm having problems filtering a view. This is my case:

When a user registers he has to select some suppliers of a list (This is a term reference as a field of my user).

A user can also create a product. Now I would like to show the products where the suppliers reconcile.

This is an example:

USER 1 has suppliers A & B.
USER 2 has supplier A.
USER 3 has supplier B.

USER A can see the products of USER 2 and USER 3.
USER B can see products of USER 1, but NOT USER 3.
USER C can see products of USER 1, but NOT USER 2.

But I'm having trouble making this filter in a view. Could someone help me on my way on how to make this?


texts: Do Entity Field Queries respect grants and/or node access?

texts:
"How to use Entity Field Queries" contatins the cryptic piece of information,

->addMetaData($key, $object)
Adds additional metadata to the query. One important usage of this method is to run the query as another user, since EntityFieldQuery's fieldCondition will take current user's permission into account[...]

and there is a DANGEROUS_ACCESS_CHECK_OPT_OUT query tag that bypasses access checks, implying that access checks are run by default when EFQs are run. But this issue suggests that access checks are NOT run, UNLESS one is using fields in EFQ, in which case the "field_sql_storage_field_storage_query() function will always add 'entity_field_access'".
So... what? Do EFQs respect node_access by default, or do you have to do something to invoke node_access?


texts: Remove confirmation page in Drupal Installation Profile

texts:
I'm doing some maintenance on a an installation profile I wrote for my small team. One of the annoyances that I am trying to remove is the confirmation page after the install is finished ("Congratulations! You have successfully installed Drupal"). Is there any to skip this page if the install is successful?

So far, the core install_finished function, seems to be the only thing I can find that actually handles this step. But I'd rather not kill kittens over this : )


texts: How to make author name hyperlinked to it's profile

texts:
For my site this is the sample page. Users are submitting articles and I (as admin) am creating myself a new page node and pasting the user article into it. At the same time I'm changing the author name to that of user's.

I've two questions:

The author name( in this page it is some "clifflowe") is not hyperlinked to the user profile but when I see in as admin it is hyperlinked. How to make it hyperlinked for all users?
Secondly after I create a new article page and simply change the author name with that of another user, will that user get any added permission on this article? Who is the original owner of this article then?


texts: Value in my custom base field added to user entity isn't saved

texts:
I've created a new custom basefield for user entity type like this:
function hd_is_integration_entity_base_field_info_alter(&$fields, \Drupal\Core\Entity\EntityTypeInterface $entity_type) {
  if ($entity_type->id() === 'user') {
    $fields['is_uid'] = BaseFieldDefinition::create('text')
      ->setName('is_uid')
      ->setLabel(t('IS User ID'))
      ->setDescription(t('ID of this user in HD IS.'))
      ->setSettings([
        'max_length' => 50,
        'text_processing' => 0,
      ])
      ->setDefaultValue('')
      ->setDisplayOptions('view', [
        'label' => 'above',
        'type' => 'string',
        'weight' => 0,
      ])
      ->setDisplayOptions('form', [
        'type' => 'string_textfield',
        'weight' => 0,
      ])
      ->setDisplayConfigurable('form', TRUE)
      ->setDisplayConfigurable('view', TRUE);
  }
}

I've also updated the entity schema with update hook:
function hd_is_integration_update_8001(&$sandbox) {
  $field_storage_definition = BaseFieldDefinition::create('string')
    ->setName('is_uid')
    ->setLabel(t('IS User ID'))
    ->setDescription(t('ID of this user in HD IS.'))
    ->setSettings([
      'max_length' => 50,
      'text_processing' => 0,
    ])
    ->setDefaultValue('')
    ->setDisplayOptions('view', [
      'label' => 'above',
      'type' => 'string',
      'weight' => 0,
    ])
    ->setDisplayOptions('form', [
      'type' => 'string_textfield',
      'weight' => 0,
    ])
    ->setDisplayConfigurable('form', TRUE)
    ->setDisplayConfigurable('view', TRUE);

  \Drupal::entityDefinitionUpdateManager()
    ->installFieldStorageDefinition('is_uid', 'user', 'user', $field_storage_definition);
}

The field is displaying fine in the user edit form, but any value added in it isn't saved. What am I missing, please?


texts: Unattended automatic security updates / upgrades

texts:
What is the best way to get Drupal to automatically perform security updates? And are people commonly employing such a method?

For motivation, consider this: Drupal just released a PSA about a recent vulnerability saying:

  ...You should proceed under the assumption that every Drupal 7 website was compromised unless updated or patched before Oct 15th, 11pm UTC, that is 7 hours after the announcement.

Fortunately I caught this one and performed the update manually one hour after the announcement. But what if I hadn't? I'd like to have an automatic update process in place to give me some piece of mind.

And I'd like for this automatic upgrade system to only apply security updates. (It just doesn't seem worth the risk to bother with potentially breaking some functionality after an update, unless the update is critical.)


texts: I assumed the settings from the function system_performance_settings were stored in variables, but couldn't figure out which.


texts:
I build a site that require lot of taxonomy terms.
I have products and i want to categorize by manufacturers.
But in every manufacturer i want to have 5(or more) basic sub-category for parts.

Manufacturers
-BMW
--Doors
--Lights
--etc
-Audi
--Doors
--Lights
--etc

the

--Doors
--Lights
--etc

will be the same in all Cars(audi /bmw..).

I have create the (Car Manufacturers) and now i have to add for every one the sub-category parts......

I don't want to add every taxonomy with hand for every Manufacturer....

Is any easy way to be able to reuse some taxonomy terms?

What i trying is to have 4-5 views for (parts) and somehow every Car(BMW/audi...) when i go Manufacturers/Audi/doors they will show me the view with Part doors for the audi .

Pontus Nilsson has a Brilliant idea to have 2 fields for Manufacturers(audi/bmw) and for part(doors/light...) when i add new product.

The question now is how i can make the paths look like Manufacturers/Audi/doors without make every taxonomy term my hand and link them without make 100 views..:/


texts: linking multiple node types to each other

texts:
I have 2 node types, complaints and solutions.
Every node type has multiple fields.

How can I link multiple solutions to a complaint?
And the other way around, how can I link a solution to multiple complaints?

-Complaint1 -> Solution1, Solution2, Solution3

-Solution 1 is linked to Complaint1, Complaint2, Complaint3

With entity reference I can only link one on one relations.
The relations module seemed promising, but it seems it's only for admin users.


texts: How do I make use of OG permissions in the context of menu links?

texts:
I've been trying to get a menu/tab link to display on an OG node (i.e. at /node/%) using the following code. This is on Open Atrium.

/**
 * Implements hook_menu()
 */

function space_tabs_override_menu() {
  $menus['group/node/%/admin/people'] = array(
      'title' => 'Members',
      'description' => 'Shows the members and the roles of every member in the Space',
      'access callback' => 'check_og_permissions',
      'access arguments' => array(array('manage members')),
  );
  return $menus;
}

/**
 * Check OG permissions, see if there's permission to administer members.
 */
function check_og_permissions($permissions) {
  if ($node = menu_get_object()) {
    // Get the nid
    $nid = $node->nid;
  }
  foreach ($permissions as $permission) {
    if (og_user_access('node', $nid, $permission)) {
      return TRUE;
    }
  }
  return FALSE;
}

So, after writing the above in a space_tabs_override.module, I'm unable to get the tab to show in, say, /node/51. I also tried to browse to the link directly /group/node/51/admin/people, and ended up getting an Access Denied page, despite having the required permissions.

Other methods that I've tried is to use the og_get_entity_groups() function. Replace the code below

  $groups = og_get_entity_groups('node', $nid);
  foreach ($groups as $groups_t) {
    foreach ($groups_t as $gid) {
      foreach ($permissions as $permission) {
        if (og_user_access('node', $gid, $permission)) {
          return TRUE;
        }
      }
    }
  }
  return FALSE;
}

Any thoughts?

2015-07-28 : I still haven't found a solution to this question. I should mention I even forced the 'access callback' to have a value of TRUE. That, according to Drupal's docs, should've forced everyone to have access. It seems like there is some hook that systematically takes back the permissions when an object has a certain menu. I tried re-overriding this with hook_menu_alter, but that didn't work either. I tried increasing the module weight and that too, didn't work. Really, how should I do this? Speaking of which, I remember there's something called entity_load() and entity_save(). This is what I'll be trying next. If anyone knows of a better method, please tell me.


texts: How to create a product without a variation?

texts:
I'm migrating to drupal commerce (kickstart 2) from woocommerce and contao isotope.

My biggest problem was/is understanding the terminology behind it - product types, variations, etc.

In woocommerce and isotope the product categories would be for example:
- Books
- Computers
- T-Shirts.

Each category would then have individual products in it, and each product would have optional variation.

I'm having hard time understanding this in kickstart2. More than that, is it even possible to create a product without variations? How can I create a store of simple unique products that would belong to different categories (woocommerce terminology), without variables.

For example:

Books: product1, product2, product 3, ... (no variables)
PCs: -- || --
...

Thanks.


texts: How can I add a caption to my navigation menu?

texts: How can I add a caption to a navigation menu in Drupal 6?  I am trying to achieve this effect:


texts: added in views header section is automatically closed: How do I avoid it?

texts:
I have added a div in views header (Custom text) section like this

This div's closing tag is added in views footer section. There are some rows  in field section as well. The Display output: template is as below

<?php
  print $header;
  print $rows;
  print $footer;
 ?>

So I am expecting the the result as

  /* header*/

row1
      /* In fields */

row2
      /* In fields */

                  /* In Footer*/

But what I am getting is

row1

row2

The div in header is automatically closed by drupal 7. How can i avoid that


texts: Display a custom field of a content type in template with PHP?

texts: I'm using Drupal 7.  I have a content type called Widget.  One of the custom fields is field_widget_position.  When I did a <?php print_r($page); ?> in the template, I can see the key-value pair of field_widget_position buried deep in the array.  Is there an easier way to get a handle on field_widget_position instead of typing <?php echo $page['somefield']['somefield2']['somefield3']['etc....']['field_widget_position']; ?>?


texts: Why running cron tasks would hit a REST service endpoint?

texts:
I can't run cron jobs from a single module or from core anymore. Somehow Drush hits a REST service endpoint.

I have configured some service endpoints for views, but why would cron jobs hit that? I cannot explain that myself.

The error message I get from Drush is the  following one.

  Services Endpoint "rest" has been setup successfully. Drush command terminated abnormally due to an unrecoverable error.


texts: Is it possible to use multiple captcha based on language selection?

texts:
I have a multi-language site.I wish to integrate captcha based on which language is selected.

Suppose if i selected language1 then captcha1
language1 => captcha1
language2 => captcha2


texts: How do I synchronize users and their roles between sites?

texts:
I've set up a multi-site Drupal installation. The main site is example.com and we also have a.example.com and b.example.com.

I own example.com, and I rent a.example.com out to Person A, and b.example.com out to Person B. They pay their site rent using the UberCart role-purchase feature on my site. I need a way to set up my site so that Person A and B can log into example.com and pay their site rent, and have the upgraded role transfer over to a.example.com and b.example.com as well, automatically so that after a month if Ubercart downgrades their role I don't have to go in and manually unassign them.

Things I've tried:

Shared users table. This doesn't work because I don't want Person A to be able to see people who have signed up for b.example.com and a shared user site means everyone can see everything.
Domain Access. This works ok but is really shaky, and I'm planning on moving up to z.example.com and onward in the future, so unless there's a way to keep things more separate than I was able to, I don't think this is feasible. For example, if each site has an 'about us' page then I would see 26 "About Us" pages from my uid=1 account. Additionally, I didn't see any way of separating the UberCart module as much as I would like. Ubercart Marketplace is a no-go because I'm not taking any commission like it was designed to do, and UC_Domain hasn't been upgraded to drupal 7 yet.
Account Sync. This seemed like the closest, but the plugin appears broken, I get tons of XML-RPC errors when I try it, and generally it doesn't work as described, and seems to only sync the first account before breaking. Google searching the errors brings back nothing apart from warnings that XMLRPC is potentially dangerous.
Bakery. This seems great but it doesn't share roles across subsites unfortunately. I've been trying to add that in, but before I spent the time I wanted to see if there's some other way that I can go about this

If anybody needs clarification on anything let me know, I really want to get this solved and can't find anything online.


texts:
I use the module "Bootstrap Login Modal".

How to redirect

/user/login

to

all over the site ?


texts: How can I change the number of items in a views View only for the first page?

texts:
Hi my friends!

This problem is described in an old post which has a solution.

The solution works well. But not perfectly. I explain.

I have 15 items. I set Views to display 8 items per page. But I want to show 7 ítems in the first page.

Everything works fine except pager. I have 15 items:

7 items in the 1st page
8 items in the 2nd page
Total: 15 items.

The pager should be 2 pages. But the pager shows 3 pages. If I click on the 3rd page of the pager, it leads me to the &page=2. Which contains no items.

How do I fix this?

Thanks in advance.


texts: Is there a way to search for instances of hook_views_query_alter() in my database?

texts:
I am running a D7 site that someone else built and I'm having trouble seeing how an SQL command in a particular view has been altered. In particular, the attributes in the SELECT statement appear to have been altered.

Is there a way to search my database to see if the person building the site added an errant hook_views_query_alter command that is the reason the SQL filter looks different than one would expect just looking at the fields in the View?

Or is there another, better way to debug this issue? Thanks for any help!


texts: Modal Dialog not Opening when not authenticated or in incognito mode

texts:
Hi i am using Drupal 8 to render a modal popup on clicking a link. However when i am connected as admin the popup render well but as soon as i logout or choose to be incognito mode of the browser the popup does not appear and the page is redirected to link set in the href tag. Here is my link :

SOME TEXT IN MODAL

Can anyone explain to me why this is so? I can't figure out why when i am connected the modal render well but when not connected it redirect me to the node.


texts: Adding Order Items to a Complete order and process the payment for newly added Items

texts: I want to add more items to a order that is complete using the default workflow. Is it possible to change the state of the order again to draft and accept payment for the newly added items in drupal 8 commerce 2


texts: How to set the comment body field to be required?

texts: I have created a comment section in my node. But it is not displaying the required option. if the comment is posted no validation occurs.


texts:
I'm trying to update Drupal from 9.1.8 to 9.1.9. However, running a composer update jumps to 9.2-beta2. I'm not sure how to fix it so that it sticks to the recommended version.
My composer.json has this...
"drupal/core-composer-scaffold": "^9.1.0",
"drupal/core-project-message": "^9.1.0",
"drupal/core-recommended": "^9.1.0",

How can I prevent my sites from updating past 9.1.x? It used to be a bit simpler with drupal/core but I know that's not the recommended package to use anymore.


texts:
I have taxonomy countries list with cities

Czech Republic
 - Prague
 - Brno
Germany
 - Berlin

Then I have content type position where I am using this taxonomy as select list. Now I need to create table with list of this content type.

Wanted result:

Country       || City
--------------||------
Germany       || Brno
Czech Republic|| Prague

I have created view for that, but I am not sure how to show parent of taxonomy term.

I have found that How to show the parent and child taxonomy term? but I do not see Taxonomy term: Term ID, Taxonomy term: Parent term at all


texts: Create multiple users roles and views at the same time

texts: I'm using D7, I need to create views and user roles, when I'm using the interface mode, it takes me too much time, how can I do that using code? or could you please suggest to me a module to install, that can create, for example 10 roles at the same time, or cloning a view 5 times at the same time.


texts:
We want to disable the locale module in Drupal site. Because some content was saved as language 'en' previously, disabling locale does not reset content and field database tables language field to 'und' or LANGUAGE_NONE. After disabling the module any nodes or fields that have been saved as 'en' are not displayed.

to fix this I created a module to update the entire database.

    $schema = drupal_get_schema();

    foreach($schema as $table =>$structure){

     if(isset($structure['fields']) && isset($structure['fields']['language'])){

           set_time_limit(0);

          db_update($table)
            ->fields(array('language' => 'und'))
            ->condition('language','en')
            ->execute();
   }
}

This code does not update the language field and i'm not sure why. Is it because the language field is an index?

also this should be incorporated into the locale module uninstall function to avoid other sites breaking in future.

Any help is appreciated

Origional post -- https://drupal.org/node/2106247


texts: what happened the ability to add PHP to the default value of a CCK field? Also, is it possible to set a CCK field to 'greyed out' or disabled by default? I don't need users editing this ref # field but I need admins to search it.