texts:
I am using Drupal 6, Ubercart 2.7, and Views 2.16 for an e-commerce site.

Using Views with the Bonus: Views Export module, I am producing an atom feed for Google Shopping. This works perfectly.

I am trying to produce a second feed for a different currency, and for my purposes, it is OK to simply multiply the sell price by 1.1 and add the currency code onto the end of the value. However, I've hit a brick wall. I've tried the following options:

Theming

I tried creating a template file for that specific field (views-view-field--google-shopping-export--page-2--sell-price.tpl.php - lol). To get this working I had to change Field Output type to "Raw" for the feed, which caused all sorts of other problems. If Field Output was set to "Normal", the template was ignored.

Dynamic Fields

I tried using the Dynamic Field and Computed Field modules, but I couldn't get either of these working - both fields were empty within the feed when I tried to pull $node->field_sell_price in any way. This makes me think that I wasn't referring to the value properly, but I tried many, many combinations - $node->field_sell_price, $node->field_sell_price[0]['value'], $node->sell_price, $node->sell_price[0]['value'] etc. I was able to pull in $node->nid and $node->type, but nothing else worked.

Are there any other options to do this? Or have I missed something obvious in the solutions above? I feel like I'm making this much more complicated than it needs to be!

Thanks for any help.


texts: How to use lazy_builder to load and replace content asynchronously

texts:
In my tests, I was able to make content be loaded asynchronous with

function callback_function() {
    sleep(5);
    return ['#markup' => time()];
}

...

$build['timestamp'] = [
  '#lazy_builder' => ['callback_function', []],
  '#create_placeholder' => TRUE,
];

In the case above, drupal renders whatever it wants to render and after the 5 seconds from the sleep it prints the timestamp. So it runs asynchronous.

But when having placeholders attached, it will waits 5 seconds before rendering everything, its not asynchronous. Like the code below:

$build['#markup'] => 'The timestamp is [timestamp]';
$build['#attached']['placeholders']['[timestamp]'] = [
  '#lazy_builder' => ['callback_function', []],
  '#create_placeholder' => TRUE,
];

My ultimate goal is to have for example "The timestamp is 1498827840" and then get it replaced to "The timestamp is 1498827845" after the 5 seconds sleep.


texts: Custom form calls different form in modal, submit/ajax callback of second form not called

texts:
I created 2 forms:
dms_gift_voucher/src/Form/GiftVoucherForm.php
  ...

  /**
   * {@inheritdoc}
   */
  public function buildForm(array $form, FormStateInterface $form_state) {
    ....

    $form['submit'] = [
      '#type' => 'submit',
      '#value' => $this->t('Submit'),
      '#attributes' => [
        'class' => [
          'use-ajax',
        ],
      ],
      '#ajax' => [
        'callback' => [$this, 'confirmGiftVoucher'],
        'event' => 'click',
      ],
    ];

    // Dialog box dependency
    $form['#attached']['library'][] = 'core/drupal.dialog.ajax';

    return $form;
  }

  ...

  /**
   * Callback for opening the modal form.
   */
  public function confirmGiftVoucher(array $form, FormStateInterface $form_state) {
    $response = new AjaxResponse();

    // Get the modal form using the form builder.
    $modal_form = $this->formBuilder->getForm('Drupal\dms_gift_voucher\Form\GiftVoucherConfirmForm', $form_state->getValues());

    // Add an AJAX command to open a modal dialog with the form as the content.
    $dialog_options = [
      'width' => 'calc(100% - 20px)',
      'dialogClass' => 'modal--gift-voucher-confirm',
    ];
    $response->addCommand(new OpenModalDialogCommand($this->t('Test'), $modal_form, $dialog_options));

    return $response;
  }

dms_gift_voucher/src/Form/GiftVoucherConfirmForm.php
  ...

  /**
   * {@inheritdoc}
   */
  public function buildForm(array $form, FormStateInterface $form_state, $values = []) {
    ...

    $form['submit'] = [
      '#type' => 'submit',
      '#value' => $this->t('Confirm'),
      '#weight' => 100,
      '#attributes' => [
        'class' => [
          'use-ajax',
        ],
      ],
      '#ajax' => [
        'callback' => [$this, 'submitModalFormAjax'],
        'event' => 'click',
      ],
    ];

    // Library
    $form['#attached']['library'][] = 'core/drupal.dialog.ajax';

    return $form;
  }

  ...

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {
    // Never called!
  }

  /**
   * {@inheritdoc}
   */
  public function submitModalFormAjax(array &$form, FormStateInterface $form_state) {
    $response = new AjaxResponse();
    // Never called!
    return $response;
  }

The first form works correct, the submit is called, the ajax callback renders the modal with the 2nd form.
But when i submit the 2nd form, nothing happens, no submit, no ajax callback called from the 2nd form.
How can i fix this? Any suggestions.
(Every example of drupal modal forms start with a link trigger with routing, but i find it strange why this approach doesn't work).
EDIT: As suggested in the comments, routing info:
dms_gift_voucher.routing.yml
dms_gift_voucher.gift_voucher_form:
  path: '/dms_gift_voucher/form/gift_voucher'
  defaults:
    _form: '\Drupal\dms_gift_voucher\Form\GiftVoucherForm'
    _title: 'GiftVoucherForm'
  requirements:
    _access: 'TRUE'

dms_gift_voucher.gift_voucher_cofirm_form:
  path: '/dms_gift_voucher/form/gift_voucher_cofirm_form'
  defaults:
    _form: '\Drupal\dms_gift_voucher\Form\GiftVoucherConfirmForm'
    _title: 'GiftVoucherConfirmForm'
  requirements:
    _access: 'TRUE'


texts:
I have a view with a list of nodes of a certain type sorted by a custom field.

Is there any way to put a ranking number on the output of a view?

Thanks!


texts: Sorting a view by criterion1 OR criterion2

texts: Is there a way to sort a view by criterion1 OR criterion2? In a view's filter setting there is an option to and/or/rearrange - is there something similar for sorts?


texts:
I was checking the access logs and could spot that most of the pages were linked from other sites with different cases. node/add is same as NODE/ADD and all combinations of upper case + lower work. Is there any way to avoid this so NODE/ADD is thrown a 404 ?

Global redirect has an option for Case sensitive URLs, but I believe its for URL alias and not menu hooks.


texts:
I have two databases I connect to with drupal. Does drush sql-dump back up all databases defined in settings.php?

If not how can I create dumps of both databases?

I've attempted using the --database=db_to_backup option but it throws an error:

sh: 1: Syntax error: "&&" unexpected
Database dump failed

Many thanks


texts: Need to alter "No Paragraph added yet. Select a Paragraph type and press the button below to add one." message - Paragraph Module

texts: I am using paragraph bundle and I want to alter this message with my custom text "Please click on below button to add data".


texts: How do I make a user's core user contact form visible as a block on the sidebar of content they created?

texts:
On my site, authenticated users with role Job Seeker have a permission to create content of the content type resume. Resume's are displayed in a view block. Said block has NO role restriction. I want a different type of authenticated user, Employer, to be able to see the user contact form for the user who created the resume content on the sidebar of the resume's content page.

This would allow for a contact method between Employers and Job Seekers where the Job Seeker's contact info is not revealed to the public.


texts:
I have a custom field on my user profile pages where users can enter their Twitter user name. When the user's profile is rendered (either on the user profile page itself or via views) I would like to rewrite this field so that it links to the user's twitter profile following the pattern http://twitter.com/[field_twitter_name].

I discovered the twitter username project on DO yesterday (https://drupal.org/project/twitter_username) and this would help me accomplish the objective, especially for new users. However, we currently have ~900 active users on our site.

Is there a way to create a new field and update its tables with the existing user's twitter names? Or is there a way to change the field type from it's current setting of "Text field" to the new type made available by the twitter username project "Twitter username"?

Any help would be greatly appreciated.


texts: Changing the key/value pair of a field list in Drupal 7 once content has been added to the site

texts:
I have a field list on my content type that I need to edit. Specifically I just need to change one of the key/value pairs. Unfortunately there's already content in the site so I can't just change it in the admin interface (it gives me an error that there are already records that use this).

I'm looking through my database (mysql) and I can't even find where the key/value pairings are stored. I can see the keys being attached to my nodes and can manually change them there, but that doesn't solve my underlying problem.

So my question is two-fold:

1) where is the table to edit field lists for a content type?

and

2) what's the preferred way to change a field list key/value pairing once content has been added to the site (too much to delete and start from scratch)?

Thanks!


texts: Custom node template with related node teasers

texts:
I have a custom node (article) template file working fine, and I want to show related nodes (events) in their teaser format. I have been doing this in my node--article.tpl.php file like this:

foreach ($field_related_event as $event_node){
    print render(node_view(node_load($event_node['nid']), 'teaser'));
}

I wanted to add a second teaser format for events (teaser_fancy) and downloaded "Entity view modes" thinking I would be able to do something like this:

foreach ($field_related_event as $event_node){
    print render(node_view(node_load($event_node['nid']), 'teaser_fancy'));
}

But now I read that node_view can only use teaser and full, and it's probably not a good idea to render relationships in my template this way. What's the recommended way to go about this? Should I create an Events Fancy view and use views_embed_view instead?


texts: How to add the relationship for tittle of content type of other in view of different content type.


texts:
As a newcomer to Drupal 7, I'm trying to understand how auditing and events can be used together.

For example, I have a content type of document, which is basically a name field and a file.  I would like an email to go out whenever an authenticated user downloads the document and also have a report that shows how ( and when ) downloaded the document.  Does anyone have any suggestions on the best way ( modules, design patterns, etc ) to go about setting this up?

Thanks in advance


texts: Can I use a token within a custom token?

texts:
I am trying to create a custom token that modifies another token.

$theDomainName = "[domain-name-raw]"; //Pull in the other token
$removeCounty = str_replace(" County", "", $theDomainName); //Replace " County" with nothing
$countyPlus = str_replace(" ", "+", $removeCounty); //Replace " " with "+"
return $countyPlus; //Return modified token as new custom token to be used through out site

If I use [domain-name-raw] for $theDomainName, my result is the original token (e.g. "Cerro Gordo County"). If I type what [domain-name-raw] should output for $theDomainName (e.g. "Cerro Gordo County"), my code works fine (it outputs "Cerro+Gordo"). What is going on?

I am using Drupal 6.


texts: Rules: how to display the value of variables?

texts:
I use the Devel module on Drupal 7 to debug some rules of my site but I can't debug without knowing the value of variables I created.

In the case, I have a loop where I sum different values and at the end of the loop I store that in a second variable that I compare to fixed parameters.

Is there something that can show me every value of the rules variables?

In the default log I have only events but I don't know anything else...
Thanks!


texts: Adding custom designed product to cart in drupal commerce

texts:
Hi I am developing a site for T-shirt designing. I have a custom UI where all the T-shirt products in my site are loaded. customer can design the T-shirt according to their needs like changing color,adding text/image etc using my UI. At the end of UI I have a buy button where user can buy the custom product. How can I add this product to my Drupal cart when user clicks buy button? I have the product id and price loaded in my hand and am using Drupal commerce module in my site.

This is my button form

<button type="submit" class="btn btn-primary"  name="button">
                                Buy Now! </button>


texts:
I want to change the source order of the "Create new account"/"Forgot your password?" links and the Submit button, so the Submit button comes first.

I am able to modify certain contents of the login block by using this function.

function THEMENAME_form_user_login_block_alter(&$form, &$form_state){
  $item = array();
  if (variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)) {
    $items[] = l(t('Create new account'), 'user/register', array('attributes' => array('title' => t('Create a new user account.'))));
  }
  $items[] = l(t('Request new password'), 'user/password', array('attributes' => array('title' => t('If you forgot your password, click to request a new password via e-mail.'))));
  $form['links']['#markup'] = theme('item_list', array('items' => $items));
}

And this template does pick up the changes and allow for markup changes around the form, but simply outputs the form in one variable. How do I modify the $content variable and print each element out separately to swap item locations?

block--user--login.tpl.php

  <?php print render($title_prefix); ?>
  <?php if ($block->subject): ?>
    <h2<?php print $title_attributes; ?>><?php print $block->subject ?>

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

<div id="user-login-block" class="block block-<?php print $block->module ?>">
  <div class="content"<?php print $content_attributes; ?>>
    <?php print $content ?>

This example uses straight markup out of Firebug and it does function, but there should be a cleaner way to do this by printing variables that already contain the markup, and that doesn't remove the "Create new account" option if the site registration is restricted.


texts: hook to redirect user before they create node?

texts:
I'm running a db_query to check if the user has taken a specific action. If they haven't, I'm redirecting them to the page where they can take that action.

function my_special_module_node_view(...) {
   db_query(...);

   if( $fails ) {
     drupal_set_message(t('Error'), 'error');
     drupal_goto('new_page');
   }
}

hook_node_view is mostly working right. It redirects from most pages except any user account pages. The only problem is it doesn't catch when they are trying to create a node. What hook can I use to redirect the user before they view the node creation form?

Update

I've switched it to hook_page_alter. This catches all URLs including the node creation form, which is progress. I had to add in some logic to skip certain paths (including the new_page path to avoid an infinite loop). It seems to be working much better, except if the user does not have access to a page it still ends up in an infinite loop. My current code:

function my_special_module_page_alter() {
  db_query(...);

  if( $fails ) {
    $base_path = arg(0);
    if( !in_array($base_path, array('new_page', 'user')) ) {
      drupal_set_message(t('Error'), 'error');
      drupal_goto('new_page');
    }
  }
}

Any ideas why the pages the user does not have access to end up in a redirect loop? Is there a simple function I can call within hook_page_alter that checks "if user_has_access_to_this_page"?


texts: How to edit order summary field labels on paypal page

texts:
My company sells online services and I have been able to limit my customers to buy one service at a time with the help of rules. However, when my users are directed to paypal, following information is presented to them on the paypal site:

Is there a way I can edit paypal label ‘item price’, as can be seen in the above shot, to something else such as ‘service charges’. Also can I remove the quantity field all together, as my users are unable to purchase more than one service at a time. No point to show the quantity to them.

I am using following code to remove quantity field, but it still appears on paypal. Also, I am unable to find the field label: item price in this hook.

function checkout_forms_commerce_paypal_wps_order_form_data_alter(&$data, $order) {
unset($data['on0_1']);  //to remove options
unset($data['os0_1']);  // to remove quantity field
}


texts: Placing header element inside list element

texts:
I am using the Group: Combine fields filter (grouped) in Views and I want to separate my first few list items from the last two with a header before the last two. Is it possible without theme functions, like with some field in Views I do not know about?

Found these similar, but they use theme functions.

Add additional element to exposed view form?
https://www.drupal.org/node/893392


texts:
How can I add this action in Rules? This is my pseudocode:

1 total=0;
2 //loop through each line item {
3 //get quantity of each product
4 total = total + line_item_quantity;}
5 if total =< 2 then total = 0;
6 total_cost = total * $1.50

I think I can get everything working with the Conditional Rules module. but I cannot get

x = x + y

to work on Rules because they say that the variable already exists.

Also, how do I use conditions on entities like calculated shipping cost? What's the variable name?


texts:
I have a new installation of Drupal 7. I was having a problem with administrative overlay URLs having URL encodings in them, which I asked about here. Another user suggested I confirm that I have clean URLs enabled.

When I went to Home » Administration » Configuration » Search and metadata » Cleanr URLs, all I see is this:

  Use URLs like example.com/user instead of example.com/?q=user. If you are directed to a Page not found (404) error after testing for clean URLs, see the online handbook.

The message was followed by the button, "Run the Clean URL test." that seems to do nothing: The browser tells me it's loading something from the site, but the page doesn't change.

I have no options to enable or disable clean URLs.
I'm pretty sure it's disabled, because when I go to website.com/user, I get a 404.

How can I troubleshoot this?


texts:
I have a Drupal project on heroku and it works fine, until a dyno restart.
After that, the Css and Js on the Drupal site stop working.
Whenever that happens, I have to do a flush cache to get the site working. From my understanding, flushing cache creates files that Drupal uses for Css and Js. Since the storage system on Heroku is ephemeral, after dyno every restart I lose that file. Thus, I am forced to do a cache flush to get that file again and make everything on the site work. Is there a way around this?
Is there a way to change the folder location of the temporary file that is created?


texts:
After running mysqlcheck -udbuser -p --auto-repair --optimize --databases mydrupaldb, I got the following error.

  cache_form error: myisam_sort_buffer_size is too small

Someone has suggested that it should be solved by increasing sort_buffer_size parameter, for example with myisamchk -r -q cache_form.MYI --sort_buffer_size=2G. Executing this command causes the following error.

  myisamchk: error: File 'cache_form.MYI' doesn't exist

How can I fix it?


texts: Additional field settings without creating a new field type

texts:
I'm trying to add 2 options to the field settings of all fields of a particular field type, in this case file field. To add the fields to the form I'm using MYMODULE_form_field_config_edit_form_alter() instead of extending the base class so it will work with other modules and I won't need to use a custom field type.
Using ThirdPartySettings to store the data doesn't add it to the base config for the field therefore the settings won't be automatically available to other modules.
e.g.
function MYMODULE_form_field_config_edit_form_alter(&$form, FormStateInterface $form_state, $form_id) {

  $field = $form_state->getFormObject()->getEntity();
  if ($field->getType() == 'file') {

    $settings = $field->getSettings();

    $form['my_checkbox'] = [
      '#type' => 'checkbox',
      '#title' => t('My Checkbox'),
      '#default_value' => isset($settings['my_checkbox']) ? $settings['my_checkbox'] : '',
      '#description' => t('Check to check my checkbox.'),
    ];

    $form['#entity_builders'][] = 'MYMODULE_form_builder';
  }
}

function MYMODULE_form_builder($entity_type, FieldConfig $field, &$form, FormStateInterface $form_state) {
   // What goes here? I can't do $field->set() on properties which don't exists.
}

I've tried setting up a schema file as src/config/scheme/mymodule.schema.yml but I'm not sure how to extend the relevant settings in core/modules/file/config/schema/file/schema.yml.
base_file_field_field_settings seems to have the relevant entries I'm wanting to add to. Do I need to add a class or an install yml file?


texts:
well I have a content type in which I needed about 6 taxonomy fields..

it was working at first but suddenly it stopped showing taxonomy fields in node display page.

I used Field Permissions and Field Group modules and I show the fields in content type's display management. but nothing changed!

although I can use views to get and show the data but it may be an error in my drupal core or something.

Update: I disabled field group and field permissions.. every thing works fine now! but cause I need these modules I should continue trying!


texts: Omega theme on Ipad slides across and disappears

texts: I'm using the latest Omega 3 theme on my drupal 7.32 site caerleonlodgehillprimary.org. I notice on the ipad2 (also Ipad Mini), if you swipe across to the left, the entire page disappears and you are left with a blank page. Has anyone got any ideas why that is? I was wondering whether its some kind of corruption in the footer, the last thing I added was to add a Contact Us block showing the address and email in the footer (which is a View based on the Contact Us node), I noticed in portrait mode, the email spills over into the next block. any idea?


texts: Change CKEditor config.js without modifying module code?

texts:
I'm using the CKEditor module and I need to adjust config.js in the module's root.  The problem is I don't want to make changes to any files part of the module because all those changes will get blasted when I do a code update.

How can I apply changes to CKEditor's config.js without modifying the module's copy of config.js?


texts:
I am loading a user via user_load_by_name() in my themename.theme. Now I would like to view some of the fields in my template. But how to get/render the fields?

I can use user_view() to render the whole user. But I would like to access only some fields and make them available in the template.


texts: Displaying Organic Group members based on a Views Contextual Filter

texts:
The end goal here is to get a list of organic group members based on a contextual filter.

The path for the view is groups/%/members, where the contextual filter is "OG membership: Group ID" and defaulted to custom PHP code. (Because the "Current OG from Context" wouldn't work.)

The custom PHP code is as follows (based off of this solution on d.o):

 if(arg(0) == 'groups' && arg(1) != null){
  $node_path = drupal_get_normal_path('groups/'.arg(1));

  $node_id = substr($node_path, 5);

  // Check if node referenced by arg(1) is a group
  if(og_is_group('node', $node_id)){
    return $node_id;
  }
  else {
    return null;
  }
}
else{
  return null;
}

There is a relationship to OG membership: OG membership from User there also. It makes no difference if the contextual filter is referencing the relationship or not.

If I "Preview with contextual filters" in the Views UI with a group's NID, the view works. So I know it's just the default value of the contextual filter.

I have something very similar in the "No Results Found" section for troubleshooting purposes, the only differences is it outputs some additional strings to clarifiy where the returns are firing. When I save the view and go look at the page, it returns "No results found" but also returns the correct NID/GID from the PHP. My suspicion is that the PHP code isn't validating with views for some reason.

The view needs to be a page, so I can't use the default block view provided by the OG module. ("OG members (user)")

The only thing I am set on is a working solution, so if you have a suggestion on doing it differently, I am open to other ideas.

Contextual filters I have tried that do not work are:
-Content ID from URL
-OG Group from context
-Raw value from URL

Any help or point in the right direction would be greatly appreciated.

Thanks!


texts: How can I use a custom table as a node type?

texts:
I am reasonably new to Drupal, I have written a couple of basic modules by following the excellent videos from buildamodule.com

Now I need to somehow integrate an existing table into a drupal site.  I would like this table to be accessable as a content / node type to the rest of the drupal system.  I do not want to add this as a content type to drupal and use the table per field system drupal has as I already have the table structure and need to be able to update the data in this table from an external source.

I tried creating a new content type in a module and was able to create a schema using the schema module.  However when i use  field_create_field and field_create_instance I end up with a seperate set of fields.

How do I create a new content type in a module that can use an existing table for its data ( even if I need to provide access functions in my module)?

Is there a good tutorial somewhere that someone knows of?


texts: How to always require email verification before accessing a page?

texts:
I have a custom page defined by hook_menu.

I want signed in users to be required to verify their email every time they want to access it. The page will have buttons on it that would allow someone to export all the data related to the account.

I've looked around for existing modules that could provide this. This looked the most promising: Email Required. However this only happens on their first visit to the page. So once the accounts email is verified the user would always have access to it.

How can I have people verify their email every time before allowing them to access the page? It would be good if the verification link in the email expired after a period of time if it isn't used for security.

Any pointers are much appreciated.


texts: overriding ubercart - add to cart button

texts:
I try to override add to cart button with hook form alter in custom module with this function but I got an error Fatal error: fatal flex scanner internal error end of buffer missed in. What can be the problem?

function uc_button_form_alter($form_id, &$form_state, $node) {
  if ($form_id == 'edit-submit-' . $node->nid) {
    $form['submit']['#attributes']=  array(
      'class' => 'node-add-to-cart',
      'xxx' => 'xxx',
    );
  }
};

Thank you


texts: How to notify a user who's mentioned in a comment?

texts:
I'm using the Message module to notify users when someone commented on one of their nodes. I'd like to extend this mechanism and also let users know when they're mentioned (e.g. @user) in a comment.

I tried setting up the following Rule:

Event: After saving a new comment.
Condition: Text comparison: comment contains @.
Action: Create a new entity: message.

I should now determine whether the text after @ is a user and, if so, store it to use it in the action. The problem is that I don't know how to do that. Another tricky constatation is that the username can contain spaces. After asking How to prevent users from being registered when their username contains a space?, I've made sure that usernames never contain spaces.

Is it possible to solve my problem by working on with Rules or is there another solution (coding, I suppose)?


texts: notify after event in followed node by follower

texts:
I use the Flag module in Drupal 7, and created a flag (for nodes) with  "follow" as name of the flag.

I want to add new event on the followed content by user, send notify for follower by php code or display counter of new event unread to user.

How can I do this?


texts: Changing the link in a Feature box to an external link

texts:
I am a Drupal beginner working with an already created site.

That said, I have been trying for days to change the text within the feature box to an external link. Currently, all of the text in the feature box links when clicked to an internal site path. I understand how to change the text to incorporate a link, but I want to continue to have all of the text in the box clickable as an external link, including the Title.

In the Links To dropdown of the Menu Attributes area I have it set to -None- but it still is redirecting to the Home page. I don't know how to add an external link in this dropdown, or using path aliases (I do understand nodes and path aliases for internal links). I have also tried Primary and Secondary links. Is there any super simple way to redirect feature box text to an external link?

Sorry for the long description, thanks for your help in advance.


texts: Drupal 7 change submit for _form_user_pass_alter()

texts:
I'd like to change the submission function for TEMPLATE_form_user_pass_alter()

function TEMPLATE_form_user_pass_alter($form, &$form_state) {
  $form['#submit'][0] = 'new_user_pass_submit';
}

This changes the value in $form, but it still will not submit using the new function.

Do I have to treat this password reset differently than other forms?

My ultimate goal is to send different emails for password resets based on the user's role,and if anyone has any better ideas I'd love to hear them!


texts:
I'm working on a project that requires a CSV of speaking engagements to be migrated to Drupal. With Migrate, I've been able to migrate over basic fields, like name, title, etc.

However, the speaker field is a field collection, which is driving me nuts. While the field collection allows unlimited speakers, the CSV only has one per event. I've tried using the node_insert hook, as described here but to no avail. Is there a better/easier way to migrate a single speaker into the speaker field collection?


texts: How to handle enabling new modules with Drush via makefile

texts:
At work we are moving to getting our new sites set up in git and doing local development. So far I've created a drush make file along with an installation profile, and I have this scripted via puppet so that when a user does a fresh clone of a repository it will download all of the packages and run a basic site install. This works OK.

Now, my question is for when I need to use a new module for a site. For example, we build a new module for the site. I want the other developers to pull from git and have the new module automatically installed. Adding it to the drush make file will only cause it to be downloaded, and running 'drush si' will cause the site to be reinstalled, wiping out all of the data.

What's the best way to accomplish this?

Edit

I feel I haven't explain this properly. I'm looking for a way to automatically enable modules based on the makefile entries in drush. The idea is the user checks out a project, and then I'll have puppet run 'drush make' and 'drush si' if no settings.php file exists. What I need to figure out is for when the next time the user does a pull and we've added a new module, how to have that automatically enabled through some script. If I need to I'll write something to parse the makefile and run 'drush en' manually, but I'd like to find something that is pre-built to do this.


texts: How to link views content nodes to custom URL

texts:
I have nodes in a view using a custom view mode (using Display Suite).  I'm doing some AJAX stuff when the user clicks on a particular node, so I need to wrap the nodes in a custom URL, like somenode/nojs/(nid).

I feel like I should be able to do this in Views, since fields can link to the content.  Is there a way to get the node to link to a custom URL?


texts: How to automatically create nodes from a bulk file upload

texts: I've got a hundred or so files (mixed types: pdf, ppt, doc, etc). I want to be able to upload these to my server, and then point my D7 site to the directory on the server that contains all of these files so that the site automatically creates a node for each file, with a single, different file attached to each node. Is there a module that will do this for me?


texts:
We're rebuilding our bilingual site on Drupal 7 and would like to use entity translation since it seems that will make later migration more reasonable. We've also been using Disqus for commenting for years now, and it works really well for moderation and not having to deal with the potentially huge amounts of data should spam start flowing in--I used Drupal comments and Mollom with bad results years ago.

The question is, how can we have a Disqus or similar third-party commenting thread on each version of a translated post in their own language without separate node IDs? Has anyone cracked this yet?

UPDATE: We may have come across a solution, but I'd welcome others' thoughts. The Disqus multi-lingual website page describes using the this.language JS variable to dynamically load the Disqus embed in a different language on per page basis.

var disqus_config = function () {
this.language = "ru";
};

The solution would be to use javascript to change that variable depending on the language selected for the page. So on load this.language = "en", then I select Spanish and it changes this.language = "es".

This seems like a pretty solid solution. Anyone see an issue?


texts: Webservices to create (Register) a new user

texts:
I am planning to write client apps which connects to Drupal 7. I like to create new users through the app, have come across some literatures but I am not sure if the approach is secure and also whether it considers all possible use-cases.

The first link which I came across is this:
https://www.drupal.org/node/1514312

I was able to configure endpoint and successfully post + create user. However, the problem with above approach is, it is not secure because any client app with the POST URL to create user can successfully register a user in the website.

I then followed this link: https://www.drupal.org/node/1871498 through which I created a OAuth authentication context. Below are the configuration details:

OAuth Context:
Context Title: App Name
Signature Method: HMAC-SHA1

The Service configuration:

Endpoint: create_new_user
Authentication:
OAuth Context -> Context created above
Default required authentication -> Consumer key (2 legged OAuth Authentication)
Resources ->
user -> create (Only create in CRUD Operation)
Action ->
user -> request_new_password & register

And I created a new user and provided the following role:

By enabling 2 legged OAuth authentication I make sure that only my authorized app with the consumer key and secret is able to access my endpoint successfully.

Using the following POST request I am able to create user successfully from the REST client:

Post Request URL: http://ExampleWebsiteBase.com/create_new_user/user/register.json

Post Headers:

OAuth:
OAuth oauth_version="1.0", oauth_signature_method="HMAC-SHA1", oauth_nonce="kXZ3iOtGqD7f350", oauth_timestamp="1450257992", oauth_consumer_key="Lq7r.........", oauth_signature="htvy........"

Content-Type:application/json

Post Body:
{
   "name":"SomeName",
   "pass":"reset123",
   "mail":"SomeName@gmail.com",
   "status":"1",
   "roles":[
      "2"
   ]
}

I would need confirmation from experts that this configuration is secure and acceptable.

Questions:

The user created in this process does not has to verify the email ID. How do I configure the webservice so that the user is not created in backend without verifying the email?
How do I integrate Social login - Facebook, Twitter and Google for instance?


texts: How can I load a view inpage using AJAX when a node is flagged?

texts:
I have a view that gives the users the option to flag nodes.  Below this view I need another view listing the results of flagged nodes to show up without the page needing a reload.  My skills are limited to Front end development so I'm unsure how I can do this via AJAX.

I did find this module:
https://drupal.org/project/jquery_ajax_load

I'm not sure how to implement this module since I need this view to commence upon the first flag event(?)

Would someone be able to help me find a solution?

Cheers!


texts: Is the #disabled form element property different from the html disabled attribute?

texts:
Looking at the documentation for #disabled in the form API documentation, one finds this:

  Setting #disabled to TRUE results in user input being ignored,
  regardless of how the element is themed or whether JavaScript is used
  to change the control's attributes.

If I'm reading this correctly, this seems to indicate that this is different from the HTML disabled property.

If I want to make an element disabled, to later enable it via javascript, and have its value come through in $form_state['values'], I should not use this?


texts: Drupal views relationships to an indirect referenced contenttype

texts:
I want to create a view with a field which shows an indirect referenced contenttype (see Design) using Drupal 6.

I have 3 content types: Person, Organization and Workgroup.

Each person is related to only one organization by the node reference field: field_related_org_unit.
Multiple persons can be linked to the same organization.

Each workgroup is related to only one organisation by the node reference field: field_supported_org. Multiple organizations can have the same workgroup.

Now I want a view which displays the information of a certain person (firstname, lastname) and in the same view I wan to show the workgroup which he is indirect related to (sharing the same organization).

So say, Person A is related to organization XYZ.
Workgroup B is related to organization XYX.
I want to show the title of Workgroup in the view.

I tried several relationships in the View, but couldn't get it working.
 see Setup View

Is it possible to realize this kind of setup? Could someone help me out?


texts:
Im allowing authenticated users to add field values on existing nodes on my site using the "Field Permissions" module. I`ve set up the necessary custom permissions in the "manage fields" screen:

However, an authenticated user is never shown the "Edit" button on the node page:

If everything where working, the user should have a "Edit" button to be able to add field values. What`s wrong?


texts: when i want to reinstall the modules i get this error

texts:
Fatal error: Call to undefined function node_type_get_names() in /home/aukhma/public_html/modules/comment/comment.module on line 119

I got a  blank  page  when  I  would try to reinstall the node and the menu  modules.

The cause that pushed  me  to  reinstall those modules is that when I want to create a node for a new content type I can't find my new content type in the "add node" page.  So I did some research and found  a solution that said I need to rebuild the menu. I did that but got no result. I've also cleared the cache multiple times through the dash board.

Please, if any one can help find a solution I will be so happy, and thank you for the quick reply.


texts: Edit/View Tab in Region other than Content

texts:
I'm trying to set up two contexts for use with a sub-theme of Omega.

3 Column Context:
Uses the regions Sidebar First, Content and Sidebar Second. Content is 6 columns wide. The Sidebar regions are each 3 columns wide. This works fine.

2 Column Context
Uses "Content Second" (9 cols. wide) and Sidebar Second (3 cols. wide).

Content Second is an additional region added to the info file in the sub-theme.
regions[content_2] = Content Second

The problem that I'm having is getting the Edit/View tabs to display in that region, the way they do with region "Content".

I've added region--content_2.tpl.php to my sub-themes folder which seems to be working but when I add:

<?php if ($tabs && !empty($tabs['#primary'])): ?>
<?php print render($tabs); ?>
<?php endif; ?>

I get a "Notice: Undefined variable: tabs in include() " refering to that code.

Is it possible to get the Edit/View tabs in any region other than "Content"?


texts: Is it possible to customize the look of Twitter Block?

texts:
Is it possible to customize the look of the Twitter Block module block?

More specifically, I would just like to change the header of the block which by default says "Tweets" and a Follow button. I'd like to maybe add a background image and put different text where that header is.

There doesn't seem to be much documentation regarding this. All I've come across is this snippet from 3 years ago about editing template.php: https://drupal.org/node/1118306
but I don't know if this is still relevant with the current version and whether if that is the solution I'm looking for.

I've also come across this tool called customize-twitter-1.1: https://github.com/kevinburke/customize-twitter-1.1
but also not sure whether this would apply to what I'm trying to do.


texts: How to create a panel for a argument path

texts:
How do you create a panel for a url that looks like product/%nid/title.

The Title should be from the node.
The node paths have already been setup with pathauto.

What i have so far in my panel

The panel doesn't get used on the page


texts: Making columns into sort asc/desc in search api-based view

texts:
I've created a search page using Views and 'search api'. I've got my results showing in tabular format with the labels in a  above the results returned.

But I can't figure out how to make each label/column header a sort. I want the user to be able to click the label in the column header to then sort that column by ascending/descending.

Anyone know how to make that possible?


texts: How to trigger an Action on an Entity from a button in a Views row (without VBO)?

texts: I know actions can be done with Views Bulk Operations (VBO), but I just want a button in each row of a view of entities. When I press the button, the action is executed for that entity.


texts: Migrate to data field with multiple values

texts:
I'm trying to use the migrate module to create products.
My issue is that I need to map data to a field that contains multiple values.

This is the exact case.

Product A has 3 prices,

Stand Price
Price for x to y qty
Price for x yo -1 (unlimited)

Using the commerce price tables module this has created the field data table with 3 fields, price, min_qty, max_qty.

Is it possible to map data to a field that contains multiple columns(values) with the migrate module?

Also the data is coming from another database.

I have not had any success using the addFieldMapping() function in the migrate module.

Regards,
Nathan.


texts:
I am on D7.x

I have not quite figured out how to solve the table prefix problem that was solved with domain access table prefix in the 6.x branch.

I know that I will need separate caching tables for instance, but I'm not quite sure how to allow the table prefixing when everything is based off the same settings.php file.

Thanks for your help.


texts: How to disable access to file page (view display mode = full)?

texts:
I want to disable access to the view display page of file by url like file/fid.

What's the good way for this? I have tried to use the hook_node_view() but it not called for the files.


texts: Can we run multiple Ajax Submit Buttons on one custom form with different ajax callbacks?

texts:
Because In my case, the first ajax button works however next doesn't and it reloads the page.

    $form['step_1']['submit'] = array(
        '#type' => 'submit',
        '#value' => 'Search',
        '#name' => 'first_submit',
        '#submit' => array([$this, 'first_submit']),
        '#ajax' => array(
            'callback' => '::firstCallback',
            'wrapper' => 'wrap-callback',
            'method' => 'replace',
            'effect' => 'fade',
            'event' => 'click'
        )
    );

    $form['step_2']['submit'] = array(
        '#type' => 'submit',
        '#value' => 'Continue',
        '#name' => 'second_submit',
        '#submit' => array([$this, 'sectond_callback']),
        '#ajax' => array(
            'callback' => '::secondCallback',
            'wrapper' => 'wrap-callback',
            'method' => 'replace',
            'effect' => 'fade',
            'event' => 'click'
        )
    );


texts:
I have 3 languages in my Drupal 8 site. All works fine, without the language switcher.
Replacing German with DE worked, but replacing English with EN didn't work.

How can I replace English with EN in Drupal 8?


texts: Looking to change the header from a color to an image

texts:
I am using the NewsCenter theme for my Drupal site, and we have had a new logo/banner designed for our website that I want to implement -- but it's not as simple as just uploading it and replacing the old logo.

This is the header of our site as it stands currently:

This is what I want to get to:

Also, with the final option, I still need to have users be able to click in the banner and get directed 'Home' -- I presume that to do this I would still upload a logo.png, but that it would just be a large transparent rectangle.

Thanks!


texts:
Suddenly the command in the title decided to stop working.

[Symfony\Component\Console\Exception\CommandNotFoundException]
Command "webform-libraries-download" is not defined.

I'm on Drupal 8.4.2 and PHP 7.1.11.

How can I troubleshoot this?


texts:
I've unfortunately run into a rather major issue on an existing Drupal site.  I recently applied the updated from core 7.12 to core 7.14. Since then, I can create new content in the admin panel, yet I cannot edit or make any changes to existing content.  I see the following errors:

  Warning: array_merge() [function.array-merge]: Argument #1 is not an array in _form_set_class() (line 4134 of .../form.inc).
  Warning: implode() [function.implode]: Invalid arguments passed in theme_radios() (line 2809 of .../form.inc).
  An illegal choice has been detected. Please contact the site administrator.

I deleted and reverted the site back to how it was before running these updates, yet again, after updating Drupal core, I still can't edit any content.  Is there any direction that can be given in resolving this issue?


texts: Counter is always set to 1 and not incrementing

texts:
I want Anonymous users to redirect to login page if they have read three articles as trail. I wrote this code but the counter on any article is always set to one.I guess its initializing again and again. Can anybody please help with code.

<?php
function track_node_view($node, $view_mode) {
if (user_is_anonymous()) {
  if($node->type == 'article' && $view_mode=='full'){
      static $counter = 0;
      if($counter <= 3) {
        $counter += 1;
        dsm($counter);
        drupal_set_message($counter);
      }
      else {
        drupal_goto("user/login");
      }
   }
  }


texts: What is the skeleton structure for a Drupal 7 module?

texts: What are the files necessary for building a Drupal 7 module?  What are the requirements for constructing a basic .info file? The essence of this question is to provide a skeleton for building a basic Drupal 7 module from scratch.


texts: What is the machine name for the Date Posted?

texts: I'm using Views and have it set to fields. Can anyone tell me what the machine name of Content: Post date is? I used Time ago in my selection.


texts: Error when running update.php about field_data_body existing

texts:
DatabaseSchemaObjectExistsException: Table field_data_body already exists. in DatabaseSchema->createTable() (line 660 of /srv/bindings/e27b77cd6512471f902f88e9e0704451/code/includes/database/schema.inc).

Any thoughts on where to track this down? Seems someone decided to delete all the field_body instances on the site and replace them with field_page_body, but I'm not sure why that would cause the above issue during an update.


texts: How to open a link of node in custom region?

texts:
I create a custom region in sub-theme. I have constructed a map, on which there is a markers when you click on a link (Image 1) description opens on a full page (as on Image 2). How to open a description in the custom region? (example of custom region is on Image 1) Also I need to transition link eg http://localhost/node/32 to open map (front page) and opens the description in the custom region?
Someone had to deal with such a task? How this functionality can be implemented?

Image-1

Image-2


texts: Switching file system from private to public makes all inline image paths broken

texts:
I built a site with private file system initially, but now want to switch to public so that I can use performance enhancements like css and js minification as they are not available for private file systems.

The problem is that switching to public changes the file path and breaks all the inline image paths. Any ideas how to do this properly?

Just as an example, with private file system paths show as
mysite.com/system/files/myfile.jpg
this is what was stored by the body field for inline images. These change to
mysite.com/sites/default..../myfile.jpg


texts: I currently have a content type to add locations to the leaflet map and a view for the map itself that shows all locations added. I also have another view that grabs that location data and it currently loads in the bubble popup. Is there a way to actually load a block view of the location data as a popup on the left side of the map?


texts: How to trace down to find where a field has been removed/hidden of a particular node

texts:
I am using a purchased theme provided by 3rd party (it is actually a custom Drupal build comes with their modules and theme). My problem is that image fields are hidden some where in the module(s) provided by this theme.

I am sure that the apartment.field_image is not removed in the template (neither by using any hidden() function nor by non printing the $content['field_image']. I came to this conclusion by observing the $content using Devel module as well as by using standard dpm() function. That field is just not there (node content) at all.

I have also made sure its not hidden in the display settings of this content type its "image".

I have checked rest of the code by searching for preprocess, field_image and image to see if they are manipulating it anywhere. I found many processor functions which were manipulating something else like adding css etc., but but I dint find any traces where they are hiding/unsetting/removing the field.

Please guide me how can I trace it. My mind is just blowing off. Thought I would get good sleep after a week but looks not the case.


texts: How to change date format of a custom entity in an update hook?

texts:
In would like to display the created date of a custom entity in the "short" format, whereas currently it displays in some default format. This is in a module that is already in, production so I need to do it as an update. I've changed the custom entity code so that it looks like this:

    $fields['created'] = BaseFieldDefinition::create('created')
      ->setLabel(t('Created on'))
      ->setDescription(t('When the case was created.'))
      ->setDisplayOptions('view', [
        'type' => "datetime_default",
        'label' => 'above',
        'settings' => [
          'date_format' => 'short'
        ]
      ]);

Then I ran drupal update:entities but it did not change. I was not surprised, because I had read somewhere recently (I can't find it now, sorry) that it had become obsolete & custom entity updates now have to be done in update hooks.

But I am stumped as to how to update it in the update hook. I've tried this

function opencase_entities_update_8016() {
  $update_manager = \Drupal::entityDefinitionUpdateManager();
  $definition = $update_manager->getFieldStorageDefinition('created', 'oc_case');
  $update_manager->updateFieldStorageDefinition($definition);
}

... which did nothing, and then I looked at this documentation which helped me understand it's not the field storage definition that needs updating but the view config. So I made another update hook following the suggestion there, but simplifying it for my own case. I must have got it wrong because the date is still stubbornly showing in the default format. Can you help?

function opencase_entities_update_8017() {
  $update_manager = \Drupal::entityDefinitionUpdateManager();
  $field = $update_manager->getFieldStorageDefinition('created', 'oc_case');
  $properties = array(
    'targetEntityType' => $field->getTargetEntityTypeId(),
    'bundle' => $field->getTargetBundle()
  );
  if ($view_displays = \Drupal::entityTypeManager()->getStorage('entity_view_display')->loadByProperties($properties)) {
    foreach ($view_displays as $view_display) {
      $view_display->setComponent('created', array(
        'type' => 'datetime_default',
        'settings' => ['format_type' => 'short'],
      ) + $component)->save();
    }
  }
}

I randrush updb each time and it appeared to complete successfully. No errors in log.


texts: Access to install.php on existing installation

texts:
I've created an installation profile.
Once the site is created and I return to install.php I can restart the installation profile. How can the install.php file be blocked so that the Drupal already installed message is shown?
When the standard profile is used 3 variables are set in the variable table:

install_profile     s:8:"standard";
install_task     s:4:"done";
install_time     i:1323783143;

When I look at the variables table after I run my custom installation profile only one variable is set as:

install_task    s:23:"install_profile_modules";

What's the correct way to set these variables?


texts: How to save current User Points as field at moment of adding a node?

texts:
The registered users on my website can create nodes from a content type called 'Stuff'. I'd now like to display the author's User Points he/she had when he/she created the node. That means: the value shouldn't be updated when the author's User Points change in the future.

How can I do that? Can I do a similar thing for comments?

Can this be done with a code/dynamic/preprocess field, provided by the Display Suite module?

@arpitr's tip for using the Computed Field module seems a pretty good idea, but as I replied to his answer, I don't know anything about PHP. I tried the following code, but it doesn't work.

global $user;
$entity_field[0]['value'] = "userpoints_get_current_points($user->uid)";


texts: How can I reduce the cache_default table?


texts: is it possible to load data of one block in the tpl of another

texts:
I'm a novice drupal coder and trying to accomplish the following

My scenario is such that i have the template files
block-mymod-1.tpl and block-mymod-2.tpl
respectively.

What i'm intending to do is get the data of block 2 to be displayed in that of 1.

currently $block->subject and $block->content in block-mymod-1.tpl give the subject and content of block1.

Is there a drupal way of overload the $block so that it could hold the subject and content of second block also?

Apparently my google skills were not good enough or i couldn't find a direct answer.

Any positive response would be greatly appreciated..

Thanks n Cheers!!!


texts: How can I change field suffix due to its value

texts:
I have a field which is of type number.

I have a view where this field is shown with its suffix. I want it to change when the value of a field is more than 1.

Is it possible to do something? Maybe some preprocess function or some module?

Thanks for any help.


texts: How to use the Rules module to unset all flags (set x days ago) when cron runs?

texts:
Case: users set flags on content using Flag module (flags are per user, not global).

Requirement: after a period of time the system should automatically unset these flags using Rules module.

The obvious way to do this would seem to be: when cron runs, fetch all instances of flag that have been set, and unset them.

(In actuality, only flags that were created x days ago will be unset; newer flags will be left. But I can't get the basic setup and this will just be a condition.)

    Event: Cron maintenance tasks are performed
    Action: ??

I can't see a way to get/fetch all flags of a certain type that have been set.

(Obviously I could choose the action Execute custom PHP code and write some code against the relevant flag table... but surely there's a cleaner way of doing this..?)

Can anyone help?


texts: How to create a tabbed view in a panel without a menu entry?

texts:
What is my goal?

I'd like to create a view for my users' profile page, similar to the 'Questions' block one finds on the user pages on this website. Instead of the user's questions, I'd like to display the articles he/she created. The users should be able to reorder/filter the articles in the view by clicking on "filter links"/tabs similar to the ones I marked in the underneath picture.

I don't know the exact term for this, but I suppose one calls this a tabbed view.

What is my problem?

I can't find any suitable solutions for this functionality on the internet, but I've read a lot of similar requests. The main problem is that the view doesn't have its own page. That means: it should just be part of the user profile page, which has been overridden with "user_view" (see: How to create a profile page?) into a panels page. (This is exactly why the tabs in @Jhilke Dai's solution don't show up.)

It's also important that the path still contains the user's ID when one clicks on the tabs, because - of course - the Articles view needs this information, namely via the Contextual filter: (author) User uid > Provide default value: User ID from URL.

What did I try so far?

I've already created a view called Articles that displays all the articles that were added by the user. As any view would, it's displayed perfectly in the panel on my user profile pages. My next step was to add the tabs to the view. I followed @Jhilke Dai's answer to the letter, but as I mentioned before, the tabs don't show up when I don't give the Master display a normal menu entry (that's not what I want).


texts: How Change the Style of views based on user option

texts: I have a set of products into grid view. I need to create a two tabs one for grid view and list view(swipe view). How to create like this using views in drupal 7?


texts: Why is redirect after login not working?

texts:
I use Ctools Modal to show the login form to users in an overlay. If a user enters right data then he is logged in and the page is refreshed.

The code:

function login_overlay_menu() {
  $items['login-overlay'] = array(
    'title' => t('Sign in'),
    'page callback' => 'login_overlay_callback',
    'page arguments' => array(),
    'type' => MENU_CALLBACK,
    'access callback' => TRUE,
  );
  return $items;
}

function login_overlay_callback($js = TRUE){
    ctools_include('modal');
    ctools_include('ajax');
    $form_state = array(
      'ajax' => TRUE,
    );
    $output = ctools_modal_form_wrapper('login_overlay_form', $form_state);
    if (isset($_GET['destination'])) {
        $output[] = login_overlay_redirect($_GET['destination']);
    }
    else {
        $output[] = ctools_ajax_command_reload();
    }
    print ajax_render($output);
}

function login_overlay_redirect($path) {
  global $user;
  if (isset($languages[$user->language])) {
    $options = array('language' => $languages[$user->language]);
  }
  return ctools_ajax_command_redirect($path, 0, $options);
}

The Catch:

It works well for right data entered at first attempt. However, if a validation fails, then the form is rebuild inside the overlay. and then if the user submits the form, he is logged in but the page is not refreshed (which is very important).

When I debugged the JS code I found that the value of Drupal.settings.ajaxPageState.js changing is the only difference before and after the validation fail.

Before: it is an object containing list of all js files loaded for that page.
After: it is an empty array. (Array[0]).

THE QUESTION:
I am not even sure if this is what causing the error. However if it is, then what may be causing this to happen? OR if not then what may be causing the page refresh to fail?


texts:
Lets say I have two (mysql) databases drupal and book_data.

The book_data database has a table called books with three columns: isbn, title, pages.

My user entity has a field called field_isbn where every user may enter multiple isbn numbers of books he read.

The next step would be to tell views about the books data structure some how.

In the best case views would allow me to add a relationship between the field_isbn and book_data.books.isbn field so I am able to:

sum up the pages to see how many book pages a user has read
sort/filter for books.title
expose theses filters

Is this possible at all?


texts: Safe to delete cache_form table while site is in maintenance mode?

texts:
My site has a very large database of 100MB, most of this is in a table called cache_form.

I've tried clearing the cache. When I try and run the cron I just get a white screen.

My site is in maintenance mode, is it safe to delete the contents of this table in PhpMyAdmin? There are clearly some other issues that I need to look into but is it safe to do this as a short term measure to get the site back on its feet? I've had to put it in maintenance mode as aspects of content creation have stopped working properly.


texts:
I made a copy of one of my drupal sites and I'm attempting to set it up to use a different database but for some reason it's ignoring changes to my settings.php file. My settings.php file is in sites/default/settings.php and contains the following

$databases['default']['default'] = array (
        'database' => 'my_db_database',
        'username' => 'my_db_user',
        'password' => 'my_db_password',
        'host' => 'my_db_host',
        'port' => '3306',
        'driver' => 'mysql',
        'prefix' => '',
        'collation' => 'utf8mb4_general_ci',
);

However the changes I made to it don't seem to take. It's still using the old database. As a test I even put in incorrect information and tried commenting everything out to see if I can break it, but there was no effect. I also checked to make sure there was no local.settings.php file.

Is there something that needs to be done to reload the settings.php file. If not is there a way to see what settings.php file is being used in case there's another file overriding it?

UPDATE: Turns out the issue was a dummy mistake on my part. The domain was pointing to the wrong server. However I'm not closing this question because I believe these answers could be helpful to others in similar situations.


texts: Remove XMLRPC to avoid vulnerability exploit

texts:
How is xmlrpc.php from Drupal core affecting functionality?

Given the fact that a vulnerability was discovered for it, details in this article

is it safe to remove xmlrpc.php file?
Is it bad practice? If so, why?
Is there any way to neutralize this security risk without removing
this file?


texts:
I'm running into issues with caching on my Drupal 7 site, where it seems that users are receiving stale pages, despite not having "cache pages" or "cache blocks" settings enabled. There is no additional server-side caching enabled. I've cleared the cache via drush cc all, as well as clearing the cache through the UI.

After clearing the cache, and with js aggregation enabled, I've pulled up pages where I receive an old version of the js. With aggregation turned off, I get the new js, as expected. Turn aggregation back on and pull up the page in an incognito window, and I get the old js.

However, even with aggregation turned off, I've also seen in our logs that we're getting "Page not found" messages for expired, aggregated js files. This indicates to me that users are getting served pages with references to these old files, though I'm open to other possibilities.

The headers for our homepage include Cache-Control: no-cache, must-revalidate and an Expires value in the past. The headers for our main.js file include Cache-Control: max-age=1209600, an ETag value, and an Expires value set to 2 weeks from now. I thought that by clearing Drupal caches, there would be an update to the ETag value that would force users to download an updated asset. Our hosting support has suggested that the settings on these assets may be impacting the upstream cache (I'm assuming they mean the cache on the homepage, for example).

So it seems like there is page caching that's happening on some level. Since I don't have server-side caching or page / block caching set through Drupal, it seems that the cache settings on the assets are impacting page cache.

Any input or thoughts on troubleshooting would be appreciated!

UPDATE: In paying more attention to the details of aggregated files and cache clearing, today after clearing the cache, I had an updated, aggregated CSS for a while, and non-aggregated JS with a cache-busting ?examplestring appended. In loading the site a few hours later, I'm being served the old aggregated CSS with the new non-aggregated JS. So it's got to be something wrong with how Drupal includes what it determines to be the newest version of the aggregated files.


texts:
I am porting the Disqus module to Drupal 8.

The new routes are working fine, except for the page title, which always displays "Error" instead of the desired title. I have already implemented hook_menu().

What am I doing wrong?


texts: Provide several download option for same image in Drupal 7

texts:
Would anybody have any idea of how to create several download option of the same image in Durpal 7.

The sample website is: http://www.travesto.com/content/101jpg-anime-animated where several download option is enabled.

I would like to create a similar option for my birthday photos. I think may be views module is used here. BUt not sure. If anybody have any idea of doing this. plz help me....


texts:
Background

I'm trying to understand the SQL queries that Drupal generates when I select different content to be displayed on my site so I can write my own php filters.

Issue

I see this in the query every time

SELECT...
FROM
{node} node
WHERE...

Question

What does the {node} mean does it refer to the content type I'm using?


texts: hook_block_view called multiple times per request

texts: I am creating a module for Drupal 7 that implements the hook_block_view. I make a call to watchdog in the hook method and I noticed (while debugging) that the the watchdog method is firing three times per page refresh. Is this normal, or is it something I should be worried about. Since each call to the method makes a database query it seems that this could result in a performance hit.


texts: Change font color in unsorted list in Views Drupal

texts:
I'm using Drupal with Views, which outputs an unformatted list of news titles (accompanied with dates). Example output of my View:

Some of the news titles need to change font color or size. For example, if the chosen taxonomy term is "hot" then the font size of title should be 8px.

I think I need a CSS class to be inserted for tagged news, but I can't figure out how to do this.


texts: How do I modify a custom entity delete form?

texts:
I have a custom entity "Possession" that I created that has a non-standard edit form route to help facilitate a decending url structure. The routing for the edit form looks like this:

entity.possession.edit:
path: '/individual/{individual}/possession/{possession}/edit'
defaults:
  _entity_form: 'possession.edit'
  _title: 'Edit Possession'
requirements:
  _permission: 'access administration pages'
options:
  _admin_route: FALSE
  parameters:
    individual:
      type: entity:individual
    possession:
      type: entity:possession

That seems to be working fine, but now the Delete form isn't working properly. When I click on "delete" the page white screens with this error:

The website encountered an unexpected error. Please try again later.
Symfony\Component\Routing\ExceptionMissingMandatoryParametersException: Some mandatory
parameters are missing ("individual") to generate a URL for route "entity.possession.edit_form".
in Drupal\Core\Routing\UrlGenerator->doGenerate()
(line 182 of core/lib/Drupal/Core/Routing/UrlGenerator.php).

After a little bit of digging I noticed that the reason that the Delete form would be complaining about the edit form route is that the cancel link on the Delete form directs you to the edit form, so it needs those parameters form the link. I ran into this problem previously with the List Builder page for this entity, but I just fixed it in the code for that page.

For this I tried to edit the PossessionDeleteForm.php file that was generated when I created this entity through Drupal Console. I added a buildForm method to the empty class to a variation of this:

public function buildForm(array $form, FormStateInterface $form_state) {
  $form = parent::buildForm($form, $form_state);
  $entity = $this->entity;

  $form['actions']['cancel']['#url'] =  Url::fromRoute('entity.possession.edit_form', [
  'possession' => $entity->id(),
  'individual' => $entity->get('individual_id')->target_id,
  ]);
  return $form;
}

If I throw a ksm() in there to inspect that it seems like it's set up correctly, but it doesn't seem to have any change on the message that I'm recieving on the white screen. I also tried adding the getCancelURL() method to the class with a basic URL:

public function getCancelURL() {
  return new Url('system.admin_content');
}

Still nothing.

Next I tried the urlRouteParamters() method in the actual Entity class:

protected function urlRouteParameters($rel) {
  $uri_route_parameters = parent::urlRouteParameters($rel);

  if ($rel === 'edit_form') {
    $uri_route_parameters['individual'] = $this->get('individual_id')->target_id;

  }
  return $uri_route_parameters;
}

That also didn't work. I have no idea what else to do here. Does anyone have any suggestions?


texts:
The image in a product (full view not teaser) is coming in full size (and too big) and I can't figure out how to change it.
Looking at the Product content type I see the 'Preview image style' is 'Thumbnail (100x)'. I read in some doc the Preview image style should be 'uc_product' so I'm a bit surprised by that.
In an attempt to figure it out I went to >>Media>>Image styles and changed every image style to Scale 50x50. Images in the teaser responded to the change but on the product page the image is still coming in large (full size probably).
Also as a guess, I went to Configuration>>Media>>Colorbox and change Max width, Max height, Initial width & Initial height to very small values. This made no difference.

Any suggestions for solving this or tips for figuring it out?

Thanks


texts: Display Search API query execution time in search view

texts:
I am trying to show the query execution time in a View where I'm using the Search API module to return results from an index in Apache Solr. I am pretty sure that in the past I could print something like:

Your query returned 234 results in 0.035 milliseconds

at the top or the bottom of the view, but this may have been a feature of the Search API Pages module (which I can't use since it does not work properly for me).

I have searched the various "things" that you can add in the header and the footer part of the view but there is no replacement pattern for this kind of information.

Am I missing an option somewhere? If this is not possible through the UI, is there maybe a way to retrieve and print this programmatically in the Views' template system?

Thanks in advance.


texts: Display content based on taxonomy with view

texts:
I have a hierarchical taxonomy like the following:

Bachelor of Degree

Year1 (child term of Bachelor of Degree)

Term1 (child term of Year1)

Year2

Term2

The body text of content1, content2, … of a content type will go under the terms term1, term2, ….

Can you kindly help me in getting the view with the following structure?

Bachelor of Degree

Year1 (child term of Bachelor of Degree)

Term1 (child term of Year1)

content1
content3

Year2

Term2

content2
content4


texts:
I have come across an error that I have been having difficulty fixing.
I am suspicious the problem is the "Primary script unknown" error, but I am lost. There is an reoccurring Fatal Error, but it is a core file that has never been modified..

Any help would be greatly appreciated.

See below for an example of the nginx error log.

  2016/01/09 08:08:17 [error] 1082#0: *315 FastCGI sent in stderr: "Primary script  unknown" while reading response header from upstream, client: 188.68.224.62, server: , request: "GET http://dhg.pisz.pl/httptest.php HTTP/1.1", upstream:  "fastcgi://unix:/var/run/php5-fpm.sock:", host: "dhg.pisz.pl"


texts: Common meta tag description for a particular content type

texts: I am working with meta tag module in drupal8.I want to add common meta title and description for a particular content type.How can i do this?


texts: How to assign roles to grant permissions to update particular pages?

texts:
I have a menu like Publications, About us , Services and i want to assign a roles to the users like one user can update the content of about us and other can services means need to give permission for specific pages.

Is this is possible?

Some more details about what I'm trying to do: I do not want to give the permission to whole content type (that is not required). I want a user wise permissions like I have a role named ouroffice-user. Then under this I have a 10 users and I want to allocate different permissions to these 10 users like no. 1 have a permission to update the welcome content and no. 2 have a permission to update the about us page all users belong to single role that ouroffice-user.


texts: Customize the output of the Drupal 8 Aggregator module

texts:
I am using the Core Aggregator module to aggregate content from RSS feeds, and then using a View to output the content.

The Aggregator module has two view modes, default and summary. The view modes themselves are editable, but the feed items themselves are grouped into the "items" field, that has no options.

In default mode, the title, blog, description etc. for each item are rendered, but in summary mode only the title and blog name are rendered.

How can I influence the fields that are rendered in summary view mode?


texts: Storing ajax callback variables in PrivateTempStore

texts:
I have an issue with changing / obtaining variables in form element's ajax callback function. (Sorry for typos, I just placed a pieces of whole code).

I have form with input field, where user can select how many pieces of each product he want

$form['wrapper_amount']['value'] = [
        '#type' => 'number',
        '#prefix' => '
',
        '#suffix' => 'pcs
',
        '#name' => "amount--product-1",
        '#ajax' => [
            'callback' => '::calculatePricePerUnit',
            'event' => 'change',
            'disable-refocus' => TRUE,
            'progress' => [
                'type' => 'fade',
                'message' => NULL,
            ],
        ],
    ];

after choosing a number I calculate price using AJAX callback function and using

public function calculatePricePerUnit(array &$form, FormStateInterface $form_state)
{
    // ... price calculation for specific product
    // $new_price = (amount * price_per_unit);

    $total_price = (float)$form_state->get('total_price_with_vat') + $new_price;
    $response = new AjaxResponse();
    $response->addCommand(
        new InvokeCommand(
            '#total-price',
            'html', [$form_state->get('total_price_with_vat') . ' €']
        )
    );
}

The problem is that when used add amount to second product the $form_state->get('total_price_with_vat') is 0 again. It means that I cant store $total_price variable in $form_state, because it's not persistent (I've already read this somewhere, that I can't store variables to $form_state in AJAX callback function). So I tried to store it to $form_state->setStorage($my_values) but it didn't work either.

Please note that all AjaxResponse commands are working and I only need to find best approach how to store data, not how to re-render form's elements.

My next step is to store data in PrivateTempStore, but question is, if it's good approach?
I don't need data on any other Wizard page, neither in Controller or any further step. I just need to calculate $total_price and some other data that I need to use multiple times in AJAX callback function, and at the end use webform API to send webform submission results via email.


texts: Access a template variable from another template (or theme hook)

texts:
I have two templates (and two corresponding preprocess hooks), one rendering a Paragraph, one rendering items from this paragraph.

How to access a variable available in the parent paragraph template (or preprocess Hook) from the items rendering template (or item preprocess hook) ?

paragraph--paragraph-row.html.twig

{{ content.MyVARIABLE }}  //it works

field--paragraph--paragraph-row2.html.twig

  {% for item in items %}

         {{ item }}

{% endfor %}

THANKS !

David


texts: How do I access the configuration variables present in settings.php through my code?

texts:
I want to access the variables present in the settings.php in my custom module. For example, if the settings.php file contains the $config['test']['uid'] = 'ABC'; line, I want to access the content of $config['test']['uid'] in a controller.

How can I achieve this?


texts: How do I set the path to a custom view style template?

texts:
I have created a custom view style in a module. It shows up in the list of view styles, but when I try to output the resulting block I get the message:

Warning: include(/var/www/core/modules/views/templates/mymodule-list.tpl.php) [function.include]: failed to open stream: No such file or directory in theme_render_template() (line 1491 of core/includes/theme.inc).
Warning: include() [function.include]: Failed opening '/var/www/core/modules/views/templates/mymodule-list.tpl.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in theme_render_template() (line 1491 of core/includes/theme.inc).

This obviously is trying to find my view template in the templates folder of the view module, but I want it to look in /sites/default/modules/mymodule/templates/.
My plugin class annotations look like this:
/**
 * Style plugin
 *
 * @ingroup views_style_plugins
 *
 * @Plugin(
 *   id = "mymodule",
 *   title = @Translation("My Module"),
 *   help = @Translation("Help text"),
 *   theme = "mymodule-list",
 *   path = "sites/default/modules/mymodule/templates",
 *   type = "normal",
 *   module = "mycarousel"
 * )
 */

I have also tried setting the path in hook_theme:
function mymodule_theme($existing, $type, $theme, $path) {
  return array(
    'mymodule' => array(
      'variables' => array(),
      'path' => drupal_get_path('module', 'mymodule') . '/templates',
      'theme' => 'mymodule-list',
      'theme path' => drupal_get_path('module', 'mymodule') . '/templates',
    ),
  );
}

Can anyone see what I'm doing wrong?


texts: How to hook to content profile edit form validation

texts:
I try the following code, but it doesn't seem to work.

function mymod_profile_node_form_validate($node,&$form) {
  firep($form, 'form');
}

Could anybody help?


texts: How can I attach the same library with Javascript multiple times on the same page with different settings?

texts:
I have a custom field formatter that attaches a library that includes a javascript file. It uses drupalSettings to pass some values to the script.
The first time the field formatter appears on a page, it works as expected. However, subsequent appearances of the formatter behave as if they have no script attached.
A simplified example:
(function ($, Drupal, drupalSettings) {
  $(document).ready(function () {
    var selector = drupalSettings.gallery.id + ' .foo';
    alert(selector);
  });
})(jQuery, Drupal, drupalSettings);

If the field formatter appears three times on a page, I would expect to get three alerts with three (slightly) different strings. Instead, I only get one, with the ID I expect for the first string.
It seems like the easy way to deal with this is to use inline scripts, but I know that's strongly discouraged. Is there a right way to do this?
Edit: updating the code to use drupalBehaviors, I now have:
(function ($) {
  Drupal.behaviors.galleryBehavior = {
    attach: function (context, settings) {
      $.each(settings.gallery.id, function(index, item) {
        alert(item);
      });
    }
  };
})(jQuery);

I'm now getting multiple alerts instead of one, but they still all contain the same string. Dumping the contents of settings.gallery shows that only one ID has been inserted into the array, which suggests to me that subsequent instances of the formatter aren't adding attachments? The PHP code looks like so:
$id = $items[0]->getEntity()->uuid() . '__' . $this->fieldDefinition->getName();
ksm($id); // just to make sure I'm actually generating the expected number of unique IDs
$elements['#attached']['drupalSettings']['gallery']['id'][] = $id;

This appears to be the right way to populate an attached drupalSettings array, based on one somewhat similar question I was able to find this morning, but clearly I'm missing something.


texts: How to measure number / time of edits by my editors

texts:
I am looking for a module or an approach or some tips on how to measure the editing activity of my editing team within my Drupal site.  I'm ideally looking for a report or dashboard that shows me how many edits, how much time, or how many words have been entered into the system on a weekly basis, rather like an asset league.

Thanks for any ideas.


texts:
Sorry for any incorrect terminology; I'm new to Drupal so it's possible that I'll mess up the Drupal-specific vocabulary.

I'm putting together a View->Page with a Table Format.

I've got a field in my data set called "registrationdate", and I can display that just fine.  However, what I need to display is registrationdate plus 14 days.  I haven't been able to figure out how to add a number of days to the value so I can display the adjusted value.

I know how to do this in SQL, but since Drupal acts as an abstraction layer between me and the database, I can't do so in this case.

Thanks in advance for your help.


texts: I would like to pilot a webform for a period of time and have the option to hide it vs. delete if needed. How do you hide a webform from your site?


texts: Charts Module not working for one site - No messages in the log

texts:
Using Drupal 8.5.4 and I am referencing the url as https://www.ostraining.com/blog/drupal/create-charts-with-views/

as a guide.  I have built charts with an empty scratch sites without issues.  However, when I try to integrate it into an existing site I get nothing.  I have checked the sites messages with but nothing is there.  I am not really sure where to look to troubleshoot the issue.

I just want a basic chart, nothing fancy out of the gate.


texts: Show profile2 fields on users page through panels

texts:
I would like to select profile2 fields on users page.

Elements:

Profile2: artist + fields
User: role artist

If the user is being viewed is an artist the panel should show its fields.

Actions:

Created the profile2 for a custom user (if I do not panelize the user/%user page the user can view the profile2 fields).
Activated the user_view pane
Added relatioship with profile 2
Now the profile2 fields appears on the UI.
Select the field header_img
Save the pane

I must have forgotten something because the profile (panelized) fields does not show any content of the profile2 fields..

Attaching some screenshots!

Thanks!!


texts: When the "Body" field is required, how can I force users to input, say, at least 400 characters?

texts: For example, this site (Drupal Answers) has this feature-- if you input too little text in the text box, the interface prompts you to write more.  Is there a module to do this?  I tried various searches but I haven't been able to find anything.


texts:
I have a site that is multilingual using path prefix, for example I can have:

example.com/en
example.com/es
example.com/fr

If the user goes to example.com, a language selection page appears (using the language selection module).

But I'm trying to enable the CDN module and it's not working because all resources are pointing to example.com/sites/.../somecss.css instead of example.com/en/sites/...

If I disable the CDN module the resources are pointed to the correct path.  How can I fix this?  I think it's bug in the CDN module.

Using Drupal 7 & Amazon CloudFront.  I don't want to change the site to subdomain for the languages (eg, en.example.com).


texts: HIde node in view when field message is equal

texts:
Can I hide a node in a view when they have a specific message? Like, if the message: "Please don't show this node" is equal with specific field content then hide him in the view, else show him?

Is there an option for this?


texts: What's the difference between using $this->t('text') and t('text') in a block plugin

texts:
I've noticed in many tutorials for constructing block plugins,

$this->t('text')

is used to create translatable text, especially in the block form function. However using

t('text')

doesn't produce any errors. Is there any difference between using either of these? And if there isn't, what's best practice?


texts: Global Submission validation based on a select item

texts:
Is there a way to get Drupal 7 / Webforms to block a submission for a duplicate answer in a previous submission.  I am sending an application questionnaire to multiple app owners, the form is setup with a listbox containing the App name, then the rest of the form is generic for each app.  I would like for the App owners to not be able to accidentally submit for the same app twice.

Many people have suggested the "Webform Validation" module, but as far as I can tell, it only does validation on the form itself.  It cannot do validation for the form being submitted against previously submitted forms.

TIA


texts: Why do D7 form builders have a $form parameter?

texts:
In Drupal 7, the first parameter of a form builder function is $form.

When implementing a form builder function, one has the option of either adding stuff to this existing array and returning it, or creating a new $form array, discarding what was passed into the function. In my experience, both of these options usually work fine.

What's the point? Is there ever a case when this parameter is needed?

I think to vaguely remember that this is somehow relevant when a form is rebuilt, so this would be the old form.. but I would not really know what to do with it.

Note: The same question already exists for Drupal 8, but it seems to be a policy here that we need distinct questions for D7 and D8. I was going to answer it for D7, and I realize it would be off-topic in the D8 question.


texts: How to get rid of a duplicate title on the front page?

texts:
When I first made the front page, I created a Basic Page and selected "Promoted to Front Page" and thought I was done.  Drupal insisted on showing this page as an article summary, and no manner of tweaking settings on my part prevented this behavior.  I decided instead to put the main front page content in a block because it will seldom ever change.

I created my block, and yay!  No more summarized front page content.  However, the title of the page shows twice.  The first is the title of the original basic page I created, the second is the title of the block I created.  I've already cleared the cache and there was no change.

How do I get rid of the duplicate?


texts: How to remove main menu from drupal site

texts: I want to remove the main menu from my drupal site, however after unchecking that box in appearance the menu bar still persists. How can i permanently remove the main menu?


texts:
I was following Set up Demo Site for Theming Practice; then, I realized that, since Drupal 9 is out, by default Drupal 9 is installed instead of Drupa 8.x is installed when running composer create-project drupal/recommended-project $SITE_NAME.

So I continued along. I was fine, until I came to the install local site. I got this error:

  The database server version 10.2.31-MariaDB-1:10.2.31+maria~bionic-log is less than the minimum required version 10.3.7.

Since I'm using ddev and docker, does this mean I need to upgrade my MariaDB version used inside of my image? if so, how do I do that?

A step by step solution explaining each step would be really helpful.


texts: Alter appearance of content types in teaser view through code?

texts:
What I would like to accomplish is the following:

When a list of a certain content type is displayed, I would like an "edit" link to be placed at the end of the summary text that, when clicked, would take the user to the node edit page for that particular node.

This list would either be created using the Views module, or through a taxonomy. That part isn't important.

How can I do this through custom module code? I'm trying to learn more about writing modules on my own, and would prefer to avoid using an already built module in this particular case, since I will already be creating the content type in question through a module anyway.

Would I do this through module code, or through theme code?


texts: Ctools Form Wizard Dynamic Fields Rebuilding

texts:
I just started rebuilding our subscription form as a Ctools Wizard Form which is great for storing values, and easy to use. Here is the code for building the form and saving the objects in ctools cache:

function subscription_poll($js = NULL, $step = NULL) {

  $form_info = array(
    'id' => 'subscription-form', //form id
    // 'path' => "poll/" . ($js ? 'ajax' : 'nojs') . "/%step", //pass the step we're on to the form, step1, step2, ..etc
    'path' => "poll/%step", //pass the step we're on to the form, step1, step2, ..etc
    'show trail' => TRUE, //show the breadcrumb / path trail for the forms
    'show back' => TRUE, //show the back button
    'show cancel' => TRUE, //show the cancel button
    'show return' => FALSE, //show the update and return button
    'next callback' =>  'd7_poll_wizard_next', //a callback function to run when the next button is called
    'finish callback' => 'd7_poll_wizard_finish', //callback when finish button is called
    'cancel callback' => 'd7_poll_wizard_cancel', //callback when cancel button is called
    'order' => array( // this controls order, as well as form labels
      'step1' => t('Step 1'),
      'step2' => t('Step 2'),
    ),
    'forms' => array( // here we map a step to a form id.
      'step1' => array( //what we're doing here is telling the wizard when step1 is passed as arg, show the form with form_id d7_poll_step_1
        'form id' => 'sub_order_form_page_one'
      ),
      'step2' => array(
        'form id' => 'sub_order_form_page_two'
      ),
    ),
  );
  /***********************************************
   * Object caching
   ***********************************************/
   $object_id = 'd7_poll';
   if (empty($step)) {
      d7_cache_clear($object_id);
   }

  $object = d7_cache_get($object_id);
  $form_state = array(
    'ajax' => $js,
    'object_id' => $object_id,
    'object' => &$object,
  );

  // Send this all off to our form. This is like drupal_get_form only wizardy.
  ctools_include('wizard');
  $form = ctools_wizard_multistep_form($form_info, $step, $form_state);

  $output = drupal_render($form);

  return $output;
}

Our Form is built as such:

The first step of our form is very straight forward, requiring that the user select if the subscription is a gift and if so, how many would they like to purchase. This gives the second step of our form the values necessary to build the number of fieldsets for entering shipping information.
The second step is build either with or without the gift subscription fields based on the values entered on the first step of the form. If there are entered values than the form populates x number of fieldsets.
We have also included a button which allows the user(s) to be able to add an additional fieldset on that same second form step. This callback:

if (!empty($form_state['object']['Gift_Quantity'])){

$form['add_additional_shipping_fieldset'] = array(
'#type' => 'submit',
'#value' => t('Add another gift recipent'),
'#submit' => array('add_shipping_address_fieldset'),
'#limit_validation_errors' => array(),

);
for ($i = 1; $i <= $form_state['object']['Gift_Quantity']; $i++){

$form['Shipping'][$i] = array(
 '#type' => 'fieldset',
 '#title' => t('Gift Subscription #@num', array('@num' => $i)),
 '#collapsible' => TRUE,
 '#collapsed' => FALSE,
);

$form['Shipping'][$i]['ShippingCountryCode'] = array(
'#title' => t('Select your Country'),
'#type' => 'select',
'#options' => $countries,
     '#required' => TRUE,
);
}

The trouble that I am having is trying to rebuild the form_state when additional fieldsets are requested through the callback. The formstate is rebuilt via the callback:

  function add_shipping_address_fieldset($form, &$form_state) {

  $form_state['object']['Gift_Quantity']++;

  $form_state['rebuild'] = TRUE;

 }

However the page is redirected to the first step. Any thoughts?


texts: How to add 3 text boxes for a phone number field?

texts:
I want to add 3 text boxes for a phone number field. The phone number format should be xxx xxx xxxx.

I need to show 3 text boxes and stored values into single field.

How can I do this?


texts: Create Latest Comments View Per Group OG 7.2

texts:
Hello it has been a while since i used OG Groups (and Panels) and im struggling a bit to create a view for the group home page showing the latest comments within the group. Its all to do with the Relationships and Contextual Filters. There seems to be so many relationships and filters available to me that its making me struggle a bit.

Could anyone advise me on how to make a view that will display the comments for that group? I think once i see the Relationships used there will be no holding me back from various other things.

Thanks


texts: How to set the field collection count programmatically

texts: I've a field collection in which I would like to set the count of the field collection programmatically. I have a taxonomy, if there are 10 terms for the taxonomy it must be the count of the field collection.


texts: Automatic Item Number Creation (For article posting as a Reference for Quick Searching)

texts:
I'm looking for a solution for automatic item number creation that will auto-create a reference number/code for any posted article, whatever the Node type. The purpose being that for any posted article (any Node type) that is created & posted by an author (with permission Roles authorised to post content) will have an item reference which can be traced throughout all aspects of workflow (including any Ticket Support document output - printer etc). This could quite simply be a standard item number as of that used on eBay (string of numbers) or similar used in organisational-wide portal. It might be for use in a local sales listing references (as in Gumtree), a vehicle listing platform (autotrader.co.uk) or simply to give a volumous document based content site a posting reference (internal intranet/external netsite), which for example, a 3rd party reader can jot down on paper, (email, cut and paste in Notes etc) and come back later and do a simple 'search' with the reference number, but not a 'purchase order' reference (as in Ubercart), purely for article reference purposes.

I'm not looking for anything tremendous (I'm not a PHPer (yet!) and I know this is more of a backend SQL DB but being more a Drupal 'plumber'/experimentalist I'm looking for simple solution for now that can be built upon later; something that Barcode module can also take advantage of and I can use in future projects of informational DataBases. Does anyone know of such a suitable solution/module for D7?

Any comments or How-tos welcome. Thanks.


texts:
i have a content type with "artist" and i have a paragraph type with "album" name. in album i have two field 1. name 2. release date.
i create a field with "field_album" name in "artist" content type that this field reference to paragraph. now i want write a query that show artist name and all albums with name and release date.
I create this query to load artist but i cant load paragraph.

    query{
  nodeQuery(filter: {conditions:[{field:"title",value: ["artistname"], operator: EQUAL}]}){
    count
    entities {
      ...on NodeArtist{
        nid
        title
      }
    }
  }
}


texts: Impossible to create content or edit image styles after Backup/Restore

texts:
I'm having difficulties with a website that's running 7.14.
I did a backup with backup & migrate, installed a new instance of Drupal (7.40), installed the latest versions of all the modules used in the original website
I then restore the database (using backup & migrate also) but I can't create content or create/edit image styles. Whenever I try, I get this error message:

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

Any ideas on what causes this error? Or how to solve it?


texts: What is the equivalent of sess_count in Drupal 7

texts:
As Converting 6.x modules to 7.x explained:

  All session functions starting with sess_*, as well as session_save_session(), are now renamed to drupal_session_* or _drupal_session_*

I have to use sess_count() in my D7 module and naturally I used drupal_session_count() but I ended up having Call to undefined function drupal_session_count() fatal error. I also tried _drupal_session_count() with no luck. User session handling functions page for Drupal 7 didn't mention about this function neither.
Which function should I use in order to count how many users have sessions?


texts: Rename images while uploading and put in specific folder

texts:
I am using drupal 7.

I have created an Advertisement content type. This contains a field where end user can upload images of their Brands.

I want to rename the images which are uploaded by the field of content type and put in specific folder named user id of the user. So uploaded file location would look like it:
/sites/default/files/images/user_id/