texts:
My users are asking for "chat", but I suspect they mean one on one IM rather than multi-uer chat rooms.

If there is no negative interaction, I could offer both.

There seem to be a few available, so I will just install them all and try them out one by one, unless someone can make a recommendation.

I need something stable for Drupal 7, easy to use for non-sophisticated users (although they all use IM & FB and the like).

We have Organic Groups so anything that can leverage that somehow might be a bonus.

Update: I am not asking what is "best". I am asking what is stable, well supported, easy to install and administer and easy for unsophisticated users. I ought to have made that clearer before. I just want to cut down my search list.

Review: Drupal Chat has a live demo, so try it out.

There is a small grey box labelled "Chat" permanently at the bottom of the screen, showing the number of on-line users. Clicking reveals a list of users, clicking one begins chat (whether the other user likes it or not).

Options are currently in progress (i.e. none).

User is not informed when partner disconnects and just keeps typing, getting no reply. "go idle/go online" has no effect.

User can chat, but that 's all. Still very much a work in progress as at Nov 2011.


texts: How to set Exposed filters in fieldset for specific Views?

texts:
I found an article that can collapse exposed filters into fieldset. But this will change all Views. How can I set below code for specific Views only? For example, I wanna use this on ViewsA only.

<?php
/**
 * hook_preprocess_views_view
 */
function YOUR_MODULE_NAME_preprocess_views_view(&$vars) {
  // Wrap exposed filters in a fieldset.
  if ($vars['exposed']) {
    drupal_add_js('misc/form.js');
    drupal_add_js('misc/collapse.js');
    // Default collapsed
    $collapsed = TRUE;
    $class = array('collapsible', 'collapsed');
    if (count($_GET) > 1){
      // assume other get vars are exposed filters, so expand fieldset
      // to show applied filters
      $collapsed = FALSE;
      $class = array('collapsible');
    }
    $fieldset['element'] = array(
      '#title' => t('Filter'),
      '#collapsible' => TRUE,
      '#collapsed' => $collapsed,
      '#attributes' => array('class' => $class),
      '#children' => $vars['exposed'],
    );
    $vars['exposed'] = theme('fieldset', $fieldset);
  }
}
?>


texts: how to distingush multiple ajax submit in single ajax callback

texts:
I trying to do add more functionality for adding video urls which I am able to do by using Ajax callback.I am referring a drupal examples for it.It has one remove one button which removes last created text field from form. But I want a remove button for each text-field to remove it.

I am creating textfields and remove button in form hook like

for ($i=0; $i < $form_state['num_names']; $i++) {
        $form['names_fieldset'][$i]['title'][$i] = array(
            '#type' => 'textfield',
            '#title' => t('Video Title'),
            '#default_value' => $webinar_videos[$i]->title,
        );
        $form['names_fieldset'][$i]['url'][$i] = array(
            '#type' => 'textfield',
            '#title' => t('Video Url'),
            '#default_value' => $webinar_videos[$i]->video_url,
        );
        $form['names_fieldset'][$i]['remove'][$i] = array(
            '#type' => 'submit',
            '#value' => t('Remove'),
            '#submit' => array('webinar_add_more_remove_one'),
            '#validate' =>false,
            '#ajax' => array(
                'callback' => 'webinar_add_more_callback',
                'wrapper' => 'names-fieldset-wrapper',
            ),
        );
}

Now a 'webinar_add_more_remove_one' submit callback is like

function webinar_add_more_remove_one($form, &$form_state) {

    if ($form_state['num_names'] > 1) {
        $form_state['num_names']--;
    }
    $form_state['rebuild'] = TRUE;
}

and 'webinar_add_more_callback' this callback returns a wrapper element like

function webinar_add_more_callback($form, $form_state) {
    return $form['names_fieldset'];
}

My question is How I can pass a video id to particular remove submit button so that I can delete particular video in 'webinar_add_more_remove_one' callback?

Thank you in advance

Any help appreciated.


texts: No install link for sub theme of sub theme

texts:
In my D8 site I have Magazine Lite, a sub theme of Classy. Magazine Lite is installed.

In web/themes/custom I have a theme installed that in its .info.yml file names Magazine Lite as its base theme.

On the Appearance tab, instead of an install link is the message:

  This theme requires the base theme Magazine Lite to operate correctly

In what way does it require the base theme beyond the base theme being present and installed?


texts: Removing duplicate content caused by node/nid/talk pages

texts:
Recently I installed the talk module, didn't like it and uninstalled it.  After removing it I have noticed that I have duplicate content listed under both the node ID and the node id followed by talk.

For instance:  The page www.mysite.com/about-us is duplicated at the address www.mysite.com/node/4/talk as are all my pages.

In the talk.module file (which has been removed along with the entire talk module) I notice the line:

  $items['node/%node/talk'] = array(

To me this looks like the line of code that created these talk pages, however being that I have removed the entire module, flushed caches etc. I do not understand how these pages still exist.  Any help would really be appreciated as I have been working on this now for several days with no answer.  Thanks in advance.


texts: Disable comments, enable reviews when programatically creating content types

texts:
I am working in drupal 7, creating content types in a custom module with the code below

/**
 * Implements hook_install().
 */

//Create 'award' content type

function awards_entry_3_install(){
    $t = get_t();

    // Step 1 - Define the custom content type

    $content_type = array(
        'type'          => 'awards_entry_3',
        'name'          => $t('Award 3'),
        'description'   => $t('Enter a record into the awards 3 page'),
        'title_label'   => $t('Award title'),
        'base'          => 'node_content',
        'custom'        => 1,
    );

    $node_type = node_type_set_defaults($content_type);

    node_type_save($node_type);

    // Step 2 - Create new fields

    $fields = array(
        // Author’s name field
        'awards_entry_3_author_name' => array(
            'field_name'    => 'awards_entry_3_author_name',
            'type'          => 'text',
            'cardinality'   => 1,
        ),
        // Description of award field
        'awards_entry_3_description' => array(
            'field_name'    => 'awards_entry_3_description',
            'type'          => 'text_long',
            'cardinality'   => 1,
        ),
    );

    //Add fields to database
    foreach( $fields as $field ) {
        field_create_field($field);
    }

    // Step 3 - Attach fields to content type

    $instances = array(
        // Author’s name field
        'awards_entry_3_author_name' => array(
            'field_name'   => 'awards_entry_3_author_name',
            'label'        => $t('Author Name'),
            'required'     => TRUE,
            'widget'       => array('type' => 'text_textfield'),
        ),
        // Description field
        'awards_entry_3_description' => array(
            'field_name'   => 'awards_entry_3_description',
            'label'        => $t('Description'),
            'required'     => TRUE,
            'widget'       => array('type' => 'text_textarea'),
        ),
    );

    foreach( $instances as $instance ) { // Loop through our instances
        $instance['entity_type'] = 'node';
        // Attach the instance to our content type
        $instance['bundle'] = 'awards_entry_3';
        field_create_instance($instance);
    }

    //Set content types' machine name as variable
    $c_path = $content_type['type'];

    //Variable to be tageted with variable_set
    $path = 'pathauto_node_' . $c_path . '_pattern';

    //Set path of new content type
    variable_set($path, 'award/[node:title]');

}

How can I turn 'comments' off and 'revision's on in code?


texts:
I am setting a cookie in an external JavaScript file with the current user time.
I want this time to be available to the server, so I am retrieving this from a cookie.

I am able to fetch the value, but only when I refresh the browser twice. If I change my current system time, and refresh the page, I still see the old time; when I refresh again, then I see the updated time.

JavaScript code

var now=new Date();
currTime=now.getHours();
document.cookie = "currentTime = " +currTime;

PHP code

$current_time = $_COOKIE["currentTime"];
echo $current_time;

I am calling the external JavaScript file in hook_nodeapi() using drupal_add_js().

As I said, I am able to get the updated value of current time from cookie but only if I refresh twice.

What could be the problem?


texts:
I am building a booking system for a local theatre company. Each theatre event is its own node, and for the same show on different nights, the first night is created, and the node is cloned, with a different date and time for each show.

On the node event page I want to show a block view of other nodes with the same title, and different show times.

I have created a contextual filter by node ID, and excluded the current node from the view already, now I need to display all other nodes that have the same title.

I'm a bit stumped though, I can create a contextual filter by node title, but I cant figure out which options I need to select to achieve this.

Appreciate any help or advice.


texts: How do you do download the files folder from the Acquia cloud service?

texts:
I just setup acquia cloud and have a site setup. I've did a git clone to my local desktop along with downloading the DB manually. But how do I get the files downloaded to my local desktop so I can do my own local testing?

Is there a quicker way to do this via drush to get the latest files and db pulled down?


texts: Views to Display Nearby nodes according to user current location(latitued/longitute)GPS

texts:
I have Content type named Restaurant, When creating restaurant nodes I am imputing the Latitude/Longitude  using the GEOFIELD  module.

I have managed to Display all the restaurants in One Map using Views, Leaflet and leaflet Markercluster modules, you can see the attached screenshot.

My task now is to create a page named Nearby, where all restaurants near to user's current location(Latitude/Longitude) will be displayed, let say restaurant within 2km from the current users location.

To get the current user location, A prompt will appear on his/her browser asking them to share their location this is more specific for anonymous users.

I believe there must be a way to accomplish this task using Views or custom module.

Please Guide me step by step on how to make it happen.

any help will be highly appreciated.


texts: Page not found when there are clean extra parameters in URL alias-

texts:
I have a working site which has PathAuto with SubPath setting properly configured. When I try to access the site from localhost in XAMPP, it gives 404 not found at several pages where the clean URL has extra parameters.

For example,  this goes perfect: subdomain.example.com/url-friendly/extra-parameters

This, in local PC: www.example2.com/url-friendly/ goes right
This, in local PC. fails www.example2.com/url-friendly/extra-parameters

Is there some known issue with XAMPP and Drupal url alias?


texts: How to change the default logo size in the OpenChurch theme?

texts:
I'm trying to upload an image for the logo with a slightly higher resolution than the default logo, but I don't find any way to change the default logo size in the OpenChurch theme. I don't need the text beside the logo there, but I need a bigger logo.

Any suggestions?


texts:
Is it possible to re-send a newsletter once it's been sent?

I am using a Simplenews module and the Subscriptions module).


texts:
I've followed the tutorial to create a custom block from
https://www.drupal.org/node/2101565

My module installed fine and I can see the block in the list of available Blocks for placing, but as soon as I click "Place Block" I just see the ajax loader for about 1 second and then nothing happens, the dialog stays open and my block does not get placed. Cleared the cache etc. didn't help, the error log does not show any available messages.

My src/Plugin/Block/TestBlock.php file:

<?php
namespace Drupal\test_block\Plugin\Block;

use Drupal\block\BlockBase;

/**
 * Provides a 'Demo' block.
 *
 * @Block(
 *   id = "test_block",
 *   admin_label = @Translation("A Test Block"),
 * )
 */
class TestBlock extends BlockBase {
  /**
   * {@inheritdoc}
   */
  public function build() {
    return array(
      '#markup' => $this->t('Hello, World!'),
    );
  }
}
?>

Drupal 8.1.1


texts: View for Entity Reference reverse, backwards forwards

texts:
The need is to present in a landing page a view of all pages that do reference to this landing page. So, this view will search in other content type, to find in a reference field that contain same id.

Landing page content type have several nodes children.

Page content type have a Entity reference field_back_parent for a node parent

Content types
Landing page (1) parent,
  Page (2) child,
  Page (3) child,

I would like to this using UI in admin. So, no entityQuery in this opportunity.


texts:
I want to run JavaScript code upon a form being submitted preceding other default tasks that are carried out on form submission.

May anyone suggest some approaches?


texts: Drupal 7 - Is there an easy way to track individual user page visits using Google Analytics or can I just do this within Drupal?


texts: How to show a block on user profile edit page ?

texts:
I am trying to display a block on an user edit page (example: user/123/edit/custom_url, but for some reason, I can't seem to get it working. Any help is appreciated.

I tried this, but this isn't working:

<?php
global $user;
if (arg(0) == 'user' && $user->uid == arg(1) && arg(2) == 'edit' && arg(3) == 'custom_url' ){
  return TRUE;
}
else {
  return FALSE;
}
?>


texts: Attach the module "Insert" to ALL "Body" fields?

texts:
I've just installed the Insert module. I have many many content types in my site and all of them contains the same "Body" field. It would take me much time to attach an Insert image-field to each one of them manually and I need a way to do that at once.

How will you achieve this goal? If you drop a module's name please also detail in steps where and what will you do to achieve it.


texts: Hello I am new to drupal 7, I want to create an module where I use and connect an API to my website. Any help from where to start?


texts: How to get the breadcrumb from a module template?

texts: I'm using D8 and I want to display only the first item of the breadcrumb in a block. So I need the breadcrumb, and manipulate it to display only the first item. Unfortunately, I don't know how to get it.


texts: Can users switch to different Profile2 profiles?

texts:
I'm trying to implement a membership site and am considering using a Profile2 profile form as an application for membership.

So I'd make a profile type for Membership A. The user would apply for Membership A, get admin approval, then be given an account with Membership A.

Later, they might want to upgrade their membership to B. Can they just switch their Profile type to a different one? Or submit a request for this and an admin changes their profile type?

Note that Membership A has fields 1,2,3,4 and Membership B has 1,2,3,4,5,6,7,8,9. So maybe just add a second profile type (B, with fields 5,6,7,8,9) rather than switch?


texts: Which hook occurs last before rendering the exposed filter widgets?

texts:
I'm trying to edit the variables that go from Views into the form array editted by hook_form_alter() and the tpl file views-exposed-form.tpl.php. Specifically, I'm trying to use the contents of $view->exposed_input for form theming, without resorting to using $view = views_get_current_view();

I've tried working my way up the order of execution defined here:

  hook_views_pre_view
  hook_views_pre_build
  hook_views_post_build
  hook_views_pre_execute
  hook_views_post_execute
  hook_views_pre_render
  hook_views_post_render

...but I'm stuck. At hook_views_pre_render(), $view->exposed_widgets gives me already-rendered HTML, so it's clearly too late, but the earlier ones don't give me anything at all.

Based on How to choose between all the views hooks?, I've tried using a preprocess hook based on the tpl file name, like hook_preprocess_views_exposed_form(), but the view isn't in scope here, I'm looking for the last views hook before this where I can find data from the view to these variables.

What I want to do, is take the contents of $view->exposed_input, and pass it through to the exposed form tpl file so that I can add a facet-like summary of current filters to my view. Which is the Views hook where I can do this?

I'm using Better Exposed Filters module, so if there are any hooks or tricks specific to that,they'd be welcome.


texts:
I have a custom content entity that renders fine in its page view and form. I'm now trying to view one of its fields in a table using an EntityListBuilder, but the following code throws an error message:

public function buildRow(EntityInterface $entity) {
  $row['id'] = $entity->id();
  $row['email'] = $entity->email->view();

  return $row + parent::buildRow($entity);
}

Results in:

  Fatal error: Call to undefined method
  Drupal\my_module\Entity\MyEntity::render() in
  /.../core/lib/Drupal/Core/Template/Attribute.php on line 294

Apparently the view builder expects a render() method, which I do not have, and which I do not want to implement, since the entity renders fine otherwise...

Also tried EntityViewBuilder::viewField() with no success.

Even when I'm viewing a node instead of my custom entity, I get the same message.


texts: How to register a theme function from the theme

texts:
I want to introduce a custom theme function in my theme.  Typically, I would register a theme in hook_theme() in a module, but I want to define this function from my theme (Omega 4).  In whatever module I'm in, I'd like to just build my render array and let it be themed by the theme-side theme function.

Example:

$ra = array(
    '#theme' => 'my_theme_fx',
    '#somevar' => 'foo',
    '#anothervar' => 'bar'
);


texts: Use CAPTCHA module on a custom HTML form? (no use of Drupal Form API)

texts:
Is it possible to use the CAPTCHA module on a custom HTML form created in a content page of a Drupal 7 site?  I am not using the Drupal Form API or webform modules.  The form has the following code:

<form id="signup_form" action="[form action]" method="post" enctype="application/x-www-form-urlencoded">

<input id="firstName" tabindex="1" type="text" name="firstName" placeholder="First Name" value="" required />
First Name*

<input id="lastName" tabindex="2" type="text" name="lastName" placeholder="Last Name" value="" required />
Last Name*

<input id="email" tabindex="3" type="text" name="email" placeholder="Email" />
Email*

<input type="hidden" name="form_id" value="signup_form" />

<input id="btn-submit" tabindex="6" class="submit" type="submit" name="submitButton" value="SIGN UP" />

</form>

I'm trying to have reCAPTCHA displayed at the bottom of the page when there has been an X number of form submissions from the same IP address in a given amount of time.   I was hoping CAPTCHA After could work for my custom form -- I tested it on our site's Admin Login page (/user) and it worked great, of course.

I can't seem to get any CAPTCHA displaying on my custom HTML form page.  In the General Settings, I selected "Add CAPTCHA administration links to forms" and a drop-down with "CAPTCHA: CHALLENGE "RECAPTCHA" ENABLED" displayed in the content page where the form is coded.

Since the HTML id has nothing to do with $form_id... I referenced this Drupal Stack Exchange page, and haven't been able to generate the form ID...I'm wondering maybe my custom HTML form doesn't have a $form_id because it doesn't use any drupal form modules?  If that's the case, then I probably can't use the CAPTCHA module.  Could someone please confirm?

Perhaps I can't use any Drupal modules and may need to:

grab the user's IP address from the header via PHP:

$ip_address = $_SERVER["REMOTE_ADDR"];
store this IP address in some sort of database and add a timestamp
delete any IP address entities in that are over an hour old
count the number of data store entities via loop and if the same IP address appears a certain # of times in a given amount of time, then display reCAPTCHA

Any guidance would be great.  Thank you!


texts:
I have this in my routing page

function_adh_apport.adh_apport:
  path: '/collecte/apports/{date}'
  defaults:
    _controller: '\Drupal\function_adh_apport\Controller\RapportsController::filtrer'
    date: ''
  requirements:
    _permission: 'access content'
    date: \d+

I got this url : ../web/collecte/apports/2016

but now, i'm trying to show in twig the value of {date}

So i do this in twig :

{{ path('function_adh_apport.adh_apport', { 'date': apports.date}) }}

but it return "../web/collecte/apports" and not just "2016"


texts:
I am running drupal 7 and using the following twitter module for twitter feed to display on the front page of a site.

Twitter Pull   7.x-1.0-rc1 Pull Info from Twitter and Create Contextual Insets

Recently, start getting the following error message instead of twitter feed

Errors occured while trying to retrieve tweets. Please check Watchdog log messages.

I don't have watchdog configured nor see any other error log that lead to anywhere. Please note that I am new to drupal. kindly let me know with detail steps how do I resolve this issue.

I see the following on /admin/reports/dblog

 Reports
 Status report
 Get a status report about your site's operation and any detected problems.
 Field list
 Overview of fields on all entity types.

This was working so I am sure the API keys were setup but I don't know where to look to confirm this.

Good idea to enable database logging. I have enabled the database logging now seeing more detail error message:

Non-empty list of tweets returned blank space after applying theme function. Most probably you are passing invalid/unregistered theme key or tpl file corresponding to the theme key does not yet exist. Please fix the problem.

I will check details on sendbox.


texts: How to theme a select box with multiple selection enabled

texts:
I have a select box with multiple selection option enabled in my custom form. Everything is works fine, however the problem is the appearance is not good and also If I have more options then the selection becomes difficult.

Is there any module out there which offers left-right selection widget like below

or any other better solution which offers better user friendly selection for select box with multiple selection option enabled.

Hope there is an easy way to achieve this rather than writing custom CSS, jQuery/JavaScript code.


texts: How to write a Drush script to retrieve data?

texts:
I want to retrieve a field value by given nodes. Node has a field 'promo code'.

How can I retrieve imageurl value by giving 'promo code' field using a drush script?

What is the better way to do it?

I want to get data as a JSON or XML format for all the given nodes.


texts: I've been told I should implement this hook thing, what does that mean?


texts: Content/scripts missing from output after migrating from Apache/MySQL to IIS 7.5 MySQL

texts:
I have recently attempted to deploy a Drupal 7 site to Windows Server 2008 R2 / IIS 7.5 / MySQL 5.6 and I'm getting some very strange results. Many of the Javascript files are not outputting, and some are outputting incorrectly. In addition it seems the content from a number of my page regions is outputting blank. The problem only seems to be affecting the front-end theme which is based on Framework. The back end theme which is working fine is running on Shiny and appears to have no problem. According to Status Report everything is green.

One example of a missing script is that the jQuery Update module is installed and configured to load 1.8, even in the admin interface on IIS. However on the front-end only the core jQuery 1.4.4 is outputting.

I've tried re-importing the SQL multiple times and checking the table statuses and cannot see any difference. Things like URL rewriting are working fine. There are instances of some content outputting, such as node bodies are outputting, but the surrounding header/footers are still completely white. Can't see any errors in the error log and the HTML does not appear to be malformed or truncated.

The server environment specifications and software versions are essentially set in stone as corporate policy, and I'm told that similar environments are in use for other Drupal 7 installations although I do not have access to these.

I'm a bit lost as for where to look where next, anybody else had any similar issues?


texts:
I'm a little exhausted and don't know where to look anymore.

After checking "aggregate and compress CSS-Files" it seems that Drupal is loading old files.

So far I tried:

Clearing Cache (of course)
Deleting the aggregated files from "sites/default/files/css"
Reloading page to re-aggregate the css files

Unfortunately Drupal is still loading the old files.

Where is Drupal getting these old files from and how to delete or refresh them?


texts: I am new to Drupal 8. I am building a website with Drupal 8, and it has many blocks contain images. They have an absolute path for the src attribute right now. I would like to make them dynamic base on the base URL, but there is no text format support PHP code anymore for security reason. Is there a safe way to achieve this?


texts: Is it possible to create a graph out of collected information stored in a Drupal database?

texts:
I am new to Drupal. As a beginner I want to create a website which needs to store lots of information. And from the collected information (statistics), I want to map a graph (or chart) out of it.

My Question: Can it be done using Drupal?


texts: Need to display fields in a different format

texts:
I have following fields in my content type:

Title: [some value]
Year: [2011,2012,2013,2014,2014,2016]
Volume: [01,02,03,04,05]
Issue: [1,2,3,4,5]
Description: [some text]

And I want a output display like the below Format.

OUTPUT:

2013
Volume 01: Issue 1,  Issue 2

2012
Volume 01: Issue 1,  Issue 2,  Issue 3

2011
Volume 01: Issue 1,  Issue 2,  Issue 3

All Issues will be hyperlinked. If I click 'Issue 1' under year '2013' it should take me to a page where all posts having value 2013, Volume 01, Issue 1 should be displayed.

How this is done using Views in Drupal 7?

Thanks


texts:
My system environment:

OS - Windows 10 64-bit
Local Server Stack - WampServer
Drupal 8.9.8
Theme Droopler
Module Commerce - installed using Composer and enabled by Drush

The Status Report (screen capture as below):

The setting for Commerce Number Pattern:

Despite clearing the cache after updating the default number setting, Drupal still reports an error as shown above.
Any assistance is greatly valued.
Thank you.


texts: Programatically remove field content from all nodes where content equals 'string'?

texts:
I am doing a migration from D7 to D8. Due to various issues in the initial site, I am doing content migration through CSV import rather than the direct drupal to drupal migration that's built in.

My content type has a Video Embed Field in it, which was throwing errors on migration unless it was filled. As such, I had to throw in a placeholder video URL for all nodes that didn't have the node filled.

Is there a way to (within drupal, or via a SQL query) programatically remove the field content from all nodes where the url is "youtube.com/myPlaceholderVideo"? All the content is in, but now I'm stuck with ~450 nodes with this placeholder URL.


texts: How can I upload files with the form element type file?

texts:
I want to upload a file and I have to use form element type as 'file'. In submit function I am not able to get any proper data related to the file which I am uploading. SO Can anyone please help me to resolve this. Please find the below code:
public function buildForm(array $form, FormStateInterface $form_state) {
  $form['test_CERTIFICATE'] = [
    '#type' => 'file',
    '#title' => $this->t('Certificate'),
    '#description' => $this->t('Your Certificate (.pem file)').': '.\Drupal::state()->get('test_CERTIFICATE_NAME'),
  ];

  return parent::buildForm($form, $form_state);
}

Submit function:
public function submitForm(array &$form, FormStateInterface $form_state) {
  parent::submitForm($form, $form_state);

  $validators = array('file_validate_extensions' => array('pem'));
  $files = file_save_upload('test_CERTIFICATE', $validators, 'public://certfiles', FILE_EXISTS_REPLACE);
  $file = File::load($files[0]);
  if ($file) {
    kint($files); exit;
    // here control is not coming
    $file->setPermanent();
    $file->save();
  }
}


texts: What license can I apply for a theme I sell?

texts:
I'm interested in creating a premium theme to sell online; I've heard a lot about the Drupal GPL licensing and wanted to make sure I've got my facts right.

If I understand it correctly, everything that works with Drupal, such as the template files and any Drupal related JavaScript counts as "derivative works", so those bits I will have to distribute as GPL.

However, things like the CSS and Images that make up most of the "design" of my theme I can distribute under my own licence, and therefore charge for.

I used the Collective Mind's End User License Agreement (EULA) as a guide.

Is this correct? Does this change if I use one of the many base themes in Drupal? Are there any practical consideration?


texts:
I tried to enable AT theme and now have a white page with the error:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 72 bytes) in /Applications/MAMP/htdocs/test/includes/theme.inc on line 98

I changed my php.ini memory_limit = 128M. No difference.

I am so crazy pressed for time, this is the worst thing to happen now. How can i fix this?
Please somebody HELP!!!!!

The site is on a localhost.

PS- now i see a different error:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 72 bytes) in /Applications/MAMP/htdocs/test/sites/all/modules/ds/includes/ds.registry.inc on line 554

Drupal 7.2.4


texts: programmatically add line item of commerce_discount type to order

texts:
I want to programmatically add line item of commerce_doscount type to my order, I test below code,it is correctly add a record to line items array but not show in  order list even I refresh the order I dont see anything in order table .

$amount = trim($amount);
  $basePrice = commerce_price_field_data_auto_creation();
  $basePrice['amount'] = $amount;
  $order_wrapper = entity_metadata_wrapper('commerce_order', $order);
if ($amount) {
    $order_wrapper = entity_metadata_wrapper('commerce_order', $order);
     $line_item = entity_create('commerce_line_item', array(
    'type' => 'commerce_discount',
    'line_item_label' => 'my test',
    'quantity' => 1,
));
    // Wrap the line item and product to easily set field information.
$line_item_wrapper = entity_metadata_wrapper('commerce_line_item', $line_item);
// Set the unit price on the line item object.
$basePrice = commerce_price_field_data_auto_creation();
$basePrice['amount'] = $amount;
  $line_item_wrapper->commerce_unit_price = $basePrice;
// Save the line item now so we get its ID.
  commerce_line_item_save($line_item);

      //  $line_item = commerce_line_item_save($line_item);
        // Add it to the order's line item reference value.
$order_wrapper->commerce_line_items[] = $line_item;
     //commerce_order_save($wrapper);
      commerce_order_save($order);
$order = commerce_order_load($order->order_id);

        // Recalculate discounts.
      //  ym($order);
        commerce_cart_order_refresh($order);

also I look at discount module and try below code

 module_load_include('inc', 'commerce_discount', 'commerce_discount.rules');
   $amount = trim($amount);
  $basePrice = commerce_price_field_data_auto_creation();
  $basePrice['amount'] = $amount;
  $order_wrapper = entity_metadata_wrapper('commerce_order', $order);
  commerce_discount_add_line_item($order_wrapper,'commerce_discount',$basePrice);

but return me EntityMetadataWrapperException: Unable to get the data property commerce_total as the parent data structure is not set. in EntityStructureWrapper->getPropertyValue()


texts: Extending existing menu/route in module_menu_alter

texts:
Trying to extend Rooms (rooms_booking_manager):

Originally, there is an enquiry-page which takes arguments

"enquiry/[startDate]/[endDate]/[roomNumber]"

I want to write a more specific handler IF arguments persons and children are given as in enquiry/startDate/endDate/roomNumber/numberOfPersons/numberOfChildren; in that case my own handler should take precedence.

This is the code used by the module.

function rooms_booking_manager_menu() {
  $items = array();

  $items['enquiry/%start_date/%end_date'] = array(
    'title' => 'Ask about availability',
    'page callback' => 'rooms_booking_manager_enquiry_page',
    'page arguments' => array(1, 2),
    'access arguments' => array('book units'),
    'type' => MENU_CALLBACK,
  );

  // …

  return $items;
}

This is the code I use in my module.

function netfactory_rooms_menu_alter(&$items) {
  $items['enquiry/%start_date/%end_date/%persons/%children'] = array(
    'title' => 'Ask about availability',
    'page callback' => 'netfactory_rooms_enquiry_page',
    'page arguments' => array(1, 2, 3, 4),
    'access arguments' => array('book units'),
    'type' => MENU_CALLBACK,
  );
}

Nevertheless, if I call enquiry/startDate/endDate/roomNumber/numberOfPersons/numberOfChildren rooms_booking_manager_enquiry_page() is called instead of netfactory_rooms_enquiry_page().

Coming from a .NET MVC background, I was thinking that the order (most specific first) is important; so I also tried setting weight=-1000 on my own route, but that did not help either.

How can I hook into a module to add a route which is MORE SPECIFIC than an existing route?


texts:
Hi can someone help me with some field maths. I have taxonomy vocabulary called "plast" with several terms (large box, small box etc.) i have created field within the taxonomy called weight which is linked to each term. Now i have a nod where the user selects term from the taxonomy "plastic"and in the next field enters amount, what i want is to show i the next field "total weight" is weight from the taxonomy term multiplied by the amount.

thanks


texts:
I have a View that is using the Table format to show all users who have uploaded content under a particular node. This view will be visible to anyone in the Authenticated User role. Users in Administrator role (about 4 users) also contribute to this, but I don't want their details to be visible to anyone else in the table. This is not intended to be an exposed filter.

So basically, if the current logged in user is in the Authenticated User role, then he should not see the admins.

If the current logged in user is in the Administrator role, then he should see everyone.

Possible? Thank you


texts: How do you use hook_query_alter to get inside a query's creation?

texts:
I'm getting no love from hook_query_alter.  I have a simple query to which I want to add a tag, while also adding a node_access tag.  Thus the whole query looks like this:

$the_nodes = db_select('node', 'n')
     ->condition('n.type', 'some_node_type')
     ->fields('n', array('nid', 'title'))
     ->addTag('node_access')
     ->addTag('my_custom_tag')
     ->execute()->fetchAll();

I then define a handler in one of my modules and litter it with debugging statements, hoping something will happen:

function mymodule_query_alter(QueryAlterableInterface $the_query) {
    dsm("inside mymodule_query_alter");
    dsm($the_query);
    if ($the_query->hasTag('my_custom_tag')) {
        dsm('Found it!');
        // do real work here
    }
}

I then clear the system cache.  Once I've done this, the following things happen:

My handler is running, and reports a number of invocations from
various system calls.
The objects being dumped by the dsm calls are all very much alike --
they contain only an alterTags array, which typically has entries
for either node_load_multiple or file_load_multiple, but nothing else -- certainly nothing like a full Query object.
None of the alterTags arrays have an entry for my_custom_tag.
The inner "Found it!" message never fires.

Arggh.  This is my first encounter with hook_query_alter(), and I'm probably just missing something basic about its use.  Can anybody clue me in?  (BTW, based on some browsing around, I've also tried defining handlers for my_module_query_my_custom_tag_alter and my_module_query_node_access_alter, but never see anything from them.)


texts: How to select nodes without taxonomy terms from a vocabulary in views?

texts:
Is it possible to select all nodes that have no taxonomy terms from a vocabulary in views?

I tried the "is empty" option in the filter section, but it does not work.

I need to do that in views because I have to use VBO on the results of the query.


texts:
I have Drupal 8 project on my local machine, which is set up with composer and I got drush included. When I'm in project root I can call drush like:
vendor/bin/drush -v

And that work well (initialized it so I can call it without typing full path):
Drush Commandline Tool 9.7.2

...
But when I moved the same project to staging server, when I try to run the same command I get error message:
PHP Warning:  require(/path_to_project/vendor/bin/drush.php): failed to open stream: No such file or directory in /path_to_project/vendor/bin/drush on line 4
PHP Fatal error:  require(): Failed opening required '/path_to_project/vendor/bin/drush.php' (include_path='.:/usr/local/share/pear') in /path_to_project/vendor/bin/drush on line 4

Inside drush file I'm executing from bin there is only one line (line 4):
require __DIR__ . '/drush.php';

But that require fails and triggers this error. drush.php file is located (in both cases) inside: vendor/drush/drush/drush.php
I have another project with the same setup and drush there works well on local box and on that other staging server, so I know problem is in server setup somewhere, but don't know where exactly? That include path from error message "include_path='.:/usr/local/share/pear'" looks suspicious to me.
Since I'm not server admin do I need his help to solve this?


texts: Restful API: Change date format from unixtime to ISO-8601

texts:
Applying the date_iso8601 Drupal function in a simple process_callbacks on the public_fields in the class file for each date field works to convert the output/display of the date format, but does not allow that format to be used for filtering by the date value.

  'process_callbacks' => array(
    'date_iso8601',
  ),

So we need to figure out how to make the query filter use the ISO 8601 date format and support things like partial matches using just YYYY-MM-DD and ensure different operators work as well (>, <, >=, <=).


texts: Content Encoding Error - The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression

texts:
Drupal 7.56, PHP 5, PHP-FPM, multi-site Ubuntu 14.04.1 LTS server

EDIT: it's NOT only when I'm logged in to my site do I get this error:

  Content Encoding Error

  The page you are trying to view cannot be shown because it uses an
  invalid or unsupported form of compression.

It happens 1/3 of the time I try to load a page. If I click "try again" twice or refresh the page twice it will load. I have followed these steps from the accepted answer on Content encoding error after enabling cache, aggregation and compression

$conf = array(
'cache' => '0',
'preprocess_css' => '0',
'preprocess_js' => '0',
'block_cache' => '0',
'page_compression' => '0',
);

I have also checked php.ini, per other resolutions, and error reporting is off.

I checked for PHP error reporting per https://www.drupaleasy.com/quicktips/browser-fail-unsupported-form-compression-related-php-notice and https://www.drupal.org/node/373101 and when I ran the wget command there was no PHP error up top.

The behavior does not change at all after clearing my browser's cache.

FWIW I've tested by disabling every module I could (I'm fighting AddThis right now). I also had to increase the memory limit from 128M to 1000M because I kept getting 500 errors too. See my note on 500 Internal Server Error after logging in

I also had to update a theme.inc file based on this error:

  /e modifier is no longer supported, use preg_replace_callback instead
  in…

as seen at https://stackoverflow.com/questions/38067166/replace-preg-replace-with-preg-replace-callback-still-failing?noredirect=1&lq=1

UPDATE:
the 500 error seems to have been fixed with a permissions reset. I put the memory_limit back to 128M after the permissions reset and no more 500 errors. I got one from Chrome at first but maybe it was a cached thing? Now no more.

Also, per Anson W Han in the comments, I have tried reverting my change to the theme file with no success. And the theme is supposed to be best with PHP 5.2-5.6 and I am running PHP 5.5.9

UPDATE:
the 500 error is NOT resolved after all


texts: Commerce multiple stores and multiple carts for B2B customers

texts:
i have a problem with multiple stores.
i set up 2 stores of the same type. store B2B for B2B customers and store B2C for B2C.

all products are sold in store B2B and just a few also in store B2C.

when i add to cart products from B2B store, in cart page i have only one commerce_cart_form view.
when i add a product sold also in B2C store, i have 2 commerce_cart_form view.

the first one with products sold in B2B store and the second one with products sold in B2C store.

why are there 2 carts?

it seems that built multiple stores to manage B2B and B2C is not the right choice.
thanks


texts:
views3 supports plugable backends rather than a RDBMS, there are backends for solr, sparql, mongodb.

Is there such a plug in to enable views to be a front end for a SOAP api? I have found a number of modules to do with services, soap, etc. But nothing which would clearly fill this role.


texts: How to change the label of exposed grouped Filter field in Views?

texts:
Ok, I also have the Better Exposed Filters module installed and enabled on this view, but this does not help.  I have no control over the label of this exposed filter that is being grouped.  There is no option to change the label on grouped items, only on single items.

What do I have to do to be able to change the label?  Am using Drupal 7.24 and Views 7.x-3.7 and Better Exposed Filters 7.x-3.0-beta3.

Thanks to anyone who can help... right now it is showing the machine label in parenthesis next to the actual title of the field.  I'd rather just have only the title of the field.

Here is what the settings look like for an exposed grouped filter to me:

And here is what the filter looks like on the actual view:

How to get rid of the (field_department) text or change the label completely?


texts:
In Making use of the admin UI, Step 3 - Implement the entity adding/editing form, it says that you need to implement "a" form with the  ENTITY_TYPE_form() signature for add/edit/clone operations...

However the wiki page is not specific in regards to whether you should implement one or two forms. I explain - the example creates two "entities": a "regular" entity, and a "bundle" entity. The example then implements ENTITY_TYPE_form() for the "bundle" kind of entity ONLY.

In attempt two answer the question: "Should I implement one or two forms?" I looked at the source code of both the Model and the Profile2 modules. The source of my confusion is that the Profile2 module implements only one form - like in the example - for the "bundle" kind of entity. But on the other hand the Model module implements two forms: one for the "regular" entity, and another one for the "bundle" entity. Why? What's the correct use case? What's the difference between the two implementations? What additional ability does implementing the "regular" entity form give us, if any?


texts:
OK, so here's my problem

I am using Simple Hierarchical Select module.

I have a taxonomy structure like this

Parent
-Child 1
-Child 2

... And I have contents linked to these terms like this
Content 1 - Parent
Content 2 - Child 1
Content 3 - Child 2
Content 4 - Child 2

So apparently if I select the Parent term in an exposed filter its only showing Content 1 and not all the 4 contents. Is it normal with this module? Isnt there a workaround for this?

Help appreciated...


texts: Redirect user after login when using openID_connect module.

texts: I have a Drupal 8 site that is utilizing the openID Connect module that users use to login to the site. I am also using the login destination module to set a specific page that the user is redirected to after login. The login destination module redirects correctly when a user logs in using the default Drupal login (this will not be available on the production site) or through a one time login link. However when using the openID to login, after a successful login the user is brought to their user profile page instead of the page specified in the login destination module. Anyone have any experience on how to redirect to a specific page after logging in using openID?


texts: How do I create content links to a group node without using panels?

texts:
I am new to Organic Groups and I am following the videos at https://modulesunraveled.com/organic-groups-7x-2x . Video 4 demonstrates how to insert a create content link on a group page using Panels and I am able to replicate this, when following the video.

However, I would prefer not to use Panels and can not display a create content link in a basic layout (without Panels or Display Suite).

Various posts say that having entityreference_prepopulate module is key, but as far as I can tell, I have this configured properly (otherwise my panel wouldn't work).

I am expecting to see a display formatter on the content type or perhaps a module generated block, but nothing seems apparent.

What am I missing?


texts: Access denied for admin user after new drupal 6 install

texts:
I just installed Drupal 6 (Don't ask why) from a fresh install (Version 6.29). I followed the install steps, created an admin user, set the correct time zone, etc.

But when I login and attempt to proceed to the admin panel, I get Access denied
You are not authorized to access this page. I have read about this issue many other places, and have attempted many solutions, but none seem to work for me.

I noticed that there is nothing in the sessions table of my MySQL database for this drupal install (but there is data in other tables). I think that this has something to do with it, but ti could be that there is info in the table, but it is immediately removed due to a session/cookie issue.

I have repeatedly removed all my browser cookies each time I have tried a solution. I have tried many solutions on drupal.org, many of which have been also referenced on other sites, but none have worked.

OS: Mac OSX 10.9 (Mavericks)

Web Server: Apache/2.2.24 (Unix) PHP/5.4.17 mod_ssl/2.2.24 OpenSSL/0.9.8y DAV/2 Server at XX.XX.XXX.XXX Port 80

Not using SSL for this drupal install.


texts:
I would like to update a custom field, added to my order items, in the price resolver process. The price resolver process do some sort of queries to select the right price and this selection has a key that I want to save in the custom field.
I'm not sure how could I alter the order line item after the right price was selected.


texts: Render fields in node template with different view mode

texts:
I have some fields for nodes. I hide the content and render fields separately as below.

hide($content);
print render($content['field_01']);
print render($content['field_02']);
print render($content['field_03']);
print render($content['field_04']);
print render($content['field_05']);

I set different field formats in content type at Manage Display" like field_01 is an image and i set large image in Full Content and Thumb image in Teaser view mode. field_02 is a taxonomy reference field which i set Link in Full Content and Plain Text in Teaser view mode.

When i render fields in node template, all fields render as view mode "Full".
Now i want render all fields from default view mode "Full". Only I want to render field_01 & field_02 from Teaser view mode.


texts: I cannot configure the site during installation

texts:
I have installed MAMP and Drupal 8 into my windows 10 machine.

I can successfully setup database and installed modules but while setting up site, i am getting below error.

  Call to a member function setRecipients() on null in standard_form_install_configure_submit() (line 25 of core\profiles\standard\standard.profile).
  standard_form_install_configure_submit(Array, Object)


texts: How to change the default search button value in awesome zymphonies free theme?

texts:
please have a look at the site, http://35.187.238.51/jrdtml/. This is a prototype site of the library I'm working for. I'm using Drupal 8.4 with Awesome Zymphonies free theme. I would want to change the text in the default Search box from 'Search' to 'Site Search'. Also I would like the Search box to appear in different pages other than just the Home page.

Thanks for your attention.

Best, Francis


texts:
Getting a node via Drupal 8's RESTful web service can be done by doing a GET with this url:

/entity/node/1

How then, do you access a View?   I've tried the following, with no luck:

entity/view/myviewid

Where 'myviewid' is id specified in views.view.myview.yml

My rest settings for views are exacty the same for nodes, which return JSON successfully.  The view GET attempt however, returns a 500 Internal Server Error.


texts: Module to display a website's favicon when displaying a link to it

texts:
I'm looking for a module that will display a website's favicon when display a link to that site. Specifically, I want to enable it to one certain Link field.

For example, if a user edits a node and uses the URL https://www.facebook.com/pages/Drupal/8427738891 in a Link field, I want to display the favicon https://www.facebook.com/favicon.ico.

Ideally, the module can cache the favicon locally (there are several benefits for this)

(Also: See my other question, if there is some a module that can do both it'll be great)


texts:
I am trying to use Vertical Tabs on the front end of my site.

Normally, I would just add a jQuery plug-in to my theme. However, vertical tabs are built into Drupal 7, so it seems silly to use a plugin, when the functionality already exists.

I'm just not sure how to call the built-in vertical tabs.

Dan Silver's blog has an excellent tutorial on how to call the built-in tabs. However, his tutorial is for horizontal tabs. I am not sure how to convert them to vertical ones.

I would appreciate if anyone could give me some hints.

(P.S. I am aware that modules exist to do this. However, for my purposes it seems overkill to use a module when I can achieve it with a few simple lines of theming).


texts:
I'm using hook_node_insert to process some data from node.

This code returns image URL, BUT i'm using FileField Paths and i can't manage to get the final image URL. Is there any way to solve this issue?

$fid = $node->field_imagen['und'][0]['fid'];
$imgpath = file_load($fid)->uri;
$url = file_create_url($imgpath);

Thanks


texts: I have a problem with the module image field crop.  I upload an image and I can to crop but when I am going to edit the node to change the crop of the image, I can't. When I edit a node, I only see the cropped image. To change the crop area I need to remove the image and upload the original image again.  Is not it possible to edit the crop for the images?


texts:
I moved a git repo from github to local gitweb and want to access the raw build make file

http://git.mycompany.com/?p=workflow.git;a=blob_plain;f=build-workflow.make;h=170f5329b413bea0efb1ec33bebdc1549403cc3e;hb=HEAD

opening that url in browser is fine:   raw code same as in github

But drush make complains about missing core and api entries.

So I checked with wget and it saves a `index.html?p=workflow.git' which is a complete html page.

How is that supposed to work on gitweb ??


texts: File browser of ckeditor increase overhead by loading unnecessary folders

texts:
When I try to use the image file browser of the CKeditor, the browser takes a lot of time to load. When I checked the request, I found that the browser loads a lot of folders that are not even displayed.

The logs shows that the file browser try to load all the folders under /pub/sites/default/files/ will it be possible to limit that to only request the folders under /pub/sites/default/files/u285430 where u285430 is the user folder ?


texts: Move file uploads in webform into subdirectory using hook_webform_submission_presave

texts:
I'm using the webform_multiple_file module to let users upload files in a webform. There is a second form component in that form. It's a number.
I want to change the upload directory, which is defined on webform admin and is 'webform/uploads' in my case. I want the uploaded files to be stored in subfolders named by the number in the second form field.
So the upload directory should be s.th. like 'webform/uloads/102'.

I first tried to accomplish it with hook_webform_submission_presave, but I only can change the file id.

Then I found hook_file_presave, which seems to be the perfect function to solve my problem, but now I'm stuck with the question, how to get the value from my form field into the presave function? The only parameter is $file.

Can someone help me on this? Submission- or file-presave? Is it possible to change the file- and upload-directory in hook_webform_submission_presave?

UPDATE:

I was able to get the form value with $GLOBALS in hook_file_presave.

$order_number = $GLOBALS['_POST']['submitted']['upload_formular']['upload_wrapper']['bestellnummer'];

Some string-functions on $file->uri do get the split point and first and second part of uri. Append first part with the value of 'bestellnummer' as the subdirectory.
Next I create the subdirectory with

file_prepare_directory($newdir, FILE_CREATE_DIRECTORY);

Then I change $file->uri and $file->destination to new URI, and dpm($file) shows, that it's changed. The new directory is created, but the file is still in the original folder after submitting the form.

It seems I'm missing something here...


texts:
I was currently developing a module(myid) in Drupal. I made a button(#myid_registrar_button) that must alert whenever it is clicked. Below is my code:

myid.module file:

<?php

    function myid_init() {
        //Jquery Library
        drupal_add_js(drupal_get_path("module", "myid") . "/js/jquery-1.11.2.min.js");

        //Custom Javascript
        drupal_add_js(drupal_get_path("module", "myid") . "/js/myid.js");
    }

    function myid_menu()
    {
        $items = array();

        $items['admin/settings/myid'] = array(
            'title' => 'myid Settings',
            'description' => 'Configuration options for the myid module',
            'page callback' => 'myid_admin_settings',
            'access callback ' => 'user_access',
            'access arguments' => array('administer site configuration'),
        );
        return $items;
    }

    function myid_admin_settings()
    {
        return drupal_get_form('myid_settings_form');
    }

    function myid_settings_form()
    {
        $form = array();
        $form['myid_registrar_button'] = array(
            '#type' => 'button',
            '#value' => '...',
            '#attributes' => array(
                'id' => 'myid_registrar_button',
            ),
        );
        return $form;
    }

myid.js file

$(function(){
    $('#myid_registrar_button').on('click', function(e) {
        e.preventDefault();
        alert("Eww");
    });
});

Whenever I click a button, it refreshes and doesnt alert something, which is supposedly will not refresh and will alert "Eww". It seems that the onclick event is not captured.The console throws no error. Where am I missing?


texts:
I have file field in a content type to upload files. I have also created a drop down which has different values like folder 1, folder 2, folder 3 and so on.

I want file field to upload my files on location based on that drop down value.

for example if I have selected folder 2 in the drop down then the files should upload in folder 2

please provide some help on this issue.


texts: PHP evaluation for "Send HTML email body"

texts:
I'm trying to compose the body of an email using PHP evaluation within a rule.  The rule is triggered when a new content is saved.  Part of the email body is composed using HEREDOC and that works fine.  This is the code I'm having trouble with:

//  Provide download link.
 if ($node->field_software_product_sku === "Some Product Name")
     echo "Trial Version Download Link
";

The above code comes directly after the ending of the HEREDOC, but, before the closing '?>'.  I anticipate that in the future, I will need to add more clauses to the 'if' statement, so, it's important that I get this to work.

I've tried several different incantations for coding the 'if'.  I've tried using the token name enclosed in single quotes.  And, I've tried using “==” instead of “===”.  The only thing that seems to work consistently is commenting out the 'if'.  Then, the “Trial Download Link” text does appear in the email.  Unfortunately, the rule is to be used for multiple “skus”, so, I need to use the 'if'.

I'm hoping I've made a subtle mistake, or, overlooked something.

Can someone point me in the right direction?

Is there a way to debug the code to see why the 'if' may be failing?


texts: How to override/implement a module's hook

texts:
Is there a possible to override a module's hook? What I want is, write a search__query_alter() hook to restrict search results. But to achive this, I should write the hook in built-in module search's .module file.

This way, I'm hacking into core drupal files, which must be bad. Is there a way to write the hook for another module in my theme's template.php file or somewhere else, not touching the core drupal files? When I write search_query_alter() in my theme's template.php file it simply doesn't work.

From my question, you may understand I'm very new to Drupal! Thank you for helping.


texts: How to programmatically enable and set taxonomy access control for role

texts:
I want to be able to programmatically enable and set taxonomy access control for the anonymous and authenticated roles. Specifically, I want to deny anonymous and authenticated users from being able to view or edit nodes tagged with a particular term. I know how to do this through the admin interface. But I'd like to be able to do this programmatically.

I can see functions to get the grants for a particular role, but not set them.

Thanks!


texts: How to get block instance id in block plugin?

texts:
I have block plugin that renders lazy builder placeholder. In my lazy builder I need to get to the block's settings so I wanted to set the block id as lazy builder argument but it turned out the block instance info is not available to the block plugin itself.

Is there some proper Drupal way how to get to this information beside serializing the configuration as lazy builder argument or storing the configuration elsewhere?


texts: Translation table: How do I restore a deleted metatag string?

texts:
At the Translation table module (admin/config/regional/translate/translate), I was translating metatags. By accident I deleted one (metatag:global:og:street-address). I thought I just delete all the useless translations, but then it deleted the whole tag.

Is there a way to restore or (if easier) add it again to the table?


texts: How to list taxonomy terms grouped by a field with Views

texts:
I have a taxonomy vocabulary called 'clients'. There's a field on that called 'category' which is a simple text list.

I want a view that results in something like:

  Category Foo

  (rendered term in category Foo)

  (rendered term in category Foo)

  Bar Category

  (rendered term in Bar category)

It seems I can group by a field, but only if I select fields as the output. Is there a way to have it group by field (for the headings) but use the rendered terms (with a particular view mode) within the grouping?


texts: places where register_globals can be set

texts:
Story for background problem: I have a hostgator account. Uploaded the content of a drupal install folder to the actual root of the server. To fix this, I deleted all the files that I recognised from the drupal installation folder. The hostgator person on the chat reassured me that by default the .htaccess file is empty so going to back to an empty would bring me back to the original state.
Everything seemed fine

Until I wanted to update 1 drupal 7 installation from 7.17 to 7.18. when starting to run mysite.com/update.php it said

  PHP register globals  Enabled ('1')
register_globals is enabled. Drupal requires this configuration directive to be disabled. Your site may not be secure when register_globals is enabled. The PHP manual has instructions for how to change configuration settings.

Checked the cpanel's php quickconfig settings. This said register_globals was set to off. So that means this setting is overwritten somewhere on a deeper level (it's a shared server so the root of my server is at a deeper level than the php installation which I obviously can't touch).
There IS a php.ini file in my root folder of my server but that one also says

register_globals = Off

I looked up this problem and a lot of people seem to solve this by settings the register_globals to off in the places I mentioned. I also put a php.ini file in my drupal installation folder at the same level as my index.php file. This solved the register_global problem, but then I started getting errors about the PDO not being compatible with my current php version (5.2.13 while PDO would be needing 5.2.4 and up). And I don't think asking my provider to update php would be the way to go....


texts: Filebrowser thumbnails "can not create img for private://"

texts:
I am using Drupal 8.7.5 and PHP 7.3.7 running on Apache 2.4.6.

UPDATE: I'm trying to make available a library of images to the public. I chose the content type of 'Directory listing' to do this. In the Directory listing I have configured a private file path (i.e. located outside of Web root) to hold the images. Apparently I have done something right as it is working except for the thumbnails. I get constant 404 errors in my apache logs and the other errors through the web interface seen in the images below.

What have I missed in terms of getting the thumbnails working? Am I missing an binary or library to render the thumbnails? Did I not create or configure a path for the thumbnails?

Below are some of the steps I have done to configure the Directory listing.

UPDATE On the server I have installed Druapl 8 using composer and drush to $APACHE_CONTENT/drupal. The drush site-install then goes to $APACHE_CONTENT/drupal/web (drupal app_root) and have added a 'private' path as $APACHE_CONTENT/resources. This puts the 'private' path outside of the drupal site's DocumentRoot. The permissions and ownership for the 'private' path are 775 and apache.apache. Also, a .htaccess file was auto generated for the 'private' path. It contains the following:

# cat .htaccess
# Deny all requests from Apache 2.4+.
<IfModule mod_authz_core.c>
  Require all denied
</IfModule>

# Deny all requests from Apache 2.0-2.2.
<IfModule !mod_authz_core.c>
  Deny from all
</IfModule>

# Turn off all options we don't need.
Options -Indexes -ExecCGI -Includes -MultiViews

# Set the catch-all handler to prevent scripts from being executed.
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
<Files *>
  # Override the handler again if we're run later in the evaluation list.
  SetHandler Drupal_Security_Do_Not_Remove_See_SA_2013_003
</Files>

# If we know how to do it safely, disable the PHP engine entirely.
<IfModule mod_php5.c>
  php_flag engine off
</IfModule>

In drupal/sites/default/settings.php I have:

$settings['file_private_path'] = $app_root . '/../../resources';

Viewing the Configuration->Media->File system is see:

I've configured a private file path to use with content created via
Content->Add Content->Directory listing.

I have then used scp to copy files into the private path.

Through the web interface, I can browse through the content but I never see the thumbnails. I get errors above my content.

In the apache logs I see 404s for the thumbnails:

GET /system/files/styles/thumbnail/private/Images/JPG/Marshal_Hub.jpg?itok=QwQds55m HTTP/1.1" 404 11730

I have GD installed.

While I can browse all of the content in the 'private' paths, none of the thumbnails get generated.

What do I need to do to get the thumbnails working?


texts: How do I list redirects to current node in a view

texts:
In views 7.x-3.7:

I'm using Contextual Filters to create a view tab for each node displaying metadata about that node, e.g., content type, last edited date, last edited by. I'd like to add any redirects (using the Redirect module) to that display.

That is, I have an existing view /node/%/about-this-node such that
if I have node [domain]/node/12345
with a display tab [domain]/node/12345/about-this-node (created from my view)

And [domain]/myshortcut redirects to [domain]/node/12345

How do I add a views field to [domain]/node/12345/about-this-node that lists myshortcut?

I would have expected an entity reference field that would allow me to accomplish this, but I can't seem to find any such field where this information would be available.


texts: How can i use the Drupal form API states to make my field value depend on another field value?

texts:
Basically what I'm trying to do is to change the #autocomplete_path for the author field in the node/add.

The value of the #autocomplete_path will be dependent on the value of another field (a select list field).

I want to do this because I made my own callback function for the autocomplete and that callback function must receive some arguments that depends on what the user will choose from another field.


texts: How to create a view to count comments per user?

texts:
I am trying to create a view with a table that shows all the users and the total number of comments that user posted in descending order. I am not sure what I am doing wrong but I spent hours on this already...

Can anybody point me to the right direction?

The closest I got is I created a view of comments so far with the author name that I tried to aggregate. But I am getting all sorts of weird results.


texts: Views returns 'All taxonomy terms' in alphabetically order; can I change to Parent > child

texts:
I'm outputtin taxonomy terms using Views; The field i'm calling up is 'Content: All taxonomy terms' and returning all the vocabulary 'address' .  Views then puts these into alphabetical order ie.

England, London, Victoria

I'd like it to return from Parent downwards.  Anyone know how to do this ?

Many thanks,


texts: How to pull in dynamic content in hook_filter_FILTER_process?

texts:
I'm creating a custom input filter to replace a placeholder html comment with a simple form. However, calling drupal_get_form within a hook_filter_FILTER_process function causes the php memory limit to be exceeded.

Elsewhere I tried to do a node_load within one of these functions and the same thing happened.  I was able to work around that but this indicates it's nothing to do with the form (which is displayed elsewhere on the site anyway, and only contains a couple of fields).

The memory limit is hit whether I actually perform any filtering or just return the unfiltered text.

Any ideas what I'm doing wrong?

Thanks


texts:
I was wondering if I can change the style sheet of a theme from style.css to style.php and Drupal will use it? I tried it and it didn't work.
I did, of course, change the file name in template.php as well. Is there anything else I need to consider?


texts: change Userlogin block on header to custom

texts:
How can we change userlogin block on header to custom, I am using D 7.9, theme : bartik, and how can i change the below userlogin block to custom block in image2 below.
And login button should take upto example.com/user and signup button should take out to register a new account

And image1

And image2


texts: Drupal-git-sandbox project: commits are shown but no new revision

texts:
I don't know why I have no new revision, what I do:
I change my code locally, then:

git add -A
git commit -m "bla"
git push -u origin 7.x-1.x

Result:

A new commit is shown in my sandbox repository on drupal.org. But I need a new revision too! I'm new to git, so can anybody explain what I misunderstand?


texts: Drupal sends emails to Hotmail but not to other accounts

texts:
I have a problem when Drupal sends email messages. I use the Rules module for doing it.

When the email is sent to a Hotmail account, the email is sent successfully; with other accounts (e.g. Yahoo, Gmail), the email is not received. The "recent log entries" shows the email as successfully sent, but the account doesn't receive it.


texts: How to override the default zen html template depending on a node type?

texts:
I have a themes which inherit from zen template. The zen template has an html.tpl.php, and I would like to override that html.tpl.php for one content type.

Let's say my theme name is test and my content type is called foo, I have tried the following code snippet into my template.php located in my test theme

function test_preprocess_html(&$vars){
  if (!empty($vars['node'])) {
    $vars['theme_hook_suggestions'][] = 'html__node_' . $vars['node']->type;
  }
}

Then I have created my html template named html--node-foo.tpl.php in the templates folder.

And, it doesn't works! I keep having the default zen html template loaded.

Here is the source of the html.tpl.php file in the zen templates folder

Ps: the following snippet works for overriding the pages templates depending on node type. Why does the above snippet doesn't works?

function test_preprocess_page(&$variables) {
  if (!empty($variables['node'])) {
    $variables['theme_hook_suggestions'][] = 'page__node_' . $variables['node']->type;
  }
}


texts: How to set a phone number via entity_metadata_wrapper?

texts:
I am trying to update a user programmatically in Drupal 7.

User records have multiple custom fields, configured via admin interface #overlay=admin/config/people/accounts/fields

My code sets text and datetime fields fine, but fails to update a phone number field.

Error message:

EntityMetadataWrapperException: Unknown data property field_mobilephone.
in EntityStructureWrapper->getPropertyInfo()
(line 335 of /Applications/MAMP/htdocs/sites/all/modules/entity/includes/entity.wrapper.inc)

Code:

  $new_user = user_save(null, $fields);

  $obj = entity_metadata_wrapper('user', $new_user);
  $obj->field_firstname->set($_REQUEST['firstname']);
  $obj->field_lastname->set($_REQUEST['lastname']);
  $obj->field_mobilephone->set($_REQUEST['mobilephone']);

When I do var_dump($obj) I can see all configured text fields in the output, but not the phone number fields.

Field type is 'phone number', provided by the cck_phone-7.x-1.x-dev module (I couldn't find any other place where it could come from).

So question is how do I set phone number field via entity_metadata_wrapper?


texts: How to create users for site from a web-form submission?

texts: I have added a webform into site to register a user, now i want users who added their information into form, to become a user of site .


texts: How does the Drupal LDAP module manage passwords?

texts:
I'm currently configuring the LDAP module for my Drupal site (7.37) and I wanted to know if it's my AD password that is stored in my database (table users).

If it's not my AD password, is it just a random string? What it is and how does it works?

Thank you.

PS: I haven't configured anything to store the password.


texts: How do I access the values of my results from a view

texts:
I have a preprocess function that I would like to run against a view, but I can not seem to be able to access the actual results. I have a custom entity called entity1 with two fields, field1 and field2. This function runs, but the value of $value is never set

function template_preprocess_views_view_hook(&$variables) {
  // View options set by user.

  foreach ($variables['view']->result as $id => $result) {
    //Things I've tried:
    $value1 = $result->field_field_field1;
    $value2 = $result->field_field_field1[0]['raw']['value'];
    $value3 = $result->entity1_field_field1;
    $value4 = $result->field1;
    //and many other things
  }
}

The foreach loop does in fact cycle through for the correct number of results.


texts: Is the "Count content views" settings related to the "Discard access logs older than" option?

texts:
My question is related with statistics module to know the "most popular" content.

I have enabled the Statistics module (Core Drupal). As you already know, to get this statistics is necessary enable the option "Count content views" in "Access log settings"; also, in "Access log settings," I saw the option, "Discard access logs older than" necessary to set time to log statistics.

According to your experience, are these statistics related with the interval of time indicated in the "Discard access logs older than" option, or are statistics of all "content views" since that statistics module was enabled?

According the code of statistics.module (line 54), the behavior expected is only add one value per visit, and nothing about use an interval of time to calculate some value; but in the "Access log settings" page it seems that this interval of time is related with the option "Discard access logs older than." Are the most popular articles tied to this interval of time?


texts: How to hide a field (cck) based on a date field?

texts:
I am looking for a way to hide a content field based on the nodes date field.

Example:

Event Name: Some Name Here

Event Date: 12/12/2012

Event  Location: Somewhere

Buy Tickets: ticket.com

If the date has passed I would like the Buy Tickets field to not show ... any help would be appreciated.


texts: Adding a simple payment method in Ubercart

texts:
I am on Drupal 7. In Ubercart, I need to add a very simple payment method. It is more of a bypass than a payment method. I will be implementing cash payment method. Basically, the transaction will be completed offline, in the real world, and I just need the system to store the information that payment has been processed in cash.

The system isn`t open for external use, so only the employees will be using it and they have authority to pick "cash"as a payment method. Hitting the "next" button on the cart checkout page with the "cash" payment method will record the transaction. It is almost like a "bypass" method, but of course I need the system to register payment has been done in cash. Since later I will need to run reports, I need to have the information on the payment method associated with each order. But that is pretty much it.

I am searching all around for something as simple as that, but can`t find. Do you know of any modules that will perform something more or less like this that could serve as a starting point so that I can create my own? Or even you might know of a module that does exactly that.

If such a module doesn`t exist, what do I need to implement to get a simple payment method on the road? I need to add a payment method to the list and I need that information to be recorded and associated with my order. Any help or hints will be highly appreciated, thank you.


texts: AJAX replaced elements not able to callback

texts:
I have a form with AJAX elements, generated as follows:

    $memberForm['members'] = [
      '#prefix' => '
',
      '#suffix' => '
',
    ];
    $form['members']['extra_flag1'] = [
      '#type' => 'checkbox',
      '#title' => $config->get('extras.flag1'),
      '#ajax' => array(
        'callback' => [$this, 'updateMemberOptionFields'],
        'event' => 'change',
      ),
    ];

(There are other fields displayed based on the current value of the checkbox).

My callback function looks like this:

  public function updateMemberOptionFields(array $form, FormStateInterface $form_state) {
    $ajax_response = new AjaxResponse();
    $ajax_response->addCommand(new HtmlCommand('#extra_flag1_1', render($form['members']['member1']['extra_flag1'])));

    return $ajax_response;
  }

This works perfectly the first time the checkbox is clicked, but subsequent clicks have no effect.

I have other AJAX components that use the #wrapper property, and these work fine. However, this component will need to replace multiple sections in different parts of the form.

Is there a way the replacement elements can have AJAX callbacks?

Thanks!

James


texts: Drupal 7 views grouping and aggregation with recipe ingredients

texts:
I'm using drupal 7 in conjunction with the recipe module, Every recipe has a number of ingredients that are stored as fields in the database. I'm trying to create an xml view (using views datasource) that lists all of the recipes, but also lists their ingredients. Here is my problem, rather than this;

<node>
<title>The Title<title>
<ingredient name> Ingred 1<ingredient name>
<ingredient name> Ingred 2<ingredient name>
<ingredient name> Ingred 3<ingredient name>
<node>

the output I'm getting is this;

  <node>
    <title>The Title<title>
    <ingredient name> Ingred 1<ingredient name>
  <node>

  <node>
    <title>The Title<title>
    <ingredient name> Ingred 2<ingredient name>
  <node>

  <node>
    <title>The Title<title>
    <ingredient name> Ingred 3<ingredient name>
  <node>

It lists it as three seperate nodes, even though there is only one node. I've tried using the "aggregation" settings but still no luck, any ideas?


texts: 8 - How to run jQuery to show a div, after register form is submitted?

texts:
I've looked at this question, but I want a div to be displayed rather than a Drupal Message

After a user successfully submits the user_register_form, I want to call a jQuery function like this:

function showMessage(){
  $('#message-overlay').fadeIn();
}

This is so I can show users that they have to confirm their email address in order to login.

I tried using hook_form_alter like this to display a custom message, but even this does not work...

function MYTHEME_form_alter( &$form, &$form_state, $form_id ) {
  if ( TRUE === in_array( $form_id, array( 'user_register_form') ) ) {
    $form['#submit'][] = 'submitForm';
  }
}

function submitForm(array &$form, FormStateInterface $form_state) {
  drupal_set_message(t('Form Submitted Successfully'), 'status', TRUE);
}

Please advice!


texts: More information about content in Link field autocomplete dropdown?

texts:
In a project we have a Link field where editors can link to internal content or external content.

There are several cases where nodes of different content types have the same title.

Is there a way to display more information than just the node title in Link fields autocomplete widget - so that we can make it easier for Editors to pick the right node?

We are using LinkIt but that does not support the link module at the moment.


texts: Show menu links for anonymous users only

texts:
I need to show the user register link as a menu item in the account menu. I am able to add the link in the menu via links.menu.yml.

The menu links shows up for anonymous users as well as authenticated users but not for admin user role.

How can I hide the menu item for logged in users irrespective of user role?


texts:
I copy the site files to my local testing environment(win7, not linux os). The site cannot run normaly. The error notes show below:

Notice: Undefined index: sidebar_first in include() (Line 138 of C:\xampp\htdocs\web\modules\system\page.tpl.php).
Notice: Undefined index: sidebar_second in include() (Line 144 of C:\xampp\htdocs\web\modules\system\page.tpl.php).
Warning: file_put_contents(temporary://fil5572.tmp): failed to open stream: "DrupalTemporaryStreamWrapper::stream_open" call failed in file_unmanaged_save_data() (Line 1938 of C:\xampp\htdocs\web\includes\file.inc).
cannot be created.
Warning: file_put_contents(temporary://fil55A2.tmp): failed to open stream: "DrupalTemporaryStreamWrapper::stream_open" call failed in file_unmanaged_save_data() (Line 1938 of C:\xampp\htdocs\web\includes\file.inc).
cannot be created.
Warning: file_put_contents(temporary://fil55B2.tmp): failed to open stream: "DrupalTemporaryStreamWrapper::stream_open" call failed in file_unmanaged_save_data() (Line 1938 of C:\xampp\htdocs\web\includes\file.inc).
cannot be created.
Warning: file_put_contents(temporary://fil55C3.tmp): failed to open stream: "DrupalTemporaryStreamWrapper::stream_open" call failed in file_unmanaged_save_data() (Line 1938 of C:\xampp\htdocs\web\includes\file.inc).cannot be created.
Warning: file_put_contents(temporary://fil55E3.tmp): failed to open stream: "DrupalTemporaryStreamWrapper::stream_open" call failed in file_unmanaged_save_data() (Line 1938 of C:\xampp\htdocs\web\includes\file.inc). cannot be created.
Warning: file_put_contents(temporary://fil55E4.tmp): failed to open stream: "DrupalTemporaryStreamWrapper::stream_open" call failed in file_unmanaged_save_data() (Line 1938 of C:\xampp\htdocs\web\includes\file.inc).cannot be created.

I need your help to solve this problem.


texts: Why is my Cache Expire "0" even when I set it to be time() + 3600?

texts:
I'm caching our hefty menu output with the function show below, as each menu item loads two views (menu popups with sub-taxonomy data as a viewfield). This rids us of about 800 extra queries per pageload since Views Argument Caching doesn't work properly, and static caching seemed liked the easiest way to work around the problem. Also the data doesn't need to be that fresh.

Now the issue is, we want the data to be cleared whenever cron runs -- and I'm setting the expire timestamp to be +1 hour from the moment it gets cached, but when checking custom_data CID from cache table the expire timestamps shows a 0 (never), instead of the now + hour. Any ideas?

/*
 * Check  if we already have main navigation in cache, if not, render it
 */
function mymodule_render_main_menu() {
  $navigation = &drupal_static(__FUNCTION__);

  if ( !isset($navigation) ) {
    // Check if we have cached data
    if ( $cache = cache_get('custom_data') ) {
      dsm("Nav from cache");
      $navigation = $cache->data;
    }
    // Else render the main navigation
    else {
      // Get main menu block
      $navigation = menu_block_block_view('1');
      $expire = time() + 3600;
      dsm($expire);

      // Set it's caching to 60min
      $navigation['#cache'] = array(
        'cid' => 'custom_data',
        'bin' => 'cache',
        'expire' => $expire
      );

      // Render the menu
      $navigation = render($navigation['content']);

      // Push rendered data to cache
      cache_set('custom_data', $navigation, 'cache');
    }
  }

  return $navigation;
}


texts:
I have a search box with the custom_search module, and everytime I search for content it always adds language:en or language:fr to the end of my search term.

Is there anyway to remove this or stop this from happening?


texts: Unpublish blog content after a certain time

texts: I have blog content (created with the Blog module). I want to create an archive which has 30 days of time. After that when we click on archive it will unpublish the blog content. Any idea how to do it?


texts: Limit image file size; if bigger, then decrease file size with lossy compression/resizing/etc. for saving disk space

texts:
When the user uploads an image with a large file size, I would like to allow him/her doing this (not restricting the file size generally, because many users don't know how to resize an image by themselves), BUT after this, I would like to decrease the file size of this image (the original file!) somehow to save disk space (lossy compression/resizing/etc.).
My site is on a shared hosting, so unfortunately ImageMagick is not available.

This question is very closely related, but does not contain any detailed information about the specific solution: How can I reduce the file sizes of the original versions of uploaded image files?

I also found the ImageAPI Optimize module, which can solve the optimization of the image via the online Yahoo! Smush.It service, but optimization is not a restriction for the file size.
There are some related topics about limiting the file size of an image on Stack Overflow and Super User too:

https://stackoverflow.com/questions/1258634/how-to-resize-an-image-in-c-sharp-to-a-certain-hard-disk-size
https://stackoverflow.com/questions/2094064/how-to-resize-a-picture-to-a-specific-file-size
https://superuser.com/questions/201440/batch-resize-jpeg-images-to-a-fixed-file-size/297029#297029

Is there a Drupal-based solution for this task?

If it's unaccomplishable or too complex, maybe I should use an integrated solution with http://www.jpegmini.com/, but I don't know any modules which solves this.


texts:
I know that alt text is usually used for images, to help screen readers etc. In this case my task manager wants me to add 'alternative text' to calendar items, to better satisfy 508 requirements. This would be for a custom content type called Event, which is called up in a view. The alt text would be entered by a user, and may or may not link to anything. I'm just trying to create a field that is wrapped in an alt tag, so it doesn't display but screen readers will find it.  I've tried different things, such as adding dummy text into the .tpl file for calendar item, but I can't come up with a good variable for $title that works. I've tried using a php print statement in the .tpl but again, haven't found the right code. I'm thinking I will probably have to do surgery on the custom event module itself, which has a form for people to enter in the event data.  One solution is to use hook_form_alter to add in some code, something like this:

function events_form_alter(&$form_state, $form_id) {
    if ($form_id == 'events_form') {
        <?php print $title . "text"; ?>
    }
 }

One thing is that I think the best place to find an event title variable is in an include file, where most of the module code lives. I can see #title being used in the include, but not sure what that is. A local variable?  How can I use that variable to print in my alt text?  I'm hoping I can use this variable in a hook_form_alter function that prints a statement using this title. From the include file:

    // Add an end and a date repeat form element, if needed.
if ($element ['#bundle'] == 'event') {
    if($element['#field_name'] == 'field_event_times_combined') {
        $element ['#title'] = t ( 'Date & Time' );
    }

But all this is close to exceeding my PHP skills, however. Does anybody have any general insight?

Many thanks


texts: I'm using Drupal 7. I have create a feed using views. Is there any way to add header and footer to feed page?


texts: Use views to produce list of terms with descriptions

texts:
I have a Tags taxonomy which includes a couple of terms with descriptions.

Tags are rendered in a simple inline list under the content, and this is fine for most of them.

But some terms are acting as flags, e.g. "needs update", "stub". For these, just being listed at the bottom is not enough.

I would like to make a view block that lists all terms that have descriptions (and not ones that don't). I plan to then stick this at the top of the Content section and use a contextual filter so that if a page is tagged "needs update" you get a warning at the top of the page explaining what this tag means. Just like wikipedia does for "This page is a stub - it needs more info...".

Problem: views 3 (on Drupal 7) does not appear to be able to add term:description as a filter.


texts:
I am a newbie at Drupal, so apologies if I am missing something obvious. I searched the issues with various keywords but could not find a similar problem.
I need some data to be sent via remote post handler when webform submissions are made. One of the data needs to be sent is the date of the submission. I figured out that I need to use "webform_submission:completed" as a token. I have been trying quite a bunch of different options at "Custom Data" to send "date" properly but I got the error of converting either the value or string to DateTime. I have token module installed and can browse all available tokens.
i.e.
Submission date: "'[webform_submission:completed:custom_date]'"
(I defined custom date in config menu as m/d/Y)
{"errors":{"ArrayData[0].submissiondate":["Could not convert string to DateTime: '09/10/2020'. Path 'ArrayData[0].submissiondate', line 1, position 102."]},"title":"One or more validation errors

Submission date: "'[webform_submission:completed:html_date]'"
{"errors":{"ArrayData[0].submissiondate":["Could not convert string to DateTime: '2020-09-10'. Path 'ArrayData[0].submissiondate', line 1, position 100."]},"title":"One or more validation errors

if I only use double quotation marks around [] remote post handler does not work at all (checked recent log messages)
More info:
The following code works fine in Postman :
{"Username" : "username", "Password": "password", "StartData" : [{ "StartDate": "2018-03-29", "UniqueId" : "123123", "Id" : 123123, "IsManual" : true}]}

I converted it to YAML as below and put it under "Completed Custom Data" and chose JSON as Post Type. Unchecked all submission data&saved.
---
Username: xxx
Password: xxx
StartData:
- StartDate: "[webform_submission:completed:custom:Y-m-d]"
UniqueId: 123
Id: 123123
IsManual: true

In this case, webform.remote_post does not work at all when I create a submission- could not see debug result at the top and anything about the remote post in the recent log messages. I tried to it in Json format + replaced the token with the current date (like "2020-09-23") to see what happens. The result is the same.
İf I use single quotation mark around "[webform_submission:completed:custom:Y-m-d]"
Response body would be as below:
{"errors":{"StartData[0].StartDate":["Could not convert string to DateTime: \"2020-09-23\". Path 'StartData[0].StartDate', line 1, position 121."]},"title":"One or more validation errors occurred.","status":400,"traceId":"0HM2T7KTISQLB:000015B4"}

So, I could not figure out how to format the date properly.
Thank you in advance.


texts:
I have omega 4 installed as my sub-theme, in which i have a custom layout. Now i am trying to make my home page custom, for which i have defined page--front.tpl.php in my templates/system folder, but its not working. I did explored the drupal questions/answers but nothing worked for me. I also tried to add

$variables['theme_hook_suggestions'] = array('page__front');

But it doesn't seems to be working either. How do i make it work, please help??


texts: Crypt::hmacBase64() versus CsrfTokenGenerator::get() and CsrfTokenGenerator::validate()

texts:
In a module I am writing, I need to add a hidden field in the registration form, similarly to what the Honeypot module does.

$form['honeypot_time'] = [
  '#type' => 'hidden',
  '#title' => t('Timestamp'),
  '#default_value' => mymodule_get_signed_timestamp(time()),
  '#element_validate' => ['mymodule_signed_timestamp_validate'],
  '#cache' => [
    'max-age' => 0,
  ],
];

mymodule_get_signed_timestamp() concatenates the timestamp with a value used to avoid the timestamp is arbitrary changed. It could be computed in one of two ways:

Using Crypt::hmacBase64()
Using the csrf_token service, which by default provides CsrfTokenGenerator::get() and CsrfTokenGenerator::validate()

The choose is then between one of the following snippets.

use \Drupal\Component\Utility;

$token = Crypt::hmacBase64($value, \Drupal::service('private_key')->get());

use \Drupal\Core\Access;

$token = \Drupal::csrfToken()->get($value);

The difference is apparently just that the csrf_token service's methods use, as part of the key passed to Crypt::hmacBase64(), also the session's data and the hash salt set in the settings.php file.

Considering that, in most of the cases, I would be altering a form submitted from anonymous users who tries to register an account (but I cannot exclude I could be adding that form element to forms submitted from registered users), should I use the first method or the second one?


texts: My administration menu dissapears when installing a module

texts:
I have created a module that implements hook_menu() using the following code:

function mypbm_menu() {
  $items['pbg'] = array(
    'title' => 'Theming example',
    'description' => 'Examples of implementing theme functions.',
    'page callback' => 'pbg',
    'access callback' => TRUE
  );
  return $items;
}

function pbg($id) {
  $stringit = $id;

  return $stringit;
}

The module works the way it is supposed to work; when it is turned on, the Administration menu module disappears.

Does anyone know why?


texts: Panel pages context and View contextual filters - cannot get it working

texts:
I have a content type which has field_section of type Taxonomy term.

Views

I created a View pane with contextual filters set to field_section. It means that the view pane should show all nodes which have field_section set to a specified value. It works when manually setting the section in Views preview, e.g. to 39.

In the Views contextual filter settings, in the section "WHEN THE FILTER VALUE IS NOT AVAILABLE", it says "This display does not have a source for contextual filters, so no contextual filter value will be available unless you select 'Provide default'." But what default value to choose? All values with "url" are no good, because there is nothing in the url.

Panels

I created a Panel Page for the home page. The page address is like http://example.com. I added the View pane.

In the Panel page, View pane settings there are no settings at all:

I've added a context and a relationship to the Panel page (not sure if relationship is necessary):

Previously, I've been passing page arguments to view panes by configuring the "Argument input" setting in Views, and it was working. But in this case, there are no page arguments. I want to pass a specific term ID tid=39 to the view pane and don't know how.


texts: Adding a line item to an order from a module

texts:
I'm trying to create a gift wrapping module for Drupal commerce. I have created the checkout pane that has a select box for the user to choose if they want their order gift wrapped (and a field to select the giftwrap price on the configuration form). I've also created a giftwrap line item type. In the pane's base_checkout_form_submit() function I would like to create a giftwrap line item that is added to the order alongside the products. This is what I've got so far:

/**
 * Implements base_checkout_form_submit()
 */
function commerce_giftwrap_pane_checkout_form_submit($form, &$form_state, $checkout_pane, $order) {

  $default_currency_code = commerce_default_currency();
  if ($balance = commerce_payment_order_balance($order)) {
    $default_currency_code = $balance['currency_code'];
  }

  // Create the new line item.
  $line_item = commerce_line_item_new('giftwrap', $order->order_id);

  $line_item->line_item_label = 'Gift Wrapping';
  $line_item->quantity = 1;
  $line_item->commerce_unit_price['amount'] = variable_get('commerce_giftwrap_price', '2.00');
  $line_item->commerce_unit_price['currency_code'] = $default_currency_code;

  commerce_line_item_save($line_item);
}

I haven't wrapped it in an if statement yet, I wanted to get it working first. This code is creating a line item in the database however it isn't adding the line item to shopping cart contents view on the checkout review page. I've altered the shopping cart view to include product line items and my newly created giftwrap line items.

Any help on this would be greatly appreciated.


texts:
I have been reading the documentation for module_load_include() and there's a warning that says:

  Do not use this function in a global context since it requires Drupal to be fully bootstrapped, use require_once DRUPAL_ROOT . '/path/file' instead.

Now I'm not sure what this "global context" means. I guess a page callback function is not in global context because I'd have to do a global $user to access the user entity. The only global context instance I can think of is in the index.php file at the root directory, but I don't think people normally  code on this file because it'd be "hacking" Drupal core.

Am I just missing the whole concept of global context as used in Drupal?


texts:
I want to know how i can create taxonomy term programmatically.

I have this code

$term = new stdClass();
$term->name = ‘Term Name’;
$term->vid = 1; // ‘1’ is a vocabulary id you wish this term to assign to
$term->field_custom_field_name[LANGUAGE_NONE][0]['value'] = ‘Some value’; // OPTIONAL. If your term has a custom field attached it can added as simple as this
taxonomy_term_save($term); // Finally, save our term

From Link

I don't know where to write it. I think it will be in template.php with some hook ?

Drupal 7


texts: Deleting a node just after it has been added

texts:
I want to delete a node after it has been added (or modified), if certain conditions happen.

Is it possible to do that with hook_node_insert? (Considering hook_node_insert  will actually be executed just before the node is added to the database.)


texts:
When we are adding a text field to a content type the default length is 255. I am curious to know the performance effect of the field types and the length have for it.

Is there a preferred order of fields and length based on performance? so that we can chose our fields accordingly.


texts:
I've got a website with a custom theme who was developed by an external group. I would like to custom the webform appearance.

In my form, there are grid fields. And these grid fields need to have a description. But in my custom theme, the description appears under the grid and I would like it appears just between the label and the grid. I hope you see what I mean.

In the theming.txt it seems that I have to edit the webform-form.tpl.php and save it to my theme folder. But in this file, there are only PHP code. So, how can I modify the HTML structure?