texts:
Getting

bash
PHP Fatal error:  Interface 'Drupal\entity\Entity\RevisionableEntityBundleInterface' not found in web/modules/contrib/media_entity/src/MediaBundleInterface.php on line 11
Drush command terminated abnormally due to an unrecoverable error.                                                                                [error]
Error: Interface 'Drupal\entity\Entity\RevisionableEntityBundleInterface' not found in
web/modules/contrib/media_entity/src/MediaBundleInterface.php, line 11

I found https://www.drupal.org/node/2722073, but we were already running media_entity-8.x-1.0 with entity-8.x-1.0-alpha3.

Brought in a big merge, imported config and now everything fails with the above error. Even though core.extension.yml has entity as enabled, when rebuilding the container, cache_container does not have entity in its container.modules array.

Is there a way to fix this without data loss?


texts: How to add an entity API accessible serial field?

texts:
I have tried Serial, it works almost what I want, excepts I can't access my field via entity_metadata_wrapper('node',$myNode). Serial field can't be find in dpm($wrapper->getPropertyInfo()), I guess the reason is it lacks entity API support.

Can it be accessed via entity API? Is there any other similar module exists?

Thank you!


texts: drupal 7 block to show if page has taxonomy term

texts:
I want to have a block to show only if the current page has a certain taxonomy term and was planning on using the block visiablity settings.

where Pages on which this PHP code returns TRUE (experts only). and need php code to find out how to tell check if taxonomy term is on the page and then the block will show up on nodes with that term.


texts:
Is there some simple code I can add to my page.tpl.php to call a block directly from the template file?

I cannot add modules to this site
Users need to be able to edit the contents of the block themselves


texts:
Is it possible to create a View that essentially a skeleton, and can be reused over and over again (on different parts of the site) simply using different input i.e. something like different node ID's?

I want to be able to create a new Views Slideshow Gallery (The gallery is a jQuery slider) just by adding content to my custom content type, Photos. The way I have it set up now, I have to create a new Photos content type, keep it not published, and then plug that Node ID to a brand new View using the Views Slideshow formatting. As you can imagine this is quite a laborious task.

This question has applications outside my specific uses. The core question is, can you create a (dynamic?) view that will automatically take different inputs for use in a content type?


texts: Import images from Joomla com_exposé to Drupal 7

texts:
I'm transfering my website from joomla to Drupal 7, but I have about 500MB of images in the com_exposé in Joomla. The albums are organized in folders with the image files, and each folder, as a XML file containing the titles and such of each image.

<?xml version="1.0" encoding="utf-8"?>
<expose version="2.1">
  <picture _mngid="1">
    <title>FotoTitle</title>
    <image>
      <url>alb_100/img_1210610237_288.jpg</url>
    </image>
    <smallimage>
      <url>alb_100/img_1210610237_946_sm.jpg</url>
    </smallimage>
  </picture>
</expose>

Is it possible to import those images with the details from the XML file? I found a module to import the images but the data contained in the file isn't associated to the images.

Could I do this with a module, or could I code this myself? I have basic PHP programming skills, but no Drupal developing experience.


texts: Custom form that will change the hyperlink inside the email for a chosen radiobutton

texts: I would like to alter the content of an email sent to the user after someone choice form radio button list. The altered content of the email would be a hyperlink to a particular version of a software. How do I do it within the submit button with Drupal 7 ? Thanks


texts: Drush crashes Call to undefined function ctype_alnum() in ubuntu

texts:
I've installed drush on ubuntu 14.04 apparently successfully but attempting to use drush within my drupal 7 app yields this:

PHP Fatal error:  Call to undefined function ctype_alnum() in /home/sam/.phpbrew/php/php-5.4.34/lib/php/drush/includes/command.inc on line 896

OK, I'm still new at PHP but apparently my php 5.4.34 installed via phpbrew is calling it? From reading about this function on PHP I see that it's part of PHP 5.4. That said, it does not show up in my phpinfo() page. Looking around the web the few times I see this as an issue seems an issue with certain modules. My code using the drush installed on OS X shows no problems so perhaps it's not my code?

Ubuntu didn't seem to report errors on install and I'm not sure if I need to install some extension to my php or if there's something wrong with my code. Help me see where I need to fix this? thx, sam


texts:
I am using Feeds module (7.x-2.0-alpha8) to create nodes with CSV import.

Currently following patch Unpublish/Delete nodes not included in feed only provides the feature where if the entry is not there in the feed than delete the corresponding node.

However the above requirement doesn't seems to solve my problem. Following is my requirement

Under the CSV file I have one column called Delete, which stores Boolean value. If the entry has to be deleted than the value is 1 otherwise 0.

I wonder how it can be resolved. Any suggestions?


texts: How to hook bundle create/read/update/delete events?

texts:
There's an ongoing discussion about how there should be CRUD hooks on bundle events, hook_entity_bundle_[create/load/update/delete/etc] (currently in the context of Drupal 8).

In the mean time, in Drupal 7, what's the closest thing we have to a hook_entity_bundle_create? To put it another way, how best to define a function that will be called every time an entity bundle is created, where the function can access data about that bundle?

The above link mentions the hook_field_attach hooks (the Field Attach API), but it's not clear which if any of these hooks will be called reliably on bundle editting.

It's be great to clearly get down what the current equivalent of bundle CRUD hooks are.


texts: Can't get Emoijone ckeditor plugin to appear on WSYISYG editor

texts:
I am trying to add the Emojione CKEditor plugin on a Drupal 8.3.7 site. I've created a module using the CKEditor API. I modeled it after both the youtube and smiley CKEditor plugin modules.

In my custom module, I've added the file src/Plugin/CKEditorPlugin/EmojioneCKEditorPlugin.php:

<?php

namespace Drupal\emojione\Plugin\CKEditorPlugin;

use Drupal\ckeditor\CKEditorPluginBase;
use Drupal\editor\Entity\Editor;

/**
 * Defines the "emojione" plugin.
 *
 */
class EmojionePlugin extends CKEditorPluginBase {

  /**
   * {@inheritdoc}
   */
  public function getButtons() {
    return array(
      'Emojione' => array(
        'label' => t('emojione'),
        'image' => 'libraries/emojione/icons/emojione.png',
      ),
    );
  }

  /**
   * {@inheritdoc}
   */
  public function getFile() {
    return 'libraries/emojione/plugin.js';
  }

  /**
   * {@inheritdoc}
   */
  public function isInternal() {
    return FALSE;
  }

  /**
   * {@inheritdoc}
   */
  public function getDependencies(Editor $editor) {
    return array();
  }

  /**
   * {@inheritdoc}
   */
  public function getLibraries(Editor $editor) {
    return array();
  }

  /**
   * {@inheritdoc}
   */
  public function getConfig(Editor $editor) {
    return array();
  }

}

The above is basically what both the ckeditor_youtube and ckeditor_smiley have. The relevant methods seem to be getFile() and getButtons().

I have the relevant ckeditor plugin sources under libraries/.

When I enable my module and clear the cache and go to configure text formats and editors at /admin/config/content/formats, I don't see the emojione button, but I do have buttons for smiley and youtube.

I've found this question and this answer, but in the answer, it isn't clear in what file the Template class goes. Also, the answerer mentions some custom js, but doesn't indicate where that goes either.

What am I missing?


texts: Modular Drupal content-type (variable sections)

texts:
I'm trying to build a modular and quite dynamic backend. I'm using Drupal for the task but haven't been able to spin my head around how to make it happen.

I need ideas on how I might solve this rather complex task.

To explain what I would like to end up with, I've faked a screenshot showing in steps what I would like the end result to look like.

Step 1

Step 2

My client wants to display his different cases. To make each case different, he wants a system where he can pick and choose how parts of his content is displayed. I suggested a modular approach where he can choose a "module type" in a dropdown, and fill in the needed fields.

There are plenty more, but for the sake of this questions, lets just stick with those.

Needs:

Possible amount of modules should be infinite.
Possible to fill in all information on the different 'modules' on the 'case' page.

Do you have any idea on how this might be solved?


texts: Is it safe to clone a EntityMetadataWrapper Object?

texts:
I want to clone an entity for multiple users, But some fields for each of them is different, Some fields are the same.

One way is to create the Entity for each:

// Doing in this in a loop for each user.
$e = entity_create('type', $info);
$e->{$same_field_for_all1}->set($value1);
$e->{$same_field_for_all2}->set($value2);
$e->{$same_field_for_all3}->set($value3);
$e->{$same_field_for_all4}->set($value4);
$e->{$fieldName}->set($this->getUserValue($user1, $fieldName));
// Set author and title for user here...
$e->save();

Another way is:

// Doing this only once
$e entity_create('type', $info);
$e->{$same_field_for_all1}->set($value1);
$e->{$same_field_for_all2}->set($value2);
$e->{$same_field_for_all3}->set($value3);
$e->{$same_field_for_all4}->set($value4);

// And doing this in a loop:
$clone = clone $e;
$clone->{$fieldName}->set($this->getUserValue($currntUser, $fieldName));
// Set author and title for user here...
$clone->save();

Is this sort of shallow cloning of EntityMetadataWrapper safe?


texts:
I used feeds to import a csv file into a customized content types that have 12 fields. I managed to create a view and display as table.

Right now I'm trying to write some php code to output xml based on the parameters users passed in url, and I'm having a little trouble on building up the query on selecting all 12 field_data tables.

Any suggestions? Thanks


texts: YouTube thumbnails - options for adjusting interface widgets and behaviour when clicked?

texts:
I wish to add YouTube videos to my site as links - I want to use a thumbnail of the video. I'm not concerned with which thumbnail used (as discussed here: How to control preview image in Youtube)

What I am concerned with is how the play etc. buttons look on a thumbnail (i.e. everything reduced in size from how it would appear in YouTube).

What options do YouTube themselves offer? And what about 3rd-party solutions?

Facebook for example does this quite well - the thumbnail is not too cluttered and will expand when clicked onto to a usable size to view the video at a reasonable size on the same page (an example of my requirement for behaviour when clicked).

Any examples of such customisations on Drupal sites, please? Thanks in advance :)


texts: Show Description Field on Individual Webform Submission Result

texts:
I would like to include the description field when viewing individual webform submissions for each component. The standard webform individual submission display shows the label and the answer, but the description field for the component is not shown.

I had a look at webform-submission.tpl.php but wasn't sure how I could modify this to include the description being displayed.

Can anyone tell me how I can get the description to display?

I'm using Drupal 7 with Webform 7.x-4.19


texts: After core update: Access denied after submitting form

texts:
We’re running on Drupal 7.73 and WebForm 7.x-3.30 – for a while now since the 7.75 to 7.77 Drupal release, we’ve been unable to update Drupal successfully.
As every time a user submits a form on the site, we’re getting an “Access Denied” message.
If you’re logged in as Admin it works. I believe it could have something to do with the “success message” that’s being displayed and that in theory, a redirect to a success page could fix it.
However, as we have many forms across several sites, it is not practical to go this route.
For two years we have had no problem updating Drupal to latest and no issues with WebForm so this is a new issue.
Can you please assist in providing a solution for this as we are unable to update to implement latest security fixes?


texts: Relationships block other content type from showing

texts: I have this views_slideshow and its supposed to show two content types, but shows only one. One is simple content type with image field (the one that is not getting showed) and other is commerce product type with relationships and contextual filters. So could this be something blocking this other non commerce content type from showing up? If I remove relationships for product, then it shows the Slideshow content type, but hides Products content type.


texts: Log into Drupal using drush uli via CURL on the command line

texts:
I'm trying to execute a CURL request via command line which uses drush uli to log into my site as an administrative user.  Then it's redirected to another destination url.

It works if the redirected url is a non-admin path available to anonymous users, but admin paths return a 403 Forbidden, which is something my site does for anonymous users trying to access admin pages.

This works:

curl -vk -L $(drush uli admin_username /node/1)

This returns HTTP 403 forbidden:

curl -vk -L $(drush uli admin_username /admin/structure)

The optional path parameter is being redirected to after logging in, but it's like when CURL gets there... it's not logged in anymore and is seeing the response as if it were an anonymous user.

Anyone experience this?


texts: Overriding a specific display doesn't work

texts: I created a view in Drupal 8 with 2 displays. I want to keep a display content view mode as teaser and the other as featured (custom), but when I change a display it updates the other display as well.


texts: How to fix entity property X doesn't support writing, when setting content type field values?

texts:
I've got a D7 content type with a few fields; nothing particularly special.  I want to be able to programattically change the values of those fields from time to time, and so wrote a function like so:

function set_field_value($field_name, $node, $value) {
    $wrapper = entity_metadata_wrapper('node', $node->nid);
    $wrapper->$field_name = $value;
    $wrapper->save();
}

This worked in a few test cases (like changing the title of a blog node), but when I try it on content type fields, I get an error like:

  EntityMetadataWrapperException: Entity property field_project_video_status_yt doesn't support writing. in EntityStructureWrapper->setProperty() (line 497 of ...)

What I'm doing wrong?


texts:
i use advanced forum. in permission page and comment module permission i  dont set post comments without approval for authenticated user but when authenticated user send post on forum it immediately appear in forum without admin approval.
but if this user add comment for a post it will add to approval list.
why?

edit: there is my mistake. when i dont set post comments without approval for authenticated user it works correctly (and user cant post comments) however authenticated user can create forum topic without approval.? how to handle this?


texts: Establish relationship between two text fields

texts:
I am stuck in a strange issue. I have two content types twilio  and call recordings. Both content types have caller phone number in common

Recording

Twilio

Now I would like to generate a report using views which can select field between two content types based on phone number.

In non Drupal terms I want inner join based on two text fields.

How can I achieve this?


texts: How do I free a variable set using variable_set()?

texts:
I have used variable_get(), and variable_set() in my form search, but when I visit another page, and come to the module again, it shows the previous results. How can I free the variable at the time of reloading the module?

/**
* @file
* The theme system, which controls the output of Drupal.
*/
function myform_help($path, $arg) {
    switch ($path) {
        case "admin/help#myform":
        return '<p>' . t("MyForm Module") . '</p>';
        break;
    }
}

function myform_menu() {
    $items['myform/newform'] = array(
        'type' => MENU_CALLBACK,
        'access arguments' => array('access content'),
        'page callback' => 'drupal_get_form',
        'page arguments' => array('myform_newform'),
        'access callback' =>TRUE
    );
    return $items;
}

function myform_newform($form, &$form_state) {
    //Create a list of headers for your Html table (see Drupal 7 docs for theme_table here

    $form['search'] = array(
        '#type' => 'textfield',
        '#title' => t('Search for Members'),
        '#size' => 60,
        '#maxlength' => 128
    );
    $form['submit'] = array(
        '#type' => 'submit',
        '#value' => t('Search'),
        '#submit' => array('myform_newform_submit'),
    );
    $header = array(
        // The header gives the table the information it needs in order to make
        // the query calls for ordering.
        array('data' => t('ID'), 'field' => 't.id'),
        array('data' => t('First Name'), 'field' => 't.fname'),
        array('data' => t('Last Name'), 'field' => 't.lname'),
    );

    if((variable_get('results'))!="") {
        $query = db_select('myform', 't')
            ->extend('TableSort')        //Sorting Extender
            ->orderByHeader($header)
            ->extend('PagerDefault')
            ->condition('lname',variable_get('results'),'=')
            ->limit(2)
            ->fields('t', array('id', 'fname', 'lname'));
        $results = $query->execute();
        foreach($results as $node)
        {
            $rows[$node->id]=array('data'=>(array)$node);
        }
    }
    else {
        $rows = array();
    }
    $form['pager_table'] = array(
        '#theme' => 'table',
        '#header' => $header,
        '#rows' => $rows,
        '#empty' => t('Empty Rows')
    );
    // attach the pager theme
    $form['pager_pager'] = array('#theme' => 'pager');
    return $form;
}

function myform_newform_submit($form,&$form_state) {
    variable_set('results',$form_state['values']['search']);
}


texts: How to link 1000 parked domains to nodes, each with node title corresponding to the domain name

texts:
I want to build a drupal site in D7 that can host thousands of parked domains as landing home pages. The purpose is to create a system for a domain broker to host many parked domains, each with its own sales page on its parked domain root.

The domain access module serves similar purpose but my experience is that it works for up to 10 domains, after that there are serious usability and performance issues arising.

So I'm looking for a simple alternative. What I need is only one page per domain, with the domain as title (example.com) and a contact form that potential buyers of the domain can use.

Assumption: the 1000 domains have been parked on the drupal installation domain.

If I create 1000 nodes hwith corresponding titles (example.com) how do I make each node the homepage of each parked domain? Maybe using .htaccess rewrites, but Im not good at that. The parked domain must stay as browser address when redirected.

Alternative might be to create one custom panel page and use tokens to use the domain URL in the title and the sales text and contact form. The contact form is just a standard contact form that sends an email to the site administrator.


texts: Possible to group views by date field larger than current date?

texts: I want to group my nodes into active and expired based on a date field. Currently I have the view set to group by this field but I don't want the active and expired groups to be broken down into specific dates such as 2 weeks, 3 days etc. I just want two groups, active and expired. How can I do this? An example of what I currently have http://www.glumbo.com/deals/footlocker.com-deals


texts: How to toggle price display with and without tax?

texts:
In Europe  it is normal for trade suppliers to show prices exclusive of VAT, but for retail suppliers to display prices including VAT.

For the use case where merchants who supply both trade and retail. Many e-commerce sites have the option to toggle the price display to show values with and without tax.

See https://www.tool-wise.com/ (radio button, top right)

Does such an option exist for Drupal Commerce? I haven't found anything in contrib.


texts:
I have taxonomy menu as the menu in my page.Here when i edit the taxonomy menu it is not getting updated in my menu.Can anyone help menu to fix this issue.

For example let say I have taxonomy menu item hello.Now i go to structure-->taxonomy-->Home page menu--->list links and I edited the hello to test.When I come to my home page it still showing the hello and it is not getting updated.


texts: How do I set administrator menu to be the same as this Drupal 7 menu?

texts:
I upgraded my site from Drupal 6 to Drupal 7.

The administrator menu is looks differently with Drupal 7 aministrator menu.

How do I set it same as the default Drupal 7 menu?

Drupal 7 administrator menu after upgrading

I want it became this administrator menu


texts: Inserting Block with Custom Input Filter Module via Shortcode Causing http 500 error

texts:
I have a custom input filter module, and I am trying to figure out why it crashes when I attempt to insert a block into a post via a shortcode. The method works perfectly when I am inserting a string, but when I try to insert a block, it causes a http 500 error.

Any ideas? I am using Drupal 7.15. Also, I have tried the insert_block module, and it generates a similar error...

Here is the input filter process that works (with a string)

function _related_links_filter_related_block_process($text, $filter, $format) {
   $shortcode_regexp  = "/\[block\]/";
   $output = "Text string inserted in via shortcode";

   return preg_replace($shortcode_regexp, $output,$text);
}

Here is the input filter process that causes the error (with a block)

function _related_links_filter_related_block_process($text, $filter, $format) {
   $shortcode_regexp  = "/\[block\]/";
   $block = block_load('block', 3);
   $output = drupal_render(_block_get_renderable_array(_block_render_blocks(array($block))));

   return preg_replace($shortcode_regexp, $output,$text);
}

Any help is appreciated!


texts: How do I migrate block content from a dev to a production site?

texts:
I've finally started looking at Drupal 8 seriously and I'm particularly interested in the configuration management. I've come across something that could be a little bit problematic and that's regarding custom block content.

I can see that the configuration management system is able to export block configuration - region, theme, weight, visibility etc. however the actual block content does not come across in the config export, which is reasonable and understandable.

On importing that block config to a production site, what appears to happen is the block config is created and a holding message is put in place, reporting the block is broken or missing. Obviously the block content doesn't exist on the production server.

How can custom blocks be migrated from a dev/staging server to a production server? I realise that blocks in Drupal 8 are fieldable entities like nodes and so will need to be migrated in the same way and I understand there is a Migrate API in Drupal 8 but this appears to be built for migrating content from Drupal 6 and 7 sites to Drupal 8 as opposed to Drupal 8 to Drupal 8 sites.

This issue is specifically regarding custom blocks as blocks generated by other modules such as Views will obviously migrate across as configuration.


texts: How are node and field tables related in MySQL?

texts:
I am working on a query that involves the field_data_body Drupal table, and I have been asked to return corresponding node ids for the relevant rows in field_data_body.

However, after reaching a copy of what I think is the accurate database diagram for Drupal databases here -

https://www.drupal.org/files/er_db_schema_drupal_7.png

I don't see how the node table relates to the field_data_body table, so I don't know what kinds of joins I could do to connect them.

I am a DBA working with the database so I am using only SQL. Although if there is a better way to return a report linking these two (in PHP, etc.) I'd be grateful if someone could let me know that, too.

Thanks for any help,
jrdevdba


texts: Does anyone know solution for adding pure javascript filter for View?

texts:
As in queston. I was googling and searching forum, but found nothing useful.

I want to setup dynamic filter for a view. Eg. http://silverwareconsulting.com/index.cfm/2008/10/2/jquery-autofiltering-table. One difference is that I need to take filter value from textfield.

Maybe this functionality is built-in in Views, but I missed that?


texts: Inject variables from Controller to Blocks?

texts:
I have a Product module that implement's an entity, a Repository, a Controller and 2 Blocks

The problem is, in the product page, I'm querying the entity in every block and also in the Controller. I'm trying to find a way to query ONLY ONE TIME, and then pass the result to the 3 parts (Blocks and Controller).

So for example, I have:

class SidebarProductBlock extends BlockBase {

  $repository = new ProductRepository();

  $product_id = $route_match->getParameter('id');
  $productObject = $repository->getProductByProductId($product_id);

  // Some more processing and return
}

class StoresGridProductBlock extends BlockBase {

// Here I query AGAIN

  $repository = new ProductRepository();

  $product_id = $route_match->getParameter('id');
  $productObject = $repository->getProductByProductId($product_id);

  // Some more processing and return
}

// And in the Controller I query AGAIN.

How can I manage to query the database just one time and use pass the result in all 3 parts?

The Blocks are always rendered in the same page


texts:
I have literally thousands of unpublished comments. I am wondering what is the easiest way to git rid of them altogether.

Thanks


texts:
I'm able to get second level of the main menu by using below code.

$menu = '';
$menuItems = menu_tree_page_data('main-menu');
foreach($menuItems as $key => $m) {
    if ($m['link']['in_active_trail'] && $menuItems[$key]['below']) {
        $menu = render(menu_tree_output($menuItems[$key]['below']));
   }
}
print $menu;

If I want to get 3rd (like in image below), 4th or 5th level. how this will be done.


texts: Domain Name language negotiation and mobile prefix m

texts:
I have a question regarding the domain name language negotiation.

I have 3 languages and the following domains:

de.domain.com
en.domain.com
fr.domain.com

When I set this as the domains for each language and use the domain name language negotiation everything works as expected.

My problem is that I have an adaptive mobile theme and I have to use following domains for that:

m.de.domain.com
m.en.domain.com
m.fr.domain.com

How can I achieve that those urls point to the correct language (de, en, fr). Now, all point to the default language (de).

Any help?


texts:
I'm trying to disable input fields of type date and checkbox in hook_form_alter with above code:

$key = 'field_name';

$form[$key]['widget'][0]['value']['#attributes']['disabled'] = true;
$form[$key]['widget']['#attributes']['disabled'] = true;
$form[$key]['widget'][0]['#attributes']['disabled'] = true;
$form[$key]['widget'][0]['target_id']['#attributes']['disabled'] = true;
$form[$key]['widget'][0]['#attributes']['disabled'] = true;
$form[$key]['#disabled'] = 'disabled';
$form[$key]['widget']['#attributes']['readonly'] = 'readonly';

Disabled all fields (type text or entity reference) but not work for checkbox and date fields.
Any ideas for solve this?


texts: How to get instance of referenced entity?

texts:
I have a node object with image field named field_image. When I do

$node
  ->get('field_image')
  ->first()
  ->getValue()

I get array with some properties instead of entity object. The array looks like this:

'target_id' => string '8' (length=1)
'alt' => string '' (length=0)
'title' => string '' (length=0)
'width' => string '587' (length=3)
'height' => string '458' (length=3)
'_loaded' => boolean true
  '_accessCacheability' =>
    object(Drupal\Core\Cache\CacheableMetadata)[1092]
      protected 'cacheContexts' =>
        array (size=0)
          ...
      protected 'cacheTags' =>
        array (size=0)
          ...
      protected 'cacheMaxAge' => int -1

Do I have to manullay load the file entity using target_id or there is a way to automatically get referenced entity object from instance of Drupal\image\Plugin\Field\FieldType\ImageItem?

Why the referenced entity is not accessible via getter? It could be lazy loaded if it's not available immediately.


texts:
I want to allow users to fill and submit a form even if they are not logged in, however if they are not authenticated yet, they should be redirected to login first, and after a successful login the submitted for will be really processed.

I will try to explain the solution that I did with a simple example:

function mymodule_menu() {
  $menu_items['custom/path/xyz'] = array(
    'page callback'   => 'mymodule_page_callback',
    [...]
  );
  [...]
}

function mymodule_page_callback() {
  // If there is a form_id_state saved in session, then
  // this is a redirect after login. Call the submit function again.
  if (isset($_SESSION['mymodule']['form_id_state'])) {
    $form_state = $_SESSION['mymodule']['form_id_state'];
    unset($_SESSION['mymodule']['form_id_state']);
    //drupal_form_submit('mymodule_form_id', $form_state);
    mymodule_form_id_submit(NULL, $form_state);
  }

  // Do normal things here.
  [...]

  return drupal_get_form('mymodule_form_id');
}

function mymodule_form_id_submit($form, &$form_state) {
  $op = $form_state['values']['op'];
  if ($op == t('Save') and !user_is_logged_in()) {
    // Save $form_state to session and redirect to login.
    $_SESSION['mymodule']['form_id_state'] = $form_state;
    drupal_goto('user', array('query' => drupal_get_destination()));
  }

  // Do normal form processing here.
  [...]
}

So, if user clicked Submit but he is not logged in, he is redirected to login with drupal_goto() and with come-back instructions, but first the state of the form is saved in the session.

Then, on page display, we check first whether there is a form state saved in session. If yes, then call again the form submit function, so that the processing of the form is finished (this time the user will be logged in).

All this seems a bit hackish to me. I wonder:

Are there any drawbacks to this approach?
Which is the best way to submit the form again,

calling the drupal_form_submit('mymodule_form_id', $form_state) (commented),
or calling the form submit function directly mymodule_form_id_submit(NULL, $form_state);?

Is there any better way to do it?
Is there any Drupal way to do it?

I have seen that this is a frequently asked question among the Drupal developers. So, maybe there is any standard answer for it.


texts: Trying to use hierarchical select in exposed view filter - dont get the option

texts: I have activated the Hierarchical select taxonomy views module, but when I add an exposed filter on my taxonomy term, I dont get an option to use the hierarchical select as a widget as the documentation says I should.


texts: Is it possible to move node edit tabs links in some block. I want to hide them from the orignal position and want to create a floating block which may contains all those links which are available in tabs.


texts: How to configure Multilanguage in D8? Front end in ES, Admin in EN

texts:
Use case in D8: Front end in Spanish (ES), Admin page in English (ES). Front end Users register/login in Spanish and view menus in ES. Content Type create is in spanish and do not need translation, content fields to be translated. Admin users view all interface in English. There is no need for interface switch module.

I could set content language as ES default, but how can enable all admin users to login and view as English by default.

I could set /admin/config/regional/language/detection and have /es for all front end users. But, what about default front page which is not needed in English?


texts: Drupal - user registration form- theming

texts:
I need to do theming of user registration form

I m doing in this way

Module file

  function mymodule_form_user_register_form_alter(&$form, &$form_state, $form_id) {
      $form['#theme'] = 'user_register';
    }

Template file

function mytheme_theme($existing, $type, $theme, $path){
  return array(
    'user_register' => array(
      'render element' => 'form',
      'template' => 'templates/user-register',
    ),
  );
}

function mytheme_preprocess_user_register(&$variables) {
  $variables['rendered'] = drupal_render_children($variables['form']);
}

And then I added user-register.tpl.php with my desired markup, a

<?php echo $rendered; ?>

Which is working fine . Now problem is that i need to rearrnage order of all fileds

Currently i have following

username, email and password, firstname , last name

I need sequence like username , firstname, email, lastname, password

can anybody tell me how to do this

Thanks


texts: Views data export user role field value missing from exported csv file

texts:
I'm using views_data_export to export data from the views displays. I added a Data Export option to the user account list views. When I use the batch in export settings, user role field is missing in the exported CSV file. While not using batch, role field is there.

Thanks


texts: Is Display Suite compatible with Panels?

texts:
-Drupal 7.37 & Omega4-Subtheme

-Windows7 HP & Toshiba Laptop

-Acquia-DevDesktop WAMP-Stack

Just a Simple question.  Is [DS] Display-Suite-Module compatible with [panels] and [panelizer]?

By that I mean do they implement conflicting Drupal-Code strategies for accomplishing the same objective.  Do they have any name-space-collisions?

I am well aware that they "purpose-wise" cover basically the same territory.

I would like to try using one on certain website-projects and the other on other website-projects. I might then leave one unenabled.  When I am familiar with both, I might attempt to use both on the same project.
Thank you for taking the time to read this.


texts:
I want a list of the input of my saved database table with buttons to delete or view the content and want to redirect it in the submit function.

With this code snipped i get only the submitted input value of the buttons, but every time is the $form_state['values'] array filled with the 1st form values. Is that the right way or need I another solution?

function myform_block_view($delta = '') {
    $block = array();

    global $user;
    $uid = $user->uid;
    $utime = $user->timezone;

    $query = db_select('mytable', 'm');
    $query->condition('m.uid', $uid, '=');
    $query->fields('m', array('fid', 'uid', 'name', 'created'));
    $query->range(0, 50);

    $results = $query->execute()->fetchAll();

    if($uid) {
        switch ($delta) {
            case 'myblock':
                $block['subject'] = '<none>';
                $block['content'] = _block_content($results);
            break;
        };
    };
    return $block;
}

function _block_content($items) {
    $output = array();

    foreach($items as $item => $item_value) {
        $output[$item] = drupal_get_form('mymodule_form', $item_value);
    };
    return $output;
}

function mymodule_form($form, &$form_state, $i) {

    global $user;
    $uid = $user->uid;
    $utime = $user->timezone;

        $form['value-'.$i->fid] = array( //EDIT
            '#type' => 'value',
            '#value' => $i->fid,
        );
        $form['view-'.$i->fid] = array ( //EDIT
            '#type' => 'submit',
            '#value' => t('view'),
            '#name' => 'view-'.$i->fid,
        );
        $form['delete-'.$i->fid] = array ( //EDIT
            '#type' => 'submit',
            '#value' => t('delete'),
            '#name' => 'delete-'.$i->fid,
        );

    return $form;
}

function mymodule_form_submit($form, &$form_state) {
   dpm($form_state);
   $form_state['rebuild'] = TRUE; //EDIT
}

The dpm output without 'form_build_id' 'form_token' 'form_id' in both,
1st example:

input =>
    view-3 => view
    value3 (NULL)

values =>
    value2
    view-2 => view
    delete-2 => delete

2nd example:

input =>
    view-3 => view
    value3 (NULL)

values =>
    value3
    view-3 => view
    delete-3 => delete


texts: Drupal 6 administration menu like the one on Drupal 7

texts:
I build a lot of sites, mostly on Drupal 7, so when I have to use Drupal 6 I am totally lost on the admin options, (even using the administrative menu bar).

Since I can't find any module for this issue, I am wondering if I should give it a try to build a module myself to rename and rearrange the admin menu items, but I am not sure, if this is even possible or if that will cause any path issues in modules later.


texts: User can't change language after redirection from custom module

texts:
I'm using custom module to redirect users from Serbia on Serbian language. So, if user comes from Serbia on front page, in URL will be added '/sr'. The problem is that user can't change the language on front page because it always will be redirected.

Can someone help me to fix this issue and make visitor able to change language on front page?

There is the code of custom module:

global $user;
function smart_ip_redirect_init() {

  if(
    // if country is detected
    !empty($_SESSION['smart_ip']['location']['country_code']) &&
    // if is front page and anonymous user
    drupal_is_front_page() && user_is_anonymous()
  ) {
    // load some global variables, language contains information about current language, base_url is base url
    global $language, $base_url;
    // load all active languages
    $languages = language_list();
    // resolve the country code to language, you have to make cases for your needs
    function country_to_language() {
    switch ($_SESSION['smart_ip']['location']['country_code']) {
        case 'RS':
            return 'sr';
        break;

        default:
            return '';
        break;
    }
    }

    // if the URL have no lang parameter
    if(strtoupper(request_uri()) == strtoupper("/")  )
    {
         // does the visitors language exist in our Drupal
      if(array_key_exists(strtolower(country_to_language()), $languages))
      {
        // redirect user to the designated language
        drupal_goto($base_url.'/'.strtolower(country_to_language()));
      }
    }

  }

}


texts: How to create a hook for a module in a theme?

texts:
I am trying to alter some data that is being passed from the Language Switcher module.

Here is a code snippet from the module.

if (isset($links->links)) {
  $build = array(
    '#theme' => 'links__language_block',
    '#links' => $links->links,
    '#attributes' => array(
      'class' => array(
        "language-switcher-{$links->method_id}",
      ),
    ),
    '#set_active_class' => TRUE,
  );
}

So '#theme' => 'links__language_block', as I could guess means that I have to create the function called

function mytheme_links__language_block(&$variables) {
    var_dump("HELLO");
    exit;
}

But it is not called. I have no idea what is the problem ?

The only hook is called - function mytheme_preprocess_page(&$variables)

Please suggest what can be wrong and why my hook function is not called.


texts: Passing variables that contain HTML through the t() function - ! placeholder has been removed

texts:
In Drupal 8, it appears that using the ! (exclamation mark) placeholder with the t() function has been removed.

I have a variable that contains HTML:

John Hancock (@JohnH)

I want to keep this HTML, as it will be styled specifically wherever it appears on the site.

In Drupal 7, I was able to do this:

t('Your name is !name', array('!name' => $name));

In which $name contains the HTML shown above. However, in Drupal 8, this doesn't work since the exclamation mark pass-through placeholder has been removed.

I tried this:

t('Your name is :name', array(':name' => $name));

But the HTML is still escaped.

The @ mark also escapes the HTML.

Does anyone know how HTML can be passed through the t() function in D8?

UPDATE:

According to No Sssweat's comment, it seems that my the ! mark does seem to work in t(). So here is my actual code:

drupal_set_message(
  $this->t(
    "@amount has been transferred to !account",
    array(
      '@amount' => '¥' . $form_state->getValue('amount'),
      '!account' => $this->accountService->formatAccountName($account)
    )
  )
);

And I get this error stack:

User error: Invalid placeholder (!account) in string: @amount has been transferred to !account in Drupal\Component\Render\FormattableMarkup::placeholderFormat() (line 235 of core/lib/Drupal/Component/Render/FormattableMarkup.php).

Drupal\Component\Render\FormattableMarkup::placeholderFormat('@amount has been transferred to !user', Array) (Line: 204)
Drupal\Core\StringTranslation\TranslatableMarkup->render() (Line: 15)
Drupal\Core\StringTranslation\TranslatableMarkup->__toString() (Line: 451)
drupal_set_message(Object) (Line: 128)

The user error is what made me think the ! mark is not allowed, but I must have misdiagnosed it. Does anyone know what is happening here?


texts: How can I get the node ID from a path alias?

texts:
I want to be able to get the nid but the only information I have is http://example.com/this-is-the-alias.

Is there a way to get either the internal path of /node/*  for that alias if I am not on the page?  Or is there a way to just get the nid from that alias right away?


texts: Links to uploaded Files are diffrent to the upload Folder (open atrium)

texts:
If I upload Files throuth the Uploadfunction in the edit subspace section (doesn't matter if subspace or mainspace), It loads the picture in the

\sites\default\files\private

or

\sites\default\files

folder.

Depending where I want to upload the pictures. But they are not shown on the Site. So if I right-click the image-icon, I get different path to the pictures.

for example :

system/files/styles/panopoly_image_original/private/logo_lang_80x24.png?itok=BfifKC1c

but the files are in the other folders.

How can i fix it?


texts:
I have js jquery 1.10.1 min js which append after drupal.js. Due to that i got following Error: "Uncaught ReferenceError: jQuery is not defined drupal.js 5".

So how can i change the order of js so that first load jquery 1.10.1 and then after drupal.js.


texts: One time login redirect to password change page

texts: In D7, How can i redirect the user when he/she use One time login. My target is after clicking one time login button user has to redirect to change password. Can any one help on this.....


texts: How/where is the marker layer added to the Google Map with the Gmap Module?

texts:
So,

I'm interested in trying to "export" a collection of markers from a Google Map generated by the Gmap module. Specifically, I'm looking for how to pull human-readable marker information from the js loaded into the page, not how to create an exportable list of the marker data.

From poking around in the javascript console, I can find what look like a series of related auto generated JS files in sites/default/files/js; but the JS looks like it contains the functions to create the markers and map definitions, not the geometry collection itself. Similarly, the gmap_markers.js doesn't provide much that's easy to decipher.

So, is drupal passing variables to those js scripts to create the markers on the fly? and if so, is there a place where a human-readable collection of those markers (ID, LatLon, popup info, and any other meta data) is stored and loaded into the Gmap?


texts: Install using Composer doesn't create .htaccess file

texts:
Followed instructions at (https://www.drupal.org/docs/develop/using-composer/using-composer-to-install-drupal-and-manage-dependencies) to install Drupal with Composer using the command:

"composer create-project drupal/recommended-project my_site_name_dir"

Composer download all the files and displayed that Drupal was ready to install. However, when trying go to the page in a browser get "Forbidden You don't have permission to access / on this server. "

Looking in the "my_site_name_dir" there is no .htaccess file so the server doesn't know to go into the "/web" subdirectory. The "my_site_name_dir" directory has only the following files:
   /Vendor
   /web
   .editorconfig
   .gitattributes
   composer.json
   composer.lock

Should the .htaccess file be created automatically by Composer? I thought Composer used to do this in earlier installations. Is there a recommended .htaccess template to use. Thanks.

Environment: Windows 10, PHP Version 7.1.20, Apache 2.4


texts: How to change user info with a rule when Points are granted to user (using userpoints module)?

texts:
I need to create a rule to change info of a user when this user is granted with points using the http://drupal.org/project/userpoints module.

I need the rule to have a condition and action like:

if total points of the user are greater than 1000 --> then set the field passed to 1

The field passed is a field that I added at admin/config/people/accounts/fields

My problem is that I can't load the Total points of the user in the conditions of the rule

I already have the userpoints_contrib module enabled.


texts: Need to add media with embed code and NOT URL - how to do it?

texts:
I'm trying to create an embedded soundcloud field in my drupal site but the embed is coming out too LARGE. In Soundcloud you can make the embed code reflect a smaller value in the sharing options, but there's no way to save it.

I can't find a way to actually use embed code in drupal. I've added the media module and the embedded media field module and the soundcloud module and the oEmbed module. None of them let me add embed code - they just accept a URL (and in fact they make me put the URL in twice for some reason). But the point is, they don't let me add embed code and I need to be able to add and tweak the embed code itself, not just add by URL.

I looked here and that doesn't help: how to add a cck field for youtube embed code?

Anyone know how to do this?


texts:
I am stuck on trying to do an OS install and following the install guide found here.
When attempting to use Composer2 to fetch I get the following errors.
  Problem 1
    - drupal-composer/drupal-scaffold is locked to version 2.6.1 and an update of this package was not requested.
    - drupal-composer/drupal-scaffold 2.6.1 requires composer-plugin-api ^1.0.0 -> found composer-plugin-api[2.0.0] but it does not match the constraint.
  Problem 2
    - oomphinc/composer-installers-extender is locked to version v1.1.2 and an update of this package was not requested.    - oomphinc/composer-installers-extender v1.1.2 requires composer-plugin-api ^1.0 -> found composer-plugin-api[2.0.0] but it does not match the constraint.
  Problem 3
    - drupal-composer/drupal-scaffold 2.6.1 requires composer-plugin-api ^1.0.0 -> found composer-plugin-api[2.0.0] but it does not match the constraint.
    - goalgorilla/open_social 9.4.0 requires drupal-composer/drupal-scaffold ^2.5.0 -> satisfiable by drupal-composer/drupal-scaffold[2.6.1].
    - goalgorilla/open_social is locked to version 9.4.0 and an update of this package was not requested.

You are using Composer 2, which some of your plugins seem to be incompatible with. Make sure you update your plugins or report a plugin-issue to ask them to support Composer 2.

In reading though several bug reports and various different posts I see this isn't a uncommon problem to have due to the last update of composer from V1 to V2.
It was recommended in a bug report that the submitter downgrade Composer to V1 so I did that and got a different set of results as follows.
    PS C:\> composer self-update 1.4.1
Upgrading to version 1.4.1 (stable channel).

Unable to write "C:\ProgramData\ComposerSetup\bin\composer.phar". Access is denied.
Complete this operation with Administrator privileges [Y,n]? y
Operation succeeded.
Use composer self-update --rollback to return to version 2.0.7
PS C:\> composer create-project goalgorilla/social_template:dev-master DIR --no-interaction
Warning from https://packagist.org: You are using an outdated version of Composer. Composer 2.0 is now available and you should upgrade. See https://getcomposer.org/2
Installing goalgorilla/social_template (dev-master dd01e6827fb19f29b3245fa893ac1f5911c72200)
  - Installing goalgorilla/social_template (dev-master master): Cloning master from cache
Created project in DIR
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file

  [ErrorException]
  "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"

The only thing I can find on that was on stack which basically said, yeah no way that's going to work.
Its my understanding that the next release will address the Composer2 changes required but is anyone aware of detailed documentation that would help me presently in navigating the scaffold issues? I am seeing all sorts of posts about patches and work arounds where what is being described is way way over my head.
I am way out of my league here in working this out but stubborn enough to learn with the right glints of information.


texts: Replacing the (add to compare list link) with the checkbox

texts:
Possible Duplicate:
  Convert a Flags Link into a Checkbox

How we can replace the (add to compare list link) with the checkbox in drupal 7. while using flag module.


texts: valueCallback in custom form element is not invoking itself?

texts:
I am creating a custom form element in my custom module. Everything is working fine except the valueCallback function is not invoking itself. I have done it in following way :

Name space

namespace Drupal\custom_element\Element;

getInfo and valueCallback Method:

public function getInfo() {
    $class = get_class($this);
    return [
      '#input' => TRUE,
      '#tree' => TRUE,
      '#process' => [
        [$class, 'processCheckboxes'],
      ],
      '#theme' => 'custom_theme',
      '#value_callback' => ['valueCallback'], // Try with and without #value_callback key
    ];
  }

  /**
   * {@inheritdoc}
   */
  public static function valueCallback(&$element, $input, FormStateInterface $form_state) {
    dsm('in valuecallback');
  }

I am not sure what I am missing.

Related Link : https://www.drupal.org/node/2320115


texts: Unable to display Drush cache-clear theme registry

texts:
I was using drush to do some of the most frequently used Drupal tasks, mainly to cache clear. It was working great, but recently I'm getting only the following option:

Enter a number to choose which cache to clear.
 [0]  :  Cancel
 [1]  :  drush
 [2]  :  registry

It was supposed to be:

 [0]   :  Cancel
 [1]   :  all
 [2]   :  drush
 [3]   :  theme-registry
 [4]   :  menu
 [5]   :  css-js
 [6]   :  block
 [7]   :  module-list
 [8]   :  theme-list
 [9]   :  nodeaccess
 [10]  :  registry
 [11]  :  token
 [12]  :  views

There is no way to clear css/js or theme registry. Whats the problem? Is it with Drush or Machine settings. Any advise highly appretiated.


texts: Print translated Image field in node template

texts:
$nodeObj = Drupal::service('entity_type.manager')->getStorage('node')->loadByProperties(['type' => 'books' ]);

$nodeObj has field 'field_book_image' and 'target_id' => string(2) "65"
in node preprocess we can get file URL
$file = File::load($target_id);

but is there any way I can print image field directly in node template with current language

{{ item.translation(langId).field_book_image.entity }}

{{item.field_book_image.entity.uri.value}}

{{ `file_url(node.field_book_image.entity.uri.value) }}`

but none of above giving Image path or Image value


texts: How to get read count of blogs in Blog module?

texts: I am using blog module to implement blog section in my website, I am not getting the count of the each blog. What is the variable that stores read count of each blog. Any suggestion will be appreciated.


texts: How can sort paragraph fields of custom content type?

texts:
I created a content type that’s combination of some typical fields and one paragraph type field and inside of this paragraph field also there are a set of multiple fields.
The schematic structure of my content type is like below:

I want to have this ability to add some of this paragraph type and update this content type every time that I want.

However, in the 'add field' section of the view creation page, I can only select the main content fields. The fields that are part of the Paragraph are not selectable.

How can I get the fields from the paragraph so that I can sort them in the view results?

So my main question is:
How can I sort this paragraph field (with a set of fields inside it) based on the custom required field value automatically?

For example, I want to sort those paragraph filed based on paragraph_field_2 field.
Is there any better solution or method for doing this work, What’s your approach to it?
thanks.


texts: Drupal Commerce: Display Different Shipping Rate depening on taxonomy Term

texts:
I would like to offer a different flat shipping to users depending on what taxonomy terms the product they have in their cart.  For example

If a product tagged with "postage rate 1"  I would like to display shipping rate 1. If they have a product tagged with shipping rate 2 I would like to display shipping rate 2.
I would also like to if possible make it so that if the cart has items with each of the tags then one item shipping rate would win through (the most expensive one to cover costs I would think)

I have had a go with rules but I cannot figure out how to get the different shipping rates to display on taxonomy terms.  I do have the commerce rules extra module installed if that will peform part of the solution

Thank you for looking


texts: Cookies for anonymous users aren't read nor checked

texts:
I currently have a module on http://hitechwolf.com that creates a welcome overlay upon a user's first visit, This should work by utilizing a jquery created cookie and showing the overlay based on its existence. The jquery works, the cookie is created, but for anonymous users the cookie is ignored and the overlay shows on every page. I've implemented jquery.cookie but it still completely ignores the cookie for anonymous users. I'm at the end of my rope, any help or alternatives would really be appreciated.

welcome-overlay.js

/**
 * @file
 *  Toggles Welcome Overlay, upon first button
 *  clicks toggles different content, second toggles overlay
 */

(function ($, Drupal) {
  Drupal.behaviors.welcomeOverlay = {
    attach: function () {
      var cookieName = 'firstWelcome';
      cookieValue = 'returning';
      cookieDays = 60;

      /** Create Cookie Creation Function **/
      function createCookie(name, value, days) {
        if (days) {
          var date = new Date();
          date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
              expires = "; expires=" + date.toGMTString();
        }
        else {
          var expires = "";
        }
          document.cookie = name + "=" + value + expires + "; path=/";
      }

      /** Check for Specfic Cookie **/
      function readCookie(name) {
        var nameEQ = name + "=";
            ca = document.cookie.split(';');
        for (var i = 0; i < ca.length; i++) {
          var c = ca[i];
          while (c.charAt(0) == ' ') { c = c.substring(1, c.length);
            if (c.indexOf(nameEQ) === 0) {
              return c.substring(nameEQ.length, c.length);
            }
          }
        }
        return null;
      }

    /** Sets value corresponding to cookie existance **/
      var visited = readCookie(cookieName);
          visited2 = document.cookie.search(cookieName);

      /** If Non-existant Create Cookie and Show Content **/
      if (visited === null || visited2 < 0) {
          // $(document).ready(function () {
          // Seconds Before Overlay Slides Over Content
          setTimeout(function () {
            overlay.slideToggle('800', 'linear', function () {
              appearFirst.fadeTo('800', 1, 'linear');
            });
          }, 1500);
          createCookie(cookieName, cookieValue, cookieDays);
      }
    }
  }
})(jQuery, Drupal);

welcome-overlay.module

function welcome_overlay_preprocess_page(&$variables) {
  /** Include the jquery.cookie plugin **/
 drupal_add_library('system', 'jquery.cookie');
 /** Attach jquery/css to module **/
  $path = drupal_get_path('module', 'welcome_overlay');
  drupal_add_css($path . '/welcome_overlay.css');
  drupal_add_js($path . '/welcome_overlay.js');
}


texts: Where to view Google Analytics "Track clicks on outbound links" results?

texts: I am using Drupal's Google Analytics module 8.x-2.5. The module configuration has a check box for "Track clicks on outbound links", which I checked since the module was installed. However, I don't see outbound link stats in Google Analytics - am I missing something? Is there something else that needs to be done for setup?


texts: how to create a view that shows blogs count for a user?

texts:
I want to create a view that list out the following fields

User name
User email
Discussion count
Blog count

I created the view and add the User: Name and User: Email in the fields but it shows me the duplicate users and Also I have no idea about how to add the discussion count and blog count to the view.

I have created the view of node type.
Any help?


texts: IMCE module button not showing for Editor role?

texts: I have given the Editor role literally every single permission, yet the button still only shows for admins. Am I missing a setting somewhere?


texts: Drupal sending SPAM, can't log in anymore

texts:
My unupdated drupal website has been sending large amounts of spam. I have now blocked the website with HTTP Basic authentication, but I can't seem to get in my admin account of the website. I've tried setting a new hash, but logging does not seem to work, as I don't get any error message when trying to.

Also the password reset function and create new account function do not work, I've tried showing error messages in my template.php file, etc.

Do any of you have any experience with this kind of hack? My Drupal was unupdated and is currently on version 7.15. How do I get back in? Or is it best to set up a new site and transfer the content.

[UPDATE] I have currently updated my drupal system to the most recent version, 7.30. But still no success. I can still not login, even though all the files are renewed. I have also reverted back to the garland theme, but also this theme is not giving me any error messages.

Thanks in advance.


texts: Possible to hide admin toolbar for testing display

texts:
I've worked on and off with Drupal for a few years.

One thing that has bothered me a bit, is that the admin toolbar at the top doesn't give you the full flavour of what the public will see.

I usually get around this by using a second browser where I'm not logged in.

I wonder if there is a simple url parameter or some other setting that can turn off or hide the toolbar for testing display.

searching the web reveals a trick with some permissions.

https://kitt.hodsden.org/blog/2011/02/turning_drupal_7_admin_toolbar

But using a second browser seems easier as I'll want this for just a few minutes at a time.

Could I write a simple plugin that will catch some url parameter and hide the admin toolbar, is there such a thing already?


texts: CCK checkbox or dropdown widget as a field?

texts:
I am trying to setup a new CCK field for a content type to display as a checkbox but I see I don't have that option in the widgets type.
Shouldn't that be included in the default CCK?

I am using the latest CCK for Drupal 6.


texts: In code alter user registration and override approval to no approval required

texts:
In my module I want to override the approval for certain users so that they are immediately approved and get the corresponding email.

The module looks at the subdomain to decide if approval is required. If it is, then the register-with-approve email should be sent. If no approval is required, the account should be activated and the no-approval-required email should be sent.

I have looked for hooks that I could use for this, but haven't got anything working yet. I'm using Drupal 7.


texts: node-edit-protection module not working in CK Editor window

texts: I am using node-edit-protection module to alert a user if they are navigating away from a modified Node Edit form without saving. It worked fine if we edit title or any other fields. But not worked if we change the body part. I am using CKeditor in body part.


texts:
I sort of inherited a Drupal 8 site which has lately generated a problem causing 500 error when e.g. trying to modify menus. I haven't myself updated the Drupal (just got it, it is currently on version 8.7.5).
I checked what is the status of database and found out there's about two dozens updates needed. So, I though, maybe drush updb would cure the problem. Well, it still might, except that the first update fails and so the others never ever get even tried. The significant lines are as below

[notice] Update started: feeds_update_8001
[error]  Missing bundle entity, entity type node_type, entity id migrate_example_beer.
[error]  Update failed: feeds_update_8001
[error]  Update aborted by: feeds_update_8001
[error]  Finished performing updates.

How to overcome that? There is no table named migrate_example_beer (though a few others including that part do).
Is it possible somehow to skip the first update, or anyone has any ideas how to cure that one error?


texts: How to update users table including relation tables with entity?

texts:
I'm currently creating a module which should help me manage users from 1 instance for my other multisite instances.
So there will only be admins/editors and no other user logins.
My goal is now to hook the user create / update function and save same datas on all other databases.

But i'm not able to bring it work.

I started with the update hook because i think it's easier. Here is module function and one of my try:

/**
 * Implement hook_entity_update.
 *
 * @param \Drupal\Core\Entity\EntityInterface $entity
 *   The entity object.
 */
function my_module_entity_update($entity) {

  if($entity->getEntityTypeId() === 'user') {
    $sites = glob(DRUPAL_ROOT . DIRECTORY_SEPARATOR . 'sites' . DIRECTORY_SEPARATOR . '*', GLOB_ONLYDIR);

    foreach ($sites as $site) {
      $siteName = str_replace(DRUPAL_ROOT . '/sites/', '', $site);
      if ($siteName !== 'default') {
        Database::getConnection($siteName)
          ->update('users')
          ->fields($entity->getFields())
          ->condition('type', $entity->getEntityTypeId())
          ->condition('id', $entity->id())
          ->execute();
      }
    }
  }

}

But here i get the error because the $entity->getFields() returns an object instead of an array.

How can i save the whole user entity at once including the roles and other related tables?

Do i really need to assign every single field? Or is there a hopefully easier way?


texts: How to rewrite View SQL query to bypass MySQL query cache (SELECT SQL_NO_CACHE)

texts: I would like my View not to use MySQL cache as one of the checks in WHERE clause keeps changing with current time (granularity set to second). Caching this query doesn't make much sense. I would like to convey this to MySQL server by rewriting SQL to SELECT SQL_NO_CACHE. I looked at hook_views_query_alter(&$view, &$query) with a hope to achieve it but I couldn't figure out how $query need to be altered for this. Usecases found so far talks only about changing order by and where clause conditions. Any directions pertaining to this will be greatly appreciated. Thanks in advance.


texts:
I just moved to a new computer: Windows 10 with XAMPP. As far as I know I set everything up the same as it was on my old Windows 7 computer. But now, for some reason, much of the time when I run drush cc all or run update.php, the database gets corrupted. Most frequently, some cache tables' *.idb files (tablespaces) are deleted from my mysql directory, which makes those tables appear as "in use" in phpMyAdmin and prevents them from being edited or emptied. They are always cache tables and never tables that actually get modified by my update hooks. Restoring the database is the only way to fix it then. This is a mature site that I've been working on for a long time, and have never seen this until the new computer. What's happening here?

A sample error message when using update.php, caused by a missing *.idb file:

PDOException: SQLSTATE[HY000]: General error: 1812 Tablespace is missing
for table '(null)': DELETE FROM {cache_field} WHERE
(cid = :db_condition_placeholder_0) ; Array (
[:db_condition_placeholder_0] => field:message_type:6 )
in cache_clear_all() (line 168 of
C:\<path>\includes\cache.inc).

My most recent drush cc all error message, which Google has never even heard of, was:

exception 'PDOException' with message 'SQLSTATE[HY000]: General      [error]
error: 1030 Got error -1 "Internal error < 0 (Not system error)" from
storage engine InnoDB'


texts: Present users with form to create new node

texts:
I have created a content type called "member" in my project. Logged in Users have permissions to create nodes of type "member".

I want to my users to be able to create the nodes without having to click "create member"

I simply want to present them with the form when they log in and all they have to do is 1. Enter the values and 2. Click save.

Thank you.


texts:
I have a site with articles which has an RSS feeds.
I 'd like visitors to be able to subscribe to those articles using their email.
They ll give their email and then new articles will be sent to their email.

I m using feedburner to email right now, but I dont like it at all.

How this can be done in using Drupal modules and an SMTP server?

What technology is stackexchange.com using for the email notifications?


texts: Validate a custom type node before submitting

texts:
I'm to validate the creation of a new content node, of a custom content type. It seems I cannot find the right hook.

I tried using hook_node_presave, however, the only way to stop node from creating is to throw an exception. This is rather user unfriendly.

 function custom_module_node_presave($node) {

    if($node->getType()=='custom_content_type'){
            if(some_business_rules_apply()){
                    drupal_set_message('You cannot add a new node.','error');
                    # cancel saving
                    throw new \Exception(t('You cannot add a new node.'));
            }else{
                    # do something more
            }
    }
}

I tried to use hook_node_validate but it seems like it is not called. Do I miss something? Maybe, I use the wrong name for the hook function? Is there some kind of example for hook_node_validate?

function custom_type_node_validate(\Drupal\Core\Entity\EntityInterface $node, $form, &$form_state){
    \Drupal::logger('My logger')->info('Node validate');
}


texts:
I'm desperate.
I have a site with 2 databases, staging and production, and in staging messages set with drupal_set_messages() appear, but in production they don't.
The codebase is the same. I tried switching database settings on the same codebase and the behavior will change depending on the database.
I have inherited the site so I'm not 100% familiar with its configuration.

My question is: is there anything on a database level that can block messages from showing? They appear in the admin area, but not in the rest of the website...


texts: Select Images from a Multiple Images Field

texts: I have a multi-valued image field that gets populated automatically with several images per entity. I need to add a manual "approval" step where one or more of the images is selected to be used later. What is a clean way to implement the approval process for existing images?


texts: Drupal 6 make a content edit form be in a specified theme

texts:
This is in Drupal 6.

How to make a content edit form be in a specified theme?

The administration theme is 'seven', and use admin theme for content edit.
Site configuration: /admin/settings/admin
Administration theme: Seven
[x] Use administration theme for content edit

Create a new content type 'example'.

In the module, this function makes 'example' edit form in example_node_form.tpl.php template.
But this template will be in 'seven' theme, themes/seven/example_node_form.tpl.php

function modulename_theme() {
  return array(
    'example_node_form' => array(
    'template' => 'example-node-form',
    'render element' => 'form',
    ),
  );
}

Want 'example' edit form in another theme, not 'seven' theme?

How to make a content edit form be in a specified theme?


texts:
I am building a site in which authenticated users may upload files.  When such a user is viewing URLs of a certain content type, I would like the left sidebar to contain, among other things, a file control.  The right column of an unauthenticated user holds the login controls, and that column must hold something else for authenticated users who have not accepted the required condition.  My goal is to have the user perform the upload while also reading the content.  Hopefully, this improves retention.

At any rate, I need a block which contains a file field.  I have been trying to do this with Node Fields Block.  So far no success.

I added a hidden file field to my content type, installed and enabled node_fields_block, and added a Node Fields Block which is enabled for pages of my content type and which contains the File.  I've created a 'Node Fields Block' display mode for the content type in which the file is supposed to appear, but nothing shows  up.  I've looked at the generated HTML and the block isn't being generated.

I'm at a loss.  Any help greatly appreciated.


texts: Bulk change radio button setting in admin/content using database

texts:
I am using a paywall module called TinyPass where I have to check a radio button in order to activate the paywall for a specific node. I now have a situation where I want to uncheck (or deactivate) this button for a lot of nodes that I have.

Instead of doing this for every individual node I would like to do this for a large selection of nodes (or even all of them).

Is it possible at all to change the value of these radio buttons setting in a node using the database or some other solution? This would save me a ton of time.


texts: Can the Drupal 6 search function also index block content?

texts:
I have a site where much of content has been entered into blocks instead of Pages, Articles or Blogs.  The blocks have then been enabled to show up on specific pages, creating the desired effect for the site.

However, as content as been added to these blocks, the search feature of Drupal won't find the pages that have that content on it.

Are there any options to adjust the search engine features for something like this?  Is there a hook that can be used to customize the search results?


texts: I would like to know whether the "node edit form" (admin form) can be displayed under the edit tab itself using MENU_LOCAL_TASK?


texts:
I'm looking for some ideas of how best to cater for the following scenario: I have a facebook-style feed on the front of a site that is updated with user content regularly, and just like facebook I want the page to update as nodes are submitted to the site.

So it looks to me like a classic use case for a bit of long-polling, or even using some of those new fang-dangled web sockets. But how am I going to integrate this with drupal?

There's no way I can have 20 let alone several hundred users long polling drupal directly - it would lock up every php process my system could provide.

I've been considering writing a tiny wee node.js program which would would handle all the long-polling connections and would watch the drupal node table directly. When updated, node would query drupal and proxy the request back to the clients. But this seems like a pretty awful solution to me.

Another idea I had was to load the current maximum node nid number along with the intial request, and then somehow also advertise this number via long-polling - if the advertised number changes, it would trigger the client to make a request. But I'm not sure how to implement this advertising.

So what other options are there?


texts: Create View to display users with same select list value to each individual user

texts:
When a user registers on my site, he/she chooses the college he attended and the course he/she studied from select list fields i created using the profile 2 module

Is there a way to create  a View that displays to each user the people who attended the same college & studied the same course.

Thank you.


texts: Displaying the contents of a document file (doc, docx, etc.)

texts:
I'm looking for a way to display the contents of an uploaded document file such as a .docx file.

In Drupal 6 I used the iPaper module which did the trick as all I needed was api code to connect with the service, and the documents were able to be kept private.

But for Drupal 7, I'm pretty sure the File entity (fieldable files) module should do the trick, but I'm not able to get it working for any files other than .txt.

There are some Google viewer modules which I'm not sure what added functionality they have over the above module, but those don't appear to work correctly. One of them requires that files are public domain which doesn't work for this project due to privacy requirements.

Some other modules like group docs viewer and ajax docs viewer charge a hefty monthly fee for displaying rendered files, but all I need is a simple open source docx viewer.

What is the best way to proceed?
Which modules are stable for production use?

Best case would allow for user upload, file contents displayed under the actual file attachment, and the rendered document editable for the user.

Note: i've gotten the google docs module to work but that doesn't allow for private files. google needs to access the file publicly in order to render. scribd field also works to some extent but has too many errors and bugs still. looking for a better, simpler solution.


texts: Load block programmatically, result: <drupal-render-placeholder

texts:
I want to load a block programmatically:

$block = \Drupal::entityManager()->getStorage('block')->load('contextualcart');
$block = \Drupal::entityManager()
  ->getViewBuilder('block')
  ->view($block);
$blockMarkup = \Drupal::service('renderer')->render($block);

But the result is:

<drupal-render-placeholder callback="Drupal\block\BlockViewBuilder::lazyBuilder" arguments="0=velocontextualcart&amp;1=full&amp;2" token="5IaX-v_M8zGkro6F9hTE93zRfIj9p4nHeLFv8Ja6ZW0"></drupal-render-placeholder>

This is fine, because I have to insert a block in AJAX.

What happened? How do I fix it?


texts: Drupal 6: Having issues with multiple paged tables in pages with multiple tabs (JQuery UI tabs)

texts:
I have a series of pages that provide paged tables inside of tabsets. Using the Tabs module, I get JQuery UI tabs, and I am using that to create pages with multiple horizontal tabs; inside those tabs I have forms and paged tables, typically one form or one paged table per tab.

The paged tables are generated using pager_query(), where I am providing a pagerElement parameter to pager_query() because I have multiple paged tables on the same page (but on different tabs).

Likewise, when I call theme('pager'...) I am passing in my pagerElement so my multiple paged tables do not get confused, as well as an additional associative array for my active tabset parameter. The call looks like this:

theme('pager', NULL, $pagerLimit, $pagerElement, array('tabset'=>$pagerElement) );

The issue I'm having is the pager links being generated, for example: when first landing on one of these multi-tabbed pages, the pager links look like:

 http://blablabla/Projects-Dash?tabset=0&page=1

However, as soon as a pager link is clicked, the pager links look like:

http://blablabla/Projects-Dash?tabset=0&page=2&tabset=0

Notice that now tabset=0 is there twice? At least the links from the 2nd paged table are somewhat different, looking like this:

http://blablabla/Projects-Dash?tabset=1&page=1%2C1&tabset=0

But they still have that extra tabset=0 at the end... how to prevent that?


texts:
I'm working on making a site I maintain WCAG AA compliant. One of the items I'm getting flagged for is "Every FIELDSET element must contain exactly one LEGEND element." This error shows up on every page that has a comment function. It turns out it is due to the Text Format option for the comment body:

I've tried DMPing $form from a form_alter hook, but I can't seem to find this field set anywhere, at least it doesn't seem to be in the comment-form form.

The ID of that form Item is edit-comment-body-und-0-format--2, which when I check my DPM output, there is an entry in comment-body/0/#format, but it's null.

Where can I add a legend to this field set?


texts: Users, subusers, and assigning subuser to multiple users

texts:
I want the following functionality in Drupal 7: Create a few parent users/business representatives (e.g. Google, Microsoft); these business representatives will add their business profile, and add employees of that specific company, add/edit/delete them. An employee can be from multiple companies and all business representatives can edit/delete employee's profiles.
Employees can also log in, and manage their own profiles.

Which modules should I use?


texts: How to create a custom 'fluid' layout in Display Suite

texts:
I created a Display suite custom layout following this tutorial: https://drupal.org/node/1098068

It works fine, but I need this custom layout to be Fluid.

  In Display Suite, the "fluid" refers to the templates ability to
  expand the column width if one (or more) columns are empty.

How can I do this? I guess I need to add some php code which will add some extras css classes. But I don't know how and where to add this code.


texts:
I want to get a list that the items with a specific term in the top (like promote). The query would be like:

$query = \Drupal::entityQuery('node')
  ->condition('status', 1)
  ->condition('type', 'news')
  ->sort('field_product_category', $tid, '<>') //Error <>
  ->range(0, 5);

Can I put calculation in sort condition? I do not want to make 2 queries.


texts:
I need some help figuring this out. I have a main site mysite.com on Drupal 7. I want to build a blog for it and want for people to access it using blog.mysite.com. So basically it's the same site (so I can manage content from the same place), just on different URLs.

NOTE*: Individual posts page should show the URL like so: blog.mysite.com/my-post

I was wondering if this can be done using a View under the path name mysite.com/blog and mask the URL somehow to show blog.mysite.com instead. I am using nginx as a webserver.


texts: I'm new in Drupal and i have crated a view for content type doctors who have many fields and i choose just some fields to be displayed in the view. Now i want to add a new filter like a select list in my page to select the country of doctor.


texts: Correct way to display a custom field in a custom content type page template

texts:
I'm using Drupal 7 with a custom content type called "lesson". In this custom content type I have a custom field named "field_lesson_objective". I'd like to be able to wrap this in a custom div, so I thought it would be pretty simple to open up my custom page template "page--lesson.tpl.php", remove "", and replace that with something that would display the field, but I'm having no luck finding a solution.

Perhaps I'm going about this all wrong.


texts: How do I override recurring text/strings with icons/images?

texts:
I'm not sure this is possible or if there is a module that does this already, that's why I am asking :) Think of String Overrides except to turn strings into an image.

I ran into the module Iconify which basically adds icons to the admin config headings, and I was wondering if there is a way to use icons/images to replace specific recurring strings. For example:
Say I would like to change the "View" link on the Page content type into an icon of an eye. Or the "Edit" link into a little pencil.

How can I achieve what I am trying to do?


texts: Permission restrictions deny you access to this broken link

texts:
In Reports -> Broken links page for some records it is showing

  permission restrictions deny you access to this broken link

Site have only one language also, some of the broken links are showing with https link also. So I don't think the problem with protocol or language.

What is the part of link-checker cron. It was not running and i tried running it manually? But still the broken link is not showing (which I intentionally put some broken link).

What else could be the problem? How to resolve this issue?

Please suggest other than "Re-Analyze link data", that removes all old records also not showing the new one.


texts: How can I send an email to site admin and vice-versa when user returns a product using commerce_rma?

texts:
I am using the Commerce Return Merchandise Authorization module for handling returns. It is working fine .

But one thing I want that when a user returns an order using commerce_rma then a notification mail should be triggered to the site admin, and also when the admin accepts user request or declines user request a notification mail should go to the user.

How can I do this ?


texts:
I'm trying to add the onclick attribute to some menu links in Drupal 8 in order to track conversions with Google.

Here's a tutorial for adding onclick events in Drupal 7 that uses the Menu Attributes module.

For Drupal 8, I looked at the Link attributes module and the Menu Link attributes module but these only allow you to add classes, not set the value for onclick.


texts:
I created a new module to extend the webform module for custom submission hooks:

function mywebform_extra_form_alter(&$form, &$form_state, $form_id) {
    if ($form_id == 'webform_client_form_213') {
        $first = array_shift($form['#submit']);
        array_unshift($form['#submit'], $first, 'mywebform_extra_submit_213');
    }
}

I have the webform module installed and I created a webform that has a node id of 213.

When I try to output the $form_id variable, the value shown is nothing indicative of a webform and instead showing "search_form_block" as the form ID?

what is the error here? I pulled it straight from this example.


texts: How to make entity revisions remember the old bundle, if it is changed?

texts:
There are some tools in Drupal that allow you to change the bundle of an entity (e.g. the node type):

The Node Convert module
The migrate module, if you update an entity and change the bundle.
Any custom programmatical bundle change, see Change entity bundle on update?

(In my case it is about commerce_product entities where the bundle changes from "product" to something else)

Entity revisions, if enabled, can remember all the field data from the old entity, even if these fields do not exist in the newly assigned bundle.

However, when loading the old revision with e.g. entity_load(), it has the new bundle, not the old one. And field_attach_load() only loads field data for fields of the new bundle.

A place to look is DrupalDefaultEntityController::load(). This queries the database for the entity / revision, and then calls $this->attachLoad() to add the field data. Then e.g. CommerceProductEntityController::attachLoad() calls the parent DrupalDefaultEntityController::attachLoad(), which calls field_attach_load_revision(), which calls field_attach_load(), which determines the entity bundle and loads the field instances for the determined bundle. The bundle is already on the entity since it was loaded from the database.

It seems the main problem is that (most or all of) the revision tables do not have a column for the bundle. I assume this could be changed with hook_schema_alter() to add a type column to commerce_product_revision (or node_revision). But will this cause other problems?

Has anyone tried this so far, or knows an existing solution? Anything I can think of right now seems hackish and fragile.


texts: Change output of a field with PHP field?

texts:
I'm constructing a view in Drupal 7 with a field called "Content: Fruit". If the value of that field is "lemon", I want to change the output to "citrus". How can I accomplish this?

Here's what I tried:

First, I excluded the "Content: Fruit" field from the display. Then I added a "Global: PHP" field after it where, in the "Value code" section, I added:

return $row->field_fruit;

Then in the "Output code" section I added:

<?php
    if ($value == 'lemon') {
        print 'citrus';
    }
?>

This doesn't work. The value of $value seems to be the node ID ("nid").

Thought this would be straightforward... what am I doing wrong here? Is there a better way to accomplish this?


texts: Does a page created with hook_menu have a nodeid?

texts: I created a page implementing the hook_menu, and I want to apply a theme for only this specific page. I know that I need to use something like page--node--nodeid.tpl.php, my question is does a page created implementing the hook_menu() have the nodeid, and if the answer is yes, how can I figure it out ?


texts: Omit Simplenews Subscribers Who Responded from Follow Up Email

texts:
I'm using D7 and simplenews. I have a newsletter category mynewsletter with 1000 subscribers.  In my most recent mynewsletter, I had a poll.  200 subscribers have responded.  I want to send a reminder to the remaining 800.  I know i could manually exclude these 200 from the list and then add them back, but I plan to do this frequently.

Is there a hook i can use before the newsletter is spooled that will allow me to eliminate the users in the list who have already responded? The email addresses of respondents is in the database, so i can compare against the list.

Anyone done something like this or have ideas?


texts: In-place editor buttons in footer missing

texts:
I installed the Panels in-place editor which, in principle, should allow me to edit page layouts on the front-end.

But the two big buttons "Customize this Page” and “Change Layout” which should show up at the bottom of the page in the footer, are simply missing; I have a blank footer bar. I have already set the default renderer to IPE as well as given appropriate permissions. Any ideas on how to fix this - get the IPE buttons?? There are no missing dependencies AFAIK, but the evidence suggests I am probably wrong..


texts: Sign Up form Fatal error: Call to undefined function _content_is_empty()

texts:
i have a sign up form that was working correctly until recently i just used it for a test signup and it throws this error
Fatal error: Call to undefined function _content_is_empty()
in sites/all/modules/cck/content.module on line 920

And when i look into line 920 it has this code

915     // Filter out items flagged for removal.
916      $filtered = array();
917      $function = $field['module'] .'_content_is_empty';
918      foreach ((array) $items as $delta => $item) {
919        if (empty($item['_remove'])) {
920          $filtered[] = ($function($item, $field) ? $empty : $item);
921        }
922      }

Any one has any idea. I wonder if its due to the Display fields change in a Custom Data type.?


texts:
I'm trying to convert a Drupal 7 site to Drupal 9 before D7 reaches EOL, and I had a custom module that had a lot of custom tables defined in Hook Schema, that would be joined together in different ways to handle a multi-step form made with the ctools form wizard. This site was originally created in Drupal 6, and updated to Drupal 7 while doing the minimum changes to the custom modules, so it predates the concept of Entities. The database structure of those tables is normalized, in 3rd normal form, because if you flattened it, would your end with millions of rows with mostly redundant information. The problem was that those tables existed in their own microcosm, not accessible to the rest of the site.
I've decided to rebuild everything from the ground up when doing the site upgrade, and I've also decided to drupalize this so the contents of these tables can be accessed by regular views, avoiding content duplication. This means that every old table will have to have it's own entity type. Fields will be basefields for performance, since I will need 50-100 fields in total, and every fiend added through the UI requires a join as far as I understand. If I need to add fields in the future, I will do it through a module update, not by adding them through the UI, so I don't need the entities to be fieldable.
After giving you this context, my actual question is, if I will only ever need 1 type of every entity bundle, do I really need entity bundles? What would entity bundles do for me?


texts: Functional test fails with PHPunit (Button with id|name|label|value "Log in" not found)

texts:
I created a functional test for a custom module named my_custom_module.
I have configured phpunit.xml correctly (SIMPLETEST_DB and SIMPLETEST_BASE_URL).
When I run
vendor/bin/phpunit -c core/ --testsuite functional --filter ExampleTest
I have an error:
Behat\Mink\Exception\ElementNotFoundException : Button with id|name|label|value "Log in" not found.
The error comes when I use my custom permission to create the user and the module as dependencies
public static $modules = [
'my_custom_module',
];

$account = $this->drupalCreateUser(['my custom permission']);

when i use a core permission the test works successfully.
$url = Url::fromRoute('<front>');
$this->drupalLogin($account);
$this->drupalGet($url);
$this->assertSession()->statusCodeEquals(200);

Thanks!


texts:
I have a portfolio view that displays all items in the portfolio. The fields are set via template so I do not have access to the fields area in views to select the parameter there, I have to do it within my node template.

The issue is I can't figure out what code to stick in there to display the "New" tag if the visitor has not yet viewed the node.

This is the code I have in the template:

<a href="<?php print $node_url?>"><?php print $title;?>

  <?php print strip_tags(render($content['field_portfolio_categories'])); ?>

I have googled and found the info here (https://api.drupal.org/api/drupal/includes!theme.inc/function/theme_mark/7) but I just can't figure out how to translate it to what code I put in my actual template file to make it happen.

Thank you so much for your help.

Thank you for your answer!  I am primarily a themer and php just is not my strong suit.

I have changed my code to be:

<a href="<?php print $node_url?>"><?php print $title;?>

  <?php print strip_tags(render($content['field_portfolio_categories'])); ?>
  <?php
    if (node_last_viewed($node->nid) > 0) {
       print '' .  theme('mark', array('type' => MARK_NEW)) . '';
    }
  ?>

This code displays the "new" text, but only if I am logged in as the administrator and it displays on all items, not just ones I have not visited yet.  Any ideas?


texts: Where should I put this JavaScript code ... the Drupal way?

texts:
I´ve read that you can create a mini module to limit comments length.
I´ts cool, and it´s working, but I need to add to it some JS so it tells you how many characters you have left.

So I´ve found some easy thing to do (via Google):

Put this inside your head tag:

And put this in your body:

Text ¦ Chars left: 500

<textarea name=”[1][3][t]” rows=”10″ cols=”50″ onkeyup=”limit(this,500,’count1′);” onkeydown=”limit(this,500,’count1′);” onblur=”limit(this,500,’count1′);” onfocus=”limit(this,500,’count1′);”></textarea>

The thing is that I should add that inside the textarea of the comment body. As you can see, the code works, but how do I make it work the Drupal way?

I need only to limit comment length.

Thanks for your help!
Rosamunda


texts:
"The specified file temporary://filelo2Fkx could not be copied, because the destination directory is not properly configured. This may be caused by a problem with file or directory permissions. More information is available in the system log."

ANYWAY what I am getting is everything minus theme and all images but strangely my multi site folders in root drupal sites folder are all working fine.

In the end I solved it by putting the root subfolder in sites along with other multi-sites. No amount of changing permissions or ownership or clean install or dropping and recreating database worked until then...which is very odd because it used to before I took the site down.


texts: Why can't I call theme functions declared in template.php in mymodule_nodeapi hook?

texts:
I have some theme functions defined in my theme's template.php file that I am calling in my modules with no problems.

I also have some theme functions defined in my_module.module that are also working.

I'm doing some work on themed automated emails with custom rules actions and I found that when rules calls theme functions defined in my theme's template.php file they don't return anything, but when calling the same functions copied and pasted to my_module.module the return what I expect.

I also found that bypassing rules and doing the same process (calling the functions from both locations) in a hook_nodeapi in the 'presave' case gives me the same behaviour. (Strangely however they work in the 'load' case.)

Is there a way I can have my theme functions neatly defined in my theme's template.php where they are already working for all my other modules, and still get at them with rules / hook_nodeapi?

Thanks!

EDIT - more info:

Thanks guys. The reason I put them in the theme to begin with is because I'm working on a multi-domain profile with a parent theme and a subtheme for each sub domain. They were template functions for html emails that need to be branded in with images and styles from each subtheme. I've had problems with putting template theme functions in modules because the path to the templates defaults to the module directory, and I need the template to be selected dynamically based on which subtheme it was called from. Thats why I wanted to define them in the parent theme so they could be overridden per child theme.


texts: Enable/open comments on all posts of a content type

texts:
When I created a content type, I chose to keep the Comments hidden. Now I have many posts of that content-type and I want to open the comments, which I did by editing the content type, but it did not open comments of any posts of that content-type.

How do I open comments on all the posts of a content type at once?

How do I remove that little help box under comments text area?


texts: tb-megamenu how to click to open/close sub menu in mobile

texts: We are attempting to get submenus to only appear when the user "taps" the menu option on a mobile browser. This functionality works good on hover but some mobile devices don't work with hovering. We need the ability to click submenu titles in order to drop them down and then click them again to collapse them.


texts: Domain Access Login Redirect for main domain and subdomain

texts: I have created three sites namely one.example.com, two.example.com, three.example.com using domain access. Here one.example.com is the main site which can create n number of subdomains. I want to redirect the admin of one.example.com to the dashboard and the other two to their respective content listing page. I'm using rules to redirect the admin of one.example.com to the dashboard. But when i login from the two.example.com, it also redirect to the dashboard which returns a "Access denied" page. How to set login redirect separately for subdomains. Please Help. I'm struck!


texts: How to set width to Media entity image in CKEditor

texts:
I have installed Media entity image Module with Lightning Distribution.
I can embed image through CKEditor. But how can I select image-styles for Image witch has embed.

Embedded code in CKEditor

<drupal-entity data-embed-button="media_browser" data-entity-embed-display="view_mode:media.embedded" data-entity-type="media" data-entity-uuid="869dbc6e-de17-4051-8945-e7acd3237c73"></drupal-entity>

Rendered in html