texts:
I'm using horizontal parallax jQuery plugin and have a page--front.tpl.php file. That's my structure:

MENU:

news

When I click this menu item, go to DIV:

    <?php
    $view_mode = 'full'; // Or 'full' for example
    $node = node_load(52);
    $view = node_view($node, $view_mode);
    print render($view);
    ?>

But I have a big problem. When i click my site adress, loading all content and items in one time. So, my site is slowly. I thinking use node_load function via Ajax. Searched site and drupal.org but not found a good info.

Is it possible? What can I do for my site speed? Ajax is a good solution?


texts: Adding an alternative email address to Entity Registration

texts:
I am looking to implement event booking with entity registration.  Currently users of my site have to log in, this then captures their email address from LDAP.

What I would like to do is have it so that when users sign up to an event they can enter an alternative email address for reminders.

I have installed entity registration and created the alternative email field, however how do I go about routing the mail to an alternative address if the user has entered one?


texts: Checked as default --> The user must confirm the account cancellation via e-mail.

texts:
How can I checked as default the value Require e-mail confirmation to cancel account.
It is unchecked as default :(

I tried to edit user.module editing this line '#default_value' => TRUE, but it doesn't work

  // Allow to send the account cancellation confirmation mail.
  $form['user_cancel_confirm'] = array(
    '#type' => 'checkbox',
    '#title' => t('Require e-mail confirmation to cancel account.'),
    '#default_value' => TRUE,
    '#description' => t('When enabled, the user must confirm the account cancellation via e-mail.'),


texts:
I have a php script that does some querying and book keeping of drupal tables. How can I run this php script directly from the url? The script uses drupal functions so I guess it should be aware of the API.

When I go to mysite.com/script.php I would like this file to run...

Is there any includes that I can add and then run the script so that it is drupal aware and at the same time, does not need to go through all the view/node/block etc? Basically I do not want to add this page as a PHP block data into one of the nodes, I would like to run in directly from the URL.


texts: What is the difference between the Load and Render objects in Devel?

texts: When viewing a Node in the Devel tab, what are these different objects Load and Render? How and where would I have access to them in the theme layer?


texts:
I would like to create a duplicate of my existing website (includes all content) and apply a different theme.

So for example I would have www.widgets.com with one theme & products.widgets.com with the same content but a totally different theme.

Also, when I add/update/delete content in www.widgets.com I would like it to change in products.widgets.com.

What's the best way to accomplish this? I'm using Drupal 6.

Thanks-in-advance


texts: I am using the field 'image' and have the 'alt' and 'title' options for the image. The 'title' shows on mouseover. How do I translate this? Or if it isn't translatable how can I show another field that is translatable as the mouse over?


texts: How to relate a complex field to another node

texts:
I'm building a hobby site that is going to be used to record results (golf). A round of golf will have any number of players, selectable from a known list of players.

I would like to be able to create a new round and add players to it, entering a score for each one. My first thought is to create content types for player and round, and a complex field that does something similar to node reference.

Before I went down that path I wanted to see if there was a smarter more Drupal way of doing this. One idea I had was to have a third content type, result, which would be a node reference to a player and an integer field, but this would require having to create the results before hand. Or perhaps the result has a relationship to a round and a player, so the workflow is create a round, then create as many results as required.

The basic question, is there a smarter way to do this?


texts: How to get user password before it is hashed?

texts:
In Drupal 8 - how can I get the user password BEFORE it is hashed?

I need to create the user at two other services through API's, so the user can use the same credentials to login to all platoforms.

I tried this:

function MYMODULE_entity_presave(UserInterface $account) {
#Here I can see the password - but not access it.
var_dump($account);

#If I use the toArray function - I can access the password, but now it is hashed.
$account = $account->toArray();

How (if possible) can I do it?


texts: How to sync content title with "synchronize translations" module?

texts:
The synchronize translations module, part of the Internationalization module (i18n), allows us to sync content between two languages.

It works very well with node configurable and standard fields. But I can't configure it to sync also the node title.

Is there a way to force it to sync also the title, or any alternative to do this work?


texts: Drupal 7 Views: Display a Taxonomy term as its Term-ID number for a node

texts:
I have a View that displays Nodes. Each of the nodes have a taxonomy term applied to it.
I would like this taxonomy term to be display as it's Term-ID number. How can I do this?

Steps I have tried

In relationships, I have added "Content: Taxonomy terms on node". This is the only option for taxonomy terms in a node View. But it doesn't have options for accessing the term ID.

In fields, you can add a field to display the term on a Node. I have checked "Rewrite the results". There is a token called Raw, but it only displays "Raw Text" as opposed to a number.


texts: In Rules, how can I use a set the value of a taxonomy term reference field to multiple values?

texts:
How can I set a taxonomy term reference field to two values using Rules?  The "Number of values" for the field is already set to two.

I set up a workflow in rules that works for setting a single value.  I tested this several times and encountered no problems.  However, when I changed the "Number of values" for the field from "1" to "2" and then edited the action to add two terms instead of just one, I got the following error message:

  Warning: Missing argument 2 for taxonomy_options_list() in
  taxonomy_options_list() (line 1375 of
  /srv/bindings/e87a1e62cfd24fea9dd67cfd074d146c/code/modules/taxonomy/taxonomy.module).
  Warning: Missing argument 3 for taxonomy_options_list() in
  taxonomy_options_list() (line 1375 of
  /srv/bindings/e87a1e62cfd24fea9dd67cfd074d146c/code/modules/taxonomy/taxonomy.module).
  Warning: Missing argument 4 for taxonomy_options_list() in
  taxonomy_options_list() (line 1375 of
  /srv/bindings/e87a1e62cfd24fea9dd67cfd074d146c/code/modules/taxonomy/taxonomy.module).

When I attempt to set a value by triggering the rule, it fails and the rules debug log has the following output:

  3.235 ms Unable to get a data value. Error: Invalid data value given. Be sure it matches the required data type and format.
  4.254 ms Unable to evaluate action data_set.

What is the correct way to assign two terms at once to a single taxonomy term reference field?


texts: what is the difference between Drupal.formatPlural() and Drupal.t()?

texts:
what is the difference between :
Drupal.t(string, arguments, options ) and Drupal.formatPlural()
Drupal.t() is used in the javascript part to translate the string and it can accept a set of arguments that will translate the string placeholders ex:
var translatedString = Drupal.t('a string about @subject that needs to be translated', {'@subject': 'Javascript in Drupal'});

what about Drupal.formatPlural()


texts:
I would like to know what is the best way to achieve a continuous migration from external DB (via Migrate).

Basically, there are several migration classes that need to be to repeatedly migrated in an ordered way (the external DB is also updated).
This said, exception management is welcomed/required during the run.

I was trying to find a solution for this but found nothing concrete.
From gathered information some approaches are to use Jenkins/Drush combination, but I wonder if adding Jenkins would be an overkill in my case.

Is there a good way to achieve this via Drush only?

Thanks


texts:
I'd like to import an iCal feed. Every calendar entry on a given URL should be transformed into a node.

I read that this should be possible with with the feeds, date and calendar module. But I did not find any description about the topic.

I would be very happy if some one could shed some light on this topic.


texts: How to show a string once you submit a form in a page reloading the page?

texts:
I need to create a page with a form and once you enter some values in the form and send it make some calculations and show a string under the form. Something like this image:

I know how to create a page with a form inside and I know how to show a message but in this case I need to show the string (message) under the form.
So, how to show a string once you submit a form in a page reloading the page?


texts:
Attempting to use EFQ for the first time. I'm following a couple walk throughs.

I'm trying to query for the content type banner which has an image field:

<?php
$query = new EntityFieldQuery;
$result = $query
  ->entityCondition('entity_type', 'node')
  ->entityCondition('bundle', 'banner')
  ->propertyCondition('status', 1)
  ->execute();

But after doing so the result of this is an error:

Notice: Use of undefined constant FIELD_LOAD_CURRENT

What is the cause of this particular error?


texts: How do I load the $form_state for a form loaded with drupal_get_form?

texts:
Or is drupal_get_form not the right way to go about loading node forms where I want to also get the $form_state?

The reason I am asking is I would like to be able to place multiple node forms on the same page and have them editable (not in a popup) on the same form as the parent form. I have already tried inline_entity_form and that would almost work, however that module does not load the entire form inline with the rest of the parent node form. Rather it places the referenced nodes in a table that you then interact with and save separately.


texts:
I have created a custom module with some inc files for different functionalities, these inc files adds config pages for admin but i had to define all urls in .module file.

is it possible to use hook_menu in inc files as well, i already used it once in .module file. what i need is menu should be added from inc file itself.


texts: Naming conventions in Media entity vs File entity

texts:
The Media Library experimental module in core introduces a generic media type "file",  while File entity calls the same thing "document". For comparison, the other bundle names are consistent between the two: image, audio, video.

Why did Media Library in core decide to change the naming and precedence set by the File entity module in contrib? I'm trying to wrap my head around the domain model here, to ensure I'm thinking about a Media Library in the correct way.  From an end-user perspective, an image and a video are both files whereas a document is neither an image or video, so the delineation in File entity aligns better with reality.

This decision affects modules in the contrib space that want to build features around the emerging Media functionality in core, so an understanding of the domain model and intended usage will help build things up correctly, instead of taking things in parallel and incorrect directions.


texts: Implementing a secure confirmation page for an entity form (D8)

texts:
I have a custom entity that is used for user submissions. Anonymous users will be able to submit confidential information using the entity add form. After submission I want to show some kind of confirmation page (Thank you for submitting etc.), but I'm not sure what is the best way to achieve this. The user should also receive a similar confirmation by email.

I was thinking of simply adding a view mode confirmation to the entity and have the form redirect to that page on submit, but I am concerned about access control here: visitors would be able to view other user's submissions, if they simply try random entity ids. Is there a way to restrict access to visitors who just submitted the form?


texts:
I am using Content Access module with Drupal 7. when i restrict node access from a specific role, it also hide link in menu.

is there any way to show restricted links in main menu?


texts: How do I render a table with a checkbox on each row?

texts:
In Drupal 7, I could achieve this using the following code.

$form['table'] = array(
  '#type' => 'tableselect',
  '#header' => $header,
  '#options' => $options,
  '#empty' => t('No data')
);

This doesn't work anymore in Drupal 8. I just want a page similar to the one at /admin/people. What's the correct way in Drupal 8?


texts:
I have created a user field in a content type article.Let say the field name analysis status which is a list selection box.I have made this field as collection in a field name Collection.

Now I created a view and I tried to expose the analysis status field in the filter criteria but the field is not get exposed.

Can anyone help me how to expose a user field(created by me) in view.

I have to filter the content title and the body based on the analysis field value.

The  Analysis status contains the following values.

1. New
2. Closed

I if select New the view filter has to filter the content based on the NEW value for a particular content type.Same this is followed for the closed also.


texts: How can I allow users to specify image dimensions in CKEditor

texts:
I have a use case where content editors have a requirement to specify the height and the width of an image in the image properties. Sticking to styles is not possible because $reasons.

The CKEditor demo has this:

But the Drupal 8 image properties looks rather sparse in comparison.

I've looked all over for this for hours, and this is the first time I've had to write my own Drupal Answers question!

Does anyone know how we can expose the option to set width and height in CKEditor?

I'm aware of IMCE - but expected behaviour of the module in Drupal 8 is to use IMCE for file upload only - once an image is placed, image properties is handled by CKEditor.

There is a YouTube video where someone has managed to configure CKEditor to use IMCE's image properties: https://www.youtube.com/watch?v=2eTfQ7Y4i5I but there's no instructions on how this was achieved, and a comment-or asked but has been hanging for a year.

I'm totally new to Drupal 8, would like to know how to do this! And then I'll figure out how to make sure the change isn't reverted next time core is patched :)


texts: Google PageSpeed Insight problem with linkid.js

texts:
I spent weeks with optimising my site. One anoying problem has left:

http://www.google-analytics.com/plugins/ua/linkid.js (60 min) how can I change the browser caching period or caching this file localy on D7 like analytics.js?


texts: I'm trying to convert a long-text field into a text-field. The only thing I found so far is the "field_config" table in the database. But any change there is only leading to errors. Do I have to change it somewhere else?


texts: How to safely delete relation entity endpoint revisions (field_revision_endpoints)

texts:
I would like to safely clean duplicate field revision data. This field_revision_(field_name) data not associated with nodes, but the relation entities.

I'm using the relation module. I'm bumping up against the problem outlined here: https://www.drupal.org/node/1530164

I have a lot of relations on my site linking different entities. My field_revision_endpoints table is growing quite large. The issue mentions as a work around, he uses a sql script to clear out the old revisions. I did some googling on info for deleting revisions, but I'll I have come up with is results relating to deleting node revisions.

Is it safe to simply delete rows out of field_revision_endpoints?


texts: integer field select list with min and max value

texts: I would like to have integer field that ranges from 0 to lets say 100000 with "select list" widget. It doesn't have to have keys i just don't want to type 10000 numbers in field settings of "List integer" field. If I select integer field type it offers min and max but there is no option to have "select list" widget. Am I missing something obvious?


texts: How to apply function to a chosen region only?

texts:
I am using this template.php function:

function mytheme_menu_tree($variables) {
    return '
' . $variables['tree'] . '
';
}

Now it applies to the menu no matter in which region it is. What if I want it to apply only if the menu is inside i.e. Top Menu region? I guess its something that needs to be added before return line?

Also I noticed another problem. It applies to all menus, i.e. if I have two menus, my return line applies to both menus, and 2nd menu is not even shown because id="" can be shown only once.

So I need that function to apply to the menu which is in Top menu region only.


texts:
I read API and put files theme folder.

maintenance-page.tpl.php works well,

but maintenance-page--offline.tpl.php don't work.

How theming off-line page ?


texts:
I have Drupal 8 site which interacts with a React component.
I want to expose one of my content type's content using REST export in views.
How do I set views path to create REST export for multilingual support?
For example, mysite/rest/export/data should give JSON data in English, while mysite/nl/rest/export/data or mysite/rest/export/data/nl should give JSON data in Dutch.


texts: Allow access to a node only if another module has already allowed

texts:
I want to change permissions for nodes by hook_node_access_records() and hook_node_grants(), but I want to allow access to a node only if the workflow access module has granted access to it.

something like:

if (workflow_access_allowed() && myModule_allowed()) {
  allow()
}
else {
  disallow()
}

How do I check wheather workflow_access has already granted access to node? (My module priority in grants array in hook_node_access_records() is higher than the workflow access module.


texts: How to setup hook_install to have a geometry field on a POSTGIS database?

texts:
From a module, I would like to create a table containing a POSTGIS geometry field.
I guess I need to use hook_install but can't find any definition of a geometry field anywhere. How can I achieve that ?


texts: Is there a way to set "no markup at all" for all new panel displays and panes as default? Or disable the other styles, like "rounded" etc, at all?


texts: how to load Ckeditor with IMCE file browser through javascript

texts:
I have installed CKeditor and IMCE modules for Drupal7.
Now when i click on a button in my page, i want to load the ckeditor with IMCE support (File browser option).

How to achieve this with javascript?
So far, i am loading the ckeditor this way, but it is not showing a file browser button for image:

CKEDITOR.replace('text_'+id, {
    width: 630,
    height: 300
});

CKEDITOR.config.toolbar = [
    ['Bold','Italic','Underline']
];

CKEDITOR.config.extraPlugins = 'imce';

The strange thing is that, the Image dialog has "Browse Server" button for the textarea under the form that is created with Drupal Form API, but when i try to apply ckeditor for a custom textarea through javascript, i don't see the "Browse Server" button for Image dialog.


texts: Views single field themeing with custom variables

texts:
How do I pass a variable from a preprocess hook to a template file for a single field, that is view files starting with

  views-view-field--

I want to know what are the preprocess functions that can be used for this purpose. Because, whenever I try to set a variable using hook_preprocess_views_view_fields it is only renderable at sytle/row level, but never at single field level.

Hope Im clear with my query. Any help appreciated.


texts: Calling a stored procedure in a different database then the default

texts:
Possible Duplicate:
  How to execute stored procedures in drupal?

I am trying to call a stored procedure in drupal.  I was wondering if anyone knew the syntax to call a stored procedure.  One thing about the stored proc is that it is inside a different database then the default database.  Any help would be greatly aprreciated.  Thanks!


texts: How to to redirect a form to a certain node for anonymous users?

texts:
In a custom module, I have a form that is triggered by an option in a menu.
I'd want this form to be redirected automatically (without action of the user) to a certain node (/node/2) when the user is not authenticated.
In the public function buildForm(array $form, FormStateInterface $form_state) {, I know how to not display the fields of the form for the anonymous user:

$oCurrentUser = \Drupal::currentUser();
if ($oCurrentUser->isAnonymous()) {
} else {

some fields...

$form['submit'] = [
  '#type' => 'submit',
  '#value' => $this->t('Submit'),
];
return $form;
}

I guess that redirection might be done with   $form_state->setRedirect('entity.node.canonical', ['node' => 2]);
but I don't know how to make it work...
Any idea?


texts: Illegal choice detected with Unlimited Image field

texts:
I have an image field in a content type that uses the image widget. Whenever I select an image to upload, it gives the error: "An illegal choice has been detected. Please contact the site administrator."

The image thumbnail appears as normal, however, there is no way to submit the form (returns errors) and you can't add more images.

I haven't made any changes to the form (just some CSS stuff for presentation).

How can I fix this?


texts: Modify variables set in parent's theme template using preprocess functions

texts:
i am having this theme parent's template field--paragraph--field-accordion-items.html.twig :
{% set block_classes = [
  'flex-container',
  'flex-child-auto',
] %}

{% if element['#object'].field_block_content_align.value|length>0 %}
  {% set block_classes = block_classes|merge([element['#object'].field_block_content_align.value ~ ' ']) %}
{% endif %}

{% if element['#object'].field_block_content_direction.value|length>0 %}
  {% set flex_dir = element['#object'].field_block_content_direction.value %}
  {% if (flex_dir=="flex-dir-row") %}
    {% set block_classes = block_classes|merge(['flex-dir-row']) %}
    {% set block_classes = block_classes|merge(['grid-x grid-margin-x']) %}
  {% else %}
    {% set block_classes = block_classes|merge(['flex-dir-column']) %}
  {% endif %}
{% else %}
  {% set block_classes = block_classes|merge(['flex-dir-column']) %}
{% endif %}

<div {{ create_attribute({'class': block_classes }) }}>
  {% for item in items %}
    {{ item.content }}
  {% endfor %}
</div>

How can i possibly add, from a child theme preprocessing function , a class to the variable bloc_classes ?


texts: How to change filename before it get saved without changing source URL using tamper plugin?

texts:
I've URL which is mapped to file field (image) via Feed Ex.

I'm trying to change the filename before it's get saved using tamper plugins (e.g. concat or regex), however it is also changes the requesting URL causing saving the invalid image files which consist html with 404 error.

How do I use Feeds Tamper plugin to modify data (filename) after the file is downloaded but before it's get saved? Or I need to find some other alternative way of doing that?


texts: How to add relationship in view for custom entity

texts:
I have an entity that references node and user via nid and uid fields.

I have created an entity around my schema and would like to use it in views. I can create a view based on a new entity that shows fields from the entity.

Now I want to add relationships to node and user so I could pull fields from them. So I want to show fields from related user and node, not my entity bundles.

What's the right way to do this?


texts:
I want to load parent term name by tid .I am using this

$term = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadParents($tid);
kint($term);

This return a object which is my parent term but I am not able to access term name by this object. Please check attached screenshot of kint($term).


texts: Why is submit handler not called if $state['rebuild'] == true?

texts:
I have a simple form that shows a form fields and after submitting shows just a download link:

function activit_report_download_file_form($form, &$state, $node) {

// check if form was already submitted
$submitted = false;
if(isset($state['triggering_element'])) {
  $submitted = true;

  if(!valid_email_address($state['values']['email'])) { $submitted = false; }
  if(strlen($state['values']['name'])<2) { $submitted = false; }
  if(strlen($state['values']['surname'])<2) { $submitted = false; }
}

if(!user_is_logged_in() && !$submitted) {

  $form['info'] = array(
      '#type' => 'markup',
      '#markup' => '
'.t('Po vyplnení Vaších údajov si budete môcť stiahnuť PDF report').'

'
  );

  $form['email'] = array(
      '#type' => 'textfield',
      '#attributes' => array('placeholder' => t('Váš email'))
  );

  $form['name'] = array(
      '#type' => 'textfield',
      '#attributes' => array('placeholder' => t('Váše meno'))
  );

  $form['surname'] = array(
      '#type' => 'textfield',
      '#attributes' => array('placeholder' => t('Váše priezvisko'))
  );

  $form['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Získať link na stiahnutie reportu'),
      '#attributes' => array('class' => array('button', 'btn-blue')),

  );

} else {

  $form['link'] = array(
      '#type' => 'markup',
      '#markup' => '

Report stiahnete kliknutím na toto tlačítko.

        '.t('Stiahnuť PDF report').''
  );

}

return $form;
}

In validation handler is $state['rebuild'] = true;

function activit_report_download_file_form_validate($form, &$state) {

  $state['rebuild'] = true;

}

In submit handler is:

function activit_report_download_file_form_submit($form, &$state) {

  db_insert('t_report_download')->fields(array(
      'email' => $state['values']['email'],
      'name' => $state['values']['name'],
      'surname' => $state['values']['surname'],
      'anonymous' => 1,
  ))->execute();

  dsm('submitted');
}

Problem is that submit handler is triggered only if $state['rebuild'] = true; in validation handler is commented. If it is not, submit handler will never be triggered.

What's the logic behind this behavior?


texts: Hide the content while the current user has no access on

texts:
I written a module to filter the access for country_admin,country_admin can only view and edit the content that have the same country with the country_admin.(Both the country_admin and content have a country field.)
Now I want to hide the content that current country_admin have no access on. Is there a function can hide the content in drupal 7 ?
Will be very appreciate if anyone can help.

if(!isset($target_user->field_role_country) || !$target_user->field_role_country['und'][0]['value']) {
  // The value is false (checkbox not checked) so we refuse access:
  return FALSE;
}
elseif ($node->type == 'clinic'
    && strtolower($target_user->field_role_country['und'][0]['value']) != strtolower($node->field_country['und'][0]['value'])) {
  drupal_set_message('This clinic does not associated with :country, You have no permission to view.', array(':country' => $target_user->field_role_country['und'][0]['value']));
  return FALSE;
}


texts: How filter_xss works in user_login_block?

texts:
Does the form elements in user_login_block have the sanitized input elements using filter_xss?
Update
This is the message that I've received:
Browsers are capable of displaying HTML and executing JavaScript. If the application does not escape special characters in the input/output and reflects user input as is back to the browser, an adversary may be able to launch a Cross-Site Scripting (XSS) attack successfully.
Through XSS, an adversary may execute malicious files, install Trojans or steal the session token of a logged-in user.
The following URLs are vulnerable to Cross-Site Scripting (XSS):
MYSITE.com/user/
Do I need to worry for this?


texts: Updating view content (in block) based on field data from page it's displayed on

texts:
I'm struggling to achieve something in Views that would be quite simple in PHP itself - hoping for some pointers.

I have created a view, displayed as a block, which appears at the bottom of each page with a content type of 'article'.
This block shows the latest 4 articles added to the site based on publish date.
It shows max 4 items (provided at least 4 articles exist and are published).

This works - however I've been struggling to extend this functionality to meet two new client requests:

The view should exclude the currently viewed article if loaded on the page of one of the 4 latest articles added; [SOLVED THANKS TO ANSWER BELOW]
The client wishes to 'override' the items shown in this view in some cases. Here I've added a field to the content type named 'field_related_articles' which is a entity reference field. The admin can now select up to 4 articles from the database which should show in this view. However it is optional, and the default behaviour is to show the 4 latest articles still. If 1 article is specified the 3 latest articles should then appear. If 2 then those 2 plus the latest 2 articles make up the view.

I've been advised to have two views then use an 'attached' display to stitch them together, then remove the extra results (if applicable) in code in a template file. But I'm struggling settling this up.

---------- EDIT : to add some clarity to second point ----------

The view is intended to always show 4 article teasers.
In it's default state this should be the latest 4 articles added to the site. This is now working.

The complexity comes in that on each 'article' content page it should also be possible to specify up to 4 articles (using an entity reference field) to show in this view instead.
I've added the field to the content type 'field_related_articles'.

So when the view is included on an article page it needs to check if any values are specified in 'field_related_articles' - if so they should be the results in the view. If less than 4 nodes have been specified, the view should then show the latest X articles to make up to 4 in total.


texts:
I try to render a main menu but it doesn't render. My old Drupal 6 template try to upgrade Drupal 7 template.

I've render in page.tpl.php.

<?php if (isset($main_menu)) : ?>
    <?php print phptemplate_primary($main_menu); ?>
  <?php endif; ?>

This is the code for phptemplate_primary().

function phptemplate_primary() {
  $output = '
';
  $element = menu_tree(variable_get('menu_primary_links_source', 'primary-links'));
  $output .= drupal_render($element);
  $output .= '
';
  return $output;
}

How do I resolve this problem?


texts: how to send notification to seller when payment is received

texts:
I want the system to send an email notification
to the author of the product when the payment
is received on their product. I have tried to run
the module mp_tokens this scenario but I do not
find the token [order-seller-email] there. please
help how to create a token for this issue


texts:
I'm trying to disable the LabJS module from running on certain pages by following the maintainers instructions at Compatibility issue with Slickgrid.

This is what I have, so far. I tried putting it directly in the page and my themes template.php with the theme's name appended to the function name, but neither work.

/**
 * Disable LabJS on certain pages
 */
function versatile_hook_init() {
  if (current_path() == "private/members/search") {
    define('LABJS_DISABLE', TRUE);
  }
}

Can you help pointing me in the right direction?


texts: Confused using Ajax call and Drupal 7 Form

texts:
I need to query a database with two parameters, which means more than one form variable needs to be passed to the server -(select where field =).  Looking at all the examples of the Drupal 7 ajax api, I've only seen where one variable is passed.

Using jquery it seems far simpler where as now I'm not sure how to parse and sanitize the post variables that are passed to the callback function.  All the examples I've seen have the callback simply returning the form.  I would think the query logic goes here along with a drupal function to return the json.

In addition the page I have is a generated table,  In this table, one of the columns is an input text field.  I'm not sure if this is the correct way to do it, but I've directly added an input text field in the array that's rendered from the result set.  That text field is editable, and if a new value is input
I want to be able to save that as a new value for the same rowid.  Therefore two variables need to be sent.

Any direction much appreciated.


texts: How to send POST request to https using \Drupal::httpClient()?

texts:
I want to send POST request to https using \Drupal::httpClient().
But ended up with error like

  GuzzleHttp\Exception\RequestException: cURL error 60: SSL certificate
  problem: self signed certificate (see
  http://curl.haxx.se/libcurl/c/libcurl-errors.html)

Below is my code.

$post_fields['name'] = 'aa';
    $fields_string = json_encode($post_fields);
    $response = \Drupal::httpClient()
           ->post("https://localhost/example/api/user-update?_format=json", [
         'auth' => ['admin', 'admin'],
         'body' => $fields_string,
    'http_errors' => FALSE,
         'headers' => [
           'Content-Type' => 'application/json',
    ],
       ]);
    dsm($response->getBody()->getContents());

How to send POST request with \Drupal::httpClient().


texts: In user page, I want to add more field like username, contact number and address. What is the common way to do it?


texts:
I've a custom route and form, form input field(s) slightly changes based on arguments passed to it. There are only 2 possible arguments can be passed in URL. I'm using current latest version of Drupal 8 i.e. 8.6.14.

Following is copy of route from module:

mymodule.form:
  path: '/mymodule/{url_option}'
  defaults:
    _form: '\Drupal\mymodule\Form\ModuleForm'
    url_option: 'custom'
  requirements:
    _permission: 'access content'
    url_option: '^[a-zA-Z]*'

The above was working with earlier version of Drupal (It stopped working recently after updating to 8.6.x).

Issue :
When I try to add a menu item (using "Admin => Structure => Menu") for this route, I get following error. I've tried both "/mymodule" and "/mymodule/custom".

  The website encountered an unexpected error. Please try again
  later.Drupal\Core\Entity\EntityStorageException:
  The "url_option" entity type does not exist.

I've also tried implementing ParamConverter, but that didn't worked either. And since there are only 2 possible arguments user can pass, I'm not creating it an entity.

EDIT : Updated Issue.


texts: What is the equivalent of domain_get_domain()?

texts:
I need the equivalent of domain_get_domain() in the Domain Access module for Drupal 8, but I can't find it.

I need to find the domain for the current request.


texts:
I have upgraded drupal , but when i am running update.php I am getting this error .
I have tried after disable invite but still no luck.

Unresolved dependency   Invite (Version 3.x required)
User Relationships Invites requires this module and version. Currently using Invite version 4.0-beta2


texts:
I have a custom module that is formatting the display of an image field, which can accept multiple values.
I would like to know what hook I should use to duplicate the first value of the field (e.g. "[image1]"), and add it back to the beginning of the array (with array_unshift() I guess) before the rest of my functions format the display/theme of the field.

So what was

[image1]
[image2]
[image3]

becomes

[image1]
[image1]
[image2]
[image3]

I am then going to theme them separately, but I think I already have that part figured out.

I am currently using hook_field_formatter_view(), and have tried to just add it to the beginning of the $items array at the top of the function, but that didn't seem to work. If I immediately dprint_r() the $items array after this it shows, but only 3 items get output; I am assuming that the number of field gets determined elsewhere.


texts: Submitting a form, when using the same form with different ID are on a page

texts:
Here is what happens:
I've create a content type poll, which admin can create polling questions and answers. Then this polling node will be rendering in a new Page node with node reference (using paragraph).

I manage to create a paragraph preprocess on .theme which will pass the NID to the buildForm.

Here is how it looks like on preprocess:

function THEME_preprocess_paragraph__poll_and_sidebar(&$variables) {
  $paragraph = $variables['paragraph'];
  $poll_form = '';
  if (!$paragraph->field_poll_content->isEmpty()) {
    $node_id = $paragraph->field_poll_content->getValue();
    $nid = $node_id[0]['target_id'];
    $poll_form = \Drupal::formBuilder()->getForm('Drupal\mypoll\Form\PollForm', $nid);
  }
  $variables['poll_form'] = $poll_form;
}

The myPoll buildForm module:

 public function buildForm(array $form, FormStateInterface $form_state, $nid= null) {

if (!$nid == null) {

  // check if user have voted
    $get_count_voter = $this->queryVoter($_COOKIE['cusid'],$nid);

  // Function on node load
    $poll_form_result = $this->getPollDetail($nid);

    $each_answer = [];

    foreach ($poll_form_result['answers'] as $answer_value) {
      $each_answer_id = $answer_value->id();
      $each_answer['answer'][$each_answer_id] = $answer_value->get('field_polling_answers')->value;
      $each_answer['calc'][$each_answer_id] = $answer_value->get('field_answers_calculation')->value;
    }

    $answer_type = 'checkboxes';

    if ($poll_form_result['poll_type'] == 'linear' || $poll_form_result['poll_type'] == 'multiple_2') {
      $answer_type = 'radios';
    }

    $form['poll_'.$nid] = [
      '#markup' => '',
    ];

    $form['poll_'.$nid]['headline'] = [
      '#markup' => '
' . $poll_form_result['headline'] . '
'
    ];

    $form['poll_'.$nid]['question'] = [
      '#markup' => '
' . $poll_form_result['question'] . '
'
    ];

    $form['poll_'.$nid]['sub_question'] = [
      '#markup' => '
' . $poll_form_result['sub_question'] . '
'
    ];

  if ($get_count_voter == true) {

    $form['poll_'.$nid]['answers'] = array(
      '#type' => $answer_type,
      '#options' => $each_answer['answer'],
    );

    $form['poll_'.$nid]['poll_type'] = [
      '#type' => 'hidden',
      '#value' => $poll_form_result['poll_type'],
    ];

    $form['poll_'.$nid]['poll_user_cookie'] = [
      '#type' => 'hidden',
      '#value' => $_COOKIE['cusid'],
    ];

    $form['poll_'.$nid]['poll_nid'] = [
      '#type' => 'hidden',
      '#value' => $nid,
    ];

     $form['poll_'.$nid]['actions']['#type'] = 'actions';
      $form['poll_'.$nid]['actions']['submit'] = array(
      '#type' => 'submit',
      '#value' => $this->t('Submit'),
      '#button_type' => 'primary',
      '#name' => 'submit-'.$nid,
      '#attributes' => array(
        'class' => array(
          'button--darkblue'
       ),
        'id' => array(
          'submit-'.$nid
        ),
      ),
   );

  } else {

    $form['poll_'.$nid]['result'] = [
    '#markup' => $this->t('RESULT'),
  ];

  }
    return $form;
}
}

On 1 page there will be more than 1 polls, for this example, I will have 2 sets of polling and it was successfully display 2 sets of forms but when I click submit button on the 2nd form , and trying to dump $form_state, it always pickup the 1st form value.

Is there a way I can define the Form ID by NID or any suggestion on fix?

Thanks,
Queenie


texts: Drupal 7- "Users who bought this also bought that" module

texts:
Does anyone know of a module for Drupal 7 that provides a "users who bought this also bought that" feature?

I found Ubercart Views but it only works for D6, not D7.

My site uses Drupal 7 and Ubercart.


texts: Override function image_style_path doesn't work?

texts:
I work with the S3FS module on Drupal 7.

In this module the function _s3fs_image_style_deliver of file s3fs.module call the function image_style_path in that line :

$derivative_uri = image_style_path($style['name'], $image_uri);

This function comes from drupal core module image.

I need a way to override this function or the function _s3fs_image_style_deliver from s3fs module.
If someone have an idea ?

Thx :)


texts:
Is it possible to use tokens such as [view_node] in css ?
I want to display links only for a particular content type.

Thanks !


texts:
Is there any easy way to store a long text description of an uploaded file?

I want to provide a long description field (textarea) when users upload files, so they can write as much as they need. Current title field is limited to 255 chars.

Any ideas on how to do this?

Thanks!

Edit 1

The file_entity module does not support Inline Entity Form unfortunately, so this solution won't work.

Here are the related issues on Drupal.org:
https://www.drupal.org/node/2038053
https://www.drupal.org/node/2327369


texts: Why would my /admin/reports/dblog get "stuck" on only showing "page not found" errors?

texts:
Edit #2: Ok, I finally logged out of my admin account, restarted the browser, then logged back in. Presto! Works. Now that I've thoroughly embarrassed myself, I'll just bow out and go hide underneath a rock.

Edit: Ok, looks like my question wasn't specific enough - sorry! Let's see if I can word this better. Thanks for your patience and to the people who've already taken a swipe at answering this.

I'm having a problem where, no matter what type I select, /admin/reports/dblog refuses to show any results other than for "page not found" entries. As soon as I hit the "Filter" button, it reverts back to the "page not found" results list.

I've tried clearing caches, rebooting Apache, running update.php ... nothing makes a difference. If I try "Clear Log Messages," I get an error screen saying "The website encountered an unexpected error. Please try again later," which is a remarkably unhelpful message. Any thoughts? Thanks!

I haven't added any new modules recently and the dblog results were working fine up until yesterday afternoon. I had made no changes to the site near that time.

I'm not receiving an Error 500 as far as I can tell, as was suggested; it's a generic error message that appears to be one of Drupal's canned messages. If that's not the case, my bad!


texts: Is it necessary to use "Correct faulty and chopped off HTML"

texts:
I'm allowing the users of the site to add comments in "filtered html" form.
And the input is in NicEdit though Wysiwyg.

Currently I'm using "Correct faulty and chopped off HTML" option in admin/config/content/formats/filtered_html

Is it still necessary for my site?

I feel it's an overhead!


texts: How to check if view result is empty Twig

texts:
To check the field I use the following code:

{% if content.field_name|render is empty %}

How to check on node.twig if {{ my_cool_view }} result is empty? Is this generally possible in Drupal 8? Thank you for help.


texts: Open modal dialog with confirmation message in form submission handler

texts:
I've a form with few fields and submit button. When user click on Submit button, I do some processing and after which I want to open a confirmation form in ModalDialog with some customised message (dynamic) and "Proceed" & "Cancel" button. If user click on Proceed button, user will be taken to next page and if click on Cancel, the modal will be closed.

I've checked this question and D.O. Issue for Core Workflow Module, but these are for opening's Modal using link and not on form submit.


texts: Have the server interpret www.example.com/directory as a directory rather than a Drupal path

texts: I've got a Drupal 6 site running at webroot, and a MediaWiki wiki running at webroot/wiki. I can access the wiki fine by going to wiki.webroot, but when I try to access it using the path webroot/wiki the server interprets this as a Drupal 6 path: how do I get the server to interpret this as a directory? I'm guessing this is something to do with htaccess?


texts: How to specify the correct private file path in a block

texts:
I have a Drupal site at http://example.org/xyz

Per the instructions here, I have set up a private file directory outside the web root.

So let's say the web root is at /home/public_html/example/xyz
The private directory is at /home/public_html/private

I have that private directory set in the settings.php file and cleared the caches. It shows up correctly here: http://example.org/xyz/admin/config/media/file-system

After clearing the cache, I can indeed confirm there is a valid .htaccess file in /atrium/admin/config/media/file-system

The directory permissions for the private directory are 755.

So now I specify the file location of a link in a block as "/xyz/system/myfile.pdf"

When I click the link, the home page simply reloads (instead of a download window), but the URL now reads:
http://example.org/atrium/system/myfile.pdf

I've tried many other variations, and they all fail.

What am I doing wrong?


texts:
here's the code of kartinkin.php file:

<?php

  $node = node_load(707);
  node_view($node);
  //$index = $_GET['index'];
  //dpm($node);

?>

<?php $index = $_GET['index']; dpm($index); ?>

  #
  #

    <?php if ($index == 0): ?>
      <?php print theme_imagecache('imba', $node->field_pics[0]['filepath']); ?>
    <?php else: ?>
      <?php print theme_imagecache('imba', $node->field_pics[$index]['filepath']); ?>
    <?php endif; ?>

    <?php for ($i = 0; $i <= count($node->field_pics); $i++) { ?>
      <a href="?index=<?php print $i; ?>"><?php print theme_imagecache('230x130', $node->field_pics[$i]['filepath']); ?>
    <?php } ?>

I have included that file with include_once() inside a node.

PROBLEM. When i click on small-image it reloads the page and after reload my big image changes. With a code above i've tried to do it without a page reload, i even write e.preventDefault(); But still after clicking on a preview image it reloads the page. How can i make big image changing without reload?


texts:
I have a node that has a parent_field (entity reference) that if left empty, that node is a parent. If parent_field has data (ie the nodes parent node name) then I can easily add pathauto in there like so:

[node:parent_field]/[node:title]

However, I would like to be able to select a child as a parent and have pathauto gather this in to the path. Basically getting the parent and child entity reference:

[node:parent_field]/[node:parent_field(child of parent???)]/[node:title]

However, in pathauto (entity tokens included), I don't see how to grab this.

Thoughts?

EDIT:

I was able to do this by chaining entities. @Clive in the comments and a post online helped me figure this out.

In the end my pathauto looks like so:

program/[node:field_parent_program:entity:field_parent_program:entity:title]/[node:field_parent_program]/[node:title]


texts: Using taxonomy terms alias in views contextual filters

texts:
I hope you can help me out with this. I have created a simple view with an argument. I use that argument to filter (contextual filter) the content of the view. I already know I can use that argument as a taxonomy term ID and as a taxonomy term name, which means I can get my view loaded as:

www.myhost.com/myview/12

or

www.myhost.com/myview/termname

Both ways are ok and work fine but the problem I have is that I'd like to use an alias for the term, instead of the termname. Term names I already have on the site have some characters which are not really SEO friendly.

Is there a way to use the taxonomy term alias or any other workaround to get this?

Thanks in advance for your help.


texts:
I am using Signup and Views in Drupal 6 (I can't install Drupal 7), and I created a view that lists all the nodes for which users can signup.
Now I want to enable users to signup for one of these nodes without forcing them to navigate to the node itself, and I need to expose the signup form though Views (perhaps using a PHP field). I've searched for this, but most of the comments are a few years old. Furthermore, I'm rather unfamiliar with PHP.

Can I expose the signup form through views 2? How can I do it?


texts: Can I use the CTools modal functionality under HTTPS adn Display Suite?

texts:
The client for a new project wants their content to display in a modal overlay.  From my research so far, it seems using ctools is the way to go.

My question is, some of this content will be product displays (using Drupal Commerce).  Will there be a conflict with the AJAX functionality while the pages are HTTPS?  I'm also using Display Suite to lay out the content.  Is anyone familiar with any issues that may arise while using ctools' modal functionality with Display Suite?


texts:
The page--404 suggestion is visible in the twig debug comments:

function amu_http_status_code_display_theme_suggestions_page(array $variables)
{
  $path_args = explode('/', trim(\Drupal::service('path.current')->getPath(), '/'));
  $suggestions = theme_get_suggestions($path_args, 'page');
  $http_error_suggestions = [
    'system.401' => 'page__401',
    'system.403' => 'page__403',
    'system.404' => 'page__404',
  ];
  $route_name = \Drupal::routeMatch()->getRouteName();
  if (isset($http_error_suggestions[$route_name])) {

    $suggestions[] = $http_error_suggestions[$route_name];
  }

  return $suggestions;
}

But it fails to consider the

  templates/page--404.html.twig

from my module.

I have tried this

function amu_http_status_code_display_theme($existing, $type, $theme, $path) {

  $arguments= array(
      'template' => 'page--404',
      'base hook' => 'node',
  );

  // this is the name of the templates
  return array(
    'page--404' =>  $arguments,
  );
}


texts:
I've created a multistep form to add new customer details when they sign up. So for example, step 1 is personal details. step 2 is contact details. Step 3 in social network details.

Only the fields in step 1 are mandatory so the user can skip steps 2 and 3 and finish registration.

How do I display a progress bar whilst the user is using the form?
I was wondering if I could display a 'Profile completion' percentage in a view to show the user they've only completed x% amount of their profile?

Something like this from LinkedIn:

Thanks,
Rumman


texts:
I have just started learning/working with Drupal and I am trying to build a theme for a website (something that has nothing to do with a blog other than the fact that the content is dynamically generated).

I have just installed Drupal 8.4 with the Minimal profile and created the bare structure of my theme. However, when I go to visit http://mysite I get redirected to http://mysite/users/1.

I want to create a frontpage containing a large search bar and the thumbnails of some content (if that matters in any way). I created a page--front.html.twig but I still can't get rid of the redirect from / to /users/1.

Could you please give me some advice regarding this redirect and the more general idea of implementing a custom landing page?


texts: Duplicate home / front page - available on two urls

texts:
I have the Views module installed on my site, and have created a Views page and set it as the home page. The url is /front.

The home page works via the web root (it's set in 'Default front page' of configuration -> site information), but it is also accessible via /front. Is there a way to prevent this?

It shouldn't link from anywhere, and I've added it to the robots.txt file just in case, but I would prefer a cleaner solution.


texts: making user profile available for anonymous user viewing

texts: I am creating a views to list the users in that I want anyone to be able to access the user's profile node. However,there doesnt seem to have any such options. Any suggestion?


texts: Link Mini Panel thumbnail formatter to node

texts:
Working on a site that shows images and video with a Mini Panel formatter in a View withe File Entity and Media modules. The Mini Panel has a piece of content of file display that shows an Image display as well as Vimeo Video and YouTube. The Image display settings uses an Image style.

How do I link the media from the mini-panel to the referencing entity? (User clicks on the thumbnail in the view listing and is taken to the node's path).


texts:
I'm looking for a module that allows registered users to signup to events with a few options. I found the "Signup Module" but I can't figure out how to make it work, at least to try it out. So two questions:

Does the Signup Module allow for getting different input depending on the event type? For example, if an event is a dinner, I would need to get the menu choice and any dietary requirements.
If the above is a yes, how can I make it work? I can't find much documentation around and I'm still a Drupal newbie. If the above is no, can you please recommend a more adeguate module?

Thanks in advance for any hints!


texts:
I am using Drupal 8 default search and I don't want to use search api module. Default search is working fine. But I Want to modify it. I want to categorize search result and get count of that category. Also I want to add class of that category so that On click of that category, I can hide other results.

There was hook hook_preprocess_search_results()  in 7 but in 8 I think they have removed.

So is there any alternate hook available? Is there any other way around without using search api and facet api?


texts: How do I create a rule to prevent a user from sending a message via the Privatemsg module?

texts:
As a courtesy to registered users on my website, I require all users who send private messages to have a profile picture.

I already have system messages throughout the site to encourage them to upload such a picture (for example, when they log in, or visit a user's profile) with a link to their account edit page where they can upload such a picture.

But how do I block them (without banning them of course) from sending a private message if they do not have a picture (in other words BEFORE the message is sent?)

Fall back scenario: If I cannot stop the action before it happens, how do I prevent the message from being delivered, with the appropriate warning to the sender of course?

The message is sent by the Privatemsg module, not the Rules module.

Any idea?

UPDATE

I have tried both solutions proposed below (jeroen and Pierre Vriens) and both did the job.

Pierre's solution below works well and is easiest to implement.

For those who need guidance in implementing it, here are the steps:

1 - Create a new role. I called mine "can send private messages"

2 - Give this new role the "send privatemsg permission" only. Remove the same permission from the authenticated user permission (and other roles that have it and shouldn't.) At this stage, only those users who have the new role will be able to send private messages. The others will be sent to a "you do not have permission to access..." page.

3 - Create the first rule: Give it a name and select, under User, "an account is created." Save it. Create a second event and, still under User, select when an "account is updated." You now have two events in the same rule.

4 - Create the condition: Select "Data value is empty." Then drill down and select the name of the field that should contain the main picture (in my case, it is "site:current-user:field-user-image".) Below that, check the Negate box. This means the rule will check if the field is NOT empty.

5 - Create the action: You want the role to be granted if the field is not empty. So select "Add user role" under User. Data selector is "account" and select the value of the role (it's the name you gave to the new role.)

And that's it. To make the user lose the role if he removes the picture, you need to create a new rule, albeit a little less complicated. I called mine "disable private messages send." It only has one event: "After updating an existing user account" The condition is, again, "Data value is empty" but DO NOT check the Negate box. For the action, it's pretty straightforward. Like for the first rule but select the remove role instead.

For this rule to work the user must go into his account and click the save button. This is ok with new accounts but it may be a drawback if your site already has many users. But eventually, they will all update their account one way or another and the rules will be implemented then. If only a few users, the administrator (user #1) can go into their accounts and click on the new role box to grant the role.

See my second update below.

Again, thank you to Pierre for his insightful approach.


texts: How to manage video content including chapter markers and CC

texts:
I'm building a site that has 46+ videos associated with it. I'm using Mediaelement.js. Each video has at least two language .srt files, a .vtt chapter marker file and two video sources, mp4 and WebM.

My project mananger says, "do it how ever is easier for you."

Part of me is tempted to upload all the files, then just copy-pasta the mediaelement code and change the file names. But this is laborous, time-consumming and prone to error.

As I'm writing this I think that I need to have a content type that has 5 or more "file upload" fields. How do I use the media module to my advantage?


texts:
I would like to implement a custom redirect for anonymous users that try to access a form built with FAPI. user_is_logged_in is used in access callback to provide true or false.

However, I couldn't find documentation on how to hook into access callback functionality e.g. what happens when it returns FALSE? Now it automatically redirects to default user login page but I need change this.


texts: Drupal t() function does not replace placeholders for me

texts:
Why would placeholders not be replaced?

For example, in the Uninstall page for modules, it shows the following.

It happens under the revisions tab as well.


texts: Load id of paragraph in hook_preprocess_layout using load($id) method

texts:
I want to load the paragraph id in theme preprocess.

function theme_preprocess_layout(&$variables) {
  $ID = $variables['content']['#paragraph'] ???; "contents - protected 'id' => array(1) = 68"
  $variables['attributes'] = new Drupal\Core\Template\Attribute($variables['attributes']);
  $variables['attributes']->addClass($ID);}

It gives me the available method "load($id)" but I don't know how to implement this method.


texts:
I need choose different template based on the path (current_path()?)

user/register/* AND
user/register/recruiter/*

I started with hook function

function ohm_theme(){
    $hooks = array();
    $hooks['user_register_form'] = array (
        'render element' => 'form',
        'path' => drupal_get_path('theme','ohm')."/layouts/hero",
        'template' => 'user-register-form',
        'preprocess functions' => array('ohm_preprocess_user_register_form'),
    );
    return $hooks;
}

Which works fine only for user/register page

Then I would like to specify the new template suggestion user/register/recruiter/* using

function ohm_preprocess_user_register_form(&$vars) {
   dsm($vars);
}

but I can't figure out how to add condition using current_path() inside this.

Thank you


texts: How to export content to XML, CSV or RTF for print

texts:
I'd like to export a (views)-list of events to re-import it with Indesign or Pagemaker, so XML, CSV or RTF-format would be great. The list should be restricted to one, the current month (this is no problem with views or even views bulk operations). The important thing is: the events must be grouped by the event-day and their respective categories (concert, theatre).

I already tried the Views Data Export module, but there is no way of grouping the fields. So every "event" has all it's fields in one column.

Is there another module you could recommend or do i have to do this programmatically (which I can't unfortunately).

Thanks in advance for every hint...

Update
Thanks to WestieUK i installed the Views Data Source module, which is working great, but not as expected. There's also no grouping of fields (at least not obvious).

So this is what i have:

<root>
    <events>
       <eventdate>21/7/2012</eventdate>
       <categorie>Clubland</categorie>
       <location>Club A</location>
       <title>Klanglabor</title>
       <time>21:00</time>
    </events>
    <events>
       <eventdate>21/7/2012</eventdate>
       <categorie>Clubland</categorie>
       <location>Club B</location>
       <title>Soundlabor</title>
       <time>21:00</time>
    </events>
</root>

I'd like to have it something like this:

<root>
   <eventdate date:21/7/2012>
       <categorie name:Clubland>
           <events>
              <location>Club A</location>
              <title>Klanglabor</title>
              <time>21:00</time>
           </events>
           <events>
              <location>Club B</location>
              <title>Soundlabor</title>
              <time>21:00</time>
           </events>
       </categorie>
    </eventdate>
</root>

Any ideas? If this can be achieved prorgammatically, like making a custom module (based on perhaps the Views Data Source module), I'd give it a try with your help!

Thanks!


texts: Sort a Table View by Fivestar Rating Fields

texts:
I'm currently using Fivestar-7.x-2.0-alpha2 and Views-7.x-3.7. And running Drupal 7.

I am trying to create a table view that displays the information from fields on a certain node type. In this case, the "Program" node and all of the rating fields (fivestar fields) and two text fields (Discipline and University). You can see what I have currently here.

The problem I am having is I can't seem to get the table to sort properly. I have cleared out the Sort Criteria so there isn't any sorting being applied other than from the table settings (I think?). I went into the table settings for the view and checked off sortable for all of the fields. However, when I try to sort them they either don't change at all (the fivestar and computed fields) or they sort improperly (the University field).

I'm at somewhat of a loss. I've done hours of Googling but I can't seem to come up with any sort of solution. If anyone could offer some advice I would be most appreciative.

I should also note that the "Overall" field is a computed field that averages all of the fivestar fields.


texts: FileField Paths works bad when upload image - the wrong way comes?

texts:
I have my VPS with two sites: in first i have FileField Paths and it works bad. In second i have no FileFiled Paths and everything ok.

The error is this:

When I choose photo in the Image field and press "upload" it shows me blank image and when I open url address of this thumbnail - it shows 404. the thumbnail url is correct.

But the original image url is not corect. FileFiled paths make the original image url like this:

/system/temporary/filefield_paths/coctail-gold.jpg

but the pattern in Image field FileField paths settings is this:

blog_images/u[node:author:uid]/[current-date:custom:Y]

so this is the reasen why i see the blank image.

But when I save the post thumbnail shows correctly, so file creates.

Please what is wrong with FileField Paths?


texts: Use twig to style a specific block (unformated list)

texts:
I have a block showing a unformated List of fields. Now I would like to use twig to style that block.

I am able to use block--views-block--blockname-block.html.twig to do the outer styling. But I could not get the fields out of the content.


texts: Brackets in URL Field Get Reformatted to %5B%5D

texts:
I have a Drupal 7 site with a content type that includes a link field.  The intention is for staff to add a link that can link to an outside website. But if that link contains brackets [ ], the module uses %5B %5D instead. It also, cuts out parts of the URL.

So, ....

...Search/Results?lookfor=&basicType=Keyword&type=Keyword&filter[]=local_time_since_added

would translate to

...Search/Results?type=Keyword&filter%5B%5D=local_time_since_added

Would anyone be able to advise me as to why the link field in a content type would not only remove parts of my URL but also replace brackets?

I see a lot of chatter about this with views, but not on a link field in a content type.


texts: Execute custom JavaScript code after Webform has been submited with Webform Ajax Module

texts:
I have an Webform that uses Webform Ajax modules, Steps module and few others.

I would like to execute some custom JavaScript code after the WebForm has been validted and submited.

I know I could execute custom PHP code by modyfing function _webform_ajax_callback_completed($form, $form_state) {...} inside of webform_ajax.module:

elseif ($form['#node']->webform['webform_ajax'] == WEBFORM_AJAX_CONFIRM){
...
//my custom code
...

But I don't want to mess with this module's code. And I want to execute JavaScript not PHP code.

Is there an way to do so, e.g. via some hook? Or maybe I can detect that form has been submited in JavaScript?


texts:
I have a simple form which should be able to accept payment via Paypal. The form(site) will support multiple languages and depending on the language, it should change the currency appropriately after applying forex conversion.

I don't want to use drupal commerce since it's too bulky for my requirements. I was thinking if possible what set of modules be used to accomplish this, e.g. webform, paypal webform, which internationalization/localization plugins and so on?


texts: how to show the foreign characters in tpl.php file

texts:
I would like to set my website as Multilingual. I typed some Korean words (eg."한국어") in tpl.php file, but when I check my webpage, it shows me some question marks (eg."???").
Here is the code:

한국어

I think it might be somewhere I need to set first. Does anyone know about this? I really appreciate anyone's help.


texts: Changing the HTML produced by Panels: Is it possible?

texts:
I like to use panels, however panels is a pain in the butt to style because of the massive amount of div's it generates. Also the classes it applies to those divs make no sense and are way too bulky as well. Causing confusion among my fellow front-enders.

To show you the output they generate:

The problem is that i'm using 960.gs and panels adds their own classes and bulky div structure, making me have to override their classes. This is something i don't want to do, i want to clean up the divs. Is there any way to do this?

Edit:

What i did to clean up some div's that i considered useless:

Starting from line #388 in flexible.inc (panels/plugins/layouts/flexible)

$output = '';
//$output = "
base['canvas'] . " clearfix\" $renderer->id_str>\n";
    //  $output .= "
base['canvas'] . "-inside\">\n";

      $output .= panels_flexible_render_items($renderer, $settings['items']['canvas']['children'], $renderer->base['canvas']);

      // Wrap the whole thing up nice and snug
      //$output .= "
\n
\n";

I actually made a copy of the flexible layout and edited that one, but if i had more time on this project, i would create a cleaner plugin for this.

Note: This isn't the best solution, this was the fastest possible route to accomplish my goal. Creating you're own small plugin is the best way to go, you can always use one of the existing plugins as a base.


texts: Post comment permission by content type and role

texts:
I want to only allow users of a specific role to be able to comment on a specific content type. The only current solution for this is using the "Comment Permissions" module which unfortunately is only available for Drupal 6 and hasn't been updated for over a year.
I have seen some people saying that it's possible to do this by writing custom code however i haven't been able to find any examples of this. Does anyone here know how this could be done or at least point me in the right direction? I'm not good at php though i have some programming experience.

I was thinking that it would also be okay if i could allow users of a specific role to comment on nodes/content type where commenting has been closed if achieving it that way is simpler.

Any help is greatly appreciated.


texts: create an commerce order list view with payment method

texts:
I would like to create simple orders list with chosen payment method.

Problem: If customer goes through checkout process at once (without returning from checkout review and changing payment method) there would be only one payment method for an order, which is ok.

However, if customer returns from checkout page and changes payment method and then completes checkout - the order has 2 payment methods attached to it.

Now, inside view I can add relationship to Commerce Order: Payment Transaction, which causes duplicates. So I choose Commerce Order: Representative payment transaction, which gives me only one payment method (Now I can use payment method field). Inside relationship I can select representative sort criteria - in my case it would be transaction id (descending). However, sorting does not seem to work. The view always outputs the first payment method chosen when creating the order.

Is anything wrong with the view or is it better option to delete the unused payment transactions?

Question: what is the recommended way of keeping only one (last) payment method.


texts: Display blockquote of text in article post, while showing original

texts:
Can anyone provide an idea for how I can add a block quote in an article post where that text is also in the body of the message?

What I mean by this, is that right now when one of our users wants to create a blockquote, they use the CKeditor WYSIWYG module and choose 'blockquote'. What this does is highlight that specific text as a blockquote. What I am more looking for is the ability of the writer to choose what they would like to have as a blockquote and also see that same text again where it belongs in the article.  Please see the image below for what I mean.

Ideally it would be great to have certain text highlighted that it is a blockquote. Then have that blockquote be right next to the original.

Update: I just talked with our themer and maybe the best solution is to highlight any text that we want blockquoted and include it in there twice. Then we can style the text with CSS that has the blockquote tag. But if there is a better way, then great!


texts:
I see this warning I go to update the database.

  Notice: Constant ADVAGG_MOD_CSS_DEFER already defined in
  include_once() (line 172 of
  /home/valerie/public_html/permanentmakeupcornwall.com/sites/all/modules/advagg/advagg_mod/advagg_mod.module)

The other problem is the advagg drop downs do not work; when I click on Experimental Settings for CSS it does not drop down for me to tick the box. I need to tick to optimise css delivery and clear the error on google page speed test for render blocking above the fold.


texts:
I am trying to build a questionnaire that simply replaces (alters) the label of a list field. I am doing so by replacing a token from views (embed) and implementing hook_form_alter() in a separate module.
How can I save that value and write it to the database?
I am using an Entity form and a list-field.
This is the snippet I am struggling with, found on Store token replacement values in the database rather than tokens themselves.
function question_to_label_node_presave($node) {
  if ($node->type == 'page') {
    $replaced_text =  token_replace($node->field_question['und'][0]['value']);
    $node->field_question['und'][0]['value'] = $replaced_text;
  }
}

I am currently trying to run this in a custom module, but I cannot find the right content type for the Entity form. I am using the Devel module to find the right array value.


texts: Using Drupal 7 Rules, how to react to a file upload and change a node field?

texts:
I have spent hours/days trying to figure out how to accomplish this in Drupal 7 using the Rules module, so I will greatly appreciate any help anyone can provide.

What I am trying to do:

When a user re-uploads a file to a node, the node should rollback from an Approved status to Pending Review. This requires some kind of automated rule that checks for when a file was updated.

Here's what I have:

A node called Data_set with a File field called data_set_file.
Data_set nodes also have a field called Status (e.g., Pending Review, Approved).

My problem:

When a user uploads and overwrites an existing attachment in the data_set_file field, I want the node's Status to change back from Approved (if already) to Pending Review. I am able to use Rules to check for when a user uploads a new file, but there are no rules conditions to check for which file or node file has been updated.

What I tried:

I created a "NOT Data Comparison" condition between node-unchanged:field-dataset-file:file:fid and (Equals/Negate) node:field-dataset-file:file:fid However, when updating the file, it did not register a change to the fid field (because it keeps the same fid). I also tried the file size field with no effect as well. When I tried the file's timestamp, it appeared to work at first until I realized that the timestamp updates every time, no matter what, that a user saves a node, regardless of whether or not a file was re-uploaded.

I may be going about this the wrong way. Anyone know what's the easiest way to accomplish this? Thanks a million!


texts: using jquery updated version in user edit page

texts:
With jquery update module  I can use newer JQUERY version in my pages and also in admin pages I use another version, 1.9 for pages and 1.5 for admin pages,my question is DRUPAL know user edit page ( user/uid/edit)  as admin page, how can I use  updated version of JQUERY in user edit page?

I did something like

function mymodule_js_alter(&$js) {
  //$javascript['misc/jquery.js']['data'] = drupal_get_path('module', 'jquery_update') . '/jquery.js';

  if(preg_match('/user\/\d*\/edit/', current_path())){
    //ym($js);
    //there is exist 1.9.1 jquery file
     $path = libraries_get_path('jquery').'/jquery-1.9.1.min.js';
  // Copy the current jQuery file settings and change
  $js[$path] = $js['misc/jquery.js'];

  // Update necessary settings
  $js[$path]['version'] = 1.9;
  $js[$path]['data'] = $path;
  // Finally remove the original jQuery
  unset($js['misc/jquery.js']);
  }
}

also

function mymodule_js_alter(&$js) {

  if(preg_match('/user\/\d*\/edit/', current_path())){
     $path = libraries_get_path('jquery').'/jquery-1.9.1.min.js';
  // Copy the current jQuery file settings and change
  $js['sites/all/modules/jquery_update/replace/jquery/1.5/jquery.min.js'] = $path;
  }
}

but not worked


texts: Cannot enable PHP Filter module in a fresh Drupal 7 installation

texts:
In order to test my ISP (a2hosting.com), I created a simple website running Drupal version 7.74 (the latest from the 7 branch) on a subdomain. It is a standard installation, with no additional modules nor themes.
Then I tried to enable the PHP filter module. When clicking Save configuration, the admin/modules page reloads without giving any message and without enabling the module, which remains off. I can turn other modules on and off as expected, but not the PHP filter. Other features are apparently OK.
What could be the problem?
PS. I did this test after having problems with PHP code on my sites, as described on  PHP content cannot be created or modified after ISP migration. A2 support team was unable to help.


texts: Why my website is showing junk characters?

texts:
My Drupal 6 website is showing junk characters like:

<�h�3�>�C�o�m�m�e�n�t�s�<�/�h�3�>� �<�t�a�b�l�e�>�<�t�r� �b�g�c�o�l�o�r�=�'�#�E�7�E�7�E�F�'�>�<�t�d�>�P�o�s�t�e�d� �O�n�:� �1�2�-�1�3�-�2�0�1�0�

It used to happen once in every 1-2 months, and with any page of the website. Clearing the cache resolve the problem.
I think its the problem with cache_page table and page compression, because when I manually clear the entry in cache_page table for that particular page, it gets resolved.


texts: How to find out which form I want to alter

texts: I am adding a functionality to drupal commerce kickstart, which involves product display modification. There should be a lot of forms but I don't which one to alter and add my new object to the existed form. Any good idea? (There is almost no documentation about it)


texts: Views exposed filter in block redirects to homepage instead of current page

texts:
Problem is similar to drupal.org/node/1807916 #65.

I'm using Views ("7.x-3.6+4-dev" in D7.21) exposed filter in bartik, with my filter exposed as block in sidebar. When I click the reset button I am redirected to homepage instead of current page as desired.

URL shown:

  "localhost/?field_sku_value=123&field_name_value=&field_component_value=&op=Reset"

(last filter values)

Filter exposed on Views Page is ok.

Try to tweak $form_state['redirect'] in views_plugin_exposed_form.inc doesn't work. Any idea?


texts:
I am using webform for contact us page.

Once form is successfully submitted,I have redirected it to thank you page.

But the URL of thank you page keep adding webform sid, like given below

http://localhost/test/thank-you?sid=1234

I want to hide the sid from URL

I am using custom redirect URL in form settings

Thanks


texts: How to add "Content type B" from within "Content type A" and then display both together?

texts:
I have the following scenario:

Content type A
Content type B

Content type A is added by the admin role.
Content type B is added by the students role.

Once Content type A is created, then on that link, like node/20 or content-type-A/20, I am looking to have an node add form for Content type B.

then the content type B that was added from this form, should be related and displayed with the existing content from content type A.

For example,
Content type A: title: Bread is good

So now, when you go to node/20 you see Title: Bread is good
then here you should have a form for Content type B with fields say title and some radio buttons.  The student role user inputs the form and then submits.

Now the node/20 should display Title: bread is good and the fields associated with content type B that the student inputted.

And more students should be able to continue adding to this.  This is something like a one-to-many relationship.  Content type A has many Content type B associated with it.

I hope someone can help explain to me how to get this done


texts: How to show only one parent term and his child term using Taxonomy Views

texts: I have created a View to show taxonomy parent term and child term. But I dont have any option to show only one parent and his only 4 child. Views display all list of parent and child.


texts:
I'm working on a drupal 8 project, I've created a webform and trying to associate a captcha to my webform using captcha contrib module.
I've a personalized template for my webform in which I render the webform fields.
I've associate the captcha to the webform under /admin/config/people/captcha/captcha-points and test as anonymous user it is always unable to associate captcha to the webform.

Should I print captcha in my webform template file? if so how to do it?
Should I add an element Captcha to my webform fields? if so is that element by default use captcha contrib module settings?

Any help is appreciate.


texts: How can I handle the user access to specific taxonomy terms?

texts:
There is a node form with a term reference field which's terms list I want to filter based on users/ permissions.

I've tried several modules in which I can grant access either user- or role-based for individual terms. Unfortunately, these settings are ignored by "Views: Filter by an entity reference view" when the views list is built.

So, whats the right way? How do I globally set per-term permissions that are also respected by views listings?

I've thought about changing the term controller but I don't see an access function there. Do I have to use a query alteration? Is there a hook?


texts:
I want all the users to access the custom defined url. But now I got error message as Access Denied, my code is as follows, I tried clearing both drupal and browser cache. Please help me,

function hbrowse_menu() {
  $items = array();
  $items['browse/restaurants'] = array(
    'title' => t('Browse Restaurants'),
    'page callback' => 'list_restaurants',
    'access arguments' => array('access content'),
    'access callback' => TRUE
  );
  $items['browse/cuisines'] = array(
    'title' => t('Browse Cuisines'),
    'page callback' => 'list_cuisines',
    'access arguments' => array('access content'),
    'access callback' => TRUE
  );
  return $items;
}

hbrowse is my module name.


texts: How do I get rules to select a random node?

texts:
I'm working on my cron rule that will post to twitter every cron run. Thing is for this rule I need it to post a random node that either conforms to specific values in certain fields, or does something else if that value is false. I could use some help figuring this out.

Basically if The value of X=y I want the view to respond with one action, but if the value of X <> y then I want it to do another. And I need it to do this on random nodes of a sepcific content type.

Any ideas?


texts: How to use hook_form_search_block_form_alter?

texts:
I was referring this page in the process of learning hooks How to Customize the Block Search Form and found following code.

/**
* hook_form_FORM_ID_alter
*/
function YOURTHEME_form_search_block_form_alter(&$form, &$form_state, $form_id) {
    $form['search_block_form']['#title'] = t('Search'); // Change the text on the label element
    $form['search_block_form']['#title_display'] = 'invisible'; // Toggle label visibilty
    $form['search_block_form']['#size'] = 40;  // define size of the textfield
    $form['search_block_form']['#default_value'] = t('Search'); // Set a default value for the textfield
    $form['actions']['submit']['#value'] = t('GO!'); // Change the text on the submit button
    $form['actions']['submit'] = array('#type' => 'image_button', '#src' => base_path() . path_to_theme() . '/images/search-button.png');

    // Add extra attributes to the text box
    $form['search_block_form']['#attributes']['onblur'] = "if (this.value == '') {this.value = 'Search';}";
    $form['search_block_form']['#attributes']['onfocus'] = "if (this.value == 'Search') {this.value = '';}";
    // Prevent user from searching the default text
    $form['#attributes']['onsubmit'] = "if(this.search_block_form.value=='Search'){ alert('Please enter a search'); return false; }";

    // Alternative (HTML5) placeholder attribute instead of using the javascript
    $form['search_block_form']['#attributes']['placeholder'] = t('Search');
}

This code is very helpful and precise to point. For example, if we want to change the placeholder, we need to put following code inside the template.php file and it works.

function YOURTHEME_form_search_block_form_alter(&$form, &$form_state, $form_id) {
    $form['search_block_form']['#attributes']['placeholder'] = t('Search');
}

Now,

From the literature on api.drupal.org, I can get the information that Hook, YOURTHEME_form_FORM_ID_alter(&$form, &$form_state, $form_id), can be used to alter the various parts of forms.
But on that page, there is nowhere a description about any part which all are described in above first code, For example, $form['search_block_form']['#attributes']['placeholder'] = t('Search'); This code is used to change the placeholder. And same way all other like title, #title_display etc...

Why I am asking this, because for hooks all things are already defines and to use them we have to use them as they are provided, So What is the method to connect this all dots, from Hook name to what can we change with that hook.

Precise Question,

To make this question to the point, I what to know from where on api.drupal.org shall I find out, this part $form['search_block_form']['#attributes']['placeholder']? Or how shall I come to know that, if I have to change placeholder I have to use $form['search_block_form']['#attributes']['placeholder'] this code only?


texts: Send a regular reminder (or do other normally cron-dependent tasks) while in maintenance mode

texts:
I recently had an episode where I put a site into maintenance mode to perform a security upgrade and forgot to go live again afterwards, resulting in almost a day of downtime before I caught the error.

I thought I could set up a rule to send me an e-mail whenever cron runs if it detects that the site is in maintenance mode, but I don't think that's going to work because cron can't execute when maintenance mode is on. A preliminary test seems to confirm that. I put the site in maintenance mode, attempted to run cron manually, and no e-mail was generated.

Is there another module or method I could use to send myself a reminder so this won't happen again?


texts: Rules: Event user has logged in won't trigger rule

texts:
I'm a newbie and using the Rules module, but Rules Event "user has logged in" won't trigger my rule.

I can set any event to trigger a rule (for example, user has logged out), but if I change it to "User has logged in", the rule is never triggered, even if conditions and actions remains the same.

This doesn't work:

Event: User has logged in
Conditions: None
Actions:

Set a data value
Parameter: Data: [account:field-point], Value: 1

But if event is: "user has logged out", there is no problem, the value changes to 1.

I had used "user has logged in" as an event in another site and it works, but in this particular case it won't.

Any idea why?

UPDATE:

I found the problem... maybe.

At a user's first log in I have a (first) rule to remove one role "new" and add a new one "active", I also set the date of first log in in a field and a second date that has a 1 year offset. The condition to this rule is if the user account has the role "new".

A user can also set some fields of his profile to be private or public by changing a field text list, I did this by setting a (second) rule that after updating a user account changes a set of cloned fields to blank when the value of a field is "private" and a (third) rule that copies the data from the original fields to the cloned ones when user selects "public". Both rules are triggered after updating a user account.

In this case, the first rule to change user roles never triggers; if I disable the third rule triggered after the user account is updated, then the first rule runs as expected.

So, it looks like I can't have two rules triggered by the same action, in this case, two rules triggered after the user account is updated.

The problem is solved by setting the third rule to trigger before saving a user account, but I still don't know what caused the problem.


texts: Is there a way to use a generic 'Site is Down' page?

texts: I recently experienced issues with my hosting company and a few of my sites went down. All users could see was a standard Drupal PDO Exception page. Is there a way I can create/use a page to show a generic "we're having issues, please check back later" page instead of this if a major problem occurs?


texts: Override a theme template variable with a module

texts:
I created two variables for use in my theme's page templates. I used variables because I wanted that value to be flexible.

function mytheme_preprocess_page(&$variables) {
  $variables['var1'] = 'value1';
  $variables['var2'] = 'value2';
}

Without creating a new page.html.twig template, I want to choose new variables in mymodule. Like, maybe...

function mymodule_preprocess_page(&$variables) {
  $variables['var1'] = 'newvalue1';
  $variables['var2'] = 'newvalue2';
}

This isn't working. I have a feeling it's because themes get priority? Any ideas?

Edit: I should clarify. How do I do this?


texts:
I have an issue on Drupal 8 with images randomly not found. I am actually not sure if the issue comes directly from Drupal.
I am developing for my organisation a website currently quite simple with just a front page and some test content with images. This works perfectly locally, as well as on a small personal server.
However, once deployed on the cloud CentOS server of my organisation, images are randomly not displayed, be it images linked to contents or blocks. Refreshing the page changes which images or displayed or not. If I try to directly access an image with its URL, the result is similar: the image is displayed or I get a 404 error, varying when I refresh.
I checked the permissions on the server and even forced a chmod 755 -R sites/default, with no change.
I found on the Internet several issues about images constantly not found, but not randomly not found. This random aspect is what really puzzles me.
Does anyone have an idea about the origin of this? Is this really related to Drupal itself?
Thanks in advance!


texts: Best way to drop a field from a content type

texts: What is the best way to remove a Drupal 7 field from a content type defined via the GUI? I want to use hook_update_N so the changes can be propagated to multiple servers upon running update.php. However I cannot seem to find a solution. db_drop_table() would make sense to me for custom defined schemas, but not for a content type/field defined through the GUI.


texts: How do I access a node object property, if it is an array?

texts:
$node = \Drupal\node\Entity\Node::load($nid);

Having loaded a node object in Drupal 8, I know how to access a property, if it is a single value, and assign it to a variable, $test in the example below:

$test = $node->field_1->value;

However, if $node->field_1 contains an array, how do I access it so that I can assign it to $test? So $test would equal something like:

array(0 => 'apples', 1 => 'oranges')


texts: Notify site users based on user account field (e.g. apt number)

texts:
I run a site for my condo, the HOA wants to setup a way to notify residents when they get a package, that needs to get picked up from the office.

In the users account settings their are both unit number and email fields.

How would you solve this problem?


texts: Attach #ajax to submit button created in hook_form_alter with #markup

texts:
I created a custom submit button for the user-login form using #markup because I couldn't alter submit button html to resemble what I needed. The second custom submit button with the needed html is added with:

$form['submit2'] = array(
  '#markup' => '
<button type="submit" name="submit"></button>
');

I then added a "hideme" class to the orginal button with $form['actions']['submit'] ['#attributes'] (deleting it stopped the other submit from working).

So far so good. But now I would like to validate the login form using AJAX. Only if I add the #ajax key to $form['submit2'], the callback is never called. This only seems to work with regular form items.

Is it possible to trigger an Ajax callback on a #markup element (in hook_form_alter)? I'm using Drupal 7.


texts:
I'm trying to add a "restricted" group membership type to only show teasers of a content type to some members. I'm calling the following function from a Rules action; however, the membership ends up being a OG_MEMBERSHIP_TYPE_DEFAULT.

function mymodule_subscribe_restricted($account, $group) {
  og_group($group->gid, array('entity type' => 'user',
    'entity' =>  $account,
    'state' => OG_STATE_ACTIVE,
    'membership type' => MYMODULE_OG_RESTRICTED));
}

Looking at the source code of og_group(), the membership type should go through. And it's defined correctly in the db table og_membership_type.

Any quick pointers or should I just refactor the whole thing to use a separate group role instead of a membership type?


texts: How to make two date fields related to each other?

texts:
H have a content type with a start date and an end date.
How can make the

end date defaut value adjusting depending on what is entered on the

start date choosen value, ensuring that

end_date always > start_date?


texts: Adding Where clause in Views Query using a custom filter Handler

texts:
How can I add a where clause in custom filter handler for views query.

I need to add where clause to alter views query using custom filter handler.

My code in custom filter:

class fee_management_handler_filter_payment_status extends views_handler_filter_many_to_one {
  function get_value_options() {
    $this->value_options = array('1' => 'Paid', '0' => 'Unpaid');
  }

    /**
        * Called to implement a payment status.
    */
    function query() {

        if filter = unpaid or 0

        view conditions  + = ' AND pid IS NULL';

        parent::query();
    }
}


texts: First four free - changing product pricing based on cart quantity in Commerce using Rules

texts:
Brief:

Product with SKU "sample" has a unit price of £0.00
Once quantity > 4, product unit price is £2.50
First four remain free. E.g if five in cart = (4 x £0.00) + (1 x £2.50).

Currently I have the first two requirements working, I can change the price of a particular product once there are more than 4 items, my current problem is that because the unit price changes, it counts for the four "free". So currently 5 samples bill at £12.50, instead of £2.50.

You can see my rules set up here:

The easiest solution would be to apply a discount of £10.00 to the cart, but I can only see options to alter a unit price of a line item, rather than applying a discount to the order.

How should I do this?

Possible solution avenue

I added a second action "Add line item to cart" and created a product with value of -£10.00. The problem here is that when the quantity is reduced to 4 or below, the line item remains. I cannot see a rule option to then remove that line item.


texts: Modify metatag description programmatically Drupal 8

texts:
I modified the meta-tag title for a view in hook_preprocess_html() using the following code.

if (isset($variables['head_title'])) {
    $variables['head_title'] = $variables['page']['#title'] . " | My web";
}

Is it possible to modify the description in the same hook?


texts:
I am having an interesting problem with some birthdate data in my profile nodes. I am using Drupal 6.

There are two people:
Ann has the following UNIX timestamp value stored in the db: 353026800
Her profile page renders it as '1981. March 10'. When I edit the node I see also this value.

Bete has the timestamp in the db: 484696800
His profile page renders it as '1985. May 11' but when I open the node for edit then I see 1985. May 12.' in the date edit box.

The profiles are rendered in a custom tpl.php and the according piece is as follows:

format_date($p->field_szuldat[0]['value'], 'custom', 'Y. F. d.');

When I dpm the loaded node then I see that both fields have the same Europe/Budapest timezone. I see that Bete's birthdate is (not counting the days) is 1 hour before Ann's. But I see that Drupal somehow handles it and renders the values in the edit boxes properly. It might be related to DST because Bete was born in DST and Ann wasn't.

My question is: how could I make my template's date rendering also handle it properly?

I have read all the related comments to the topic, but they do not match my case because here an extra hour is being added to one of my dates.

UPDATE:

The field I am talking about is a "Datestamp" with the following configuration: "No timezone correction" is set, the granularity is only year-month-date.


texts:
I tried to install the module Menu Minipanels, without success. I tried both the 1.x and 2.x version but the minipanel don't show up in the menu. After half a day I gave up.

I do like the idea of a megamenu using minipanels, so this question is:
How to use minipanels in a menu, without the 'Menu Minipanels' module?

EDIT: I got Menu Minipanels working at last, but it has a major bug that anonymous users can't see the minipanels in the menu! Back to square one.

So again the same question..


texts: How to target votes to referenced nodes from main node and transfer the same vote to other nodes?

texts:
Lets go by example - I want to create IMDB website on Drupal. I use either Fivestar or Rate module to make different rating types - Say Critic Rating, Story Rating, Animation Rating etc.

And these ratings appear on MOVIES Content type. Now when user votes on Movie on User Rating then the vote should also reflect on the Director's and Producer's Page (CAST content type for all participants in the movie including actors, cameramen, director, producer etc). Similarly when user votes on "Story Rating", then all referenced nodes of CAST content type involved with this field (story) should also be voted.

I am not sure of the structure at present, in the sense in movie content type - I have fields like "story" with referenced node from CAST content type where people who have written the story will be referenced. Also I will have fields called ACTORS - and all actors of the move will be referenced from CAST content type. But this doesnt seem to be the right way to do it as I later cannot filter content based on fields say if I want to see people involved in story - then a filter should be able to do so. But creating a field will not allow me to filter it. Some taxonomy term has to be used.

It'll be great if someone could explain the IMDB way of making the website on drupal with content types in a little detail.

Regards.


texts: How to “filter” out one specific user in a view?

texts:
I’ve a question regarding some of my blocks which I’ve made in views (using Drupal 6 and Views 2). One of the users on the site is the sites “manager” and so this user of cause writes a lot of posts, comment on a lot of posts and “likes” a lot of posts.

In some of my blocks I display the most contributing users and this “manager” is almost always on top of the list and I would like to display the most contributing users, but “ignore” this user.

My views are very simple and basic created. For example in one I list the most commenting users right now (that be, the last 24 hours) and I sort according to the comment count.
In this example, how do I “filter” out the one user?

Thanks

Sincere
- Mestika


texts: Should I down-grade to Drupal 6.x? There seems to be much better support!

texts: If I'm only looking to throw some easy-to-use modules together for a client and then put the Zen theme on, should I stick to Drupal 6.x? I've noticed in my exploration of Drop-down menus in 7.x that there is very little support for it in the form of modules.


texts: Altering the Title of node using Preprocess

texts:
I am trying to alter the page title of history content type using this function

function mytheme_preprocess_page(&$variables) {
   if(isset($variables['node']) && $variables['node']->type == "your_content_type") {
   drupal_set_title("my_title");
 }
}

But you know what, I dont get anything in node array.