texts:
I am making a site which will deal with various micro-topics about a subject.

Each subject will have the following:
i) A backgrounder (one-time)
ii) A news blog (obviously recurring)
iii) FAQs (basically static)
iv) Set of links / documents (static too, but can simply be updated)

My problem is about organising the content.

(A) First option
* Every topic itself will be a taxonomy term
* Create 4 content types: backgrounder, blog, faqs, links

First, the problem here is that soon I'll run into probably a few thousand topics i.e. a few thousand taxonomy terms.
Second, since each term page will have to serve as the homepage for that topic, I have no clue how to organise such a page.

(B) Second option
* Each topic will be a node.
* Each facet (backgrounder, blog, faqs, links) will be CCK fields.

First, the problem here is that it would probably look awful, if the newsblog becomes longwinding.
Second, managing this might become difficult.
Third, since most of the content will be CCK inputs, the actual node area might not have any content. Searc indexing becomes a hassle.

Right now I am quite clueless.

Any advice towards the right direction would be of great help.

Subir


texts: Change placement of 'Read more' link in a teaser

texts:
I have a view where the content is displayed as teasers on the page. There is a 'Read more' link that is displayed above the body text for each teaser (refer to the screenshot below, circled in red), but I would like it to sit underneath the body text instead. Any suggestions on how this can be done?

Edit - 21st of August: Answered my own question below.


texts: drupal webform : how to get values inside a component type fieldset

texts:
I know to retreive information contained in a textfield that is not in a fieldset by
     $submission->data[cid][value][0].
but as soon as it is in a fieldset, textfield component
     $submission->data[cid][value][0] gives me nothing.
How do I do to retreive information contained in a textfield component contained in a fieldset component.
.


texts:
I have a module I'm developing that will be used by several sites.

I have a "preview" site on the same server that I would like to be able showcase new features in before promoting to the production sites.

I thought I would be able to have the production version in the drupal/modules directory, and the preview version in the drupal/sites/preview_site/modules directory. I had expected Drupal would load the module from the site's directory and ignore the copy in the global modules directory.

However, when I do this, I get the following error:

  PHP Fatal Error: Cannot redeclare

It would seem that Drupal is trying to load both copies!

Is there some way I can get it to only load the local copy?

Is there a better way to achieve this (I expect lots of people will say don't put the preview site on the production server.)


texts:
I created a profile type for users to upload their data using fields and I want other users (registered or anonymous) to have access to a search form and they can search for anything on any user's profile (name, jobtype, gender, etc)
if a another user searches for a string in job search, the entire information should be accessible?


texts:
I have a view of events, grouped by month. Each month could have between 1 and 6 events. The pager is set to 10 items.

Example:

January
x x x
February
x x x x
March
x x
April
x

So if there are 5 events in April, the page cuts off after the first item. Even though paging can be used to navigate to the remaining events, this is misleading; it looks as though there is only 1 event in April.

So I wonder whether Views pager could work by row rather than item?


texts: How to set #value to the form item from HTML data-*?

texts:
In product.tpl.php I have a code like this:

<div class="paint-order" data-pid="<?php print $node->field_product_ref['und'][0]['product_id']; ?>">

With JQuery I can get this product_id with this code:

var paint_id = new Number($('.paint-order').data('pid'));

I create ctools popup form, and want to fill #value of form element

$form = array();
$form['form_wrapper']['buy_art_buy_one_click_product_id'] = array(
  '#type' => 'value',
  '#value' => (string) htmlspecialchars(insert ['product_id'] here),
);

What I must to use instead of 'insert ['product_id'] here' to get value of data (or other) HTML-attribute?


texts: Drupal.attachBehaviors only working for some fields when using Ajax .load

texts:
The following code works for some things that I do in terms of .load() such as adding Chosen to fields.
But it won't do anything to date fields, conditional fields or field groups. They get left with no JS.

I've added other similar forms on the page as a test so the scripts are available and I've also added the scripts to the theme's .info file.

Is there any way to fully .load() a form? It has to added using Ajax as it's a really slow form and kills website performance.

EDIT: As Jimmy Ko pointed out, this isn't a good method. Instead, this link shows how to change the target of a form submit in an iFrame to the parent so I'll try loading the form that way with a custom tpl so only the form is shown in the iFrame.

   (function($) {
Drupal.behaviors.myBehavior = {
  attach: function (context, settings) {
    // Check so it doesn't repeat load
    if ($('#page-content-st-node-form').length == 0) {
    // Load
     $('.page-bar').load('/node/add/page-content-st #page-content-st-node-form', {}, function() {
     Drupal.attachBehaviors($('#page-content-st-node-form'));
     });

    }

  }
};
}

)(jQuery);


texts: Fatal error: "isEven" is an invalid render array key /web/core/lib/Drupal/Core/Render/Element.php

texts:
we have this code in template.theme but when we go to view the web, the page show a error as this: "isEven" is an invalid render array key /web/core/lib/Drupal/Core/Render/Element.php . I dont understand very good Drupal and as works it.
function fcjc_bootstrap_preprocess_paragraph(&$variables)
{
  /** @var \Drupal\paragraphs\Entity\Paragraph $paragraph */
  $paragraph = $variables['paragraph'];
  if ($paragraph->getType() === 'image_text_full_width' || $paragraph->getType() === 'imaxe_texto_biografia_') {
    $variables['isEven'] = $variables['elements']['isEven'];
  }
}

function fcjc_bootstrap_preprocess_field__field_image_text_section(&$vars)
{
  foreach ($vars['items'] as $delta => &$item) {
    $classname = ($delta % 2 == 0 ? 'even' : 'odd');
    $item['attributes']->setAttribute('class', $classname);
    $item['content']['isEven'] = ($delta % 2 == 0);
    }
}

In paragraph.twig I have this:
<div class=" image col-sm-4 col-xs-12 {% if isEven %}right-shadow{% else %}left-shadow col-sm-push-8{% endif %}">
Can Somebody can help me? please. Thx


texts:
A knowledgeable user had a strange login problem today. Our site is using LoginToboggan.

User went to directly to a URL requiring login (clicked on a link a in an email), but was not logged in.
User got 403 page, Access Denied, as expected. I have 403 pages set to go to /toboggan/denied.
User typed in name and password (or browser had it memorized) and clicked "Log in"
User went to a 403 page again. This happened repeatedly.

The user tried two other browsers, cleared cookies, etc. Eventually he tried our usual login page, which has a regular login block. That worked fine.

I tried this myself several times, and was able to reproduce it exactly once. I noticed at some point during multiple failures that the URL on the 403 page was not the original URL, but was /user/logout. It was as if I was sort of half-logged-in or half-logged-out.

Since then I've tried numerous variations on this and haven't been able to duplicate it. For the user, it happens consistently. I went over the user's browser settings and they don't seem to be unusual (he accepts third-party cookies, etc.).

Suggestions welcome as to what else to check for.


texts: How to translate countries in multilingual site?

texts:
I have used country_get_list() function to render all pre-installed countries in my select list.

When my site is in English, it is showing all country names in English, which is fine. But for French site, I want all country names should get translated in french.

For example: in English a country name is India but in the French site, it should display like Inde.

Is this possible to achieve?


texts: How do I display labels in checkbox grid table?

texts:
I managed to create table grid with checkboxes, however I can't get the label to display in first column. What am I missing, could you guys help ?

Thanks!

This is what I have in backend

Update:

Drupal issue: https://www.drupal.org/project/webform/issues/2951650


texts:
I have enabled the path auto and workbench modules in my drupal installation. I have to set the url alias once only. Once a node is published and url alias is generated, the url alias should not be generated again if end user changes the title of the node. Also I have to generate the url alias only when node goes to published state.

I am trying something like this:

function hook_entity_presave($entity, $type) {
  //Do not create url alias of node unless its not published and if you create a Draft of a published node, the URL of the published node should not go away.
  if($entity->workbench_moderation['current']->state != 'published'  && !isset($entity->workbench_moderation['published']))
  {
    $entity->path['alias'] = '';
    $entity->path['old_alias'] = '';
    $entity->path['pathauto'] = 0;
  }
  else {
    $entity->path['pathauto'] = 1;
  }
  // if node is published, do not change the url alias if end user changes the title of the node.
  if(isset($entity->workbench_moderation['published'])) {
    $entity->path['alias'] = $entity->path['original']['alias'];
  }
}

and I am trying to accomplish this with hook

function hook_node_presave($node) {
  $node->path['alias'] = $node->path['original']['alias'];
  $node->path['pathauto'] = 0;
}


texts:
I have used Drupal 7 for a while, but am only starting to learn to use the tpl and template.php files. As you would expect, I have become good friends with the documentation, but am still having trouble putting all the pieces together at times.

One thing that I have not figured out how to do, but seems pretty basic, is to create a function in template.php or a custom tpl file (not sure what I need as well as how to do it) that outputs HTML. Let me explain what I mean...

I have created a custom node--content-type.tpl.php. In there, I have put the following code in to replace the normal submitted by information:

<?php if ($display_submitted): ?>

      Created by <?php print $node->name; ?> on <?php print format_date($node->created, $type = 'medium'); ?>.

      Last revised by <?php print (user_load($node->revision_uid)->name); ?> on <?php print format_date($node->changed, $type = 'medium'); ?>.

<?php endif; ?>

I am trying to figure out how to reuse this code in some of my other custom node tpl files without simply cutting and pasting it in. I am obviously missing something basic. How can I go about doing this?


texts: My page is in hook_admin_paths(), but doesn't show admin theme

texts:
function mymodule_admin_paths() {
  $paths = array(
    'admin-dvr/*' => TRUE,
  );
  return $paths;
}

I have a module which generates a page and I want that page to be themed with the admin theme. I implemented the above hook so that when I browse to admin-dvr/dvr/manage it should be displaying with the admin theme.

On my dev server, this works just fine. When I push that code to production, and flush all the caches, I'll sometimes see it load with the admin theme ONCE, but then every time after that it loads with the mainsite theme.

What am I doing wrong? Why won't it load my page with the admin theme?


texts:
I need to rebuild my website, actually built with Drupal 7, and install Drupal 8.
I have some modules that don't exist in Drupal 8. So, I decided to install Drupal 8 and rebuild the website from scratch.
I have more than 100 users already subscribed on the website and I need to import them in Drupal 8.
Is there a way to export them and import them in Drupal 8?


texts: Allow the user to permit per role to view of any/all profile2 fields

texts:
I have a Drupal 7.0 social site with three roles, each with a profile they may or may not want other roles to see all/part of. I'm not sure how to allow the user to specify which fields can be viewed by each role, but this is my current idea:

Create an on/off checkbox to signal view permission for each role per profile field
Use the views module to present profile, filters allowed view of each profile field
Similarly, when editing a profile, it will be presented with a view module so that corresponding role permission checkboxes can show next to it.

I imagine 'edit profile' could look similar to Drupal permissions (except under permissions would be the profile fields instead of module/feature list):

I'm clear on how to set up the view such that any given role can see each profile field that has been checked.

But is this possible to make it so when the user is setting up their profile, they see a view to add/edit profile2 with inline permission boxes instead of the default profile form that hasn't any such checkboxes?

Perhaps I would need customize adding in hook_form_alter or can this all be done in the UI?


texts:
I just enabled the devel module on Drupal 6 and using dpm($form) was showing values for me but  it does not show values any more. What would mostly the issue here? Is there a way to see those values?

Thanks


texts: How do I set Views Bulk Operations Fieldset Collapsed by default?

texts: Using VBO, I am trying to set the Operations Fieldset to collapsed by default. Is there a setting to do this? or a theme override that I can use per view?


texts: How to allow users to choose different theme?

texts:
Some of my site users prefer a light theme, others prefer dark one. In drupal 6, is there a way to allow users to choose their favorite theme? How?
Thanks


texts: Contextual views - show articles that the current user is interested in

texts:
Aim
I am working on a Drupal 8 site that has articles which have a 'interests' field, and each User profile has a 'interests' field.
I want to create a view that only shows articles that the currently logged in user is interested in. For example, if the currently logged in user is interested in "Sports" and "Business", the view should show all articles that are tagged as either "Sports" or "Business".
Attempts
I presume that the solution will involve using Relationships and Contextful Filters. I have read about both here and here.
I have checked previous answers, and think this one is pretty close to what I'm trying to do: Display content having the taxonomy of the logged in user
However, I couldn't seem to get it to work for Drupal 8
Amends
Include of screenshot


texts: In my content type field, I have a select list of current users on the system.  I want to create a page that lists all these usernames in a table.  The key is the user id (uid).  The label is their username.  When sorting in Views, it sorts by the key (uid number).  I want it to sort by the label (username).  Is there a way to do this with Views?  Keep in mind that the user list is all dynamically generated so manually reordering is not an option!


texts: How do I get the display id of a view in Drupal 6?

texts:
I'm trying to use the views_data_export module to get the content of a Drupal 6 view in xml format. On the module's page, it says to use this command:

drush views-data-export [view-name] [display-id] [output-file]

I can figure out the view name well enough, but how do I get the display id?


texts: I want to add the link to tags i.e. /admin/structure/taxonomy/tags directly to admin menu so that it appears next to "Content" link present on admin menu. How to do it?


texts: How to define event listener in the service?

texts:
In Drupal 8 is possible to use event subscriber that is the separate class that defines the callback that should be called on the defined event. See  Event Systems Overview & How To Subscribe To and Dispatch Events

But I'm wondering how to define event listener that will trigger the method of the service on the desired event?

here Symfony references:

Events and Event Listeners

Built-in Symfony Events


texts: How to apply single theme to all webform in drupal 7

texts: I want to create a theme or page layout which will be applied to all the existing and newly created webforms. I want to divide page in 2 parts. In left part want to show webform description and in right part all the webform components.


texts: How to change position of a block in a region?

texts:
I just added a block to the 'content' region. It shows up at the bottom of this region. How do I do to move it to the top of this region?

I'm using the Drupal default theme: Garland

thanks


texts: How to allow user content on the front page?

texts:
I am just struggling with my first site and a handful of friends helping to beta test.

Whenever admin posts there is an option to post to front page, but not for others.

I am not sure if I want the users to even see that option  -it might confuse the non-techy - but they do want to see their recent stuff on the front page.

How can I do that?


texts: How can I filter a view by "has translation"?

texts: Filter a view by "Current user language" creates an empty div when missing translation. This is problematic because it breaks my layout. See the below image for my criteria.


texts:
I'm having difficulty getting my custom field formatter to activate. My intention is to allow users to request a 'Copy to Clipboard' button to be added to a text field.

I've tried to follow online tutorials and examples:

http://www.metaltoad.com/blog/drupal-7-tutorial-creating-custom-formatters

https://github.com/SpaceBeers/Drupal-YouTube-Formatter/blob/master/youtube_formatter.module

and I've come up with the following (in a file clipboard.module, referenced from clipboard.info): the formatter_view() function is currently left empty until I figure the other stuff out.

How can I trigger this code? I've tried unloading and reloading the module, clearing the cache, but whenever I add a new text field and then go into the Field Settings for that field, I don't see any form appearing for the custom settings. Should I be setting some other config elsewhere in Drupal in order to enable this?

Thanks in advance for any help.

/**
 * Implements hook_field_formatter_info().
 *
 */

function clipboard_field_formatter_info() {
  return array(
      'clipboard_formatter' => array(
      'label' => t('Copy to Clipboard'),
      'field types' => array('text','text_long','text_with_summary'),
      'settings' => array('show_clipboard_copy_button' => FALSE),
      )
  );
}

/**
 * Implements hook_field_formatter_settings_form().
 */

function clipboard_field_formatter_settings_form($field, $instance,   $view_mode, $form, &$form_state) {
  //This gets the view_mode where our settings are stored
  $display = $instance['display'][$view_mode];
  //This gets the actual settings
  $settings = $display['settings'];
  // Initialize the element variable
  $element = array();
  $element['show_clipboard_copy_button'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable/Disable Button'),
    '#description' => t('Controls display of Copy to Clipboard Button'),
    '#default_value' => $settings['show_clipboard_copy_button'],
  );

  return $element;
}

/**
 * Implements hook_field_formatter_settings_summary().
 */

function clipboard_field_formatter_settings_summary($field, $instance,     $view_mode) {
  $display = $instance['display'][$view_mode];
  $settings = $display['settings'];
  $summary = t('Enable or Disable a Copy to Clipboard button for text fields', array(
    '@show_clipboard_copy_button'     =>     $settings['show_clipboard_copy_button'],
    )
  );
  return $summary;
}

/**
 * Implements hook_field_formatter_view()
 */

function clipboard_field_formatter_view($entity_type, $entity, $field,     $instance, $langcode, $items, $display) {

  $element = array();
  return $element;

}


texts: Alter language select on a node add/edit form

texts: Wonder if anyone has had any experience altering the options presented to a user from the language select on a node add/edit form. I have some custom access control ont the site and basically I'm looking to remove options based on a individual editors access to approved locales. If they haven't been approved to make edits for a certain locale then they shouldn't see an option to add a translation for that locale in the dropdown.


texts: How to set up APC on Drupal 7 with httpd + fastcgi?

texts:
Can you recommend how to set up APC for a site running Drupal 7 on apache2 with fastcgi ?

I got to the point where apc.php shows only one file cached that is apc.php itself.
I cannot see if APC cache is used at all when accessing Drupal nodes.

PHPinfo shows:

Server API  CGI/FastCGI

apc

APC Support enabled
Version 3.1.9
APC Debugging   Disabled
MMAP Support    Enabled
MMAP File Mask  /dev/zero
Locking type    pthread mutex Locks
Serialization Support   php

Directive   Local Value Master Value
apc.cache_by_default    On  On
apc.canonicalize    On  On
apc.coredump_unmap  Off Off
apc.enable_cli  On  On
apc.enabled On  On
apc.file_md5    Off Off
apc.file_update_protection  2   2
apc.filters no value    no value
apc.gc_ttl  3600    3600
apc.include_once_override   On  On
apc.lazy_classes    Off Off
apc.lazy_functions  Off Off
apc.max_file_size   1M  1M
apc.mmap_file_mask  /dev/zero   /dev/zero
apc.num_files_hint  1024    1024
apc.preload_path    no value    no value
apc.report_autofilter   Off Off
apc.rfc1867 On  On
apc.rfc1867_freq    0   0
apc.rfc1867_name    APC_UPLOAD_PROGRESS APC_UPLOAD_PROGRESS
apc.rfc1867_prefix  upload_ upload_
apc.rfc1867_ttl 3600    3600
apc.serializer  default default
apc.shm_segments    1   1
apc.shm_size    30M 30M
apc.slam_defense    On  On
apc.stat    On  On
apc.stat_ctime  Off Off
apc.ttl 7200    7200
apc.use_request_time    On  On
apc.user_entries_hint   4096    4096
apc.user_ttl    7200    7200
apc.write_lock  On  On

cgi-fcgi

Directive   Local Value Master Value
cgi.check_shebang_line  1   1
cgi.fix_pathinfo    1   1
cgi.force_redirect  1   1
cgi.nph 0   0
cgi.redirect_status_env  no value   no value
cgi.rfc2616_headers 0   0
fastcgi.logging 1   1

I would like to use boost + memcache + apc eventually but currently I have a problem enabling apc on httpd with fastcgi.


texts: How do you include a field.tpl.php, to a custom views field handler. outside of the theme?

texts:
so i've created my custom field handler in views. and i want to include a field template in the module. i can achieve what i need by copying the views-view-field.tpl.php into my theme. but i want views-view-field--MYMODULE.tpl.php to be scanned and used from the module folder..

do i need to "declare a theme function" in my

class views_handler_MYMODULE extends views_handler_field

THANKS


texts:
I'm setting up a webshop were clients can have multiple profiles. For example a customer and supplier profile.

Whenever the user logges in, he gets a choice which profile he wants to sign in. Depending on which profile the user has selected, he gets to see different views.
Above this, the user should be able to change from profile within the site... Much like the Masquerade-module, but in this case, it should be for all users.

I hope I make myself clear on this one...
Some advise on how to tackle this issue would be most welcome!


texts: How can I export all my blog posts as CSV?

texts:
I'm migrating my website from Drupal to WordPress, and the only content I have left to migrate over are all my blog posts.

From my research, the easiest way to do this would be to export my blog posts from drupal as a CSV and then import the CSV file to my Wordpress site.

However, I'm having trouble figuring out how to export ALL my blogposts. The only thing I've managed to find (from myPhP Admin) is 'content_type_blog.' However, that only gives me the 'front page tease' and not the whole blog post.

Where can I find ONLY my blog posts to export?


texts: How to stop all the processes except by entering Linux via SSH?

texts:
I have been deleting some Feeds through the Feeds GUI, but somehow Drupal 7 has been stuck. The site is in maintenance mode. I have no Drush access, and I cannot enter with Admin 0 user.

How can I stop all the processes except by entering Linux via SSH?


texts: Webform - Mandatory text field depending on select option state

texts:
I was hoping to get some direction on how to make a textfield in my webfrom mandatory but only if a particular select option was not checked.

So the textfield is mandatory by default but if the select option is checked, the text filed is no longer mandatory. I have tried to do this via jquery but have then read that validation is server side so I'm not sure what best practice is for this.

Does this type of behavior need custom validation via hook_form_alter() - or is there another way to achieve this? I am running Drupal 7.

Thank you in advanced.


texts: Why does core uses the lib directory instead of the src one, for its classes?

texts:
Drupal 8 now uses the PSR-4 specification for namespaces and auto-loading; module developers need to keep their PHP classes in their module's src directory.
However, if you look in the core directory, Drupal keeps all these in the lib directory.

Why is this so?


texts: Help text blocks show up randomly in node add/edit form with Drupal Bootstrap theme

texts:
I can't get rid of this display bug.

I set a Help text for all my content-type's fields to guide my users in the node add/edit forms.

However, these text blocks seem to show up randomly in the form page. Illustration:

Yes, I can assure you that all the fields have a help text set up in the administration interface.

There are no similarities between the field's types. There are text, select lists, taxonomy term reference, etc...

I tried without the field groups (we never know). But no luck.

My config is Drupal 7.32 and my theme is based on Bootstrap 7.x-3.0.

Any idea?

EDIT:

No, they not appear in HTML source at all.

Here is a part of the source code showing one field without help text and one field with help text:

      <input id="edit-field-function-title-und-0-value" class="text-full form-control form-text required" type="text" maxlength="255" size="60" value="" name="field_function_title[und][0][value]">

      <input id="autocomplete-deluxe-input--2" class="autocomplete-deluxe-form form-control form-text jquery-once-2-processed ui-autocomplete-input autocomplete-deluxe-form-single" type="text" size="60" value="" name="field_organisme[und][textfield]" autocomplete="off" role="textbox" aria-autocomplete="list" aria-haspopup="true">

Ce champ est destiné à l'organisme, structure, société, entreprise, cause, fédération, etc. à laquelle la personne physique ou l'entité appartient et pour laquelle elle est référencée dans Grape.


texts: Image Cache only clears when clearing my browser cache

texts:
When I update my image style (for example adding a water mark overlay) the only way I can see the change is if I clear my browser cache. I am using the ImageCache Actions module.

I downloaded a fresh copy of Drupal and installed the Imagecahce Actions module and the problem doesn't happen on that site. It updates without requiring me to clear my browser cache.

Anyone have an idea what could be causing this issue?


texts: Duplicate paragraphs from node type FOO to node type BAR

texts:
I have two content types: FOO and BAR. These content types have a field called "field_paragraphs" of type "paragraph". And other fields of course.

Now in a situation my user can click a button (that call one of my function defined via hook_menu) and "copy" content of type FOO to a new content of type BAR, so I need to copy, NOT CLONE, field_paragraphs from FOO to BAR: I need to create a standalone copy of "field_paragraphs"; like two different insert.

I have searched on google but all talk about "clone", but in my case I need to copy so I can not use "clone" module.

How can I do this ?

M.


texts: How to send a email message to specific user role when the site goes to the maintenance mode in drupal 7?

texts:
I would like to use emails to communicate with users. So i really want to send a email message for all users(or just a number of users with specific role) when the site goes to the maintenance mode and send another one when the site comes online.

I checked triggers, rules, actions but couldn't find anything to help.

How can I solve this?


texts: Show a list of my product with my coupon discount

texts:
I have 50 products. I used ubercart module and uc_coupon for my e-commence website. I have many different type of coupons for different products and I always make human mistakes and confuse.

Here is my question: Is there anyway to show a list of products with price and discount as well?


texts: How can I add JavaScript scripts to bottom of a page, in my template?


texts: Image style settings for scaling an image

texts: What settings can I use for the image style module that will make all thumbnails in a gallery  of a consistent width and height? Thus, if an image's width is smaller than the thumbnail width when scaled, the width of the thumbnail remains consistent.


texts: Dont want horizontal scroll bar for views

texts:
I am using a view called "exhibit" with multiple fields.
I am getting a horizontal scroll bar since the view have multiple fields.
But I don't want the horizontal scroll bar.

How can I achieve this.


texts: Adding a new separate menu link to /admin/config in page?

texts: Adding new separate menu link in admin config page  like development service


texts: Send report of all changed or updated content in past day?

texts:
Trying to use Rules to do this but I think it's a bit too complicated.

I want to specify a time interval - say 24 hours - and generate an email report that lists all of the content that has been changed or created.

I can do this for individual items quite easily, but I'm looking for an aggregate report that someone could look at in the morning or evening to get a general overview of all the content changes.

I did stumble across the Views Rules module, which is interesting. It would allow me to create a view containing all the new content or updated content in the past xx hours and present that data to Rules. But it seems that would still just allow me to loop over the data and send out individual emails.

I could of course just write a small module to do this as well, but I'm wondering if there's an existing solution?


texts:
I want to disable comment moderation and I want to show all comments by default. In the comment settings under content type, I can't find anything for this.
How do I disable comment moderation?


texts: Products are stored without title and product variations. Can't display them

texts:
Such a weird thing has happened in my commerce kickstart 2 store. Somehow some products are in database but have not product variations and have not Title, so I can't display them in backend to remove them.

Is there a way to display those products in backoffice or I will have to delete directly in database? If so, is safe to remove them only in products table?

UPDATE:

I went inside database. I figured out that products that are not displayed in back-end search have not product variations anymore. Most of these products had Title Field and I could delete them by searching in front-end, clicking in Title link - this took me to node page's product. But now there are a few ones that have not Title. In front-end searching display them, but there is not a link to view node's product. So I think what I have are nodes without product variations. And the question What I do to deleted them remains.


texts: View Group By field with mult-value field

texts:
I have a field that contains multiple boolean values ( similar to a tag or taxonomy term) which indicates status.  So the field is like this.

application="received, data complete, references, financials,"
I'd like to create a tabular report grouped like this:

Received:
Item A
Item C

Data Complete:
Item A
Item B

References:
Item A
Item B

The problem is that grouping on the field is like this:
Received, Data Complete, References:
Item A

Data Complete, References:
Item B

Received:
Item B

So I need to break up the field in views.  I realize I can create a view in a view or view field, but wondering if there is anything more simple/elegant.


texts: Ionic Framework won't authenticate in browser (works in emulator)

texts:
I've set up a simple Ionic Framework app which utilises Drupal 7 Services API to authenticate a user, before hitting some custom end points to retrieve data when logged in.

The issue I'm seeing is when running ionic serve to view the app in the browser: http://localhost:8100/#/auth/login.  I can successfully log in, but when requesting an endpoint, the user is not detected as authenticated.

Logging in successfully - see log debug:

However, when trying to access a custom end point - the user doesn't appear to be authenticated - the dblog reveals Anonymous (not verified), thus returning ["Access denied for user anonymous"] in the console. The dblog looks like so:

The odd thing is, if performing the exact same steps using POSTMAN or via the iOS emulator when running ionic emulate ios all works fine, see dblog now (this is when using emulator):

More info: I'm using the Drupal CORS module, with the following set up:
api/*|http://localhost:8100|*|Content-Type,X-CSRF-Token,Authentication, Origin, Cookie|true

On each request I'm passing the X-CSRF-Token.  I can't pass a Cookie as the console returns 'Refused to set unsafe header "Cookie"

My $http request looks as follows:

  this.getEventFeed = function(csrf, payload) {
    var api = FetchGlobals.getUrl();
    var deferred = $q.defer();
    var req = {
     method: 'POST',
     url: api + '/api/rest/event_feed/feed.json',
     headers: {
      'X-CSRF-Token' : csrf,
      'Access-Control-Allow-Credentials' : 'true',
      // 'Cookie' : cookie,
      'Authentication' : cookie
     },
     data: payload,
     // json : true,
    }
    console.log(req);
    $http(req)
    .success(function(data, status, headers, config) {
      var response = {
        'ok' : true,
        'data' : data,
      };
      deferred.resolve(response);
    })
    .error(function(data, status, headers, config) {
      var response = {
        'status' : status,
        'data' : data,
      };
      deferred.resolve(response);
    });
    return deferred.promise;
  };

EDIT: It appears to be an issue with the Cookie. As recommended here: https://www.drupal.org/node/1133084#comment-8433677 - I've added a new header called Authentication.  I can see from the dblog the user is succesfully being authenticated, however, I receive the error ["CSRF validation failed"].


texts:
I have two taxonomies status and sub-status. In my sub-status vocabulary I have parent status field which is a term reference pointing to the status field.

I created a view of sub-status taxonomy terms and I added two columns Parent Status and Sub-Status

I want to sort the views by parent status term name but it seems I don't have access to the parent terms name. I tried with adding relationships as well but no luck.

Any idea how it can be achieved?


texts:
I'm working on a module for a D7 site that generates a block. Unfortunately all the HTML is hard coded and I need to make it translatable. I have done the following:

Changed

$output = "
Page title here
";

to

$output = "
".t('Page title here')."
";

but no amount of clearing caches or refreshing strings gets "Page title here" to appear in the translate interface. I've loaded the page and even changed the text but it does not show up. I'm aware of the case sensitivity of the search

Is there something I'm missing?


texts: Programmatically rendering a Views pane with arguments from context

texts:
I'm trying to programmatically render a Views pane (ie. a Pane display of a view) with a taxonomy term as argument (passed in the pane context)

The following code illustrate how the pane is rendered

$selected_type = 'views_panes';
$selected_subtype = 'persona_display-panel_pane_1';
$context = array(
  'context_taxonomy_term_1' => ctools_context_create('entity:taxonomy_term', $fully_loaded_taxonomy_term);
);
ctools_content_render($selected_type, $selected_subtype, array(), array(), array(), $context);

It mostly works and the view is rendered. However, the taxonomy term in the context is not used as argument for the view.

In the pane views display's settings, the "Argument input" for the one views' argument is configured as "Term ID" "From context":

I looked at the code for the view display handler. Arguments handling is done in views_content_plugin_display_panel_pane::pane_process_conf(). I checked there and the issues seems to be that $conf['context'] is not set. So $context_keys ends up being an empty array. Later in the switch statement, $key = array_shift($context_keys) sets $key to NULL, the isset($contexts[$key]) test fails and the $argument is ignored.

I have no idea if this is a bug with Views pane, or if something is missing in the pane rendering code.

Note: I'm actually using a Pane Field field in a Paragraphs bundle.


texts: Using panels in place editor, how best to make "Save" button refresh the page after saving is complete?

texts:
My code adds custom CSS to the page header based upon content in panels panes...using the in place editor, you can change a pane, then save the page, and not see your updated changes until you refresh the page.

Any simple way to make this page refresh after you click the "save" button?

Thanks a bunch!


texts: Control node access on content type with field permissions

texts:
I'm straggling with a conflict for controlling permission access on node base and on field base.

My use case is: I've a content type representing a learning project with a set of fields (Author, type of project, materials...) which should be visible only to a group of students. The value of one of the fields (module A, module B, module C ...) is characterizing the difficulty of the project and to which user it should be visible. On base of this field the node should be fully accessible or not for a specific role. If it's not accessible however there should appear a subset of the fields of the node, the same subset of fields appears also to a not authenticated users.
I've defined the different field permissions for the roles, and then I was hoping that with Content Access or Simple Access while creating my content I could check to whom is visible. But as said in various tutorials using more than one access module could lead to conflicts and in fact what I can't do is for a specific node and a specific role to make visible all the fields, while for the other roles are visible only the subset of fields for that node.

What could be a good and less painful (hoping no coding) way to go?
Thanks in advance for any suggestion and help you can give me.


texts: CSS for Display Suite Fields not applied

texts:
I'm attempting to place text next to the top of images inline for a content type using CSS on fields through Display Suite with a built-in layout in Panels (Two column bricks)

I am using a subtheme for the professional_theme.

I have tested and ensured the style sheet is over-ridden to my subtheme
I have inserted the css shown below (and tried several other css codes)
I have inserted the css names into the CSS Classes of Display Suite
I tried applying the styles to several different fields as well as
the region independently and together.

That all being said I think there is extra CSS code being inserted that is throwing off the style being pulled in but I have no idea where it is coming from.

The code below displays Source Code with the CSS style I applied to the image and a text field:
The names of the only styles I applied are: .floatleft .floatright

Are you the Kind to be Kind

Tuesday, October 27, 2015 - 09:30

You are in charge of your own destiny, don’t try to control theirs.

CSS CODE: Keep in mind that I have tried other CSS codes

.floatleft {
clear: both;
vertical-align: top;
float: left;
padding: 4px 10px 4px 0;
}

.floatright {
clear: both;
vertical-align: top;
float: right;
padding: 4px 0 4px 10px;
}

Any help is greatly appreciated. I tried finding CSS documentation for Display Suite with little luck.
WO


texts:
I'm trying to install Drupal 8.0.0-rc4 using Xammp and when I get into the requirements review I get this warning in the list that says:

  PHP OPcode caching can improve your site's performance considerably. It is highly recommended to have OPcache installed on your server.

It has a link for something to download but I'm not sure what to do once I get there. Can someone please help me out? I'm using PHP 5.6.14.

If I move on anyway and try to view my Drupal site I get this:

  The website encountered an unexpected error. Please try again later.


texts:
I am new to Drupal. Is there any template hierarchy structure to output different section of durpla like node, page, vocabulary, block etc. If so how can we use that.

E.g. In WordPress we have a template hierarchy to output page, posts, category, custom post etc.


texts: how to unpublish a comment rather than deleting it

texts:
I like to use "threaded style" comments. However the problem with them is that when a users deletes their own comments all the "replies" to those comments are deleted as well.

Is there a way to "unpublish" those comments instead of deleting them?


texts: How can I convert a set of Products to another Product Type?

texts:
We've decided to set up another Product Type and would like to convert some of the Products to another Type.

Is there a reliable way to convert a set of Products to another Product Type?

I saw this question which seems related, but it seems kind of 'hackish': How Can I change the machine name of product type

Is there a tool or procedure which is known to work reliably?


texts:
To fix the problem with the submit function
I have tried clearing my cache
I have also tried uninstalling the module and reinstalling the module. the code segment is below.

The submit function for some reason never is run

function redirect_custom_reg_menu_alter(&$items) {
  if (isset($items['user/register'])) {
    $items['user/register']['page arguments'] = array('redirect_custom_reg_user_register_form');
  }
}

function redirect_custom_reg_user_register_form() {
  $form = array();

  // Add the form fields for the registration form.

  $form['personal']['username'] = array(
    '#type' => 'textfield',
    '#title' => t('username'),
    // this is built in validation to the form api
    '#required' => TRUE,
    // control the size parameter
    '#size' => 20,
    '#prefix' => '
',
    '#suffix' => '
',
    '#description' => 'Please enter your first name',
    '#maxlength' => 25,
  );

  $form['name']['formtype'] = array(
    '#type' => 'radios',
    '#title' => t('form type'),
    '#options' => array(
      t('form1 form'),
      t('form2 form'),
      t('form3 form')
    ),
  );

  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => 'Submit',
  );

  return $form;
}

function redirect_custom_reg_submit($form, &$form_state) {
  drupal_set_message(t('The form has been submitted. personal="@username"',
    array('@username' => $form_state['values']['username'] )));
}


texts: How to create a view block for comments with nesting and parent relationship

texts:
I'm trying to display the comments on my nodes in a view rather than using drupals default comments rendering.

Is it possible to display a comment view on a node, which also renders the comments with replies, rather than rendering every comment (including replies) as a top level comment?

How would you setup views to do this?

UPDATE

I've successfully setup views, so that it renders comments and replies in the correct order.

You have to set:

Relationship -> Comment: Parent Comment
Sort Criteria -> Thread (desc)
Sort Criteria -> (Parent Comment) Comment: Post date (asc)

However the pager still counts every single comment reply as an item, so it is prone to cutting off threads in the middle and ideally I'd still like to page it.

ORIGINAL WORKINGS

What I've tried to do so far -- Show: Settings: Parent relationship

Getting the top level comments was reasonably easy, I created a view block which displays comments and then added:

Contextual filter -> Comment NID (Content ID from URL) (Shown here)

This gives a me a view block which will display comments. However all the comments are rendered as top level comments (no indented markup)

I needed the parent relationship, so I added a second relationship (comment views by default have a Comment: Content relationship),

Comment: Parent Comment

And then under Format: Show: Settings, I enabled:

Relationship: Parent Comment

Unfortunately on loading the node, this causes several PHP errors. views_plugin_row_comment_view.inc has a pre_render function and for some reason changing the Relationship: Parent Comment causes none of the CID's to load in the pre-render function and so it spits out all the horrible errors you see below. How am I setting this up wrong?

Undefined property: stdClass::$cid in views_plugin_row_comment_view->pre_render() (line 79 of ... sites\all\modules\views\modules\comment\views_plugin_row_comment_view.inc
Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 173 of C:\xampp\htdocs\basic\includes\entity.inc).
Notice: Undefined index: in template_preprocess_views_view_row_comment() (line 645 of C:\xampp\htdocs\basic\sites\all\modules\views\modules\comment.views.inc).
Notice: Trying to get property of non-object in template_preprocess_views_view_row_comment() (line 646 of C:\xampp\htdocs\basic\sites\all\modules\views\modules\comment.views.inc).
Notice: Undefined index: in template_preprocess_views_view_row_comment() (line 646 of C:\xampp\htdocs\basic\sites\all\modules\views\modules\comment.views.inc).
Notice: Trying to get property of non-object in template_preprocess_views_view_row_comment() (line 650 of C:\xampp\htdocs\basic\sites\all\modules\views\modules\comment.views.inc).
EntityMalformedException: Missing bundle property on entity of type comment. in entity_extract_ids() (line 7729 of C:\xampp\htdocs\basic\includes\common.inc).

What I've tried to do so far -- Sort: Comment Threading

I took a look at the following sandbox module and according to the issue thread it was based on https://drupal.org/node/1039494, apparently it was solved ages ago by adding in a sort criteria Comment: Thread.

I tried adding this and setting the relationship to parent comment but this also had no effect, the comments still remained in separate rows. Has anyone had success with this method?


texts: Is possible to choose the file_default_scheme to save avatars?

texts:
I'm using amazonS3 module and if I choose Amazon Simple Storage Service as my default download option, user's avatars are uploaded to my bucket in Amazon. I wish I could choose the default_scheme for avatars but checking the user_save function code I found these:

 if (!empty($account->picture->fid) && (!isset($account->original->picture->fid) || $account->picture->fid != $account->original->picture->fid)) {
    $picture = $account->picture;
    // If the picture is a temporary file move it to its final location and
    // make it permanent.
    if (!$picture->status) {
      $info = image_get_info($picture->uri);
      $picture_directory =  file_default_scheme() . '://' . variable_get('user_picture_path', 'pictures');

So I think that it uses the default scheme selected. Is it possible to change it?

Thanks


texts: How to set a default theme programmatically

texts:
I am trying to build an install profile and I want to have my custom theme enabled and set by default after the installation.

Adding in MYPROFILE.info.yml...

theme:
  - my_theme

...is not enough. This only installs it, but it is not set as the default theme.

I guess I have to do something else in the MYPROFILE.install file in

function MYPROFILE_install() {
  // how to set as default my custom theme
}

Thank you


texts: How to offer Views as options in a Content-Type field

texts:
I would like to add a field to a content type (Events) that gives several views (Certificates of Completion) as options.  Thus, when creating an Event the admin can select which certificate will be associated with this Event.

I'm hoping there is a module for this, but as you might imagine Google can't figure out exactly what I'm asking when my query is predominantly filled with generic drupal terms like "Content Type", "Field", and "Views".

Any recommendations will be greatly appreciated.


texts: db_select with subquery including conditions from 2 tables

texts:
I spent much time without success to search how to convert with db_select the following query, running perfectly with db_query :

    SELECT *
    FROM job_orders j
    WHERE j.statut = 'To do'
    AND j.job
    IN ( SELECT r.job
    FROM referential r
    WHERE r.category = j.category
    AND r.label = :label
    AND r.activity = :activity ),
    array(':label' => $label, ':activity' => $activity);

Here is the corresponding (?) db_select query I wrote :

$subquery = db_select('referential', 'r')
    ->fields('r', array('job'))
    ->condition('r.category', 'j.category')
    ->condition('r.label', $label)
    ->condition('r.activity', $activity);

$query = db_select('job_orders', 'j')
    ->fields('j')
    ->condition('j.statut', 'To do')
    ->condition('j.job', $subquery, 'IN');
$results = $query->execute();

I got no result with this db_select query, while I got answers with the db_query one... could somebody tell me what is wrong in my db_select query ?

Thank you.


texts:
To the best of my knowlege, I could not find a answer that applies to my situation, so here it goes:

I am using the feeds import to add a series of roughly 6500 employees as nodes (not preferred solution, I know... Blame my project manager).

I am importing a XML:

<OS2>
  <Persons>
    <Person>
      <Brugernavn>UsernameFromExternalSource</Brugernavn> **<<-- Never Empty, but also not unique**
      <Navn>RealName</Navn> **<<-- Never Empty, but is not unique. Serves as node title**
      <Stilling></Stilling> **<<-- Can be empty**
      <Telefon></Telefon> **<<-- Can be empty**
      <Mobil></Mobil> **<<-- Can be empty**
      <Afdeling></Afdeling /> **<<-- Can be empty, usually is not. Inserts into Taxonomy**
      <Email>some@name.com<Email /> **<<-- GUID as it is the only one that will always be unique**
      <Kompetencer></Kompetencer> **<<-- Can be empty**
      <Opgaver></Opgaver> **<<-- Can be empty**
    </Person>
  </persons>
</OS2>

I've mapped the items with the proper Xpath, but when I run the import, all the items are being imported properly, but sometimes, very randomly, some items are being imported twice as seperate nodes (meaning I will have /employee/name and /employee/name-0 )

I checked the feeds_item table, and there are several instances of the guid column, as well as the hash, having the same value twice, wich as I understand it, should'n happen.

I am at a loss, and I've tried to convice the people who have the final say to let me use alternatives, but that is sadly out of the question, as well as getting the XML altered to have it's own numeric unique-ID.

Futher data that might help:

I recive no error messages in the apache log, or the Drupal log
As far as I can tell, all elements are being imported properly, in some
cases with said duplicates
The server does not timeout, and has 8GB of ram assigned to handle the import

Does anyone have an idea of what is going wrong?

Thanks in Advance.


texts: Function declared in template.php doesnt get loaded in a page's content

texts:
I have created a function called generate_rss(), but when I call that function inside a page using PHP code as input format, I get the following error message:

  Fatal error: Call to undefined function generate_rss().

I am using Drupal 6. Does anybody know how to fix this?

<?php
     echo generate_rss('http://rss feed url here');
?>

I think template.php is loaded after the page's contents are rendered.
If I use

`include_once( 'path to theme/template.php');`

there will be no fatal error.


texts: Some links in admin not working correctly

texts:
I know this is a pretty "broad" issue, but I have several links in the admin interface that are not working correctly. One place in particular is in the Rules section of admin. When I edit a rule and add a new Condition, the "Data Selectors" fieldset text is not clickable (so I cannot expand it to see all of the available data selectors. Also, when I click in the "Data Selector" textbox field, the autocomplete is filled with "

" html wrappers around the data selectors. The attached screenshot shows both of these issues.

What would cause this? So far I have tried switching to Bartik theme (I use Seven as my default admin theme)... no change. I also updated all modules and updated Drupal core to the most recent version (7.27). My next step will be to disable modules, but I am quite hesitant to do so since I "need" all of the modules that are currently installed. I would appreciate any feedback and ideas on what might be causing this, and how it can be fixed.

Thanks!


texts: Security issues after authenticated user has been logged out

texts:
I have a profile information page that is being displayed for an authenticated users. But after I log-out as that specific user,and then i click the back button of the browser,I could find the anonymous user landing on the profile information of the previously logged-in user.

How could I prevent such a behavior as I do have some confidential information on those profile information page.

Could someone please help me.


texts: How to get current language of node in twig?

texts: I have a tranlatable node, and I need to get its translation language. You know, I must to know is current node is in Polish or English. So... below there are my devel dumps from a node in Polish and a node in English. I see that there is a difference in #activeLangcode (x-default and en). But how to get that value? Or is there any better way to check current language of node in twig? Please help.


texts: How to make the radio field checked by default?

texts:
I have a field group which consists of a radio box and other fields. This field group can have multiple values. My radio box field have two options and the first is checked by default. But when I add the second value (of the field group) – my radio field has no checked option, both options are empty (in the newly added field group). Is it possible to make the first checkbox option always checked?

Here's the short video showcasing the problem: https://www.dropbox.com/s/366xt4q57ryvteu/drupal-radio-issue.mp4?dl=0


texts: admin toolbar not showing sub-navi in Firefox any more

texts:
First the admin toolbar worked perfectly fine in Mac-OS-FF – then suddenly the sub-navigation (the fly-out sub-pages) stopped showing – partly. The sub-navigation seems to be covered or cut off:

At that time I neither updated FF nor added/removed any browser-plugins or dp-modules. The same happened to three different dp7 installations simultaneously. I then updated FF – no change.

In chrome everything works fine.

Has anybody else witnessed similar behavior?
Any pointers / tips would be much appreciated.


texts: Show menu item to all users, prompt for credentials for anonymous

texts:
I have an item in the navbar that links to a page view which can only be accessed by authenticated users.

I want the menu item visible for anonymous users, and also to have them redirected to login if they try to access it. This seems like a common use-case. I see a plethora of modules that accomplish this in Drupal 7, but I don't see any for Drupal 8.

How can I show the navbar for anonymous users that prompts users to login with Drupal 8?


texts: Why is my form_state being reset after submission?

texts:
I have a menu item with page callback:

function my_menu() {
  $items = array();
  $items['my/action/%ctools_js'] = array(
    'title' => 'do something',
    'page callback' => 'my_action',
    'page arguments' => array(2,3),
    'access callback' => TRUE,
    'type' => MENU_CALLBACK,
  );
}

function my_action($js = NULL, $nid = NULL) {
  $form_state = array('nid' => $nid);
  if(!$js) {
    drupal_build_form('my_action_form', $form_state);
  }
  ctools_include('modal');
  ctools_include('ajax');
  $form_state['ajax'] = $js;
  $form_state['title'] = t('Form Title');
  $output = drupal_build_form('my_action_form', $form_state);
  $commands = array();
  if (!empty($form_state['finished'])) {
    $commands[] = ctools_modal_command_dismiss();
    $commands[] = ctools_ajax_command_redirect('challenges');
  } else {
    ctools_modal_form_render($form_state, $output);
  }
  print ajax_render($commands);
  exit;
}

function my_action_form($form, &$form_state) {
  // form fields defined here
}

function my_action_form_validate($form, &$form_state) {
  // $form_state['finished'] = true;
}

function my_action_form_submit($form, &$form_state) {
  $form_state['finished'] = true;
}

If I uncomment out the line in my_action_form_validate The modal form dismisses and the redirect works. But with that line commented out when I try to set the $form_state var in submit, the modal doesn't dismiss and doesn't redirect. The form submit code executes (calls to drupal_set_message work fine), but by the time it gets back to the conditional (line 11) in my_action, $form_state has been set to default and a blank form reappears in the modal popup. How can I dismiss the modal window after submission?


texts: Views block: Displaying a content block on profile page (/user) with user's chosen tags as contextual filter

texts: I have a block on the user's profile page that filters content based on the supplied tag as an argument/contextual filter. Users on my site can add tags to their profile (with an autofill field pulling from the free-tag taxonomy) -- these tags are topics that they want to "follow." I would like this block to display content that is tagged with the tags they've personally chosen. thanks in advance!


texts:
I'm trying to backup my Drupal website (not only database) as complete as possible, because It's in the desired state. The backup should cover actual versions of all modules, themes, database tables, settings, just everything.
Now my method is to zip everything under /var/www/ folder and backup the database with Backup migrate module.
The restore process is

delete everything in /var/www
drop database and create it again and set permissions on it
unzip my backup to /var/www
restore with Backup migrate module

Will this method work? Do you know smarter method to make a complete Drupal web backup?


texts: URL translations transposing between primary and secondary languages or just displaying wrong

texts:
We have a Drupal 8.7.10 site, multilingual (17 countries localized with 2 or more languages each).

In the example I am attaching, we have a "people" page where we are listing people for our company in this country. The URL path should show "insalar" instead of "people" for the Turkey Turkish translation. The form field for the path shows correctly. But the "View" tab, as well as the listing in the admin list, shows "people". (pictured below)

The English page links are showing "insalar". So it is inverting it for some reason. But it doesn't happen for all content types and it doesn't even happen all the time. Nor does it seem to happen for every translation (and we have A LOT).

Any idea what might be happening?


texts: How do I create a link that redirects to a destination after completing an action?

texts: I'm trying to create login/logout options for menus that are parts of groups on my page. The thing is I want each menu to have that login/logout select redirect the user to the group page, not the user profiles. How would I go about setting this up in the path setting of the menu?


texts: Unable to create new user from Admin "New User" page ... Drupal 7

texts:
function MODULE_NAME_form_user_register_form_alter(&$form, $form_state, $form_id) {
 $form['actions']['submit']['#value'] = t('Submit');
}

I override the name of the submit button using customs module.

User registrations works fine, but when I'm trying to create a user through admin interface, fill out the form and click "Submit", I get redirected to "user/list" page, user doesn't get created, and the text on the top of the page is actually from "create user":

Any idea why this problem occurs?


texts: "Promote to front page" to other than front page

texts:
Is it possible to push node summaries (teaser text) onto pages other than the "Front Page"?
I see the option "Promoted to front page" but is there a workaround for promoting them to  sub-pages as well?


texts: Open Atrium: How to change Task assignment from users to groups?

texts:
I'm trying to change the Task content-type to be able to assign tasks to groups, and only show those tasks in Task List that are assigned to your group you are added. I've tried by adding a new field with Entity Reference to groups, to select multiple and this part is okay and working fine.

I'm blocked when I'm trying to set the filters in the Views to get the current user's group and show the task if it's assigned to that group.

Thanks a lot!


texts: How to change the value of the publishing status checkbox to false by default?

texts:
I want that checkbox to be unchecked by default, because currently it's always checked.

And I want this result:

The structure of my content is as follows:


texts: Update programmatically value of field collection item

texts:
I want to update a field collection

I have the following:

function pdf_app_node_presave($node) {
    if (!$node->is_new) {
        global $base_url;
        if($node->type == 'article') {
            $node_wrapper = entity_metadata_wrapper('node', $node);

            foreach ($node_wrapper->field_chapitres->value() as $library) {
                $library_wrapper = entity_metadata_wrapper('field_collection_item', $library);

                  $books = $library_wrapper->field_subchapters->value();
                  foreach($books as $book){
                    $book_wrapper = entity_metadata_wrapper('field_collection_item', $book);
                    $title ='sfsdfsd';
                    $book_wrapper->field_pdf_title2->set($title);
                    $book_wrapper->save();

                  }
            }

            field_attach_update('node', $node);

        }

    }

}

But i get an error i think i should use something like

    $values[0]['field_title'][LANGUAGE_NONE][0] = $title;

but it is also not working.


texts:
I don't want to make a full migration. I want to migrate only and solely Nodes (preferably with their Metatag metadata as well). Not Views, Not Panels, not Contexts, not URL redirects - Only Nodes...

I ask this after encountering some troubles in full D7>>D8 upgrade and when using the Drupal Upgrade module (I even opened a thread regarding it here in DA). Therefore, I am looking for ways to make only a partial migration, or to make migration in parts.

Is it possible regarding to nodes?


texts: Which are the steps to make Locale language switcher block appear at selected area?

texts:
After this question on which module to use to handle interface translation I was expecting the setup of Locale to be pretty straightforward. I guess it is not.

Well, my backend and navigation menus got translated right away but the main objective (as you can see by reading the other question) was to allow any user to change language as needed.

So the goal is to setup the language switcher block in order that it is available to everyone.
Steps performed:

Enable module Locale
Setup language switcher block to appear at some area
Configured block to appear to all roles on every page
Added a new language and imported the .po file
Checked all locale permissions (except anonymous user -> translation)

Am I missing something?


texts: How to get "User ID From URL" with contextual filter in Pfofile2 page

texts:
I'm using Drupal7.

I wanted to display some fields from user account in profile2 page by using Views. I tried to do this by using views block and views_embed_view() coded in profile2--ProfileType.tpl.php for profile2 page.

So, I created a view and set contextual filter like below.

-"USER:UID"
-the default value is "User ID From URL"

But that doesn't display View in profile2 page even though the URL is "Mydomain.com/profile-My_Profile_Type/User_ID". On the other hand, that View works in the user account page. So, this means that it may be because contextual filter of "User ID From URL" doesn't work in the profile2 page even though its URL has User ID. I changed the contextual filter from "USER:UID" to "(Profile) Profile: User uid", but it doesn't work either...

Can anybody give me the advice how to make it work?

Thank you


texts: How to use current user object in Drupal 8?

texts:
The answer to "Is there a function to get the current user object that avoids accessing the global variable?" includes this:

  In Drupal 8, you simply use the static method \Drupal::currentUser()
  to get the equivalent of Drupal 7 $GLOBALS['user']

I tried to use the following code:

$user = \Drupal::currentUser();
$name = $user->get('name')->value;

But that results in an error like so:

  Fatal error: Call to undefined method Drupal\Core\Session\AccountProxy::get() in /home/remindme/uhoc.org/modules/testmodule/src/Form/FruitForm.php on line 173
  (Line 173 is $name = $user->get('name')->value;

Do I need to used some namespace or there is some other way to access the user object?


texts: Build a form dynamically with the results of a view?

texts:
I'm working on a view block in which I load several nodes.
I don't know how many nodes will be loaded because it depends on an exposed filter.
I have twig file for the display, I also have a twigExtension php file to call custom functions.

For example, the output of my view looks like this :

Reference
ABCD
BCDE
CDEF

I would like to get a form :

Reference | Quantity (Select dropdown)
ABCD | 0
BCDE | 1
CDEF | 0
<Submit Button>

Once the user clicks on the Submit Button, it creates 3 nodes of a Custom Content Type.

The lead I'm investigating for now is to use a form but I don't know how I could pass the results to this form, build it with these results and get something like :

public function buildForm(array $form, FormStateInterface $form_state) {
    $form['ref_1'] = array(
        '#type' => 'textfield',
        '#title' => t('Reference 1'),
        '#default_value' => 'ABCD'
        '#attributes' => array('readonly' => 'readonly')
    );
    $form['quantity_1'] = array(
        '#type' => 'select',
        '#title' => t('Quantity 1'),
        '#options' => array('00', '01', '02', '03'),
    );

    $form['ref_2'] = array(
        '#type' => 'textfield',
        '#title' => t('Reference 2'),
        '#default_value' => 'BCDE'
        '#attributes' => array('readonly' => 'readonly')
    );
    $form['quantity_2'] = array(
        '#type' => 'select',
        '#title' => t('Quantity 2'),
        '#options' => array('00', '01', '02', '03'),
    );

    $form['ref_3'] = array(
        '#type' => 'textfield',
        '#title' => t('Reference 3'),
        '#default_value' => 'CDEF'
        '#attributes' => array('readonly' => 'readonly')
    );
    $form['quantity_3'] = array(
        '#type' => 'select',
        '#title' => t('Quantity 3'),
        '#options' => array('00', '01', '02', '03'),
    );

    $form['submit'] = array(
        '#type' => 'submit',
        '#value' => t('Submit'),
    );

    return $form;
}

Or maybe should I look at the exposed filter function, maybe is there a way to modify the way it works to call my own function before display ?

How would you do it ?

Thanks.


texts: User logout automatically when the browser is closed

texts:
I need to logout a user if the browser is closed. I'm using Drupal 8.
I tried setting a session cookie in php. But the problem is the cookie should be 'httponly' and 'secure'.

Please suggest me the right method or is Drupal having such settings to achieve  this.

Thanks.


texts: What happens to URL alias when a node is unpublished?

texts:
We have many pages where we set "Generate automatic URL alias" to true and false. Then we will eventually unpublish some of the pages. Looking at Webmaster tools, we have found the URLs are still indexed and cached so when any unpublished page is crawled again it is generating a 404.

Given that in the Path settings we have set the Update action set to "Create new alias. Delete old alias", we need assistance in figuring out what happens to url aliases once the page is unpublished in the scenario where "Generate automatic URL alias" is set to true or false.


texts: Can't get jQuery UI autocomplete working

texts:
The text field that is created seems to just act like a normal textfield, no autocomplete function or any indication that it works at all.

There's no errors in the console. I've run checks to see if jQuery UI is loading, it is. I'm using jQuery Update module, so both libraries are at version 1.10.

I'm using the Bootstrap theme, but I've tried disabling that and using Bartik, it makes no difference.

Any ideas?

Here's the form alter function I'm using in my module. It fires just fine.

function mymodule_form_mymodule_form_newlead_alter (&$form, &$form_state) {

    $form['business_category'] = array(
        '#title' => t('Business Category'),
        '#description' => t('Category' ),
        '#type' => 'textfield',
        '#id' => 'business_category',
        '#attached' => array(
            'library' => array(
                array('system', 'ui.autocomplete'),
            ),
            'js' => array(
                drupal_get_path('module', 'mymodule') . "/custom.js",
            ),
        ),
    );

}

Here's custom.js

(function ($) {

        $( "#business_category" ).autocomplete({
            source: [ "cat1", "cat2", "cat3" ]
        });

})(jQuery);


texts: How to install latest stable Drupal version from drupal/recommended-project branch?

texts:
I've forked drupal/recommended-project and run composer install from the default branch (8.8.x), it installed the latest dev version (8.8.6-dev). There's also a tag 8.8.5 (latest stable as of now) which has the same composer.json with the exception of these lines:

    "require-dev": {
        "drupal/core-dev": "^8.8"
    },

I've deleted these lines in branch 8.8.x hoping this would install the latest stable version but it installed the dev version anyway. I don't want to use tags because I forked the upstream and have my own changes.

How can I install the latest stable version of Drupal from the default branch (8.8.x)?


texts: Can I create a url alias for private files?

texts:
Should we be able to add a url_alias (in D8 from /admin/config/search/path) for a private file?
Right now it allows me to add an alias (and I can see that it is being rendered in the front end) but it generates a 404.

In my particular case the path for the uploaded file is ...
/system/files/2017-08/1.pdf

A related, but different question, includes ...

How can I change the file private URL


texts: Error running BrowserTest (Drupal\Core\Config\Schema\SchemaIncompleteException: No schema ...)

texts:
I am working on a module Rate Limiter and trying to improve the deprecated SimpleTest with BrowserTest. While doing so, I get the following error.

  C:\Project\Sites\devdesktop\drupal8>.\vendor\bin\phpunit -c .\core\phpunit.xml.dist --filter testRateLimitConfigPageVisit .\modules\custom\rate_limiter\tests\src\Functional\RateLimiterConfigFormTest.php
  PHPUnit 6.5.7 by Sebastian Bergmann and contributors.

Testing Drupal\Tests\rate_limiter\Functional\RateLimiterConfigFormTest
E                                                                   1 / 1 (100%)

Time: 56.75 seconds, Memory: 6.00MB

There was 1 error:

1) Drupal\Tests\rate_limiter\Functional\RateLimiterConfigFormTest::testRateLimitConfigPageVisit
Drupal\Core\Config\Schema\SchemaIncompleteException: No schema for rate_limiter.settings

C:\Project\Sites\devdesktop\drupal8\core\lib\Drupal\Core\Config\Development\ConfigSchemaChecker.php:88
C:\Project\Sites\devdesktop\drupal8\core\lib\Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher.php:111
C:\Project\Sites\devdesktop\drupal8\core\lib\Drupal\Core\Config\Config.php:227
C:\Project\Sites\devdesktop\drupal8\core\lib\Drupal\Core\Config\ConfigInstaller.php:334
C:\Project\Sites\devdesktop\drupal8\core\lib\Drupal\Core\Config\ConfigInstaller.php:134
C:\Project\Sites\devdesktop\drupal8\core\lib\Drupal\Core\ProxyClass\Config\ConfigInstaller.php:75
C:\Project\Sites\devdesktop\drupal8\core\lib\Drupal\Core\Extension\ModuleInstaller.php:268
C:\Project\Sites\devdesktop\drupal8\core\lib\Drupal\Core\ProxyClass\Extension\ModuleInstaller.php:83
C:\Project\Sites\devdesktop\drupal8\core\lib\Drupal\Core\Test\FunctionalTestSetupTrait.php:437
C:\Project\Sites\devdesktop\drupal8\core\tests\Drupal\Tests\BrowserTestBase.php:1026
C:\Project\Sites\devdesktop\drupal8\core\tests\Drupal\Tests\BrowserTestBase.php:490
C:\Project\Sites\devdesktop\drupal8\modules\custom\rate_limiter\tests\src\Functional\RateLimiterConfigFormTest.php:32

ERRORS!
Tests: 1, Assertions: 0, Errors: 1.

The Schema file is: https://github.com/aneek/rate_limiter/blob/develop/config/install/rate_limiter.settings.yml

And the Test File is: https://github.com/aneek/rate_limiter/blob/develop/tests/src/Functional/RateLimiterConfigFormTest.php

What I am missing?


texts: Is Git now the only way to install Drush?

texts:
Going in circles trying to figure out the right way to install Drush on a Linux CentOS system.  I have Git set up, but as I'm not planning to contribute to Drush code at the moment, it's not unambiguously clear that I should be using Git.

Some directions say to use PEAR, but when I go to the Drush project page, the directions say to get Drush 6 from Git.  Tutorials I have found demo wget and PEAR, not Git.  And the Git project page View says, "Use our Github project for contributing code, or reporting bugs, or requesting features," none of which applies.

Could an experienced Drupalista please answer the following?

Is Git now the only method of obtaining Drush?  Someone asked a
similar question more than a year ago when PEAR was still
recommended.
If Git is the way to go, I have read that drush should not be installed within the website directories, so which directory is it recommended to be in when I invoke the following?

git clone --branch 7.x-5.x http://git.drupal.org/project/drush.git

I'm looking forward to using Drush.  Thanks!


texts: How to set cardinality for textfield field in custom form?

texts:
I just created a new custom form using hook_forms, I added all my fields, everything looks fine.

One of the field is a textfield. I wanted to allow the users to set as many values as they want.

I found the "cardinality" attribute but I could not figure how to use it.
Is it possible without creating a custom field?

Thank you


texts:
I'm having an issue where the 'chart' field from the easycharts module is not visible on the content type when I'm creating. I've installed libraries for easychart and highcharts, and have no idea what the issue could be.

Anyone run into this issue?


texts: How do I hide specific node fields to users not registerd to that specific node?

texts:
I am building a site with a course content type. Users can only view some of the course details (such as date, location and description) unless they are registered on the course. Once registered their is certain webforms and file downloads related to the course which they can access too.

A company admin user (sponsor) should be able to access specific courses, and if they have access to a course they can invite people (delegates) to register on the course. Basically each individual course is by invite only.

I'm a little confused as to how to build this. I assume Organic Groups, and/or Entity Registration may be the right direction, but I've never actually used either Module. Does anybody have any suggestions on how I can build this? Which Modules should I use and does anybody have any tutorials or references which may help in this specific area?


texts:
Ok, this is a newbie-question i'm afraid to ask for some time .. how to use Drupal Hooks?
Yes, i know where to look for the code, but then? Put it in the template-folder, a block, a custom module?

When i google for a tutorial, the most results are for Drupal 6 / before 2010.


texts:
I'm wondering if there's a way to make a view render an Atom feed with custom fields, that would output something similar to this:

<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" ... xml:lang="en-US">
   <title type="text">my atom feed</title>
   <subtitle type="text">my atom feed subtitle</subtitle>
   <id>the feed's url</id>
   <rights type="text">some copyright</rights>
   <updated>2013-06-14T02:29:00Z</updated>
   <author>
      <name>me</name>
   </author>
   <generator>my feed generator</generator>
   <link rel="alternate" type="text/html" href="my site's url" />
   <link rel="self" href="the feed's url" />
   <my:field1>value1</my:field1>
   <entry type="my_type_1">
      <id>an article's url</id>
      <title type="html">article title</title>
      <summary type="html">article summary</summary>
      <published>2013-06-14T01:16:00Z</published>
      <updated>2013-06-14T01:47:40Z</updated>
      <author>
         <name>someone</name>
         <uri>the guy's bio page url</uri>
      </author>
      <content type="html">full body content in &lt;strong&gt;html&lt;/strong&gt;</content>
      <my:numeric_field>2</my:numeric_field>
      <my:yet_another_custom_field>hi there</my:yet_another_custom_field>
   </entry>
   <entry> ... </entry>
</feed>

The views_rss module can do stuff like this (in fact, I've already accomplished a lot using its hooks to define the fields, and field formatters to do stuff like <author><name>name taken from a user reference field in the node</name><uri>the user's url</uri></author>, but I can't find a similar module that provides the same functionality for Atom feeds.

Is there such a module out there? I've tried atom and views_atom without success. If not, how hard would it be to implement it? I guess this would involve making a "views plugin", with which I'm not really familiar.


texts:
After moving some animation code from page-front.tpl.php to a block, the paging animation is broken.

Good:

Broken:

The slide code is:

 Event One

 Event Two

 Event Three

      1
      2
      3

When I move the above code into a block and output via print $banner;, there is some extra
 which breaks the animations:

 Event One

 Event Two

 Event Three

      1
      2
      3

Is it possible to force print $banner; to output the raw content of a block, without the
 and
?


texts: How Do i implement an alternative for the Privatemsg Bulkmail module?

texts:
I'm using the modules Private Message, Invite and Organic Groups in Drupal Commons.

I get listed with trusted content using Views and need to set private Message button for bulk operation just like the Privatemsg Bulkmail module from D6 (for which there is no D7 version yet).

How can I get the Private Message module to work with the VBO module, or any other module, in Drupal 7?

I created an Email system with bulk operation via external mail system.

  "User can invite friends and send email using VBO module "

But I want to send mail/message internal system like the Private Message system for bulk trusted contacts. How can I achieve this?


texts: Compare data and add send email action using rules module

texts:
I have two content types:

"Reserve a trip" with the fields Res_Date_Between, and Res_date_and
"Post a trip" with the fields Post_Date_Between, and Post_date_and

The users who organize the trip and who have the permission to add the content type Post a trip, can give the trip the departure date (Post_Date_Between) and the end date (Post_date_and). The users who want to reserve the trip have the permission to add the content type "Reserve a trip", and can give the trip the departure date (Res_Date_Between) and the end date (Res_date_and).

What I need is verifying the "add new content type" event occurred for the "Post a trip" content type, and add the "send email" action for the users who reserve a trip checking that the dates in the the two fields of the "Reserve a trip" content type are within the two dates of the "Post a trip" content type.

How can I achieve this?


texts:
For my next drupal project I need more flexibility in content-styling, than the standard approach allows. I need to be able to build the content-body for every single node from different elements. Like in TYPO3 I need a sandbox of pre-styled elements (e.g. full screen image, two column text, 3 boxes side by side, etc) and be able du add as many different elements as I want. The markup and styles should be saved in my theme, so there should not be any html in the content fields.

e.g.

EDIT 1: Its basicly something like the Form builder what I am searching for. (see comments)

Usualy I have used an WYSIWYG editor whith shortcodes, insert module and predefined styles, but I learned that it is not a good practice.

My approach which atm only work in the theory:

I use Field collection module for being able to add unlimited blocks of the collection.
Whithin the field collection I have one select-box where I define the template_name for the collection.
Than I add all the fields I need (e.g. text, image, backgroundimage, date) to the collection
With the Conditional Fields module I controll which fields are needed/shown for every single template (see select box).

Screenshot 1 //
Screenshot 2
The theming is done in my field-collection-template file (if template_name == x, render this whithin  particular markup)

Unfortunately this is really complicated  ( I have to make a dependies for every single field in any template).

is there any better solution?


texts: Using Rules module to Auto Post the content to Linkedin Account

texts:
I am using Drupal 7. I used Feeds module for content from the RSS. So i can get the content from RSS Feeds. Now Feed Content types automatically saved with RSS Feeds content. So now I want to auto Post the Feeds content to the twitter,linkedin and facebook.I am using Twitter module.

So i can Auto post the content using rules module to Facebook.
Same Time I Can Auto Post the content using rules module to twitter..
 I want to post this content via rules module to linkedin.. I am using Linkedin module also. But it doesn't work for rules module ? Using linkein module for particular content types only. I want to post the content for particular user linkedin account?Admin can submit the content post to the linkedin account.But i want to auto post the content for particular user account?

Is there any way to auto post the content via rules module to linkedin account. I am in critical situation.Please anyone guide to me. Thanks in advance.


texts: How to add comments per picture in a photo album?

texts: I have an activities content type that I want to add a photo gallery to (in the same content type). However I want comment capabilities per picture. How can I achieve this?


texts: How to name a template file for the following theme hook suggestions?

texts:
I hardly managed it to create theme hook suggestions to work with different bean blocks, so I can use custom .tpl files like:

bean--{bundle_name}.tpl.php // currently only bunde is 'zielgruppe'

Here is the code so far:

/**
 * Override or insert variables into the block templates.
 */
function mymodule_preprocess_block(&$variables) {
  // For bean blocks.
  if ($variables['block']->module == 'bean') {
    // Get the bean elements.
    $beans = $variables['elements']['bean'];
    // There is only 1 bean per block.
    $bean = $beans[reset(element_children($beans))];
    // Add bean type classes to the parent block.
    $variables['classes_array'][] = drupal_html_class('bean-' . $bean['#bundle']);
    // Add template suggestions for bean types.
    $variables['theme_hook_suggestions'][] = 'bean__' . $bean['#bundle'] . '_tile';
    $variables['theme_hook_suggestions'][] = 'bean__' . $bean['#bundle'] . '_' . $bean['#entity']->delta;
  }
}

But for the last suggestion I just cant figure how to freakin name the file. delta prints "für-angehende-lehrkräfte". I've tried to following file names which dont get noticed:

bean--zielgruppe-für_angehende_lehrkräfte.tpl.php
bean--zielgruppe-für-angehende-lehrkräfte.tpl.php

(appearently stack messes up ü characters in code areas)

For instance, bean--zielgruppe-tile.tpl.php works.


texts: How do I remove a node from the front page after a certain period of time?

texts: Can I use the Rules module to remove a node from the front page after a period of time determined by the administrator user when creating the node?


texts: How can I show children in the taxonomy teaser views of parent/grandparent terms?

texts:
Lets assume we have a Taxonomy called Region

Asia - Thailand - Bangkok

If a post is tagged with Bangkok, would it show up in the teaser view on following pages:

/region/
/region/asia/
/region/asia/thailand

or would it only show here?

/region/asia/thailand/bangkok

If later is the case, what's the best way to show it in parent terms teaser views?

Thanks for your help in advance.


texts: How to pass information by reference from a hook to Feeds?

texts:
I need to have the ability to tell Feeds to skip a node from hook_feeds_before_update. But since there is no variable sent by reference I don't know if it's possible without having to modify the code in Feeds.

Anyone know how to do this?


texts: Plotting multiple points on a Google Map using geofield in a View

texts:
I have a content type called Installers that has addressfield and geolocation (et al) attached to it.

Following the instructions found here : https://www.drupal.org/node/1944648 I was able to set up a View Page listing the Installers closest to the location entered on the exposed filter.

I've set up an Attachment to that View Page, set as a Geofield Map, and set to inherit the exposed filter. However it displays nothing (just the default location), and certainly doesn't appear to update the map depending on the results of the Page.
Have I missed a step or is there more to plotting multiple points on a Geofield Map?

Any and all assistance given is greatly appreciated.


texts: How to edit default Commerce Order status?

texts:
I am trying to edit the label of a default Commerce Order status (Pending:pending).

I have tried through commerce_order.api.php like it is explained in this post: Change order status string from "Completed" to "Shipped" and on this page but unfortunately it did not work for me. More, in this PHP file, the Completed status should display Finished and it doesn't work either??

The Commerce custom Order Status works fine with new statuses but I did not find any way to edit default ones.

Thanks for any tip.


texts: Add "- Please Select -" to a required CCK field

texts:
In Drupal 6, by default, a required CCK field will display the first allowed value.
I want it displays "- Please Select -": Is there an easy way to do this?

I do not want to save "- Please Select -" in the database.


texts: How do I display a "Thank You" message after submitting a Webform 3.x form?

texts:
I recently upgraded a Drupal 5 site to Drupal 6.  This upgrade also entailed upgrading the Webform module from version 2 to version 3.

I have a very simple webform setup that asks for a name and email address to sign up for a newsletter.  Before upgrading, the webform administration area had a textarea labeled Confirmation message or redirect URL, but I no longer see this option.

When the form is submitted, it just reloads the form with empty values.  The form is submitted properly, but I would like to be able to present a "Thank You" message instead of reloading the form page.


texts: What's the "Best Practice" approach for disabling secure pages on local Dev?

texts:
Wondering what the "best practice" approach would be for disabling secure pages on local dev. I'm running a site on Acquia Cloud and have access to the environment variable AH_SITE_ENVIRONMENT and I could easily do something like:

if (isset($_ENV['AH_SITE_ENVIRONMENT'])) {
  switch ($_ENV['AH_SITE_ENVIRONMENT']) {
    // case 'dev':
    //   // do something on dev
    //   break;

    // case 'test':
    //   // do something on staging
    //   break;

    case 'prod':
      // do something on prod
      break;
  }
}
else {
    $conf['securepages_enabled'] = 0;
}

Is that the best approach or is there a better, cleaner way? Also, are there negative implications for filling up settings.php with stuff like this?


texts: How can I create block for my custom form?

texts:
I create a custom form module. Now I want show my form in a block. How can I do this ?

Note: I create MymoduleBlock.php in /modules/my-module/src/Plugin/Block path with this code but not work:

<?php

namespace Drupal\my-module\Plugin\Block;

use Drupal\Core\Form\FormInterface;
use Drupal\Core\Block\BlockBase;

class MymoduleBlock extends BlockBase {
  public function build() {
    $form = \Drupal::formBuilder()->getForm('Drupal\my-module\Form\MymoduleForm');
    return $form;
   }
}


texts:
I have a module that uses hook_menu to create several pages that are populated with SQL query results.

I have been trying to configure drupal_mail and hook_mail to send these results via mail when the pages are visited, but so far I haven't succeeded.

I used the info I found here and indeed, the module works: whenever I run cron the sample mail is sent, but I haven't found the way to customize it in my module so when I load my custom pages the results are sent via mail.

Also, if my data is the result of:

function mystats_all() {

$header = array('Nombre', 'Status', 'Rol 5 = Alumno', 'Email' );

$query = "
SELECT name, status, rid, mail
FROM users
JOIN users_roles ON users.uid = users_roles.uid
WHERE mail NOT LIKE '%@example.com'
AND users_roles.rid =5
AND users.status =1
";

$result = db_query($query, $some_value);
    while ($row = db_fetch_object($result))
    {
        $rows[] = array(
                    array('data' => $row->name, 'align' =>'left'),
                    array('data' => $row->status, 'align' => 'left'),
                    array('data' => $row->rid, 'align' => 'center'),
                    array('data' => $row->mail, 'align' => 'left'),

        );
    }

    $table_attributes = array('id' => 'my_id_for_table', 'align' => 'center');
    $output .= theme('table', $header, $rows, $table_attributes);

    return $output;

how can I correctly send my table via mail? I don't know (and I would like to have the drupal_mail function working to make some tests) if I should use $query or $result.

Thanx in advance.

Any ideas or help, please?


texts: How do I get the username of the logged-in user?

texts:
I am working on a site where on a page I am querying some data related to my project.

Here I have many clients and I have given all of them access to project search page. On search page I run a query according to the fields selected by the user and display the result as a table on the page itself. But my query is as such that it is not user dependent.

I just want to ensure that each user has a specific set of output for itself (i.e not all the table would be displayed to all users).

How do I get the username or user ID of the logged-in user?


texts: $base_url variable in settings.php is not being read. How do i set this variable?

texts:
On my laptop I recently moved my Drupal sites from Acquia Dev Desktop server to a standard MAMP setup. Problem is the root dir folder isn't being read. The root dir folder name would be, by default part of the base url. For example, the mission page URL should be  http://localhost:8888/mywebsite/mission. But instead it's trying to load as http://localhost:8888/mission.

Since using Drupal I haven't had to once set a base url variable. In the settings.php file I found a variable for this which I uncommented and set. On line 282 in the settings file it now reads as like so:

$base_url = 'http://localhost:8888/mywebsite';

but this is having no effect whatsoever.

How or where can this be set? Or is there something I should do within the MAMP set up?


texts: Set a token as the default value of a new field

texts:
In Drupal 7, you can set defaults values for most fields. Is it possible to set a token as the default value.

I remember this being possible in Drupal 6, but it doesn't seem possible in Drupal 7.

There is a thread here that discuss the possibility, but its not clear if it was solved.


texts:
I need to like AND to dislike contenttyps, but the total likes should be displayed as Likes - Dislikes. I tried to use the "flag" module and created two different flags (one for likes, one for dislikes) but this leaves me with two problems

I need to get the total count of the likes (likes - dislikes) within a view - how can I do this??
Can I disable the like/dislike button, if it was already clicked? So you can like and dislike but only once (no toggle).


texts: Add content -> taxonomy autocomplete input field size

texts:
My content type has a taxonomy auto-complete field.
My problem is that some content requires like 10-20 taxonomy terms where my input field for it is way to small.

I don't see in my 'manage fields' settings where I can define this length.


texts: How do I remove the label from the webform grid options?

texts:
We've upgraded to Webform 7.x-4.2

We're using the grid input type.

In previous versions we just had the options along the top, now the label is being concatenated before the option.

So in bold along the top row show be "1" not "me-1"

How can I prevent this behaviour?


texts:
I am trying to make a node have the alias "/libraries" but I get a Page Not Found error which looks to be returned before Drupal has fully bootstrapped (I don't get the usual Drupal 404).

I checked a few other sites and they seem to have the same issue. Is there some reason why I cannot use this alias in Drupal? Would it have anything to do with a "libraries" folder in the root of the project?

Edit: It does appear to be because I have a "libraries" directory in the docroot which contain various JS libraries for CKEditor and other modules that need them.

So what is the fix here? I assume if I change the directory to anything else, those plugin paths will break. I could add Libraries API maybe, but I don't know the status of that module, but it still means any module that has a libraries.yml file that looks for /libraries..../file.js still won't work.

In this actual case, /libraries is a View (or could wind up being a node with a View block on it) that lists all libraries in the system, and thats what I want the URL to be.


texts: Jquery not working on pageload, works after resizing

texts:
I'm having problems correctly displaying a static div (jumps to top of browser too early). I have found some JQuery code to fix it. I made a custom js and put the code in there. Using console log, i can see the code is being run on page load.

However I only get the desired effect after resizing my window, how do i get this code to work without resizing my browser window?

i added this to my theme info file:

scripts[] = js/scroller.js

this is my scroller.js file:

(function ($) {
    $(document).ready(function({$(window).off('.affix');console.log( "ready!" );
    $('.navbar-default').removeData('bs.affix').removeClass('affix affix-top affix-bottom')
});})(jQuery);

i added this to page.tpl.php

<script src="/gamingleagues/themes/gamingleagues/js/scroller.js"></script>


texts: Best practice for node expiration with email notification

texts:
I have a page where users can create meetings which have a specific start date and time, other users can join this meetings until up to an hour before it starts.

One hour before the meeting starts i would like to send an e-mail to the participants to tell them that the meeting will take place, or that it is canceled because not enough participants have been found. So i need to filter all the existing and not yet closed/started meetings and see if any of them are less than one hour away from starting.

Question:

Whats the best practice to do this kind of data evaluation in Drupal. Is there a recommended way of doing this?

My idea:

Just create an external PHP file including all the drupal shebang, call it every x minutes with a cron job and access the DB from inside this script.


texts: How do you modify the form after it validates and show's errors

texts:
I have built a form using CCK in Drupal 6. I have two fields, one which is called health plans and the other is called terms. If I select a health plan I update the terms via AJAX (both are select lists).

So for example: (health_plan_field)Plan A -> (terms_field)(1, 3, 6, 12)

I submit the form and serialize the terms inside a session so that I can keep them.

My problem is that if the form has errors, the terms field is blank because it starts empty until a health plan is selected. So if I have already selected a plan and terms, when the form returns after errors I have nothing.

I have tried to use form_alter (have used this before) by recursively walking down the cck fields on $form to modify the term_field options based on what I have in the session. This does nothing on return.

My code is as follows (called from hook form alter):

function acg_pportal_new_service_order_form_cck_walkerTerms(&$array, &$cck_fields) {

$terms = unserialize($_SESSION['termDataFromForm']);
if (!empty($terms)){
    foreach($array as $key => &$value) {
        if (in_array($key, $cck_fields)) {
        unset($value['value']['#options']);
        $first = "";
        foreach($terms as $key2 => $value2){
            if (empty($first)){
                $first = $key2;
            }
            $value['value']['#options'][$key2] = $value2;
        }
            $value['value']['#default_value'] = $first;
            $value['value']['#value'] = $first;
        }

    }
    }
}

Is there anything that you know that will help me in this case.