texts: How to hide a block in a view when an exposed filter is being applied?

texts:
I have built a view with exposed filters. There is a 'popular content' block on this page which I am controlling using the Context module (https://www.drupal.org/project/context)

I would like it so that the popular content displays, but only if no filters are being applied to the view. If a filter is applied then the block should not show.

I can see that the Context module has a query string condition option which I've tried to apply but without success. I've tried adding things like ~?title=* or ~*?title=** here but I can't seem to get the behaviour I'm after.

Any help would be appreciated.

UPDATE

I've used the answer from @Pierr.Vriens to create a rule component. However, the block now isn't showing on the /MyViewPath page (which is /courses on my site). I've put the export of the rule I created below. I'm surprised that it's not showing on the page now at all. The block is being set in the correct region, the 'rules' component has been added to the block settings itself and I've disabled the context module from messing with it too.

Here is an export of the rule I created:

{ "rules_block_visibility_popular_courses" : {
    "LABEL" : "Hide block for filtered course view",
    "PLUGIN" : "rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "USES VARIABLES" : {
      "module" : { "label" : "Module", "type" : "text" },
      "delta" : { "label" : "Delta", "type" : "text" },
      "result" : { "label" : "Result", "type" : "boolean", "parameter" : false }
    },
    "IF" : [
      { "text_matches" : { "text" : [ "site:current-page:url" ], "match" : "courses " } }
    ],
    "DO" : [ { "data_set" : { "data" : [ "result" ], "value" : "1" } } ],
    "PROVIDES VARIABLES" : [ "result" ]
  }
}

UPDATE 2

So it was the space at the end of "courses " that was causing the problem. The exported rule below did the trick:

{ "rules_block_visibility_popular_courses" : {
    "LABEL" : "Hide block for filtered course view",
    "PLUGIN" : "rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "USES VARIABLES" : {
      "module" : { "label" : "Module", "type" : "text" },
      "delta" : { "label" : "Delta", "type" : "text" },
      "result" : { "label" : "Result", "type" : "boolean", "parameter" : false }
    },
    "IF" : [
      { "text_matches" : {
          "text" : [ "site:current-page:url" ],
          "match" : "courses",
          "operation" : "ends"
        }
      }
    ],
    "DO" : [ { "data_set" : { "data" : [ "result" ], "value" : "1" } } ],
    "PROVIDES VARIABLES" : [ "result" ]
  }
}


texts: creating custom panes for field data in drupal 7

texts:
I need to port a panel feature from drupal 6 to drupal 7. I am able to get all the panel fields that come from views and blocks. Only thing i am not able to get is the fields that are coming from the content types.

Editing the panel shows "This pane's content type is either missing or has been deleted. This pane will not render." in the pane. The code generating this pane is

$pane->css = array();
  $pane->extras = array();
  $pane->position = 2;
  $display->content['new-4'] = $pane;
  $display->panels['top'][2] = 'new-4';
  $pane = new stdClass;
  $pane->pid = 'new-5';
  $pane->panel = 'top_left';
  $pane->type = 'content_field';
  $pane->subtype = '<field name>';
  $pane->shown = TRUE;
  $pane->access = array();
  $pane->configuration = array(
    'label' => 'inline',
    'formatter' => 'default',
    'context' => 'argument_nid_1',
    'override_title' => 0,
    'override_title_text' => '',
  );

The content_field type requires a plugin content_field.inc which was present in cck module in drupal6 as 'cck/includes/panels/content_types/content_field.inc'. How do i port this thing in drupal 7. There should be something equivalent to content_field.inc in drupal7
also.

Can someone lemme know how to get over this issue?

Thanks


texts: Creating a node with multiple joined fields

texts:
I'm sure I used to know how to do this, but now I can't work it out.

I have a content type, lets say it's called "project". A project can have multiple contributors, and for each contributor I need to have two fields, let's say "Name" and "University". Can I set this up as a single Content type?

If not (and I have to have a Content type for the project and a Content type for the contributor, using entity reference to link them), then how do I set it up so it's easy to edit on a single page (i.e. create a new project, click something to add another contributor on the same page)


texts:
I have 3 languages in my site and also user with 'Webmaster' role.

Is it possible to keep all nodes/users tabs (view|edit|translate|devel etc.) in one preferred language for this role?


texts: How do I use PHP in "Rewrite results" for a field in a view?

texts: In a view, I configured a file to "Rewrite the output of this field." In the text area I need to use PHP. Can this be done?


texts: Show products based on the location (country) of the visiting user

texts: I need to display products based on the country of the visiting user, the countries have the same language (Spanish), but different systems of currency, I installed the module smart ip to identify the country of the visiting user and the countries module for creating the product can select the country or countries where the product will be available, my goal now is to make filter in the view to show only the products available in the country of the visiting user.


texts:
I followed this answer to try and theme node add

https://stackoverflow.com/questions/1538600/how-can-i-theme-the-template-for-edit-or-add-a-node-for-a-specific-content-type

the only problem is my theme is using Garland in node/add so I can not theme it with mythemename_, how do I use my custom theme for this instead of garland


texts: Recently added localized taxonomy terms not appearing in secondary language

texts:
I'm running a multilingual site in two languages: English (default) and French.

I have a Vocabulary with the Translation Mode set to Localize. Everything was working fine until I added some new terms in English. I then used the translate interface to add French translations for these terms.

I have a term reference field that has the same value across all languages. When I set this value on the English node edit page, it works. When I switch over to the French node edit page, the value has defaulted to the first term in the list and the recently-added terms don't even appear.

I've tried refreshing the strings through the translate interface, flushing all caches, and running cron but nothing can get these new terms to appear in the French node edit form, and the values refuse to stick for any language except for English.

How can I refresh this Localized vocabulary so that the terms are the same for both languages?

I've made an album on imgur that hopefully gives a better idea of what's going on: http://imgur.com/a/t9i7G


texts:
I have two content types, Brand and Sector. Brand have a sector field which is an Entity reference field.

I have views that display the list of Brands and it has a sector contextual filter which displayed as an input field where you have to input a node ID.

I was trying to make it a dropdown with sector titles for a user friendly experience but wasn't able to achieve this in views. So I decided to alter the views form but it seems like that it's not working the same as in D7.

What's the right way to alter the views field or is there a way to render a field as dropdown using views?


texts:
I am new to drupal themeing, I have tried to find the presidency of template files(.tpl.php).. So my question is for a particular scenario if I have html.tpl.php, page.tpl.php, block.tpl.php, node.tpl.php, taxonomy-term.tpl.php, template.php,

which file going to run first?
if I want to make change some variable's value for page.tpl.php/html.tpl.php then I need to write a function XXX_preprocess_page()/XXX_preprocess_html() according to this listed presidency (https://api.drupal.org/api/drupal/includes!theme.inc/function/theme/7) ?


texts: Remove added URLs after link when printing a page

texts:
I am using the Print module, but the links in the body of my articles are followed by their URL. How can I remove the URL when I am printing a page?

What I have now is some test with some URL (http://www.somewebsite.com/article2) to show, and some more (http://www.somewebsite.com/article8) text to demonstrate.

What I want is some test with some URL to show, and some more text to demonstrate.

I tried changing sites/all/modules/contrib/print/css/print.css without success.

.item-body  {
      a[href]:after { content: none !important; }
     /* img[src]:after { content: none !important; }
      a[href]:after { content: ""; /* hide visible URL after links. */ }
      /* a[href]:after {
      content: " (" attr(href) ")";*/
  }
}

update
The part i want to remove is in bold.
   contributor helping  report. It’s the latest nightmare.some text for the url to be removed (http://url-to-be-removed) then some more text.


texts: Drupal Commerce charge customer after an event

texts:
I have a Drupal Commerce site, on that site, I want to sell live streaming sessions. I would like to know, how I can charge to the user after that event, according with the time of the session.

I'm not sure if exists a way to link PayPal customer accounts with my site for make charges automatically, without additional user actions.


texts: How to programmatically populate FileEntity

texts:
I have a file entity with some custom fields, for example a date field.
How can I programmatically set the field values?

If I, for example, set date-field value with a DrupalDateTime object, I get an error on saving the entity.

$entity->set('field_myname', $drupalDateTimeObject);
$entity->save();

SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'field_myname_value'

So I assume there needs to be a transition between the DateTime object and the actual field value.
How can this transition be done dynamic, if the field types are dynamic?


texts:
I have a view where you can search for a number of users. Each of the 5 roles are limited to search for different roles of users, in a slightly complex matrix form.

A user can have multiple roles assigned to them too.

How do I restrict the "Filter: User Role" field depending on the role of the user using the search? I was initially planning to use contextual filters, but it appears to be more complex than that.

Can I use a hook or theme template to filter the results of the view depending on the user role?


texts: Add a Radio-button with other option in comment type

texts:
I have the following requirement in Drupal 8:

I have to create a comment type with options. In options there will be a Other option on whose click a text field will be opened.

something like below image:

How can i achieve the showing of text box on other option selection in comment type?


texts:
I need to make a testimonial page, which include 3 parts.

text on the above
video testimonial which have the owner name and his image
text testimonial which have the owner name and his image

I am new at Drupal and using Drupal 7 for start things.

I made 2 content types, first for video testimonials the second for text testimonials

Now I am confused how i will proceed to plan things up.

Thank you for the help in advance


texts: Can I assign a taxonomy to a content type's term_reference field at runtime?

texts:
I need to manage a few different types of objects, let's say "car", "pickup", and "van".  These are similar enough (for my purposes) that I can define a single content type and associated code for "vehicle" and use it for all of them, along with a field that specifies the exact type of the object.  This allows me to do things like have one page that shows all the cars, one page that shows all the pickups, and so on.  I have this code running; everything is fine.

I now want to add an OPTIONAL tag field to these items, using the taxonomy / term_reference stuff in Drupal.  The catch is that I want to have a separate tag taxonomy for each of my different kinds of vehicles, so that "car" tags don't show up in the truck's autocomplete suggestions. (Trust me -- in the context of my app, this makes sense.)  The question is how to do it; the complicating factor is that the vocabulary for a tag field has to be defined when the field is added to the content type, and, remember, my content type is generic across all the types of vehicles.

So:

Ugly possibility #1: Define a single tag field -- field_vehicle_tags? -- in the content type and write some magical code in a form_alter or theme or after_build hook or somesuch that, when building the edit form for the node, checks to see what kind of vehicle is being created (this is known upon entry to the form) and bashes the appropriate vocabulary into the field's autocomplete process.  I don't know that this is actually possible, and I suspect the opportunities for screwing myself are endless.
Ugly possibility #2: Define one tag field for each kind of vehicle -- field_car_tags, field_pickup_tags, etc -- each of which is connected to its own taxonomy.  Then, use the theming hook to throw away (= not render as part of the form) all the tag fields except for the one that matches the kind of thing being edited.  This is stupid and wasteful in all sorts of ways, but I'm pretty sure it would work.

Any thoughts or alternatives?  I'm currently leaning towards #2, but if there's a better alternative, I'd love to hear about it.


texts: All Blocks in One Theme Automatically Disabled

texts:
On a Drupal 7 site that I help maintain, the blocks in one of the themes were all disabled automatically.  I manually added all of the blocks back of course, but can't promise this won't happen again.  To try to find out what happened, I queried the block table and discovered that the tracking columns are not provided (e.g. created, changed, uid).  So then I went on to see if MySQL could tell me the last time that these rows were modified, but there is no such native function.

Has anyone seen this problem?


texts: Allow users to email a file and create a new post

texts: Tumblr allows users to upload files using a randomly generated email account that is assigned specifically to each user. I have a content type called "Video" and I would like to find a way to randomly generate an email address using my site's domain and allow the user to attach a video file and meta data. When they send it, it gets uploaded to the site just like it would if they submitted the form online. I am also using Amazon SES if that could be helpful to solving this.


texts: How do I collect field values of a submitted webform?

texts:
I'm trying to integrate a Mailchimp mailing list into Drupal. The Mailchimp list requires:

First Name
Last Name
E-Mail

The client already has a list in this format so ideally I need to collect this data in Drupal.

I want to have a newsletter block that collects the email address and forwards a user to another page that has the full newsletter sign up with first name last name and the email but pre filled out.

I know I'm going to need Rules and Webform. But how can I collect the value of the webform field and use it again as a token later?

Note:  I am using this within the Drupal setup, but the list requires three fields of data (first/lastname/email). I want to have a block that initially collects the email and forwards them to the full newsletter signup page. I have the webform and rules working to direct the user from the page with the block to the signup page, but I need to find out how to create a custom token from the field.


texts: Should I create a reference field or a third content type to represent a many-to-many relationship?

texts:
I have a student table and a course table that have a many-to-many relationship (a student can take many courses, and a course can be taken by many students).

If I am implementing the above data model as a database, I would create a third table to represent the many-to-many relationship.

But I want to implement the above data model in Drupal 8. I think that in Drupal 8 there are two ways to implement the above data model:

I can create a reference field in one of the two content types
(student or course) that points to the other content type.
I can create a third content type that have two reference fields
that points to the student and course content types.

Am I correct that these two ways are valid? And if I am correct, which one should I choose?


texts: I want to add css class to a field inside hook_field_widget_form_alter, but it doesn't work!

texts:
in this link
https://api.drupal.org/api/drupal/modules!field!field.api.php/function/hook_field_widget_form_alter/7

it describes that we can add css class to an element in a form via this code

function hook_field_widget_form_alter(&$element, &$form_state, $context) {
  // Add a css class to widget form elements for all fields of type mytype.
  if ($context['field']['type'] == 'mytype') {
    // Be sure not to overwrite existing attributes.
    $element['#attributes']['class'][] = 'myclass';
  }
}

I tried to use it but it seems $element['#attributes']['class'][] = 'myclass'; doesn't add any css class to form after rendering.

So how can I add css class to a form element inside hook_field_widget_form_alter() ?


texts:
I would like to create a Home view (the principal page of the site) without any type of content like news. The problem is that when I create a view, I don't see any way to hide the content.

I have tried to put the number of items to 0, but this loads all contents. How can I create a home page without any content?

My Drupal version is 7


texts: Attach an #ajax callback to a field when the form is reloading from previous ajax request

texts:
Is it possible to attach an #ajax callback to a field when the form is being regenerated from a previous ajax event (like a submit button)?

What I tried

Adding the #ajax callback to the field when the form is reloading does not seems to trigger anything:

// Adding the ajax event to the field.
$form['my_field']['#ajax'] = array(
  'wrapper' => 'module_form',
  'callback' => 'module_form_ajax_callback',
);

The Drupal.settings array is not updated after the end of the ajax process. Seems like I'm trying to do something the Form API isn't able to do out of the box... Here's the result of the first ajax request:

You can see there's still only the submit button in the form attached to an ajax event.

Update

I spotted the issue, it was somewhere else. My form is a multi-steps form, when a step is submitted, I rebuild the form with the previous steps and add the next one.

For the previous steps, I render them based on data available from $form_state['complete form'], the render array here is actually storing a lot more data than the one I had set in the first place, which was causing conflicts.


texts: i18n language switcher don't show on default lang

texts:
I'm using Drupal 7 and Clean theme. And my site have 3 languages. Using i18n module for this features. Everything is working...

Language Switcher block is active, showing on 2 languages. But, when click my site default language, don't show this block.

How can i solve this?


texts: How Do I Properly Add Custom CSS Classes And IDs To Drupal 7 Sub Menus

texts:
I'm having a theming problem with my Drupal secondary navigation.  I have a two level menu set up - i.e. five parent links, two of whom have children.  The problem I'm seeing is that the children have the same CSS classes and IDs.  Consequently, when I click on a parent that has children, they are appearing the same as the parents.

I have tried to modify the menu via my template.php and page.tpl.php to no avail.  I have the following in my template.php file and it is throwing errors saying $sub_menu does not exist:

function framework_menu_link(array $variables) {

  unset($variables['element']['#attributes']['class']);
  $element = $variables['element'];
if($variables['element']['#attributes'])
$sub_menu = '';
if ($element['#below']) {
$sub_menu = drupal_render($element['#below']);
}
$output = l($element['#title'], $element['#href'], $element['#localized_options']);
return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . "</li>\n";
}

Any help or guidance anyone could provide would be appreciated.

Thank you!

+Chris


texts: How to check for product taxonomy term in Rules actions (Ubercart)

texts:
I am using Drupal 7 with Ubercart. I am trying to configure to send an email when customer makes a purchase of a product mapped to one particular taxonomy term.

I tried adding actions in a custom rule (created with Rules). But there is no such action available to check the product field values or based on taxonomy terms.

Is there any alternative ways to check product fields in Rules actions?


texts: How to add a comment form in VBO to add the same comment to mutiple nodes?

texts:
I am using "Comments" as a note option. I want to let users add the same comment to multiple nodes with the Views Bulk Operations (VBO) module.

How do I get the "Add Comment Form" in VBO to achieve this?


texts:
How should I debug OOP level errors in Drupal8? Error messages and backtrace seem to be useless.

I have installed the pants module locally on the latest Drupal 8 environment. And got an error. Now, I know it's because of the Pants module, because it worked fine before I installed it. But the problem is that the error message and the backtrace are completely useless in debugging this problem. Please see the image attached.

Am I missing something? How this problem should be debugged, given the non-descriptive messages?


texts: Why am I getting empty input value on expose filter $form_state variables for taxonomy?

texts:
I have created a panel. Inside the panel there is one content pane and one view expose filter present.

Normal exposed filter works properly but Simple hierarchical select does not works as expected: I am getting empty value after submit.

I have checked using views_exposed_form_alter hook.

$form_state['view']->exposed_input['shs_term_node_tid_depth']

Is there any alternative way to set or get the expose filter input?


texts: Why does entity_metadata_wrapper does not preserve node's custom URL while updating other fields?

texts:
I am programmatically loading a node of custom content type (i.e. staff) using entity_metadata_wrapper and add a reference to a collection of other nodes and then save the node.

The custom nodes (i.e. of type staff) has a custom a URL, set when the node was created (they are all created manually but, subject to being updated programmatically on regular basis). I also have pathauto module enabled but, I don't need it for this specific scenario.

entity_metadata_wrapper does load the node, assign the references and magically resets the node's custom URL to automatic. Any idea about this behaviour? Is there any way to preserve the custom URL?

Here is the code that loads the node, establish reference and saves the node :

      $node = node_load($staff_drupal_id);
      $wrapper = entity_metadata_wrapper('node', $node);
      $wrapper->field_staff_selected_publication->set($publication_ids);
      $wrapper->save();


texts: What code should I use where I used db_query()?

texts:
I want to execute SHOW TABLES in Drupal 8. In Drupal 7, I would use db_query("SHOW TABLES"), which is deprecated in Drupal 8.

What should I use for Drupal 8?


texts: Fatal error when changing field type using hook_form_alter

texts:
I'm currently trying to override a custom field within a Taxonomy Vocab via hook_form_alter()

I have configured a text field with the machine name "field_hex", and I'm trying to change the type to 'jquery_colorpicker' (when a user adds /edits a term), so that the user can use a jQuery Colorpicker to enter a hex value.

$form['field_hex']['#type'] = 'jquery_colorpicker';

Overriding the field type using hook_form_alter using the code above displays the colour picker, but when you click "Save" and submit the form, I get the following Fatal error:

Fatal error: Cannot create references to/from string offsets nor overloaded objects in /var/www/mysite/includes/common.inc on line 6448

I noticed that the field type before I override the value for this field is "container" and not "textfield" as I would've expected. I'm not sure if this means anything?

Also, I tried changing the field type to "textarea" and I get the same error when I submit the form so it can't be the 'jquery_colorpicker' value causing problems.

Any help / direction would be greatly appreciated!!

## UPDATE ISSUE SOLVED! ##

It seems I was referencing the form array incorrectly when trying to change the form item type. When trying to change a form item type, always remember to reference the language portion too:

$form['field_hex'][LANGUAGE_NONE][0]['value']['#type'] = 'FIELD_TYPE_HERE';


texts: How may I add a tab item in an OG that shows a Content Type related to that group?

texts:
We have Drupal Commons 3 (on Drupal 7). In our groups, I'd like at add a tag near the group's title that links to a certain content types. I have a View ready to go. How might I add that view to an OG tab?

Update and screen shots:

So I have this view:

I had hopped to create a new tab here:

By playing with this setting:


texts: How to Set Hidden Form Field Values Permanently via Form Alter

texts:
I have a webform that gets some hidden form fields set based on the referring URL.  Within hook_form_alter, I can successfully set the hidden values with $form[elements][NAME]['#value'].

function MODULE_form_alter(&$form,\Drupal\Core\Form\FormStateInterface $form_state, $form_id) {

 //Get referring Program path/URL
 $previousUrl = \Drupal::request()->server->get('HTTP_REFERER');

 if ($form_id == FORM_ID) {

    $prog = getLeadProgramContact($previousUrl);
    $form['elements']['referrer']['#value'] = $prog->field_email->value;
    $form['elements']['program_name']['#value'] = $prog->getName();
     }
}

However, when the form gets submitted, it appears hook_form_alter is called again, breaking everything, since the referring URL is now itself.

How can I permanently set hidden field values on initial form render?  Anything I try with hook_form_alter seems to fail.  I have also tried "#default_value"


texts: Create a dynamic user registration form using Profiles

texts:
So, I need to create a user registration form for a website that has numerous types of users that are distinctly different from one another. I've already found the profiles module, and I'm using that. But I want to streamline the user registration process.

We don't want to create a large form that pushes everyone through the same questions, even if that question isn't applicable to that user. Nor do we want to compromise and only not ask certain questions that are important to that particular type of user.

I'd also prefer the form to be dynamically updated, rather than a multi-step form.

How can I do this?


texts: How do I add a thumbnail to the teaser of a blog post containing an image?

texts: I am using Drupal 7 and have added an image field to the blog content type.  The image comes in fine when creating the blog post, but when viewing the teaser of the blog entry in the list of user's blogs, there is no thumbnail in the teaser showing that there is an attached image.  Is this possible to have? How do I do it?


texts:
I'm very close to getting this working right. I created a custom content type with several decimal fields and an entity reference field where you select a user to assign the content to. I am using a computed field to add up the decimal fields and would like to multiply them by a field that I've added to the User profile.

The problem is that I don't know how to reference the field.

This doesn't seem to work:

field_get_items($entity_type, $entity, 'field_percentage_split')[0]

I'm using Drupal 7. Any ideas?

Thank you!


texts: Is there a module that provides perpetual results on scroll?

texts:
Let's say you have a page that is a view, and the view is set to page at 50 items. You have 150 items, so you have three pages. Is there a module that will load additional results, like 30 more, when the user scrolls towards the bottom?

The effect is that you don't need to use the pager, as new results appear automatically.
The effect I want to get is the one used in this site.

Is there a module that will do this for a view?


texts: "Twig_Error_Syntax: The block 'content' has already been defined line"

texts:
I have a block template in Drupal 8. I want to wrap a section element around the block when it is in the right region.

Twig gives me this error.

  Twig_Error_Syntax: The block 'content' has already been defined line

I understand the error, but I don't know how to fix it. Can anyone show me how to fix the code?

   {% set block_region_var = block_region %}
   {% if block_region_var == 'footer' %}
     <div{{ attributes.addClass(classes) }}>
       {% block content %}
         {{ content.body }}
       {% endblock %}
     </div>
   {% else %}
     <section id="{{ section_custom_id }}">
       <div{{ attributes.addClass(classes,'container') }}>
         {{ title_suffix }}
         {% block content %}
           {{ content.body }}
         {% endblock %}
       </div>
     </section>
   {% endif %}


texts: hook_form_node_type_form_alter does not work

texts:
The sort comments module has a  function in sort_comments.module as below:

  /* drupal@ganovelli.it - blackice78 */
  define('SORT_COMMENTS_OLDER_FIRST', 1); // default
  define('SORT_COMMENTS_NEWER_FIRST', 2);
   /* Alter node type form: allow user to decide comments sorting */
 function sort_comments_form_node_type_form_alter(&$form, $form_state) {
  $form['comment']['comment_default_sorting'] = array(
 '#title' => t('Sort'),
 '#type' => 'select',
 '#options' => array(1 => t('Older first'),
                     2 => t('Newer first')),
 '#default_value' => variable_get('comment_default_sorting_' . $form['#node_type']-  >type, SORT_COMMENTS_OLDER_FIRST),
  );
 }

so that if you go to structure>content types, and for example for Article choose edit, then in comment setting, it will give you a drop down menu, so that you can select the order for showing comments, older first or newer first.

I am trying to do something similar, so in order to see how does it work, I have this in my annotations.module file:

define('Annotations_OLDER_FIRST', 1); // default
define('Annotations_NEWER_FIRST', 2);
/* Alter node type form: allow user to decide comments sorting */
function Annotations_form_node_type_form_alter(&$form, $form_state) {
  $form['comment']['annotations'] = array(
    '#title' => t('Sort'),
     '#type' => 'select',
    '#options' => array(1 => t('Older first'),
                     2 => t('Paragraph number')),

  #default_value' => variable_get('annotations_' . $form['#node_type']-  >type, Annotatiios_OLDER_FIRST),
  );
  }

But I can not see the drop down menu, at the same place that I see the drop down menu for sort comments module. Does anybody know what is the reason?


texts: You are not authorized to access this page with blocks displayed

texts:
I made a custom module in Drupal 7 with a simple page.

I used hook_menu to make permission :

function mymodule_menu() {
  $items = array();
  $items['prestart'] = array(
            'title'             => t('Prestart page'),
            'page callback'     => array('mymodule_show_page'),
            'access arguments'  => array('access content'),
            'access callback'   => 'mymodule_isUserAuthenticated',
            'type'              => MENU_NORMAL_ITEM,
  );
  return $items;
}

The function to check if the user is authenticated :

function mymodule_isUserAuthenticated() {
   if (!user_is_logged_in()) {
       return FALSE;
    }
     return TRUE;
  }
}

After I created block (admin/structure/block) and I added to the page.

Problem :
If I go on the page in a private navigation tab (so not connected), I can see You are not authorized to access this page but all blocks are displayed.

How can I fix it ?


texts: Custom profile fields are not being displayed on user edit page in drupal 6

texts: I have created some custom field to user profiles like address, phone no etc. It is configured to display these field during registration. It works well. My problem is these fields are not being displayed on user edit page (user/5/edit). Is there any way i can display the fields on user edit page. I am using drupal 6.


texts: User own account, cancel account button not showing on edit form

texts:
I'm using Drupal 8, on my website I have 2 users roles, both can delete their own data, on role 1 cancel account button show on the edit form in both languages, Portuguese and English(default), but on role 2 it only shows up in the language the account was created, both have the right permissions, there is no preprocess on the form that either removes or makes the access false.
Any idea of what it could be, has anyone had a similar problem, how do I fix it?


texts: Drush: --yes-if-newer behavior with pm-download?

texts:
I'm writing an Acquia Cloud Hook where I install Registry Rebuild. In the interest of performance, I'd like to only install it if it's not already at the latest version. In other words, --yes unless it's already the current version.

Is there a simple way to do this in current Drush or shell?


texts: How to compare nodes of different types but same fields?

texts:
Is there any way to compare nodes of different types but with the same fields?

I have 2 content types: Flats to rent and Flats wanted
Both types have the sames fields: rooms and city
In a view I have a list of the Flats wanted and each one has a button: find flats
When you click the find flats button I need to show all the flats to rent that have the same values for: rooms and city  than the clicked flat wanted

I already get it working by creating a View using $_GET variables in the url and arguments.
But I need to use clean urls, then$_GET must go out.

Is there any way to do this in a cleaner way? I need to do it using View because I need to be able to apply bulk operations in the resulting list.

Maybe a module could do this??

Thanks


texts: What might cause drupal to give me Japanese values for the user profile, when the site is set to English?

texts:
I'm playing whack-a-mole bug edition with drupal yet again.  Recently I've done a number of things including installing the neutral_path module.  I just discovered that now my user profiles (which all have English and Japanese name values) are giving me Japanese values when the site should be in English.  Examining the variable that is passed into MYTHEME_preprocess_user_profile() I see that the field values are in Japanese and that $variables['elements']['#language'] is set to 'ja'

What could be causing this?  What are reasonable steps to take to try and debug this?

I notice that after drupal_bootstrap() runs, I have $language reflecting English, but $language_content reflecting Japanese.


texts: Responsive Images Not Scaled-Down Properly in Omega Theme just on Firefox

texts:
I'm building a responsive site using the Omega theme, and Adaptive Image Styles. So, in my Firefox 16.0.2 (Mac) browser, images that are scaling down look very poor quality as they are scaled down. If I take the same image out of Drupal and scale it in the same browser, it looks fine; in any other browser, it looks fine. Images seem to be using proper CSS (max-width:; height:auto;).

Check out this snapshot. Is it a bug in my browser or where does the issue exist?


texts: Showing Forum Topic Count 0 because, content access module conflict with Advanced Forum

texts:
In my project I am working with advanced forum. for this I installed module as below.

advanced forum
ACL
content_access
chain_menu_access

The issue is after adding Forum Topic into forum, the count of topics display zero (0).
Help for resolve this issue.


texts: Creating an API via module routing files that includes csrf verification headers

texts:
I am working on migrating a custom API from D7 to D8 and am doing so by using module routing. I have a routing.yml file that looks like so:
ytp_user.api.login:
  path: "/api/v1/user/login"
  defaults:
    _title: "User API Login"
    _controller: '\Drupal\ytp_user\Controller\UserAPIController::login'
  methods: [POST]
  requirements:
    _csrf_request_header_token: "TRUE"
ytp_user.api.get_current_user:
  path: "/api/v2/user/me"
  defaults:
    _title: "User API Get Current User"
    _controller: '\Drupal\ytp_user\Controller\UserAPIController::getCurrentUser'
  methods: [GET]
  requirements:
    _custom_access: '\Drupal\ytp_user\Controller\UserAPIController::authorize'

In the first route, I am trying to validate a csrf token provided in the headers, via the requirement _csrf_request_header_token: "TRUE", however, this does absolutely nothing. It doesn't validate or even check that the header exists as the documentation suggests it should.
I've tried replacing this with _csrf_token: 'TRUE' which at least checks that the token exists in the query, but I can't get a valid token!!! If I grab a token from /session/token and then pass it along in the query as ?token=<token-from-session/token> then I just get an error saying the CSRF token is invalid.
Am I missing another step or is the documentation just straight up incorrect? I have been searching for hours and everything suggests that what I have should work, so why is the CSRF token not being validated properly?


texts: Alter Add to Cart form POST data provided by #action

texts:
I am going to be phasing out Drupal Commerce on our website in favor of a new custom built application that is hosted at another URL. Without completely rebuilding everything I am trying to override the Add to Cart form to redirect with POST data to the new app.

Using $form['#action'] I can redirect properly and dumping out shows something like this:

array(7) {
    ["quantity"]=>
    string(1) "2"
    ["product_id"]=>
    string(4) "8566"
    ["form_build_id"]=>
    string(48) "form--90fc5Yp9qgp4CVFJlq03jfEZyYBkAhDX-j7E5g9oBQ"
    ["form_token"]=>
    string(43) "T08Fl1dNHuI4BCZ4JuLNwxbw6gUTOfnodbc1zcQMR4E"
    ["form_id"]=>
    string(35) "commerce_cart_add_to_cart_form_8566"
    ["field_are_you_a_product"]=>
    array(1) {
        [0]=>
        array(1) {
            ["field_are_you_a_"]=>
            array(1) {
                ["und"]=>
                string(3) "yes"
            }
        }
    }
    ["op"]=>
        string(11) "Add to cart"

This is helpful but the product_id is useless as I need more info, like the SKU or a custom ID field I have on the product level. I can't seem to get this to provide me with the product info I need.

I initially tried using a custom submit handler instead but that didn't work. drupal_http_request isn't right as it just sends post data, does actually redirect with post data like action does.

So since setting the action works great, how would I alter this form to send more information during that step within hook_form_alter?


texts: Check Billing and shipping info to be the same using Drupal commerce module?

texts:
I'm using the drupal commerce module and I also installed the commmerce shipping module. Now in my cart I have the form to enter the Billing and Shipping information. So far so good, but I'd like to have the checkbox option to check something like: "Use the billing information for the shipping information". Then when checked I should be able to submit the form and the validation will skip the shipping information form.

Do I need to installed other modules to do this?


texts:
In my site (camperlife.it) I have installed sorl + search api solr and all works for sections where solr is active (like /aree-di-sosta-italia.html). Now I want to substitute /search (search modules) with search api + solr.

Is there a module/way to do it (simple) or I need to create a view for this?


texts: Contextual links only appear the first time

texts:
I know this is a really specific issue, but it's a mystery that annoys me.

The contextual links menu that allows me to edit articles is only showing up the first time I view it. By this, I mean, if I refresh the page, they will no longer work. If I click the edit tab, save the node and let it return me to the node's view page, they work again. But, then I refresh, and they are broken again.

I've noticed that the focus class is appended to the article (on hover) on the page when it works, but not when it doesn't work after being refreshed. I've also noticed by debugging that in StateModel.js and VisualView.js, that toggleOpen happens twice (on the broken version -- after refresh), opening and then closing the contextual links menu. But, I can't figure out why.

The content div, which contains the html for the article & contextual links, is 99% identical in bother versions with the only difference being a changed form-build-id for the comments.

The css/js files loaded on the page when it works/doesn't are nearly identical in both versions, with the only differences being a css file that does 2 unrelated things.

This is on both Firefox and Chrome.

If anyone has any ideas, it would really help me sleep at night.


texts: ajax_render() - CSS not adding/updating in IE

texts:
I'm using AJAX to update page content. In my page callback I have a few commands and end with ajax_render().

When I click the AJAX link from another page, the content updates, all my JS and CSS for that page are added, and everything works perfectly. However, the CSS is not being applied in IE.

It appears that the following two lines in ajax.js are causing the problem:

var new_content_wrapped = $('

').html(response.data);
var new_content = new_content_wrapped.contents();

If I hack ajax.js and change (line 519):

wrapper[method](new_content);

to:

wrapper[method](response.data);

it works!! Any ideas?


texts: "#markup" form element can't have children

texts:
I have my form, but any child of the "#markup" element will not appear when the form is being rendered.

$form['html'] = array(
  '#type' => 'markup',
  '#markup' => '
My Heading
',
  '#tree' => true,
);

$form['html']['element'] = array(
  '#type' => 'textfield',
  '#title' => 'Foo',
);

In this example the "element" form field will not be rendered.

Is this a Drupal bug, or do I need to do something specific?


texts:
We have a field that is an Entity Reference to Blocks. In our situation, this field is referencing a View block. We are able to add this field on the content type and node properly, but when the page renders there is the following error message. We set this up using steps from Drupal 8: How to Reference a Views' Block Display from a Field.

  Uncaught PHP Exception DomainException: "When a #lazy_builder callback is specified, no properties can exist; all properties must be generated by the #lazy_builder callback. You specified the following properties: #attached." at /mnt/www/html/netscout/docroot/core/lib/Drupal/Core/Render/Renderer.php line 333

How would we resolve this issue?

What we have tried:

DomainException with #lazy_builder and ['#cache']['keys'], but this did not have anything that helped because we do not load the block by using #lazy_builder
We tried updating our modules, but still get the error message
Tried removing the removing the block reference, but then we were not able to add the view block to the page.

We are using Drupal v8.5.3.


texts: Views 3, 2 different node types, filtered by the same contextual filter

texts:
I have two node types. Node A and Node B, both node types can have a reference to to a taxonomy term.

Now I am trying to construct a view which shows a list of both Node A and Node B, filtered by the taxonomy.

So Node A and Node B have different names for the the taxonomy field (field_nodea_taxonomy, field_nodeb_taxonomy). If add both of these fields as contextual filters and then try to filter on taxonomy term with id 10, by writing "10/10", i get only contents for the first filter.

How can i make it so to that it will show both content types, but filtered?


texts: Acsessing field data for a views template

texts:
I have a client who wants to be able to input a content type which allows for the upload of 4 different pdf files. They want to have a view that allows them to click on one link and load each pdf file in a separate tab. I can get this to work in the footer of the view with the global text option and inputting the following code:

[title]

The problem is, I need this to work in the fields using the global text option but full html is not allowed there. I am trying to use a views template file to input the code but I can not figure out how to access the data that is supplied by the replacement patterns in the view. Any tips on how I can assign variables with the right data in the template file?


texts: Is there any way to know if it is the first visit of a Anonymous User?

texts:
I'd like to know if is there any way to know if it is the first visit of a Anonymous User?

If so, can I fire up a rule to redirect the visitor to other page.


texts: How do I configure Content Security Policy for base64 images?

texts:
I'm using the Content Security Policy module and I placed restrictions on img-src.
Set to Self.
Additional sources:
https://www.google-analytics.com https://ssl.gstatic.com https://www.gstatic.com https://www.googletagmanager.com

However, my logs are filled with messages like this:

[Report Only] Refused to load the image
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAD1JREFUeNpiYGBgOADE%2F3Hgw0DM4IRHgSsDFOzFInmMAQnY49ONzZRjDFiADT7dMLALiE8y4AGW6LoBAgwAuIkf%2F%2FB7O9sAAAAASUVORK5CYII%3D'
because it violates the following Content Security Policy directive:
"img-src 'self' https://www.google-analytics.com
https://ssl.gstatic.com https://www.gstatic.com
https://www.googletagmanager.com".

How do I allow the base64 images provided by Drupal (jsonapi in this case)?


texts: Can I call two callback function in one ajax call?

texts: I just want to know how we can achieve two ajax callback on one form submit.Is it possible?and how?


texts: View: Distinct list of all referenced entities

texts:
Basic setup: 3 content types

Festival
Event
Speaker

Event has a entity 1-to-1 reference field containing a Festival.

Event also has a 1-to-many reference field containing Speakers.

How can I set up a View to list all of the Speakers taking part in a Festival? (A Speaker can take part in more than one Event).


texts: Drupal 6 to Pressflow migration: MyISAM to InnoDB?

texts:
I will soon be migrating from Drupal 6 to Pressflow. As Pressflow encourages InnoDB for certain tables, how can I promote these recommendations when migrating an existing site?

Is this something which update.php handles?

In addition, as my Drupal site is not the latest Drupal core version, should I update to latest core first, and then sideways to the corresponding Pressflow version, or can I go straight from 6.19 to Pressflow 6.22?


texts:
Is there a way to create a group by in a table views.

Here is how I would like that the group by looks like


texts:
Drupal commerce shipping module.
I want to set a tax rate on a shipping price so that the shipping price with its tax component is integrated in the subtotal of the line items.
Guess it has to be done with rules but I don't know where to start.
Any help is very welcome!


texts: Keeping three cck text multi-value fields and a three-level taxonomy hierarchy in sync

texts:
CCK and Taxonomy fields offer different advantages and, in some situations, it is necessary to utilize both. Especially if a developer is using Views and Rules. One of the bigger challenges a developer might encounter is how to manage values that are mirrored in both and how to keep them in sync.

I have a couple of displays for a view that utilize both a three-level hierarchical taxonomy (using Simple Hierarchical Select) for exposed filter input and three CCK list (text) fields that are used only for displaying the selected field values on the frontend, in a table, and in a set of custom breadcrumb links (using a views global custom text field). I would have preferred to do away with the cck fields and render the parent/child Taxonomy term names in the table and breadcrumb links instead, but wasn't successful at it.

In my content type, I would like to synchronize the two types of fields, so that when new values are added to one, they are also added to the other. This would allow me to simplify adding new unique values. I don't care if the taxonomy terms feed into the cck field values, or vice versa.

Has anyone come up with a good solution for this?


texts: Automatically generated  tags when rendering body content

texts:
My D7 creates anchor tags automatically when 'www.*****' in text is found.

Example:

www.site.com

produces

www.site.com

but

site.com

produces

site.com

Corresponding field value stored in DB still has www.site.com. Could not any signs of such an action in theme scripts. In known modules neither. Had anyone met something like this? Maybe some guess where to look for?


texts:
My client wants a comment section on the front page only. I can't figure out how to allow commenting on the front page. I tried allowing commenting on basic pages, but it wont show on the front.

Thanks.


texts:
I am having my site on www.abc.com which is hosted with hostgator. It is installed in public_html, and I installed Drupal in a sub-folder.

Whenever I go to my site, the address bar of the browser shows www.abc.com/techspot, when I would like it to show just www.abc.com.

How can I achieve this?


texts:
So I've had my first taste of Drupal Group, and it looks really promising so far. Now I may be missing something totally, but if my user (testuser1) is a  member of a group with 2 other members, why can I not see the Member tab as testuser1?

However, as a site admin I can see the Members Tab:

I already have enabled the Group Type permission: View individual group members for both members and outsiders. So my question is, how do I allow members and outsiders to view the members of that group?


texts: Import xml with Feeds module. Only one value is imported

texts:
I have a xml (http://pastebin.com/q64L3ECX) that I need to import with Feeds module into my site. Basically, with this xml example, I need to import 3 nodes where my GUID (set as unique) is "test_case". Each test_case is inside a test_set.

The problem is that I can only get the first test_case of each of the two test_set of that file. Can someone help me understand what is wrong?

Debug output:

xpathparser:0 :
<test_set_name tl_label="Name" tl_name="name" tl_physicalname="CY_CYCLE">GUI.00 Launch Applications</test_set_name>
<test_set_name tl_label="Name" tl_name="name" tl_physicalname="CY_CYCLE">GUI.02 EM NE.000 EM NE Generic.Generic EM NE tests</test_set_name>
xpathparser:1 :
<test_case_name tp_label="Test Name" tp_name="name" tp_physicalname="TS_NAME">Launch TNMS</test_case_name>
<test_case_name tp_label="Test Name" tp_name="name" tp_physicalname="TS_NAME">Open</test_case_name>
<test_case_name tp_label="Test Name" tp_name="name" tp_physicalname="TS_NAME">ManualNetworkScan</test_case_name>

Created 1 node.


texts:
in my e-learning website i sell my tutorials. my files are there in private folder and after paying for each set of files, users have access to download that specific set of files...
to implement that; so far i used this module: "Private files download permission" = Allows by-user and by-role downloads from private file system directories.
so for each set of files i have to created a separate role!
my problem: now i have so many roles and it is getting more difficult to organize them!

now i am thinking of other solutions such as using taxonomy!
i can create a form to upload a file to private folder and assign a taxonomy to it!
1- any user who pay for it, can get that taxonomy and can download it but i don't have a clear idea how to assign this taxonomy to a user after paying?
2- how can i let him download from private folder if that user has the taxonomy?
i can do it all by PHP coding and hooks but is there any module which can do half of the job at least? or if there is no module to help me...can i use Rules to check if a user has a certain taxonomy or not?


texts: I replaced a pdf file but google searches for the node turn up the old pdf file

texts: I replaced a downloadable pdf file that was uploaded to one of the nodes on my website. But a google search of the item still goes straight to the old file. I've tried deleting the node completely and recreating it with the new file, but it still won't work. (The file name is the same, it's just the content that's augmented). The google search will direct properly on my laptop, but not on my ipad. I can't figure out if this is a drupal issue or a google issue or a browser issue (I deleted all cookies and history on my ipad before googling, but it still won't work)--can you help? Thanks!


texts: d7 link two pages within a (draggable) view by image

texts:
I'm trying to set up an image gallery that needs to be sortable in D7. So I installed the Views and Draggable-Views modules. Now I have one view with three pages: Gallery, Sort Gallery and Single Image. (Single Image being a view with one larger image and a previous/next link)

All of this works but I can not find a way to link an image in the Gallery-grid to the Single Image view. In the properties of the imagefield I can set up a link, but only to "content" and "file". I need to link that image to that image in my Single Image page. How can I do that?

Any ideas or solutions would be greatly appreciated!!

thanks


texts:
Field labels can be hidden for a content type by going to "Manage display" and changing the labels to hidden.

However, I rarely need to show labels.

Is there a way to have the labels hidden by default, site-wide?


texts: Integer thousands separator in add node form

texts: I need to place thousands separator on integer field type in add node form when the user is typing a number in the field. Is there any module or quick solution for this problem?


texts: Which actions in Drupal needs clearing the cache?

texts:
I'm a newbie in Drupal. I usually use the clear cache function from Devel module for each changes(sometime I use drush command line tool) like: modify CSS, create/change blocks, change permissions, create new content type, create new web form, change template files... and clearing the cache costs a lot of time on my local environment (I've just 1GB of RAM).
So can anyone show me which actions in Drupal that we need to clear cache.


texts: Views relationship between user and custom created entity

texts:
I've an custom entity type : "card", witch has a property named "owner", an entity_reference to the owner of the card.

My custom entity is pretty basic and has been created trough Drupal Console.

If I create a view on Cards I can use the relationship to get the "owner" fields and properties accessible.

But if on a  Users based view, the reverse relationship is not present : I can't access card information's from the owner.

Am-I missing something ? Do I have to set up this reverse relationship somewhere ?

Thanks in advance !


texts: Taxonomy page by views with two arguments?

texts:
I'm not sure if I have understood correctly how views override taxonomy page. What I would like to do is to let taxonomy page have two arguments and each of them are taxonomy terms from different vocabularies. For example,  I have two vocabularies  and  like below. Node can be tagged with multiple terms from  but just with one term from

<Color>
 Blue
 Red
 Grey

<Car>
 GM
 BMW
 Toyota

I would like to make URLs like this.

/Blue/GM
/Blue/BMW
/Blue/Toyota
/Red /GM
/Red /BMW
/Red /Toyota
/Grey/GM
/Grey/BMW
/Grey/Toyota

And when user taxonomy link on node page view for example,
If the node is tagged with "Blue" "Red" "GM"

Click "Blue" takes to /Blue/GM
Click "Red" takes to /Red/GM
Click "GM"  takes to all the node list of "GM" maybe URL /GM

I've been playing with taxonomy views but still can't figure out hot to achieve this.


texts: What do Contextual Filters filter against?

texts:
I've been banging my head against a wall trying to understand contextual filters for about 6 months now so I thought I'd give up and finally ask. Most recently I read this article on cofiguring contextual filters, which renewed my confusion and frustration on this topic.
Normally in query or procedural languages when you filter something, you specify 2 or 3 things;

The value to filter (e.g. "blonde")
The place to look for the values (e.g. the "hair color" column)
Optionally, the operator to use.

My understanding is that contextual filters only use the "equal to" operator, so I'll leave out 3.
For example, if I wanted to filter a nodes table on all nodes whose value in the title column is equal to the contents of the my_title variable, then in SQL I'd write something like this;
SELECT * FROM nodes WHERE title = @my_title

There's a left hand side (title) and right hand side (my_title). But in the Contextual views section of the view I can only pick the dynamic value to check against (the equivalent of my_title) but where do I pick what I'm actually filtering on (ie. the title column)?

As far as I can tell this is telling the filter to filter on the ID of the current page. Which is fine, but what am I filtering? What are the left and right hand operators to the filtering operation?


texts: How do we create a View showing the most read author?

texts: We have Views for Most Popular Content.  How do we setup a View showing most popular author based on the total "reads" for all his articles using Drupal 7 core.


texts: how to create template file for single page in drupal 7

texts:
i have created "about us" page in drupal 7 admin interface of basic page type. I want to apply a specific layout for this "about us" page only.

But after goggling, i found solution of applying specific theme to specific content type like

page--content_type.tpl.php.

i dont want to apply layout for all pages in that content type, but only for this specific page "about us". If this can be done by overriding like this "page--node--nodeid.tpl.php", then where to find the nodeid for this page.


texts:
What makes a field sortable in views?

I have 5 fields output in a table and only two (Node Title and an int) are sortable the rest (mixture of content taxonomy and node reference) are not sortable.

Is it possible to add in this functionality via code?


texts: Adding ajax to text field in node edit form

texts:
I have created a content type "Type A" and added three fields to content type. I want to display value in third field equal to (value of first field - value of second field).

I want to implement the same using ajax functionality. I have created a custom module and alter the "node form" and add ajax to field 1 but ajax is not working on change event of textfield.

Code Snippet:

function employee_login_form_alter(&$form, &$form_state, $form_id){

    $form['field_total_value']['#prefix'] = '
';
    $form['field_total_value']['#suffix'] = '
';

    $form['field_value_first']['#ajax'] = array(
        'callback' => 'employee_login_ajax',
        'wrapper' => 'calculate-total-value',
        'method' => 'replace',
        'event' => 'change',
    );

    $form['field_value_first']['und'][0]['#ajax'] = array(
        'callback' => 'employee_login_ajax',
        'wrapper' => 'calculate-total-value',
        'method' => 'replace',
        'event' => 'change',
    );

}

function employee_login_ajax(&$form, &$form_state) { //print_r($form); exit;
  print_r($form_state['values']);
}


texts:
Every time I download a new copy of the live database to my local site I also have to download the photos (several GB).
Is there an easy way to write the URL for one "photo" field (type image) to always use the live site urls?

I'm using S3 but haven't found a good way to batch move images and image styles to S3.


texts: Get logged in user from node loaded with node_view

texts:
I have a specific content type with it's own node template. When I go directly to the node all user information from the $user variable is accessible. However when I load this node with node_view into another page any of the code in the template that is dependent upon the user info breaks because the template doesn't register the user as logged in. Is there something special I need to do to make it properly populate the $user variable?

Edit

This is at the top of my node--product.tpl.php (the node template I'm loading).

 global $user;
 print_r($user);

This returns:

stdClass Object ( [uid] => 0 [hostname] => ###.###.###.### [roles] => Array ( [1] => anonymous user ) [cache] => 0 )


texts:
I am thinking of setting a product that is only valid from a period of time eg:

product a from 15january2016 til 15january 2018, upon this setup it will be available from that period of time.

also when creating the product a, I can set the time of the product available more of like a timeslot like :
9:00am - 10:00am - 3booth
10:00am -11:00am - 3booth
etc

user will be able to choose more than one.

example :

A buy 9am-10am - 3booth
A also buy 10am-11am - 1booth

so A can buy 3stock from a timeslot and also buy another timeslot with only 1 stock. and how do we proceed with this option? can product attributes help?

this product is going to be available daily.

more of like selling practice session.

my question are :
can this be achieve by attributes? for timeslot? and since there is only 3 classes, and this each class can only be taken by one person 1hour, is there any solution for validation of stock?

I am brainstorming of doing custom attributes but can not get away of thinking how to handle the stock of the class available or not?

some ideas would be great

thank you!


texts: How do I make an object available as a token?

texts:
I have created a custom token. Inside my token's code, I'm getting a node object. I want to give the users the option of displaying this node's properties. So, for example, assuming that my token's name is [mycustomtoken] I want them to be able to write:

[mycustomtoken:author] so that they get the node's author or

[mycustomtoken:title] to get the node's title.

Is there a way to do this in Drupal?


texts: How to hide an empty block with no results

texts:
The block is generated by Views and I the only field comes from a relationship and is not accessible in the filters, so I can't set a filter.

I have tried to use another field, rewrite the results but the filter only considers that initial value of the field, not the rewritten one.

I suspect I have to do something with a template file, but a precise how-to would be very helpful.

Thanks in advance!


texts:
I am using a contextual filter for a view in Drupal 8. The contextual filter is a Taxonomy Term: name filter with a term relationship. It works correctly.

I'm now trying to override the title using this filter. In previous versions of Drupal, using %1 would have given me the argument. But not in Drupal 8. Is there a way to either get the argument or (even better) the term name into the title override?


texts:
I have this error message:

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

I know it's a folder permission problem. But I can't figure out which folder is the cause.

In sites/default/files I have these three folders, all of them with permission set to 777:

tmp

temp

temporary

Then I don't know where is the problem??
I attached a image capture of the sistem file setting:


texts: Markup being stripped from form element title

texts:
I need to add links to checkbox titles, I can see the link in the render array but when it renders the markup is stripped. How can I get the links to not be stripped?

I am doing this in a form alter, the checkboxes are added to the user registration form in the Drupal UI, i.e. they are form fields.

$tc_link = Link::fromTextAndUrl(new TranslatableMarkup('terms and conditions'), Url::fromRoute('<front>'))->toString();
$tc_link_label = t('You agree to the ') . $tc_link;
$form['field_terms_and_conditions']['#title'] = $tc_link_label;

The markup is like this:

        <input name="field_terms_and_conditions[agree_terms_conditions]" class="form-checkbox" id="edit-field-terms-and-conditions-agree-terms-conditions" type="checkbox" value="agree_terms_conditions" data-drupal-selector="edit-field-terms-and-conditions-agree-terms-conditions">

        You agree to the terms and conditions

But if I inspect it with kint the links are clearly there.


texts:
I spent the last couple of days searching about my project on google. Reading on blogs and drupal answers. I haven't concluded to a result.

What I want to do:

Have a submission form which can be used to upload math equations and text. The form should have the option for Latex input AND using buttons like MathType.
Have the option to edit those data after submission.
Generate PDF files from the database using Views.

I found that CKEditor with a math plugin is a popular choice, however it stores the data as images. So, I will not have the option to edit it after that. Storing it as Latex could lead to another problem of generating PDF files since Latex is processed on the client and most of the PDF generators I found are server side.

Any ideas since Google didn't help a lot.


texts: hook_permission and control access [how to redirect to the login page if user not logged in]

texts:
How does one limit "what" can access a page. I have little understanding on how to use hook_permission() to set user permission based on a role to control access to hook_menu() items. However, what if I have a hook_menu() item that is to be used solely by the system itself? For example, say I have a registration page in a custom module: module/register - Anyone can access that page. Then, say I have an another page which is only for admin. So, I register another item in hook_menu(), call it module/register/reg_user_details - I do not want anyone to be able to browse to module/register/reg_user_details

Instead I want page to be visible only when user is logged in, I have already created a hook_permission

/**
 * Implements hook_menu()
 *
 */
function video_subtitles_menu() {
  $items = array();
  $items['video_subtitles/upload'] = array( //this creates a URL that will call this form at "video_subtitles_test/upload"
    'title' => 'Upload Subtitle', //page title
    'description' => 'Uploading subtitle for videos',
    'page callback' => 'drupal_get_form', //this is the function that will be called when the page is accessed.  for a form, drupal_get_form need to be used
    'page arguments' => array('video_upload_subtitles_form'), //Name of the Uplaod Form
    'access callback' => 'user_access',
    'access arguments' => array('administer video_subtitles module'),
  );

  $items['player/video_subtitle_status'] = array(
     'page callback' => 'video_subtitle_status',
     'access callback' => 'user_access',
     'access arguments' => array('administer video_subtitles status'),
  );
  return $items;
}

/**
 * Implements hook_permission.
 */
function video_subtitles_permission() {
  return array(
    'administer video_subtitles module' => array(
      'title' => t('Administer video_subtitles module'),
      'description' => t('Access the video_subtitles upload module Page'),
     ),
    'administer video_subtitles status' => array(
      'title' => t('Administer video_subtitles module status'),
      'description' => t('Access the video_subtitles module status Page'),
  ));
}

So User is not able to access my page unless user is logged in, but
what I need user should be redirected to the login page when he is not logged in as admin , if he successfully login it should be redirected to my page.

visit url d-7/example/my-module
if already logged in show the page
if not logged in redirect to the login page
if user logged in successfully redirect to d-7/example/my-module page

What is best way to achieve this

Similar Question

using-hook-menu-with-hook-permission-access-denied

using-hook-menu-and-hook-permission-to-control-access

can-someone-explain-access-arguments-in-drupal


texts: Import contacts from different social networking sites and invite to my drupal site

texts:
I am in the process of building a social networking site.I need to allow my users to be able to invite their friends as well on to the site. Using the Invite module alone will not cater to my need. What i need is this to work with some other module. I want users to be able to import their contacts from Facebook, Twitter, Gmail and then select between the contacts the users to invite. I thought of using the Contact Importer module but it has issues with social networking platforms. Please advice. You may have a look at the following image to understand my use case.
http://i.imgur.com/BAczhzX.jpg?1


texts: Setting to disable database logging in dblog without disabling module

texts:
I am going through the dblog core module, but I can't seem to find a setting to disable database logging. Is there an option to disable the database logging without disabling the module?
Also, are the messages written in a file instead?


texts: Custom PHP code to create a node with rules

texts:
I am trying to create an Automatic Registration with rules. Basically when a new asset is created a rule will kick off and create a new registration node with custom PHP but the new node is not being created. I don't see any errors in the reports. Here is the code:

$node = new stdClass;
$node->type = 'asset_event';
$node->title = 'Automatic Registration';
$node->[field_first_name]['und'][0]['value'] = [site:current-user];
$node->[field_asset_event_type]['und'][0]['tid'] = 791;
$node->[field_asset_additional_informati]['und'][0]['value'] = 'Event created by automatic registration';
$node->[field_link_to_asset_id]['und'][0]['value'] = [node:field-link-to];
node_object_prepare($node);
node_save($node);

Thanks for any help.


texts:
On the Website im currently building, i am using the Node Reference Module to link Activities to Persons, so i can view which Persons have participated in a Acticity.
I also setup views and panels to list the Activity each Person has done on the Person node.

Now i want, in the Activity node, to show other Activities the Persons participating have done:

Person A has done Activity A and Activity B
Person B has done Activity B and Activity C
Person C has done Acticity A B and C
Person D has done Acticity A

When I look at the Activity B node, I want to see something like this:

Other Activities the Persons have participated in:
Person A: Activity A
Person B: Activity C
Person C: Acticity A and Activity C

How would i do this? I found this (http://drupal.org/node/1257946) topic, but there he is using 3 nodetypes.

Thanks for your help :)


texts: How to hide options in the second select before choosing option in first select

texts:
i have taxonomy : Cities and taxonomy Towns.

cities have : Sousse and Tunis
Town have Elzahra (related to Tunis (taxonomy cities) and Sahlool (realted to Sousse (taxonomy cities)).

i have installed the module "reference_option_limit" and i created in the content a field named city and an other field named Town , in Town field i have coched :

and i created a view for this content :

but the problem in the page it shows me all the options: for the second select:


texts: Error: "module does not exist" after I removed a module from the file system without disabling and uninstalling it

texts:
I removed a module from the file system without disabling and uninstalling it. And now I have error:
Drupal\Core\Extension\Exception\UnknownExtensionException: The module drupalweather does not exist. in Drupal\Core\Extension\ExtensionList->getPathname() (line 522 of core\lib\Drupal\Core\Extension\ExtensionList.php).
How to solve this error?
I use windows operating system and local server open server.


texts: Views 3 - Add wildcard or "contains words" to contextual filters

texts: I setup a basic contextual filter in Views 3 and currently I have it pass in a field called "office" which is set by the $user. I have many different offices in my results with the string "new york" in it. Is there a way to return all results that has the string "new york" in it? Currently contextual filters only accepts an EXACT match string only.


texts: How to set all values of a field as body classes

texts:
I want users to easily modify the layout of a node by selecting options in a 'Layout' field that the node contains. The field is a entityreference field referencing taxonomy terms.
(For example, the user can select term 'hide-images' and the body class 'hide-images' will be used in the css to hide images.)

I have found this code that sets the first value of a field as body class.
But how can I add all field values (taxonomy terms) as body classes?

/**
 * Implements hook_preprocess_html
 */
function THEME_preprocess_html(&$vars){
  // Check if on an article node page
  if($node = menu_get_object('node') && $node->type == 'article'){
    // Get field values
    if($term = field_get_items('node', $node, 'field_layout')){
      // Add first term value to body class
      $vars['classes_array'][] = drupal_html_class(reset($term));
     }
  }

}


texts: Does Drupal detect if the user register email could not be delivered and removes the account?

texts:
I got this error message back from the MTA:

  This message was created automatically by mail delivery software (Exim).

  A message that you sent could not be delivered to one or more of its
  recipients. This is a permanent error. The following address(es) failed:

  #######@***.+++
     Connection timed out:
     retry timeout exceeded

This is fine so far. What puzzles me is the fact that the created account disapeared. This is reproducible. The account was created again (same email address), the delivery error occoured again and the account disapeared.

Is this on purpose?


texts: How to disable/enable all products in commerce?

texts: The Commerce Backoffice module allows to delete all selected products from the list. But how about to change the status for all products or for the selected ones?


texts:
This seems to be a common issue when deleting terms linked to indexed content via term/entity reference, but no solution has worked so far.

I am using the following:

Drupal 7
Solr 5.5.3
Search API 7.x-1.22
Field reference delete 7.x-1.0-beta1

The terms are linked via a term reference field on a node.

When the term is deleted, Field reference delete module informs Solr the referenced nodes need reindexing, which removes all articles containing the TID. This works fine. However after reindexing the term ID is still shown with (0) results on display instead of the term name.

Only deleting all indexed content and reindexing removes the facet as expected.

Before this, querying Solr for facets returns this:

{
  "response": {
    "numFound": 1139,
    "start": 0,
    "maxScore": 0.43971312,
    "docs": [
      {
        "item_id": "124618",
        "score": 0.43971312
      }
    ]
  },
  "facet_counts": {
    "facet_queries": {},
    "facet_fields": {
      "im_field_tax_tags": {
        "1107": 8,
        "1108": 212,
        "1109": 29,
        "1110": 619,
        "1111": 0,
        "1112": 61,
        "1114": 59,
        "1115": 105,
        "1117": 48,
        "1118": 35,
        "1119": 67,
        "1121": 120,
        "1124": 234,
        "1125": 15,
        "1127": 60,
        "1129": 6,
        "1133": 304,
        "1134": 59,
        "1214": 856,
        "1215": 317,
        "1216": 397,
        "1217": 819,
        "1219": 597,
        "1220": 6
      },
    },
    "facet_dates": {},
    "facet_ranges": {},
    "facet_intervals": {},
    "facet_heatmaps": {}
  }
}

Note 1111 has been deleted and has 0 results, yet still appears in Solr's list of facets. I presume this is cached somehow. Searching for im_field_tax_tags:1111 also returns 0 results.

It is also worth noting that the facet display has a Minimum facet count of 0, as the way they are displayed requires empty facets to be shown. I understand changing this to 1 would solve the problem (I suspect this is a more common configuration, which may explain why others have had more success), but it is unfortunately not an option.

Any help would be appreciated.


texts: Vertical tabs of form fieldsets taking a long time to load

texts:
UPADTE: I've been awarded a Tumbleweed badge for this question (Asked a question with no votes, no answers, no comments, and low views for a week). My gut feeling is this is about optimizing Drupal to speed up page loads, but maybe it's something else?

I have a form divided into five fieldsets. The sets are displayed on my page using vertical tabs, like this:

// Form element: vertical tabs.
$form['vertical_tabs'] = array(
    '#type' => 'vertical_tabs',
);

// Form elements: fieldset tree.
$form['Fruits'] = array(
    '#title' => t('Type'),
    '#type' => 'fieldset',
    '#tree' => TRUE,
    '#collapsible' => TRUE,
    '#group' => 'vertical_tabs',
);

...etc.

When the page loads, initially just the plain form appears. It takes about 2-3 seconds for the vertical tabs 'styles' to be applied to the form. In other words, it takes a significant time to load the finished page. Has anyone else had this problem and figured out how to stop/arrest this behaviour?

I am using Zen theme, if that makes any difference. Thanks.


texts:
I created a theme from scratch and I didnt make a lot of changes to the theme template files which listed as below:

  block.tpl.php
  html.tpl.php
  node.tpl.php
  node--article.tpl.php
  page.tpl.php
  page--front.tpl.php
  views-view.tpl.php
  views-view-fields.tpl.php

A lot of styling that I made with HTML/CSS was missed up when I start creating contents and didn't appear as I expected.

Below code is used for getting the whole content, but how am I able to break it into artic title, article meta, article content body?

print render($content);

So I would like to know how am I able to edit the PHP files and giving styles to each element? Also some of elements that are specific for home page and category pages are shown into the article pages, so how shall I fix that too?

EDIT:
here is title's code from page.tpl.php:

<?php print render($title_prefix); ?>
<?php if ($title): ?>
<?php print $title; ?>
<?php endif; ?>
<?php print render($title_suffix); ?>

and that's the title code from node--article.tpl.php:

<?php print render($title_prefix); ?>
<?php if (!$page): ?>

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

<?php endif; ?>
<?php print render($title_suffix); ?>

But still all articles getting its title styling from page.tpl.php and it is staying outisde of the div that I specified for the node--article.tpl.php file. So how to fix that?


texts: custom block menu path returns json Ok, but a 404 status header

texts:
I created a custom path via hook_menu with a page callback to a function that prints json.

It all works in the sense that requesting: http://cms.tripchi.com/tripchi/getme returns my JSON, but the header says it's 404 which is throwing off everything in the app. This only returns the 404 status on the client's godaddy server (PHP Version 5.4.19 w/ CGI/FastCGI), but returns 200/Ok on my local PHP Version 5.3.5 w/ Apache 2.0 Handler. All Drupal configurations and databases are equal.

hook_menu

function tripchi_menu() {
    return array(
        'tripchi/getme' => array(
            'title' => 'My Profile',
            'description' => 'mobile test for user status and object',
            'access callback' => 'user_access',
            'access arguments' => array('access content'),
            'page callback' => 'tripchi_getme')
    );
}

callback function

function tripchi_getme(){
    $user = $GLOBALS['user'];
    $json = array();
    // ... a bunch of stuff to construct a special array;
    drupal_add_http_header('Status', 'Ok');
    drupal_add_http_header('Access-Control-Allow-Origin', '*');
    http_response_code(200);
    //echo json_encode($json);
    drupal_json_output($json);
    drupal_exit();
    //die();
    // i've tried all combinations of commenting/uncomming the above...
}

below screenshot of the requests locally (right) and remotely (left):

why does this always return 404 but also give me my perfectly json encoded data?


texts: How to add user upload files to git when the node is pulished?

texts:
my requirements is:

some users are adding application file drupal system adding node.
initially that node is in unpublished state. Once the admin is publishing the node that uploaded file need to be pushed to into github repo.
If there any module available for git interaction Please suggest.


texts:
I have some small Drupal 7 sites that don't require me to log in all the times, and there are no users. I would like to change the user login path to something else to deter bots targeting Drupal installations on the /user path.
How can I achieve this?

I can add a CAPTCHA, but I want to change the path too.


texts: Metatag images don't work anymore after updating

texts:
I was on Drupal 8.5.x and Twitter cards and Open Graph on Facebook were displaying correctly.

After updating to Drupal 8.6.1, the images don't display anymore. The others data (title, description, url...) are OK, it's juste an images problem.

So I've checked the tokens used by the Metatag module and they are the same I used in Drupal 8.5.x without any problem.

The token I use for images is : [node:field_image_article:entity:field_image]
Indeed, in my content type, I use a field named "Image article" that contain several fields (title, author, licence...) including an "Image" field where I upload the image.

When I look at the source code of my webpages, I have this :

<meta name="twitter:image" content="https://example.com" />
<meta property="og:image" content="https://example.com" />

instead of the complete URLs of the images...

Does anyone know how to solve this ? Thx.


texts: How to find the image cache url for images

texts:
I want to get the url to a specific image from image cache. I have the image file name (my_image.jpg), file path (site/default/files/my_image.jpg). From this value I want to get the url to a certain image cache folder (sites/default/files/imagecache/240x135/my_image.jpg). I cannot use any drupal methods/modules to get this because I am using external scripts to directly access the back-end database, from where I can get the image name, actual image path, but couldn't find the table where the url to image cache is stored.

How can I do this?


texts: why do my cache entries all double up with a #cache_redirect item?

texts:
I'm caching a piece of render array by adding cache keys to it. It's getting cached correctly, but I see two rows for every instance of it.

One looks normal -- contains the render array, with a cid that looks like:

CACHE_KEY:[languages:language_interface]=en:[languages:language_url]=en:[theme]=MYTHEME:[user.permissions]=HASH

The other one had data that starts like:

a:2:{s:15:"#cache_redirect";b:1;s:6:"#cache";a:5:{s:4:"keys";a:1 ...

and its CID is:

CACHE_KEY:[languages:language_interface]=en:[theme]=MYTHEME:[user.permissions]=HASH

It looks like this is something to do with language negotiation, but why, and is this normal? The page I am loading when I am testing this is using the language prefix, so I'm not getting redirected.


texts:
The components I am using are:

CKEditor 3.6.6.1
Media 7.x.2.x-dev
Media Colorbox 7.x-1.0-rc4
Colorbox 7.x-2.4
Panels 7.x.3.3

The Theme I am using is: Bootstrap 7.x-2.2

I am trying to figure out how when I insert an image via the WYSIWYG editor CKEditor to have the image be smaller then be able to be opened in a colorbox. I am currently using the above modules with this process:

Create a new article
Click insert media
Click Library
Click a preloaded image I already have selected
Display as Colorbox
Click submit
Save the content

After all of that nothing happens. The image is not clickable at all (as to mean that a pointer does not render when I move my mouse over the image). What I am asking is simple. I have read that Media should handle colorbox integration now for images... how? I want to be able to insert images via the WYSIWYG but cannot seem to find instructions on this matter.


texts:
can you help me create a view template? Indeed when I rewrite the output field "image" no labels is displayed. So I created a "views-view-field--sitemap--page-6.tpl.php" template file in the folder of my theme, but I see no change. I emptied the cache.

<?php

$fields["path"]->content = '<loc>' . $fields["path"]->content . '</loc>';

$fields["field_image"]->content = '<image:loc>' . $fields["field_image"]->content . '</image:loc>' . '<image:title>' . $fields["field_image-atl"]->content . '</image:title>';

echo $fields["path"]->content;
echo $fields["field_image"]->content;


texts: Remove bits of code from PrivateMSG Module

texts:
Does any one knows how you go by removing this "(1 New)" from the Messages bar, I want to have it say "Messages" and to the right will be the counter...

I am new at this!...:)

-Thank you


texts:
I'm using LoginToboggan as my login page, and on the login form, it has: "You are not logged in." I want to be able to edit this text, and the admin interface doesn't give an option to do so.

Searching around, I see that this is set in the LoginToboggan module in a theme function:

function theme_lt_unified_login_page($variables) {
...
$output .= '
' . t('You are not logged in.') . '
';
...
}

So I can't edit the module directly, nor would I wish to "patch" it. I see that theme_lt_unified_login_page is called by:

function logintoboggan_unified_login_form($active_form = 'login') {
...
$output = theme('lt_unified_login_page', $variables);
...
}

I don't really understand what hook I would use to intercept and override / edit just this text? It doesn't appear in the $form object.


texts: commerce kickstart - how to edit a view ? the link is missing

texts:
I am really clueless why the edit link of the view is gone in Drupal Commerce, even Drupal 6 used it before.

Where is the edit link?


texts: Can i get rid of the 'default' site in multisite?

texts: I have a multisite (sub directory style), and am wondering if i can delete the default site (sites/default)? I just want to get a 404 if the site doesn't exist, no fallback.


texts: How can I add or remove links to nodes in a list depending on the values of some of the fields

texts:
I have a lot of content migrated over from a legacy CMS.  All of the nodes have some value, but there were a lot of entries that don't need more than for their information to show up in the long lists (They don't need individual node pages).  Let's call the three fields that need checking:

abstract
related_websites
public_files

What would be the best way to set it up so that if abstract is empty, and the multiple entry allowed related_websites and public_files both have no entries, that the entry still be listed, but there be no link to the full node.

I'll need to do this all over the place, from search results to listings by date and by content type, so the easier it is to implement the better.  Would this be better done in a theme or a module?


texts: add css class to html element based on taxonomy?

texts: I would like to add class to the HTML element based on taxonomy. Is it possible to do it from inside template.tpl.php or do I need to create needed templates manually? If so, how will my theme know which template it should pick? Thank you


texts: Why is Javascript disabled when I'm logged in?

texts: Unfortunately I'm not a coder and don't know how to provide info that might solve this riddle.  All I know is that my Flexslider, WYSIWYG fonts, and expand/collapse function do not work (Flexslider is invisible, fonts are a mish-mash rather than @fontyourface standard that is set, and it's as if expand/collapse is not there) when I'm logged in.  I don't have other accounts, but it all works as an anonymous user.  Also, it worked for me as well until a couple of months ago.  Any ideas how that could happen?


texts: I am trying to compare views in exposed form but so far there is no way I am getting views information in exposed form. Is there any way to do so? I need to compare view id for theme suggestion.


texts: Capturing cache metadata from file_create_url?

texts:
I'm writing a Drupal 8 controller which takes in a media entity, and returns a redirect response to the actual file URL.

It works by finding the file associated with the media entity, and then does this:

      $url = file_create_url($file->getFileUri());

      $response = new CacheableRedirectResponse($url);
      $response->addCacheableDependency($media);
      $response->addCacheableDependency($file);

      return $response;

However, this results in a LogicException: "The controller result claims to be providing relevant cache metadata, but leaked metadata was detected"

Ok, so what's happening is that file_create_url() ends up generating cache metadata, and that cache metadata is not being attached the response object. But it doesn't seem possible for me to do that, because file_create_url just returns a string and not the cache metadata object.

Here's my current workaround, but I'm not sure if this is correct either:

      $context = new RenderContext();
      $url = \Drupal::service('renderer')->executeInRenderContext($context, function () use ($file) {
        return file_create_url($file->getFileUri());
      });

      $response = new CacheableRedirectResponse($url);
      $response->addCacheableDependency($media);
      $response->addCacheableDependency($file);
      if (!$context->isEmpty()) {
        $metadata = $context->pop();
        $response->addCacheableDependency($metadata);
      }

      return $response;

Anyone with more experience with cache metadata know if this is the correct way to handle this situation?

Thank you


texts: Drupal Commerce Change Order Weight at Checkout

texts:
I am using Commerce FedEx to retrieve quotes at checkout and using a SmartPost setting that requires packages to be over 1lb. to return a quote from FedEx. I need to have the order shipping weight from Commerce Physical Products default to 1lb. for the entire order weight if the order weight is under 1lb. at the time of checkout. I do not want to make all of the products a minimum of 1lb. due to inaccurate quotes if multiple items are ordered so I am looking into a solution with Rules, but cannot seem to get an Action that will allow me to do this.

Example: One product is 0.25lbs. When two are ordered, the shipping weight should be 1lb. at checkout to receive a quote. When six are ordered, the shipping weight should be 1.5lbs.


texts:
I have a view where I'm showing all postings by post author. Right now, I show (and filter) the posts by author name using contextual filters.

I want to change it so that I still use the username in the contextual filter, but when I override the the title, I want to show the human readable name.

So, for example,

www.example.com/postings/kyle.keiper

Currently shows

Postings by kyle.keiper

in the title.

How can I change the view so that the URL stays the same, but it shows "Postings by Kyle Keiper"?


texts: Exposed filter in views to filter users by age

texts:
I have the Birthday module installed that displays the age of users. I am trying to create an exposed filter in a view that will allow users to select from $age1 to $age2. Of course this requires two filters (one min age and one max age) so the view will display all users who fall into that bracket. The Birthday module computes age "on the fly."
Any guidance on how to proceed with this will be greatly appreciated.
Thanks.
:)


texts:
Probably a stupid question. I'm more used to Drupal 7, but I'm working on a new site today and it's Drupal 6. There is a Views Slideshow on the home page. The buttons and images automatically cycle. We want to add a link to each button/image so people can click and go to a related page.

http://simulab.com

I looked at the nodes for the content used for each image and I was surprised that there is no field to store a link--as is common in most slideshows I see now.

The Links module is installed, but again there is no Link field type in the node content used to store each image/button in the view.

Looking at the HTML, I see that there is no href for each button or img. Apparently one can hover over a button to switch visible images, but cannot -click- to go to another URL.

What's the preferred way to add a click URL to each of the images and/or buttons in the view?

TIA


texts: A quick noob question here! How to set a theme to use a custom template for 404 error pages instead of using page.tpl ?


texts: Is it possible to determine what attachments (JS libraries, CSS, etc.) are required by a node form?

texts:
I'm developing a solution which allows users to create content through a custom AJAX-driven UI. The first step in the process requires users to pick a content type from a dropdown list, which will then trigger the relevant node form to be loaded in to the page via AJAX. The HTML for the node form is being built correctly, but the issue I'm experiencing is that required JavaScript libraries are not included in the page, e.g. system libraries such as drupal.ajax and jquery.form, and libraries provided by contributed modules such as CKEditor and the media browser provided by the Media module.

Is there an elegant way of determining what libraries are required by node forms for a range of content types before the form is loaded? My intention would be to include all of the libraries using drupal_add_library, drupal_add_js and drupal_add_css in the page callback function for the UI.

Thanks in advance to anyone who has any ideas!


texts: Flexslider view preview working but not on actual page

texts:
My block is not working for the flexslider: The images are not appearing, but the view preview does work.

I don't know if it is relevant, but a similar problem would happen with just a slideshow view, although one image would appear and it would not cycle.

Could jQuery be a problem?

The following is the actual page with the block that is not showing any images.

The following is the view preview, which works.


texts: Conditional addition of css - hook_init?

texts:
I need to conditionally add css to a page  based on the page content / URL. In the past (D6 and down) I was always advised against using hook_init() mostly because of it's weird load order in the Drupal bootstrap process. It was not uncommon to see the hook fire multiple times on a each page load - this still might be the case.

Looking at the D7 docs for hook_init() the following code example is provided:

function hook_init() {
  // Since this file should only be loaded on the front page, it cannot be
  // declared in the info file.
  if (drupal_is_front_page()) {
    drupal_add_css(drupal_get_path('module', 'foo') . '/foo.css');
  }
}

The example implies that conditional addition of css makes sense while:

  To add CSS or JS that should be present on all pages, modules should
  not implement this hook, but declare these files in their .info file.

using a modules .info for site wide css additions.

Questions:

What are the options in adding css via drupal_add_css conditionally
besides hook_init?
Has anyone had luck using the theme hook -> hook_html_head_alter():

THEME_NAME_html_head_alter(&$head_elements) {

  if (drupal_is_front_page()) {
    drupal_add_css(drupal_get_path('module', 'foo') . '/foo.css');
  }

}
or use the theme engine for the theme hook:

phptemplate_html_head_alter(&$head_elements)


texts: Save certain registration fields elsewhere in database

texts:
This is for Drupal 7. I am trying to write my first real custom module but I'm running into some difficulty and I'm just not sure how to look for my answers.

I've created a new entity for my module (with Entity API) with a corresponding table in the database. I need to add records to this table upon new user registration. I've used Form API to add a new field to the user registration form but I'm not quite sure the best way to do the next step. When the registrant submits the form, I would like all the regular Drupal registration stuff to happen, but I would like to intercept this one field and have its data go to the table I've created for my entity.

Here's what I have in the .module file of my custom module (the part concerning the registration form):

/**
* Implement hook_form_user_register_form_alter()
*/
function my_module_form_user_register_form_alter(&$form, &$form_state, $form_id){
    //add my module textbox to the registration form
    $form['my_module_field'] = array(
        '#type' => 'textfield',
        '#title' => t('My Module field'),
        '#required' => TRUE,
    );
    $form['submit'] = array(
        '#type' => 'submit',
        '#value' => 'New Submit Button',
        '#submit' => array('my_module_form_submit'),
    );
    unset($form['actions']);
}//end my_module_form_user_register_form_alter

/* Custom Submit handler */
function my_module_form_submit($form, $form_state){
    db_insert('my_entity_table')->fields(array(
        'my_entity_item' => $form_state['values']['my_module_field'],
    ))->execute();
    drupal_set_message('Your information has been saved.');
}//end my_module_form_submit

This is working fine to get my special field in my special table. But the user is not created. I suppose I could do it manually (like enter the other information into the appropriate users table and everything) but obviously I would rather not do that manually.

I feel that I must be missing something obvious here but I'm not having any luck searching for it. I am self-taught in the little I know of programming and Drupal.

Is there a way for me to just jump in to the regular submission handler and say, "hey, put my field here instead!"?

Thank you for your time.


texts: adding css classes into a specific image field

texts:
is there a way to add css classes only to specific image field?

with the image field name field_news_images:

<img class="thumbnail" src="../images/something.png"/>

There are no options to add the classes in the manage display