texts:
Possible Duplicate:
  Is it possible to join dynamic tables (subqueries) using db_select()?

I have this part of a query running in drupal with db_query.

LEFT JOIN (SELECT ogmk.gid, ogmk.etid, kompas.* FROM og_membership ogmk
        INNER JOIN node kompas ON kompas.nid=ogmk.etid AND kompas.type='kompas'
        INNER JOIN publication_date pd ON pd.nid=kompas.nid
        WHERE pd.published_at > :start AND pd.published_at < :end AND kompas.status = 1
        ) ogm_kompas
        ON ogm_kompas.gid=og.gid

The left join should give records if they are available. If not the fields will be null.

How can I transform this to the db_select method with a selectQuery, so I can use the theme function for sorting and paging?

Thanks in advance for your answer.


texts:
I'm getting the following error:

Migration failed with source plugin exception Migration failed with source plugin exception: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: 'posmsoftllc' for column 'sourceid1' at row 1

I can't figure out why I'm getting this error.

It has something to do with my MigrateSQLMap - there's no real primary key on the source database, but I suppose username would probably work. I've got the MigrateSQLMap setup as follows:

$this->map = new MigrateSQLMap($this->machineName, array(
  'Username' => array('type' => 'varchar',
    'length' => 75,
    'unsigned' => FALSE,
    'not null' => FALSE,
  )
    ), MigrateDestinationEntityAPI::getKeySchema('commerce_line_item', 'recurring')
);

But I'm receiving this error - what could be causing this? Why is it expecting an integer value? Do I even need this map for a successful migration?


texts:
$form['set_end_date'] = array (
  '#type' => 'date',
  '#title' => t('set end date'),
  '#required' => TRUE,
);

$form['actions']['#type'] = 'actions';
$form['actions']['submit'] = array(
  '#type' => 'submit',
  '#value' => $this->t('Fetch'),
  '#button_type' => 'primary',
);
return $form;

How do I add a JavaScript file from a module?


texts: Views: Trying to filter content by two field values (either/or)?

texts:
I'm trying to filter published content by the values set inside of two fields (one or the other). Right now, I'm successfully filtering my content by one field:

Contextual Filter

  If field_targetuser = logged in uid, than display content.

However, I also want to show content in which field_universal = YES , regardless of the logged in uid.

Naturally, implementing the first Contextual Filter and than a second only further filters the intial filter. What I'm trying to accomplish:

  Show all content of this type if targetuser matches logged in user id,
  but ALSO show all content where field_universal = YES, regardless of what appears in the targetuser id.

Views setup:


texts:
How do you add jQuery tabs in a "template.php" file?
I'm trying to add it with drupal_add_library('system', 'jQuery.tabs') or drupal_add_js('/misc/ui/jquery.ui.tabs.min.js'), but I'm not having any luck.

Here's my full snippet:

function custom_theme(&$existing, $type, $theme, $path) {
  $hooks = array();
  drupal_add_library('system', 'ui.tabs');
  // custom.js will call jQuery.tabs!
  drupal_add_js( path_to_theme() .'/js/custom.js', array('weight' => 9));

  return $hooks;
}


texts:
I try to print field_tags inline and comma separated. My code in node.html.twig:

<p>{{ content.field_tags | join(', ') }}</p>

This return error message: The website encountered an unexpected error. Please try again later.

Whats wrong? Help.


texts:
Drupal 8.9.6 - I have to update my products/variations prices for 2021, which I have done successfully using commerce_price_updater but it reflect new prices in cart only for those products which are added in last month. How can I update old cart item's prices with shipping charge?
Customers ordering items offline by generating a quote from cart page. So I need to update new prices without going to checkout process


texts: Code comments in TPL file that wont be rendered in HTML?

texts: Can I add code comments to my template files that won't be publicly shown in the HTML?


texts: Attach PDF file to Drupal Commerce Order Notification

texts:
How do I attach a views_pdf file to the commerce email?

I have views_pdf, commerce_coupon.

As Sally I would like to buy a coupon and have a copy emailed to me.

I am stumped on how to get the pdf view into a File object.

function yhivecoupons_mail_alter(&$message) {
  global $user;

  if (!empty($message['id']) && ('message_notify_commerce_order_order_confirmation' ==  $message['id'])) {
$pdf_coupon = views_embed_view('commerce_gc_user_giftcards', $display_id = 'pdf_1');

  $my_attachment = array(
    'filecontent' => $pdf_coupon,
    'filemime' => $pdf_coupon->filemime,
    'filename' => $pdf_coupon->filename,
    'filepath' => NULL,
  );
  $message['params']['attachments'][] = $my_attachment;
 }
}


texts:
I'm having some problems where using drupal_get_form() breaks the upload/remove functionality of a file field when it's processed with ajax. It seems this may be a core issue (http://drupal.org/node/1526300) but I haven't found a solution that works for me yet.

I've noticed that the form degrades gracefully when ajax is disabled in the browser and the file field works correctly.

I would like to just disable ajax for this form but I don't see how. I don't see any #ajax elements in hook_form_alter() or hook_field_widget_form_alter().


texts: Using a different administration theme according to the role

texts:
Is there a way to use different administration themes according to the roles assigned to users?
I have two roles (admin, editor), and I want that, when creating content, users with the admin role use the garland theme, while users with the editor role use another theme.


texts: Views Display output in tpl file not working

texts:
I'm making use of views 2.xx and pressflow 6.xx and i'v a little issue when it comes to the views Display output template file, it just won't show the rows when i tried to print them like this:

      <?php print $fields["field_genre_value"]->content; ?>
      <?php print $rows["field_genre_value"]->content; ?>

Non of them work....


texts:
I am using Drupal 7.
I would like to create a list of items in which all items can be arranged using Drag 'n' Drop. Just like Menu system in Drupal.

I found drupal_add_tabledrag() but it seems it is used in table display/output. I want to create a simple list with rows and it should be arranged, just like menu in Drupal7.

Though there is DragableView module, but I want that every logged in users can create a list and they can manage their own list.


texts: Backup and Migrate exclusion recommendations?

texts:
When doing database backup using Backup and Migrate, what is the reasonable table exclusion strategy?

My first guess was:

Exclude the following tables altogether - leave that listbox with no selection
Exclude the data from the following tables - select all tables that include "cache" word, such as cache_block or ctools_css_cache.

Any comments, any considerations, any recommendations?


texts:
I want to show the user, his/her email address on their "My Account" Page. I am not using any modules for the registration page, but just the default Drupal 7 registration fields.

How can i display user name and email address fields to the user on "My Account Page"?


texts:
I am using D3 word Cloud locally on my computer. It works fine. It gets the data from the database and displays it as word cloud on webpage. I want to place the output from it in Drupal website. How do I place it as a block?
EDIT: I have 2 JavaScript file, a JSON file and a HTML file. All these files I want to include. I just realised that the HTML file has this code,
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<script src="../lib/d3/d3.js"></script>
<script src="../d3.layout.cloud.js"></script>
<script>
  var fill = d3.scale.category20();

  d3.layout.cloud().size([800, 300])
      .words(["This", "is", "some", "random", "text"].map(function(d) {
        return {text: d, size: 10 + Math.random() * 90};
      }))
      .padding(5)
      .rotate(function() { return ~~(Math.random() * 2) * 90; })
      .font("Impact")
      .fontSize(function(d) { return d.size; })
      .on("end", draw)
      .start()
      ;

  function draw(words) {
    d3.select("body").append("svg")
        .attr("width", 800)
        .attr("height", 300)
      .append("g")
        .attr("transform", "translate(150,150)")
      .selectAll("text")
        .data(words)
      .enter().append("text")
        .style("font-size", function(d) { return d.size + "px"; })
        .style("font-family", "Impact")
        .style("fill", function(d, i) { return fill(i); })
        .attr("text-anchor", "middle")
        .attr("transform", function(d) {
          return "translate(" + [d.x, d.y] + ")rotate(" + d.rotate + ")";
        })
        .text(function(d) { return d.text; })
        .on("click", function(d) {
          var string_url = "http://etraining-dev/search/node/" + d.text;
          window.location = string_url;

  });;
  }
</script>

which is just script. I am not sure how to include these files and make it work. Can anyone help?
Thanks.
Background
D3.js is a JavaScript library for manipulating documents based on data. I will need to add the d3 javascript library to the page, as well as the D3 word Cloud script. I then need some way of inserting the HTML5 canvas element in my content so that it can be manipulated by d3.


texts: How to calculate two taxes for the same product?

texts:
Spanish taxes depends on the product but also on the customer. A product could have one of this taxes: normal (21%), reduced (10%) and super-reduced (4%). This is managed by a field on the variation type and it works good.
But there is another variable that has to be considered. The customer could has a type of bussines that implies to add another additional tax to the same product. They are named "surcharge" and they are normal (5.2%), reduced (1.4%), super-reduced (0.5%). It is calculated in the next form:
Product price without taxes: 100 €
Normal taxes (21%):  100 * (21 / 100) = 21 €
Surcharge (5.2%):   100 * (5.2 / 100) = 5.2 €
Order total: 100 + 21 + 5.2 = 126.2€
Implementing a class ProductTaxResolver implements TaxRateResolverInterface let me add one tax but I need to add more than one, depends on a customer field (custom user field). How could I do it? Could I add another tax with a custom tax condition?


texts: How to display a form filled by a VBO-submission?

texts:
I'd like to use Privatemsg module to send messages to group of users. For this purpose I plan to use a view with Views Bulk Operations (VBO) and plenty of exposed filters.

I was able to create a custom VBO-action that puts the selected users into the recipient field of the message form:

function mymodule_my_custom_action(&$user, $context=array()) {

module_load_include('pages.inc','privatemsg');

$recipients = array();
foreach ($user as $recipient) {
$recipients[] = user_load($recipient->uid);
}

$subject = 'Some subject'

$message_form = drupal_get_form('privatemsg_new', $recipients, $subject);
$message_html = drupal_render($message_form);
}

I'm not very experienced in development so I don't know how to display this form together with the view that helps choosing the recipients. A simple print $message_html; won't be enough of course. For example would it be possible to use a panel page containing two panes: one for the view of users with VBO and one for the privatemsg form?

Any help would be greatly appreciated!


texts: Need to flush cache after node translation

texts:
I have a Drupal 6 site running with multi language support. When I translate a node and get redirected to the newly translated node only the headline is visible. If I flush the cache using the administration tools I can see the rest of the node.

Why is this happening and I how do I prevent it? I feel like I have tried everything!
For example trying:

  drupal_flush_all_caches();
  cache_clear_all();
  cache_clear_all('*', 'cache', TRUE);
  cache_clear_all('*', 'cache_content', TRUE);
  cache_clear_all('*', 'cache_page', TRUE);
  cache_clear_all('*', 'cache_menu', TRUE);
  cache_clear_all('*', 'cache_filter', TRUE);
  cache_clear_all('*', 'cache_views', TRUE);
  cache_clear_all('*', 'cache_views_data', TRUE);
  cache_clear_all('*', 'cache_update', TRUE);
  cache_clear_all('*', 'cache_block', TRUE);
  cache_clear_all('*', 'cache_form', TRUE);

Using function mymodule_node_form_submit($form, &$form_state) and function mymodule_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL). I have verified that both hooks works using Devel.

I have also tried looking into the cache tables to try and figure out which rows change when flushing the caching using the administration tools, but without luck.

UPDATE JULY 18:
Even if I turn off the cache I cannot see the translated node before I flush the cache. How is this even possible?

UPDATE JULY 18 PT2: I think I have found the problem. In the table cache_content a row called e.g. content:1269:1270 got the value(data) a:0:{}. If I delete this row the text appears. To me it seems that it does not cache the new translation correctly, and thus saving an empty cache which makes the translated node empty. But how do I solve this? Even with db_query('DELETE FROM cache_content'); in the submit hook the row gets created.

Thanks in advance.


texts: How to merge loggedin and annoymous user's cart in drupal commerce

texts:
To merge loggedin and annoymous user's cart for same session.

User (username:jone) adds something in the cart (Product 1). Before add to cart: Cart is empty
User adds something in the cart (Product 1). After add to cart: Order ID 15821 Line item IDs 159808

User registers and logins
User logs out

Annoymous User adds something in the cart (Product 1). Before add to cart: Cart is empty
Annoymous User adds something in the cart (Product 1). After add to cart: Order ID 15822 Line item IDs 159809

Annoymous User adds something in the cart (Product 2). Before add to cart: Order ID 15822 Line item IDs 159809
Annoymous User adds something in the cart (Product 2). After add to cart: Order ID 15822 Line item IDs 159809, 159810

Viewing the above log, somebody would assume that this user has bought 2 different products.

Now User checks out and login with username : jone
we want to after the login show/add last order product (159808)
However, currently we have the following situation.

Order 15821 Line item IDs 159808 are exist in database in checkout_checkout mode(status).
Order 15822 exists with 2 line items, 2 different products. Line IDs are 159809, 159810.

I want to be displaying all line items 159808, 159809, 159810.
but line item 159808 are not display

please suggest any solution.


texts:
I am having issues opening a modal with buttons using OpenModalDialogCommand.
It says in the docs of that command, that it can take as it's 3rd param any Jquery UI option (from http://api.jqueryui.com/dialog/) and it works well, for width/height/class, but anything more advanced i hit a wall. I am trying to make a button but can't figure it out.

$response = new AjaxResponse();
$options = [
    'width' => '800',
    'height' => '300',
    'dialogClass' => 'no-close',
    'buttons' => [
      'text' => 'Proceed',
      'click' => 'function() {alert();}'
    ]
];

$response->addCommand(new OpenModalDialogCommand('Title', 'Body', $options));
return $response;

This returns a modal successfully, width is ok, height is ok, class is ok, but there is not button, i tried 3/4 variations of it with no luck.

~p.s. i know i can make a simple form with one button, and return that in the modal, but there has got to be a way to make this work.


texts: How do I add a custom button next to the "Add Content" button?

texts: How can I add a button next to the + Add Content button on /admin/content, in Drupal 8?


texts: Update existing nodes with fields from XML or CSV

texts:
There are 2 greate modules for importing nodes Feeds and Feed Import. Is there a way to update fields of existing nodes on import from XML or CSV file?

For example, there is an XML feed from another website with products (id + price) and file with additional data for the same products (id + description). How to import both sources into the same node in Drupal?


texts:
I would basically like to display the form/field that is used for changing the user's email address on a custom page with my own layout and things.

Ideally, I would like to make it so that if Javascript is enabled, the email address would appear as text with a 'Change' link next to it. The link would make a text box appear in place of text so that the user can change the address. Obviously, all this would happen without refreshing the page, and if Javascript is not enabled the email address should appear in the text box immediately like normal. If anybody can provide me with at least some, or all of the code that I need, that'd be so awesome.

Thanks in advance


texts:
I have created a field(select list) with some colors. I want to let my site users choose the color (color of menus, blocks ...) of their account.

How can I do this?


texts: Programmatically Add Features for Role assignment in Ubercart Drupal 7 product node

texts:
I am trying to create a product programmatically and set it features for role assignment, that a user gets a specific role after he purchases, i tried all the ways i can but couldnt get it working. below is the code i used for adding it, but when i edit the feature for role assignment it doesnt hold the values i set in the edit feature form.

function add_product_feature($nid, $sku){
     // Insert new product into the uc_product_features tables
     $desc = "SKU: ".$sku."
Role:
     purchaser
Expiration: Global expiration
      (not overridden)
Shippable: No

      Multiply by quantity: No";
      $nid1 = db_insert('uc_product_features')
      ->fields(array('nid' => $nid,'fid' => 'role','description' =>
      $desc,
      ))
      ->execute();
}


texts: How update user info using its UID in a custom module?

texts:
We have a webform and when submitting this form we would like to update user info in the database regarding values of submitted Webform.

I already managed to get the submitted values from the webform in my custom module. But I don't know how to update the user info in the database because all user info are in separated tables.

I can run a few update queries for each value but it's not a logical way for me!

Any other suggestions?


texts: In form alter what is the different way of hiding fields and what is the difference between them?

texts:
I am currently using the following code to hide the fields in the form

1.  $form['field_name']['#access'] = FALSE;
2.  hide($form['picture']);
3.  unset($form['picture']);
4.  $form['account']['mail']['#disabled'] = TRUE;

i saw this post https://stackoverflow.com/a/21041471/2251933 , https://drupal.stackexchange.com/a/49985/36808 explains some of the point but not all.

i want to retain the values in the form after form save but for some reason i want to hide the fields in the form.

what is the best way to do it and why it is so.


texts:
On a D7 site using fivestar , I'd like to extract data from the module but there is not such table or node in the database and looking at the source code, I could not figure out in which table/fields the fivestart data are related/stored.

So appreciate your help about this.


texts: How would I monitor if a new entity had been saved?

texts:
I am creating a module that I want to run when an entity is saved. I have used rules in the past but the overhead on the module means that I cannot use it. Is there another way that I can do this?
Thanks


texts:
We would like to hide accross our Drupal site all but certain types of nodes (to give you a more concrete idea: we're running a music blog and would like to have all reviews and interviews of non-female artists hidden for international women's day).

My idea was to add a new tag, "woman2013", that describes whether the node is to be featured or not, and then make sure that all our views filter all our nodes on this tag.

I will go over the templates and write PHP code that skips the display of the "woman2013" tag.

Basically what I'm trying to achieve is a machine tag. There seems to be no option however in Drupal (6) to do this.

What would be an alternative approach to achieve this result?


texts: How to make User Picture a required field?

texts: I do not see any option to make User Picture required in Account - Manage Field settings as it is not a real field in D7. Any tips?


texts: form validation messages are not rendered immediately

texts:
I have a form, with multiple (ajax) components. I have added a simple button in the middle of this form, to validate custom fields.

$form['fieldset_2']['forward'] = array(
  '#type' => 'button',
  '#value' => t('Forward'),
  '#name' => 'btn_forward',
);

As expected, button call validation function in which I check if all values are correct.

The validation messages are not rendered immediately. I have to refresh page to get the error messages. The button doesn't use ajax.
I have a field type radios and form_set_error doesn't color the element with red or something.


texts: How to create a pricing rule from custom line item referencing a taxonomy term in Commerce?

texts:
I'm using Commerce Kickstart and I am trying to create a pricing rule for a custom line item that references a taxonomy term that adds an amount to the product's base price.

For the condition, I have chosen "Line item product has term(s)" (I believe that is made available from the commerce rules extra module). My question is what Data selector should be chosen?

I can get it to work if I chose the condition of "entity has field" and then select the field that references the taxonomy.  The problem is, if nothing is selected in the field by the user - the amount is added anyway as this condition just checks for a field

Here is the rule:

{ "rules_wingstop_plano_tx_options" : {
    "LABEL" : "Wingstop Plano TX Options",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "TAGS" : [ "Plano TX", "Wingstop" ],
    "REQUIRES" : [
      "rules",
      "commerce_rules_extra",
      "commerce_line_item",
      "commerce_product_reference"
    ],
    "ON" : { "commerce_product_calculate_sell_price" : [] },
    "IF" : [
      { "entity_has_field" : { "entity" : [ "commerce-line-item" ], "field" : "field_quantity" } },
      { "AND" : [
          { "commerce_rules_extra_rules_condition_has_terms" : {
              "line_item" : [ "commerce-line-item:order:commerce-line-items:0" ],
              "voc_name" : "wingstop_plano_tx_75074_boneless_wing_options",
              "term_id" : { "value" : { "73" : "73" } },
              "product_display" : "1",
              "term_operator" : "IOO"
            }
          }
        ]
      }
    ],
    "DO" : [
      { "commerce_line_item_unit_price_add" : {
          "commerce_line_item" : [ "commerce_line_item" ],
          "amount" : "300",
          "component_name" : "base_price",
          "round_mode" : "0"
        }
      }
    ]
  }
}

Thanks in advance to any insight you can give on this.

Scott


texts: Adding zip archives to the Document File Type

texts:
I have many PDF documents in my site, assigned to the Document File Type by the File Entity Module.

I have added a few fields to the content type, thus allowing nice interface in showing all PDF files on the site, with nice filtering.

Now I want to include Zip archives in this interface. (Zip archives are not by default added to any Document type). I have updated the Document type definition to include the mime type application/zip on this page: /admin/structure/file-types/manage/document/edit

Is there any way I can automatically update the existing zip archive files so they are assigned to the Document File Type? As mentioned, there are quite a lot of them and I'd prefer not to have to upload them all again.


texts: Is it possible to use mixed LDAP and local Drupal authenticated users on the same site

texts:
I have a site in which site editors and administrator need to login using LDAP authentication.  However, the site also will have regular authenticated users, who can register for an account directly through the standard new user registration form.  I was wondering if it is possible to configure a Drupal site so that regular users can use the standard Drupal authentication process, but site editors and administrators can LDAP authentication?

I see that the LDAP module has a mixed mode setting in which it will use LDAP authentication if local authentication fails.  I would assume in such a situation, any users that registered for an account through the standard create new account form would have a local account and thus would be authenticated locally.  But how would it work with creating a new editor or administrator account?  Is it the case that I just need to add them to the LDAP server, after which they be automatically added to the Drupal system?


texts:
I've tried to add a loading animation to the website in case if the user clicks on buttons or input submit buttons. It work, except on those buttons which using AJAX. For some reason those buttons are processed, but my event listener looks like it was detached... Anybody know the reason or how can I fix it?

Code for the loading (it will create an overlay with a spinner and text):

(function ($, Drupal) {
  Drupal.behaviors.myModuleLoading = {
    attach: function attach(context) {
      $('button, .btn, input[type=submit]').not('.close').once('loading').on('click', function (event) {
        // Create the loading DOM.
        var background = $('<div>', document);
        background.addClass('loading-background');
        var logo = $('<div>', document);
        logo.addClass('loading-container').append(
          $('<div>', document).addClass('loading-container-inner').append(
            $('<div>', document).addClass('loading-icon')
              .append($('<div>', document)).append($('<div>', document))
              .append($('<div>', document)).append($('<div>', document))
              .append($('<div>', document)).append($('<div>', document))
              .append($('<div>', document)).append($('<div>', document))
          ).append(
            $('<div>', document).addClass('loading-text').text('Processing...')
          )
        );

        // Add to the body the created DOM.
        $('body').append(background).append(logo);
      });

      // Remove any remaining loading if user close a modal.
      $('.close').on('click', function () {
        $('.loading-background, .loading-container').remove();
      });

      // If it was an AJAX call this will be called.
      $('.loading-background, .loading-container').remove();
    }
  };
}(jQuery, Drupal));

Keep in mind, it works on those buttons, which doesn't use AJAX at all. With those buttons which using AJAX, it doesn't work from the beginning, but the loading-processed class is visible, which is added by the once('loading') code. I guessing there's a magic somewhere in Drupal which prevents to call other event listeners? (In chrome there's a way to stop the script and debugging if a click event happened, in AJAX buttons it doesn't stop, in normal buttons it stops, both are input[type=submit] type buttons.)


texts:
I am making a builder mini panel with two rows and three regions in each. Each region display a node.
     The problem is that only the first node is showing, rest just refuse to show.
     I have tried setting the styles of each region from default to no style, but the problem still persists. Here is a screen shot of my page


texts: Conditional checkbox fields if checked show a related textfield

texts:
So I want to create an Order form for my products list in Drupal 7, I'm using Entity form module, I have a prepopulated checkbox list widget to show all my product's node title as checkbox. What I want is if anyone checks a checkbox a textfield shows up to add the amount he wants to offer. I tried Conditional fields module too but it kind of doesn't work for my case because there will be more products added to the list and I cant add textfield to it manually and it will be a massive waste of time to do that.

I appreciate any suggestions and approaches or any other modules you might recommend.


texts: How can I update/revert a feature which includes page manager and mini panel components that is stuck as overriden?

texts:
I have a feature which includes page manager and mini panel components that is stuck as overriden?

I have tried reverting and updating the feature both from the web ui and also from drush to no effect.  I don't get any error messages but after clearing the cache twice the feature is still marked as overriden.

Generating a diff reveals about twelve differences that look like this:
+'new-6' => array(
-'new-1' => array(
+'pid' => 'new-6',
-'pid' => 'new-1',

I assume this is the result of the site on which I created the feature having a lot more content already in place than the site on which I have installed the feature, which has no other content.

I also tried removing the offending parts (those related to page manager and panels) from the feature, updating the feature, and then adding them back onto the feature using the web ui, but it still displays as overriden.

I found this thread but there wasn't any particularly helpful information:
http://drupal.org/node/744450

Any ideas about how I can update or revert this feature?


texts: How do I implement "enable" or "disable feature" similar to Drupal Gardens?

texts: I'm interested in implementing something similar to the way Drupal gardens let you enable and disable features in the create-site interface. (I mean the term features figuratively, not necessarily the features module.) Is this just some sort of custom form that hooks into enabling and disabling modules?


texts: Revision not working for content type using workbench moderation module

texts:
We have 7-8 content type. We are using workbench moderation module for revision and create draft.
This module works fine with all content type except one content type.
All settings are same for all content type.

When I edit content and save as draft, it gets published and anonymous user can see updated content. It should not visible to anonymous user as updated content saved as draft.

Anyone one have idea, what is the problem.


texts: How do I create a bundle under my custom content entity type in Drupal 8?

texts:
I am working on creating a base list entity type I will call CustomList for the sake of this question. I pair it up with CustomListItem so that I have an entity type to define the list and another to define the items in the list.

I intend to create bundles underneath these to build a custom cart, a saved item list, and an item group list.

So far everything I have found in Drupal 8 either creates Node Bundles (which I don't want) or a bundle of config yaml files to define the bundle (in this case ECK did this for me). But nothing useful on how to create a bundle under a specific entity type.

Would I just declare a new entity type and do something in the annotations to make it a bundle? If so I am unsure as to what annotation to use or how to use it.

Thanks,
Patrick


texts:
I need to create a completely blank page in Drupal. For simplicity sake the entire page should display the following:

Hello World!

While I can normally just create a page outside of Drupal, this page will need to access some of Drupals functions such as db_query. How can I create a completely blank page for a single url (e.g. http://www.example.com/blankpage)?


texts: How do I turn off the Comment Pager for a Type?

texts:
I have a Type configured as below, asking for 50 comments per page. However, I'm getting the pager on nodes that have as little as a single comment.

I've looked at responses another question. However, those responses point to a configuration in another view. I have no other views on this node type. It uses Responsive Bartik with no other modifications.

Outside of setting an extremely large "Comments per page" and using CSS to hide the pager, how else should I attack this?


texts: Is it possible to insert blocks into content using the paragraphs module?

texts:
I have a node (basic page type) with a lot of text (several paragraphs <p> of text).

Within two <p> tags I have to insert a block (generated with views oder other modules like Nodeblock).

How can I insert the existing block directly between the text of my node? Is it possible to do this with the "Paragraphs" module?

If not, why not?

If not, which other modules allow me inserting blocks directly into the node text?


texts:
I am trying to set Drupal 7, Drupal Commerce and Amazon to be able to sale files that are already on Amazon s3 servers.
I have set all of the settings, including the services key and the secret key in the AWS module.

It seems that everything was set just fine, but I don't find the way to connect a file to a product. I don't even find a list of files from my Amazon socket.

Does someone has an experience with selling files with Drupal Commerce 7.x-2.x?


texts: How to hide Profile2 entity fron user view?

texts:
I have a few profile2 types. Profile2 entity is always rendered on standard user view page.

How can I hide this entity? I know I can hide all fields in Manage Display tab, but I wondering if there is a way quicker way.


texts:
I have enabled the the "multilingual with translation" option for the content type.

I have created the node and translate it in 2nd language. In 2nd language I want to unpublish the content but when I unpublished it, it also unpublished the content in the 1st language.

Is it possible to publish/unpublish content by language?


texts: Serving the CSS and JavaScript files of the Bootstrap theme locally

texts:
I have installed bootstrap theme on drupal 8 and instead of using CDN provider, I'd like to load my bootstrap files locally for offline intranet usage.

Does anyone knows where should I put my bootstrap css & js files to in order to achieve this? Are there any instructions I can follow to achieve this?

Thanks


texts: AJAX calls in CTools Content Type Plugin?

texts:
I'm building a CTools Panels Content Type (i.e., that thing you insert into panels when adding content, not a type of node) and I am trying to use a form item's #ajax attribute to set some default values. See code below.

This is all inside of the content type's my_module_content_type_edit_form($form, &$form_state) call, by the way.

  $form['link_type'] = array(
    '#type' => 'radios',
    '#title' => t('Link Type'),
    '#ajax' => array(
      'callback' => 'my_module_set_target'
    ),
    '#default_value' => empty($conf['link_type']) ? '_blank' : $conf['link_type'],
    '#options' => array('none'=>t('No Link'), 'internal'=>t('Internal Link'), 'external'=>t('External Link'), 'document'=>t('Document Link')),
  );

My callback is the following.

function my_module_set_target($form, $form_state) {
  watchdog("Test", "Testing callback", array(), WATCHDOG_ALERT);
  $form['link_target']['#default_value'] = '_parent';

  return $form['link_target']['#default_value'];
}

Regardless of whether the return I'm suggesting would actually work, watchdog() doesn't even work.

I know CTools does some weird stuff with AJAX, but it can't be that weird. Do you have any idea on how I'd do what I'm wanting to do?

Thanks!

Alternatively: How do I set a default value based on the value of a previous form option?

I figured out how to do this, but it's a bit hacky -- you create new form fields for each dependency fork. You can then merge the values together in hook_content_type_edit_form_submit(), using whichever one corresponds to the value chosen for the component that initially forked everything.

I'm leaving the question open because I (and, frankly, every programmer I'm working with) is really wanting a good way to use AJAX inside these Panel content type edit forms.

Update: It appears you can't do stuff with #attached, either.

$form['link'][$i] = array(
  '#type' => 'fieldset',
  '#title' => t('Link #@num', array('@num' => $i)),
  '#collapsible' => TRUE,
  '#collapsed' => TRUE,
  '#attached' => array(
    'js' => array(
      'alert("Yay.");', 'inline'
    ),
  )
);


texts: How to prevent dynamic library definition from being cached?

texts:
I have a use case where i want to dynamic add library  , Attributes of library will vary with page. In my case the $callback will be different depending on the page.

$libraries['sample.my-lib'] = [
    'js' => [
      '//maps.googleapis.com/maps/api/js?'.$key.'&callback='.$callback
       => [
        'type' => 'external',
        'attributes' => [
          'async' => "true",
          'defer'=> 'true'
        ],
       ],
    ],
    'weight' => '2200',
  ];

The above code works but when i navigate to different page i have to clear the cache to get updated value of $callback.

I have tried hook_library_info_alter but library definition is still cached.

How can i work around it to make my use case work.


texts: Remove 'Switch to plain text editor' in CKEdtior

texts:
Where do I disable the switch to plain text editor link from the CKEditor. I checked the settings and I don't find anything that support this.

I tried to disable it with display:none; through CSS but it wont respond to it. Here is the code

Switch to plain text editor

I both tried with the id tag and the class to disable it but it dosen't work.

.ckeditor_links a {
display: none;
}

does not work :(

Any suggestions?


texts: What's the correct way to pass variables to the JavaScript of a custom CKEditor plugin?

texts:
I saw that we can pass values to our JavaScript using drupalSettings. However, this is for Drupal custom module JavaScript files. Since a CKEditor plugin file is already attached/loaded in a different way, I am wondering what's the correct way to pass variables to it.

The following is the code that I made, according to the example, but I have the feeling that plugin.js is loaded two times:

one time in inline_comment_preprocess_html()
and one more time with inline_comment/src/Plugin/CKEditorPlugin/InlineComment.php

What's the correct way to pass variables to plugin.js?

inline_comment.info.yml

name: CKEditor Inline Comment
type: module
description: "Adds the Inline Comment plugin to CKEditor."
package: CKEditor

dependencies:
  - ckeditor
  - core/jquery
  - core/drupalSettings

version: '8.x-1.0'
core: '8.x'
project: 'inline_comment'

inline_comment.module

function inline_comment_preprocess_html(&$variables) {
  $lotus_height = '300px';
  $variables['#attached']['library'][] = 'js/plugins/inline_comment/plugin.js'; // I think I shouldn't try to load plugin.js two times
  $variables['#attached']['drupalSettings']['lotus']['lotusJS']['lotus_height'] = $lotus_height;

}

js/plugins/inline_comment/plugin.js

CKEDITOR.plugins.add('inline_comment', {
    //...
});

(function ($, Drupal, drupalSettings) {
    Drupal.behaviors.LotusBehavior = {
        attach: function (context, settings) {
            var lotusHeight = drupalSettings.lotus.lotusJS.lotus_height;
            console.log('lotusHeight' + lotusHeight);
        }
    };
})(jQuery, Drupal, drupalSettings);

I noticed if I remove the line with $variables['#attached']['library'][] and I dump($variables) there is no drupalSettings variable in #attached array.


texts: How do you expose/display a product type's custom field in a product display?

texts: I created a custom field in my product type, but how do i get it to display on my product display when my item is selected? The field doesnt show up in managed display in the product display.


texts: Organic Groups: how to add an invite link?

texts: I'm using Organic Groups (og) and Organic Groups Invite (og_invite) on a D7 site, and see a way to invite a user to the group, but only through the admin panel - enabling the permission for a group member to invite others does not add a link to the group page to send an invite - what am I missing?


texts: WSOD on node edit/view pages only after migration - subdomain multisite

texts:
just migrated my company's website, foo.com, to a new server.  It is a multisite installation with an intranet, intranet.foo.com, installed at /sites/intranet.foo.com.  Everything migrated successfully except for one thing: node view and edit pages are not loading on the intranet (whereas admin pages, view pages, etc., are loading perfectly).

I tried a blank node.tpl.php and the page still didn't load, so the error must be elsewhere.

I have php error reporting enabled in index.php –

but I don't see any php errors (is this even possible - for some types of error?  Anyway I have a ticket open asking the host to enable error reporting in php.ini).

I don't see any WSOD documentation on drupal.org that pertains to this specific predicament (node page WSOD only).

Does anyone have any ideas about server settings that could be causing this to happen on the new server?  Or database issues that could be affecting node pages only?  Or if it is a php code error, where would it be such that it would break only node edit and view pages?


texts: Query method not triggered in custom filter handler?

texts:
I'm using Views 3.

I needed to create a custom Views filter that handle dates range. So I looked at example and tried to mimic the behavior and I got some trouble.

It seems that when I extend my own class from views_handler_filter, the query method is never invoked, BUT if I extend my class from let's say views_handler_filter_string it works.

I must forget something but I'm stuck here.

Here is my code, if someone can take a look and advise me about what happened, I would be very grateful.

Here is my .views.inc file :

<?php
  class v3d_date_custom_filter extends views_handler_filter {
    var $always_multiple = TRUE;

    function value_form(&$form, &$form_state) {
      //parent::value_form($form, $form_state);
      $form['value']['v3d_date']['period'] = array(
        '#type' => 'select',
        '#title' => 'Period',
        '#options' => array(
          '7_days' => 'Last 7 days',
          'yesterday' => 'Yesterday',
          'today' => 'Today',
          'custom' => 'Custom dates'),
        '#default_value' => 'custom',
        '#attributes' => array("onclick" => "period_click(this);"),
      );

      $form['value']['v3d_date']['start_date'] = array(
        '#type' => 'date_popup',
        '#date_format' => 'Y-m-d',
        '#title' => 'Start date',
        '#size' => 30);

      $form['value']['v3d_date']['end_date'] = array(
        '#type' => 'date_popup',
        '#title' => 'End date',
        '#date_format' => 'Y-m-d',
        '#size' => 30);
      }

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

     if(is_null($form_state['values']['start_date']) &&
        is_null($form_state['values']['start_date'])) {
        return TRUE;
     }

    /*
     * If we get array for start_date or end_date
     * errors occured, but the date module will handle it.
     */
     if(!is_string($form_state['values']['start_date']) ||
        !is_string($form_state['values']['end_date'])) {
       return TRUE;
     }

     /* Get day, month and year from start_date string */
     if(!preg_match('/(\d+)-(\d+)-(\d+)/',
        $form_state['values']['start_date'],
        $start_date
        )) {
       return TRUE; }

     /* Get day, month and year from end_date string */
     if(!preg_match('/(\d+)-(\d+)-(\d+)/',
        $form_state['values']['end_date'],
        $end_date
     )) {
       return TRUE; }

     /* Create timestamps and compare */
     $start_date = mktime(0,0,0,$start_date[1],$start_date[2],$start_date[3]);
     $end_date = mktime(0,0,0,$end_date[1],$end_date[2],$end_date[3]);

     if($start_date >= $end_date) {
       form_set_error('start_date','Start date must be anterior to end date.');
     }
   }

   function query() {
     die('fdsfds');
     $this->ensure_my_table();
     $field = "$this->table_alias.$this->real_field";
     dsm($this);
   }

 }
?>

And my .module file

<?php
  function custom_filters_views_api() {
    return array(
      'api'=>3,
      'path' => drupal_get_path('module','custom_filters') . '/views',
    );
  }
?>

And  part of my views_data that use my custom filter :

<?php

function voice_views_data() {

  $data['v_tp_voice']['date_utc_agent'] = array(
    'title' => t('date_utc_agent'),
    'help' => 'date_utc_agent',
    'field' => array('handler' => 'views_handler_field'),
    'filter' => array('handler' => 'v3d_date_custom_filter'),
    'sort' => array('handler' => 'views_handler_sort')
  );

  return $data;
}


texts: Displaying Profile2 edit page with Panels

texts:
I have a profile2 edit page (Drupal 7) found at user/*/edit/main. It has several fields that the user can edit.

As it stands, all the fields are displayed one on top of the other in one column and that makes a rather long list and lots of scrolling.

I would like to list those fields in an (imaginary) table or grid of 2 or 3 columns.

I tried Display Suite, but it's not compatible.

I am trying Panels but I can't get it to work. I use the user profile template of Page Manager (/user/%user.) The variant's selection rule is Path: user/*/edit/main, no context and the "Profile2 from user" relationship.

I have found all my fields and I have organized them in two columns (2 regions side by side) in the panel content.

The variant is enabled but it doesn't work. There is no change whatsoever when I visit the page (all fields still listed in one column.)

Am I doing something wrong or is Profile2 not compatible with Panels (like with Display Suite?)

Any and all suggestions or workaround would be greatly appreciated.

Thanks. :)


texts:
I am newbie to drupal. Recently I changed blocks of my theme and set main page content block to none.I logged out of my site. I tried to access admin panel by appending /user at URL. It redirected to login page but it login form is not appearing as displayed in image below. I am unable to enter my username and password.

Any helps are welcomed.


texts: Related Content By Taxonomy Term and fields

texts:
I have a content type which has taxonomy term field (Department). There is another field of the same taxonomy term (Priority Department)

I want to create a list of related content where the block shows only priority department related content and not the department field.

I tried views and contextual filter and relationship with no luck


texts:
I've installed Drush following http://www.zyxware.com/articles/4497/drupal-installing-latest-version-of-drush-on-linux-system-and-troubleshooting.

Now, when I try to run Drush, I get this error message.

  PHP Fatal error: Class Symfony\Component\Console\Style\SymfonyStyle contains 4 abstract methods and must therefore be declared abstract or implement the remaining methods (Symfony\Component\Console\Output\OutputInterface::isQuiet, Symfony\Component\Console\Output\OutputInterface::isVerbose, Symfony\Component\Console\Output\OutputInterface::isVeryVerbose, ...) in /var/www/html/tubimer/vendor/symfony/console/Style/SymfonyStyle.php on line 33
  Drush command terminated abnormally due to an unrecoverable error.
  Error: Class Symfony\Component\Console\Style\SymfonyStyle contains 4 abstract methods and must therefore be declared abstract or implement the remaining methods (Symfony\Component\Console\Output\OutputInterface::isQuiet, Symfony\Component\Console\Output\OutputInterface::isVerbose, Symfony\Component\Console\Output\OutputInterface::isVeryVerbose, ...) in /var/www/html/tubimer/vendor/symfony/console/Style/SymfonyStyle.php, line 33

How do I fix these errors?


texts: I'm trying to use Profile2 and Profile2 Registration Path to create 3 different profiles but when i register a new user I don't see the registration page of the profile but the drupal's default registration forms...where i wrong? How should i do?


texts:
I need to create pdf of user's cart items with custom header & footer. I decide to create custom module in which I can get cart items details. But I have no idea about how to do this? I have tried:

$store_id = 1;
$order_type = 'default';
$cart_manager = \Drupal::service('commerce_cart.cart_manager');
$cart_provider = \Drupal::service('commerce_cart.cart_provider');
$entity_manager = \Drupal::entityManager();
$store = $entity_manager->getStorage('commerce_store')->load($store_id);
$cart = $cart_provider->getCart($order_type, $store);
foreach ($cart-> getItems() as $order_item) {
    foreach($order_item->getPurchasedEntity() as $purchased_entity){
        print_r($purchased_entity);
    }
}

But it gives an array like

Drupal\commerce_product\Entity\ProductVariation Object
(
[values:protected] => Array
    (
        [variation_id] => Array
            (
                [x-default] => 432
            )

        [type] => Array
            (
                [x-default] => product_variations
            )

        [uuid] => Array
            (
                [x-default] => 87d27a77-4bc1-40ff-b3cf-ad3e949ce1b3
            )

        [langcode] => Array
            (
                [x-default] => en
            )

        [status] => Array
            (
                [x-default] => 1
            )

        [uid] => Array
            (
                [x-default] => 9
            )

        [product_id] => Array
            (
                [x-default] => 65
            )

        [sku] => Array
            (
                [x-default] => xx-uua
            )
        [price] => Array
            (
                [x-default] => Array
                    (
                        [number] => 22.000000
                        [currency_code] => USD
                    )

            )
        [field_order_no] => Array
            (
                [x-default] => Array
                    (
                        [0] => Array
                            (
                                [value] => PE-5070
                            )

                    )

            )

And many more protected objects.
I know I can get quantity, title & price easily using drupal function but how can I get few custom details from above array like field_order_no in above array, I have some unique attribute assigned to variation that I need to display in pdf?


texts:
I have a html doc and css for a site that I do not currently have live. I want to use Drupal for the site but have a question about testing when changing the html/css into something compatible with Drupal: How do I check my progress to make sure things are working?

With an HTML doc, all I have to do is click the doc and it opens up in my browser. How do I test with Drupal in that way?

What steps do I take to install Drupal locally? I am running Windows, so do I use WAMP? I am a total noob, any help would be more than awesome.


texts: How to pass custom variables into drush site-install?

texts:
I'm installing drush profile via:

drush site-install my_profile --db-url=db.url --account-name=admin --account-mail="admin@example.com" --site-mail="admin@example.com" --site-name="My Site"

But how I can pass some variables into my_profile to initialize them with default values?

In example I'd like to set specific file_public_path and file_private_path as some module fails to install because of the folder misconfiguration.


texts: How to get JSON data from exception in httpClient()

texts:
public function myLogin() {
    try {
      $client = \Drupal::httpClient();
      $request = $client->post('https://targetApi.com/auth/login?fx=1', [
             'json' => [
                 'login' => 'demo',
                 'password' => 'demo1234567',
                 'locale' => 'en'
              ]
      ]);
      $response = json_decode($request->getBody());
      return $respone;
    } catch (\Exception $e) {
      \Drupal::logger('autoapp')->error($e->getMessage());
    }
  }

When I set wrong password I can catch this in $e->getMessage(). The message is:

Client error: `POST https://targetApi.com/auth/login?fx=1` resulted in a `404 Not Found` response:
{"error":"auth.user.notfound"}

So I can catch error, this is fine. But I'd like to get JSON data from It. And if in the try part I have it in $request->getBody(), how can I get it from $e ?


texts:
I've installed the webform module in my drupal site and want to configure it so that the submission limitation is by email instead of cookies. I dont want users who have already submitted to submit twice if their email is in the system. Is there a way to do that? Would I Have to create a new module for this? If so, how do I communicate my new module with the webform module? Or would editing this webform module be the solution (which I dont think is a good idea in case I have to upgrade it and lose the changes I've done).
Please help. Thanks.


texts:
In my application I have a page that shows a view and a few fields from a node related to the view; this node is created when an authorized user accesses the page for the first time. When the node is published, the page can be viewed by anonymous users also.

Therefore, when the page is accessed, I have the following possibilities:

Authorized user and the node does not exist: create the node, then display the page in edit mode.
Authorized user and the node exists: display the page in edit mode.
Anonymous or unauthorized user: display the page in view mode.

Therefore, the first thing I have to do is search for the node with an entityQuery. My code goes like this:

$query = \Drupal::entityQuery('node') ;
$query->condition('type', 'my_custom_type') ;
$query->condition('my_custom_field', $value) ;
$ids = $query->execute() ;

This works fine for authenticated users, but always returns zero records for an anonymous user, even if they have the permission to access the node (through the 'access content' permission). I googled something and I found this answer on SO (but please note I am on Drupal 8, not 7), so I added the following before executing the query:

$query->addMetadata('account', user_load(1)) ;

This works, but seems to me more a nasty workaround than a proper solution... is it really the way to go? I looked in the permissione list to see if the anonymous user is missing some permission, but didn't find anything.


texts: how to show only child term on expose filter option based on parent term from url in drupal7 views?

texts: I have created views with expose filter in drupal7. In expose filter I need to show only child term.Parent value will be depend on url. This time all parent and child term are showing in expose filter .


texts:
I've altered the default register form into multistep and its connecting with web service SOAP.
The first step is validating well and gets the webservice response.
The second step of the form is using the default fields user, pass, pass_confirm and email.

I have two issues: When I'm passing the XML string to the web service and when response with error message, lets say in this case ("this user its already registered), Drupal its registering the user. How could prevent Drupal to register if there is a error from the web service? Here is a part of the code. Its a submit handler that connects with the web service.

<?php
**
 * Submit handler for user registration form.
 *
 */
function custom_register_register_submit(&$form, &$form_state) {

    $egn = $form_state['values']['egn'];
    $card_mask = $form_state['values']['last_digits'];
    $auth_code = $form_state['values']['authorization_code'];
    $trn_date = $form_state['values']['transcation_date'];
    $ip_address = $_SERVER["REMOTE_ADDR"];
    $session_id = session_id();
    $name = $form_state['values']['name'];
    $pass = $form_state['values']['pass'];
    $email = $form_state['values']['mail'];

$xml_string = '<reqRegRequestCardHolder>
  <egn>' . $egn . '</egn>
  <cardMaskLastDigits>' . $card_mask . '</cardMaskLastDigits>
  <authCode>' . $auth_code . '</authCode>
  <trnDate>' . $trn_date . '</trnDate>
  <username>' . $name . '</username>
  <password>' . $pass . '</password>
  <email>' . $email . '</email>
  <ip_address>' . $ip_address . '</ip_address>
  <session_id>' . $session_id . '</session_id>
  <language>bg</language>
</reqRegRequestCardHolder>';

    $client = new nusoap_client('http://10.10.60.80:8090/CardHolderAuthentication.asmx?wsdl', array('soap_version' => SOAP_1_1, 'trace' => 1, 'exeptions' => true));
    $client -> soap_defencoding = 'UTF-8';
    $client -> decode_utf8 = FALSE;

    $result = $client->call('CreateRegistrationRequest',array('_xml'=>$xml_string));

    $response = simplexml_load_string($result['CreateRegistrationRequestResult']);

    $status = $response->status;

    if($status == 'SUCCESS') {

        $requestId = $response->requestID;
        //drupal_set_message("request id : ".$requestId, 'status');
        //$form_state['step'] = 2;

            }
    elseif ($status == 'ERROR') {

        $description = $response->error->descr_bg;

        $form_state['step'] = 1;
        drupal_set_message($description, 'error');
    }
    else {

    }

    dpm($form_state);

}

The other issue is: I'm using the PHP function simplexml_load_string() to receive a response from web service as a array.
On my multistep form on the first step simplexml_load_string is working properly, but on the next step when the user is filling the default fields user, pass, pass_confirm and email after submitting the form there's an error: Exception: Serialization of 'SimpleXMLElement' is not allowed in session_write_close().


texts: Drupal Commerce: line_item field in user profile?

texts:
Im trying to achieve the add to favorites function, but I cant reference the commerce_product/product_display becose the items that are sold in my situation get customized by the user (add text, images, whatever).

I have a custom line item type called custom, where I added the field to handle the customization my users can do.

For the add to favorites functionality, i thought to add a line_item field in the user profile, put in it the custom line items created, and when he want to buy it all I have to do is create a new line item copying the fields value and then add it to the cart.

But i have some trouble: when i try to add (for test) the line items in the user's profile page throught the standard widget, I dont get any error message but the line items doesnt get saved..

Are them bounded to commerce_orders only?


texts: How to solve my Field mapping problem during import of Registration codes?

texts:
I'm using the RegCode Module and I need to have 64 different registration codes and I want each of them to be used an infinite number of times. So the only solution is to import them.
I created an Excel spreadsheet with two columns:

"code", which contains the 64 codes.
"maxuses", which contains "999999".

I exported it as a CSV file but when I try to import it, I get this message:

File successfully saved
Successfully inserted 0 rows out of 64
Warning: array_combine(): Both parameters should have an equal number of elements in regcode_ie_admin_import_submit() (line 167 of /sites/all/modules/regcode/regcode_ie/regcode_ie.module).

Am I doing something wrong ?


texts: Image Gallery not loading random thumbnails

texts:
This has been happening for... perhaps for years.

I have an image gallery here http://windwanderer.com/image

When I load any page of this gallery, only SOME of the thumbnails are loaded and the rest show the default text.

Which thumbnails load and which do not changes with each load. Try it, go to the link above and see which images are shown (you may need to scroll down) then click "reload" on your browser. Some of those that looked to be unavailable will be loaded and some of those that loaded correctly the first time will now appear as thought the image can't be found.

The error occurs in Firefox, Midori, and even Dolphin browser running on Android phone!! Haven't tested it with iexplorer.

I believe this problem may have persisted over an upgrade from Drupal 5.x to 6.x

My guess was that it had something to do with the cache. Here is what I have done:

I've emptied it
turned off page caching
rebuilt the derivative images multiple times

... yet the problem persists.

I would really appreciate any help. Please be patient, though, as I don't sit at my computer every day and it may take me time to test solutions.

Cheers
Jesse

  SITE STATS: Drupal Version: 6.x-2.9 Image Gallery Version: 6.x-1.1 Was
  using acidfree albums in 5.x but changed to image gallery (views) when
  upgraded to 6.x The view states "Overridden Node view: image_gallery"
  Views Version: 6.x-2.16 Was using image toolkit: "GD2 image
  manipulation toolkit" but have just changed to "ImageMagick Toolkit"
  in attempts to solve this problem.


texts: hook_form_alter not working in comment form Validation

texts:
I am trying to apply a hook for comment form email validation but it is not working.

function ajax_comments_form_alter(&$form, &$form_state, $form_id){
  if($form_id == 'comment_migrate_example_advanced_comment_form') {
    $form['#validate'][] = 'ajax_comments_custom_validation_function'; // this adds your validation function to the stack
  }
}

function ajax_comments_custom_validation_function(&$form, &$form_state){
  $email = $form_state['values']['mail']['und'][0]['value'];
  $regex = '/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/';
  if (!preg_match($regex, $email)) {
      form_set_error('mail', t('Invalid Email.' ));
    }
}

I am using the following code in ajax comment module's .module file. What am I doing Wrong here? Please help. When I try to submit the form it gives Ajax Error.


texts: How to improve Drupal speed when developing in localhost

texts:
I'm looking for tips from other Drupal developers to make Drupal faster when developing (specially Drupal 7)

Taking in consideration that during development you don't want cache, so you can see the result of changes in code php/css/js. (See some answers here to flush cache / disable cache permanently)

Googling for "drupal slow localhost" will give some tips... but I want yours :)


texts: How to debug a rule that doesn't want to fire?

texts:
I have nodes that can be flagged with a global flag.
When a node is updated I want a rule to unflag that node.

Rules Event: After updating existing content

Rules Action: Unflag a node.
I then select the flag, "data selector" = node, "User on whose behalf to flag" = node:author (this field should be ignored because it's a global flag),
"permission check" is unchecked.

When I update a node which has a global flag set, it doesn't get removed.
Did I set it up wrong? How can I debug a rule that doesn't want to fire?


texts: Linking two different content types with Views

texts:
I was wondering if one can link up the data with views in this way:

I have two content types (current_state & desired_state), both have 3 fields (location, item, quantity)

How can I join the data, so that it displays in a table like:

location | item | desired_quantity | current_quantity

I separated those content types because people with other permissions are allowed to edit them.


texts: How to implement a multiple (AJAX) field collection with the FAPI

texts:
Background: I have a field colleciton containing two fields. This field collection is attached to a profile entity and its number set to unlimited.

I am currently retrieving this field from the profile form to use it a custom form.

I get the form array and it is displayed correctly, but when I click on the button to add another element, I got a popup displaying this error:

  EntityMalformedException : Missing bundle property on entity of
  typefield_collection_item dans entity_extract_ids() (ligne 7663 dans
  /drupal_project/includes/common.inc).

Anyone have a clue or hint of what is going on behing the scene ? Maybe a solution to solve this issue ?

Update: the form I am making is a ctools multistep form. I am opened to alternatives such as Dave Reid's multifield.


texts: What is the goal of template_preprocess_page(&$variables)?

texts: I am trying to modify the login and register page drupal 7 but i actually don't understand what is the goal of template_preprocess_page(&$variables) ... Someone can give me a better explanation of that ?


texts: How can I add a menu link on the right side of my menu bar while having the main menu on the left side?

texts:
I have a menu bar displaying the main menu on the left side and I would like to add a link to user account on the right side (right corner). I am using the TB mega menu module. Any idea of how I could do that? Thanks!
EDIT: here is a screenshot showing the main menu I was referring to (Home - Resources - Development Hub - Community Center). What I would like to do is to add the user menu (using the TB mega menu module) on the other side of the menu bar (right side).


texts: How can I connect drupal 6 and activemq?

texts: I would like to use publish subscribe technique to send updates to drupal as they happen in an external database. This database has middleware that publishes changes using a messaging system (apache camel).


texts: How can I throw a form error if a submission field has a certain value in webform?

texts:
I am using mymodule_webform_submission_presave() to alter some of the data before it gets saved.
I want to check if a certain select field has a certain option selected, dont save the form to the db and give the user an error like "you may not pick this" and dont save the form.

I would remove the option itself from the form but this wont be possible.

I've also tried to do it via the webform gui but there is no rule which says "this select may not have this option selected", is there?

Thanks!


texts: Assign field permission to individual users?

texts:
Here the idea is to avoid defining dozens of roles to account for delicate permission requirements of users.

Say, on a certain node that has 100 fields, a webmaster may eventually need to define several hundreds of permission sets, many of them are needed for very few users on and ad hoc manner. Being able to define field permissions for particular users gives the webmaster ultimate flexibility and avoids insane proliferation of roles.

I appreciate your hints about this possibility.


texts: How to add/remove a permission from a user role to a particular user without modifiying the user role?

texts:
Let's say that I have a user role called ARTICLE_VIEW_EDIT which has permissions to view and edit own articles nodes. I have the following 2 cases.

I want to give extra permission, delete own articles permission to a user - user101 who has the user role ARTICLE_VIEW_EDIT and this modification must not affect the user role.
I would like to remove edit permission from a user - user102 who has the user role ARTICLE_VIEW_EDIT and this modification must not affect the user role.

After doing some research I have found out that I could use the Role class to create custom user roles but that will be saved as configuration not as a record in the user__roles tables hence I am not getting the output that I'm looking for.


texts: Why can't I edit Views in Drupal 6 since moving the site?

texts:
I moved a Drup-al 6 site from one hosting server to another, exporting and re-importing the DB. Everything works well but for some reason I can't edit anything in the views. Each time it says page not found which is really odd. Has something happened with paths?

I've tried rebuilding menu structures and cleared all caches etc.

Thanks :)


texts: How do I hide the page title based on node type using template_preprocess_page()?

texts:
In Drupal 7, this was possible. (See How to hide page title based on node type using template_preprocess_page().)

function MYTHEME_preprocess_page(&$variables) {
  if (!empty($variables['node']) && $variables['node']->type == 'concert') {
    $variables['show_title'] = FALSE;
  }
}

What is the equivalent in Drupal 8?


texts: Let users assign particular roles to other users

texts:
How can I let a "subadmin" to assign only particular roles to other users?

Just an example: my users can only use the forum if they have the "forum user" role. I would like to delegate the right to a "subadmin" to assign the "forum user" role to particular users, without letting this subadmin to be able to assign any other roles. Or I also want to let this subadmin assign the "article creator" role to others, etc.

Is there a module for that? Or do I have to create my own?


texts: Calendar View of a Field Collections and Contextual Filters

texts:
I've clicked my way into a corner. So I have a Field Collection called Performance Dates that is embedded to a Content Type of Performance that looks like this:

I would like to put this into a calendar view, listing all dates (the field collection) from a single performance (the Performance content type).

Since Entity Host ID is not offered as a contextual filter, I was thinking to create a contextual filter on the Field Collection's ID.

My question: If I am going about this the right way, is there a way to return an array of IDs here much like using SQL where id in (x, y, z)?


texts: Show Content Type Fields from a entity reference

texts:
I have a content type which i have linked to another content type. For e.g.

Companies (Content Type)
Employees (Content Type)

When creating a new employee i have to say which company it works for so in the Field Type i chose "Entity Reference and chose Autocomplete as the widget".

Now i have created a view which shows a list of all the employees, in this view i can show the companies Name however i want to show the companies logo instead of the name.

How can i grab the fields from "Companies" and display them within the Employees VIEW?

Thanks in advance.


texts: How to render language select block in page template?

texts:
Background information:
I used the following script to list all the twig blocks: drush ev "print_r(array_keys(\Drupal::service('plugin.manager.block')->getDefinitions()))" and when I tried the following twig : {{ drupal_entity('block', '') }} and it is not rendering the twig block–

I developed a Twig page in Drupal 8 to allow my website visitors the ability to select the language they want. I downloaded all the multilingual contrib modules.

I am facing two issues:

How to render a block in the middle of my twig page to display the language drop-down menu? (I already have a block that displays a drop-down menu language from a contrib module).
The CSS background image I had setup is covering one of the Twig field I wanted to test. How can I tweak the CSS in order to display the twig block?


texts: Struggling with View Slider Image Rotation

texts:
I'm struggling to let the images rotate with the View Slider module.

When I add an image of content type of say -> image_slider. At the moment it only replaces the current slider image with the latest published content of type image_slider instead of rotating between the images.

Where can I set/change this?

Thanks in advance!

Edit: I added 2 images to one node and now when I think it wants to rotate between the images I get this error in the console: Uncaught TypeError: Cannot read property 'action' of undefined


texts: PHP filter field behavior with Rules - can't use curl_exec

texts:
I am on Drupal 7. I am trying to use Rules to execute custom PHP code. I am using PHP filter in order to achieve that. Inside that PHP filter I will use curl. The idea is to communicate with a remote API.

I already have one Drupal website running this code I want to use and it works like a charm. On this website I am using Rules, PHP filter and curl.

The issue is that I am porting the EXACT same code to a new website using the same set of tools (Rules, PHP filter, curl), but I can't save my code into PHP filter.

The field will allow me to save this

$data = array(
'User'          => 'someuser',
'Password'      => 'somepassword',
'Subject'       => 'Something',
'Message'       => 'Something',
'StampToSend'   => $account->created,
'MessageTypeID' => 1
);

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://someurl.com");
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_FAILONERROR, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

When I add the last line "$response = curl_exec($curl);", then Drupal won't save my Rule. No error messages, no messages in the Drupal logs, no anything. It will just fail to save the field. I can save all the code above, and Rules with PHP filter will accept it. When adding the curl_execute line, it simply won't save.

Any ideas on what I could do? Thank you!


texts:
I am trying to remove specific HTTP response header from my site.
The header looks like this:

Link: <https://example.com>; rel="canonical",<https://example.com>; rel="shortlink"

So far I have tried this simple code in my theme_html_head_alter:

header_remove("Link");

But that does not remove the header. Is there some specific Drupal way to deal with this, or am I using this code in wrong function? Or am I completely wrong with this?

Thank you in advance


texts: I have a site using tb mega menu. The only problem I have with it is it will not allow me to place a column to the left of another column. It just groups the two with the one I want to move always at the bottom. This wouldn't be much a problem if I could reorder the structure menu and see it affected on tb mega menu pages. The only solution I found was deleting the database row of that menu and starting over.


texts:
I have setup a Drupal Commerce website (using Drupal 7) with two shipping options:

Delivery by courier company
Pickup from store

The next step in checkout process is to choose the payment method. BUT...
if the second choice (pickup from store) is chosen, the only available payment method is Pay at store (offline payment). I have managed to show only this option through Rules. So far so good.

My concern is that for better user experience I have to make this step skipped. So after the Shipping step where the user selects the Pickup from store option, the next logical step is the Review pane for a final review by the user before complete the checkout process.

I have read that the Payment selection method (checkout step) is required for the Payment Redirection (I fail to understand it).

I have already tried to use hook_commerce_checkout_router, checking the $order shipping line and use the drupal_goto function redirect to the review page. My custom function is the following:

function <myModule>_commerce_checkout_router($order, $checkout_page) {
  global $user;

  if ($checkout_page['page_id']=='checkout') {
    if (!empty($order->commerce_order_total['und']['0']['data']['components']['2']) && ($order->commerce_order_total['und']['0']['data']['components']['2']['name']=='flat_rate_from_store')) {
      drupal_goto('checkout/' . $order->order_id . '/' . $checkout_page['next_page']);
    }
  }
}

I get error "The page isn’t redirecting properly". It is the same result as if someone is at the shipping step and manually tried to enter at the url the /review.

Do you think is possible to achieve skipping this step to speed up the checkout process or I have to give up trying ?
At year 2017 it is very important to give a user the best and the most logical way to move around in a website. Useless steps and clicks slow down the process and maybe end in frustration.


texts: How do I produce 2 lists with one display?

texts:
I'm back on this issue for me because I would to implement Responsive slideshows with thumbnails and many of those use 2  elements to display thumbs and full image.
So I know I need to edit the style output template or the row style output template but I don't know how to find values provided by views to print them inside my template.
This doesn't explain how to find variables.
I'm looking for some example and explanations to understand how to do.

So I get the style output template, and I have done as you said to print fields. I want to modify the field settings in the view.

<?php if (!empty($title)): ?>

<?php print $title; ?>

<?php endif; ?>

<?php foreach ($rows as $id => $row): ?>
  <li class="<?php print $classes[$id]; ?>">
    <?php print $row; ?>

<?php endforeach; ?>

      <?php foreach ($rows as $id => $row): ?>

    <?php print ($fields['field_galerie_image_vdl_fid_1']->content); ?>

<?php endforeach; ?>

I can't find the right targeting for my desired field, and in the  I need to exclude some part of the output.


texts: CCK select list and default values from array without writing custom module

texts:
For my CCK select list options, I did:

//just making up firstName field to simplify example
$sql = "SELECT uid,firstName FROM users";
db_query($sql);
while($row = db_fetch_object($result)) {
  $uids[$row->uid] = $row->firstName;
}
return $uids;

This returns something like:

'1' => 'joe'
'2' => 'bob'
'3' => 'sarah'

Now in CCK, how do I programmatically set the the logged in user's id to be the default selected from the select list?  Furthermore, CCK's example of a default return value makes no sense to me:

return array(
  0 => array('value' => value for value),
  // You'll usually want to stop here. Provide more values
  // if you want your 'default value' to be multi-valued:
  1 => array('value' => value for value),
  2 => ...
);

I know I can do this with hook_form_alter, but I am trying this WITHOUT writing any custom module so I can learn CCK and make it easy for my future devs.


texts:
I have a menu hook and page callback which takes several arguments to generate some table data in a page, the page makes heavy use of entityfield_query and some other modules.

I need to be able to e-mail the contents of this page based on a set of periodic dates. What's the best way to achieve this?

I realise that the css will all have to be added to the page but if I could get the structure into an e-mail that would be a start.


texts: How to show one variation of one product in a View Pane

texts: I have a View Pane on my home page where I list all products that are in promotion. Each product variation that can be set to "show in promo banner 1" via a taxonomy term field with checkboxes. So the store owner can now tick this checkbox to indicate that this product variation is in promotion. This works but only for product displays that have only 1 variation. When, for example, I only tick this checkbox for "product variation 4" of a particular product and no other variations, the first variation shows with a variation select widget and that's not what I want. So how can I only show that particular variation without the widget but with all the correct data and an add to cart button?


texts: What is the difference between a page and a node?

texts:
What is the actual difference between a node and a page in Drupal 7? Why there is separate page.tpl.php and node.tpl.php pages. How is the theming applied for the actual page.

Any link for understanding all this would be greatly appreciated.


texts: How do I allow to select the "Match All" or "Match Any" filter?

texts:
I have a Drupal 7 View with BEF and 7 exposed filters.
I want to show a Radio Button below the filter with 2 options "Match All" and "Match Any".

By default the "Match Any" option will be selected and if the user selects any filter the result will be shown for the matching filters.
But if the user selects "Match All" then the result should show only the records where all the selected filters match.


texts: Add #ajax callback to an entity_autocomplete field

texts:
I have an entity_autocomplete field in a form.

$element['content'] = array(
  '#type' => 'entity_autocomplete',
  '#target_type' => 'node',
  '#title' => t('Content'),
  '#title_display' => 'hidden',
  '#default_value' => $content_default,
  '#selection_handler' => 'default',
  '#selection_settings' => array(
    'target_bundles' => $selected_bundles,
  ),
  '#prefix' => '<div class="container-inline">'
);

I would like to add an #ajax callback to run after someone has selected a piece of content from the autocomplete drop-down, but I can't seem to find out how to attach it.

I have tried as follows which works for select boxes.

   $element['content']['#ajax'] = array(
      'callback' => 'Drupal\MODULE\Plugin\Field\FieldWidget\WIDGET::METHOD',
      'wrapper' => $id,
      'method' => 'replace',
      'progress' => array(
        'type' => 'throbber',
        'message' => "shuffling",
      ),
    );

However, it does not fire. Is it possible to do what i need?

It actually fires if you tab out of the field, but I need it to fire after a selection is made.


texts: Clean way of building simple taxonomy browser of arbitrary depth

texts:
I have spent days trying to determine a clean way to do the following:

Display a list of all top-level terms in a vocabulary with links to their child terms
Upon clicking a link, be taken to a list of the children of those terms.
Ad infinitum until the lowest-level term, for which a list of nodes tagged with that term will be displayed.

This seems like it would be pretty commonly-needed functionality but I can't find any solution that can handle arbitrary depth, particularly if not all term trees  descend to the same depth.

An ideal solution would be one that uses Views 3, Contexts, EntityFieldQueries, or anything else that's well-supported in Drupal 7.

I'm able to do almost exactly what I want by making a simple view with three node:term relationships (term, term's parent, and term's parent's parent) and user those for sequential contextual filters. The only problem with this is that if there's a node with a termpath of too little depth, it gets listed as "uncategorized" and generates a dead link. Instead of doing that I'd like it to link to the next child term available.


texts: How to check field value against same field on existing nodes of same content type

texts:
I wonder if it possible to check the value of a filed against same field in already existing nodes of same content type.

My case: I have a content type property where people advertise their properties, inside property content type I have a field Phone number. I would like to have a rule to check the value of phone number filed against all the existing properties when user click save on creating new property page and send email to administrator with value of the phone number field.

For my experience the Rules module should be able to do that, but I can't figure how.

How dose Unique field module work?

Knowing about the way Unique field module functionality i can customise the module/create my own to send email if there was a any other content with same phone number


texts: Can Drupal built-in search or Apache Solr find comments on the site made with Disqus?

texts:
I'm evaluating comment systems and although I see disqus used in many cases I'm not sure if it is the best choice for me as I am uncertain that my site's own search system could show comments in search results.

Can Drupal built-in search or Apache Solr find comments on the site made with Disqus ?

Research I have shown so far is that Disqus has Search Engine Optimisation (SEO) -- for external search engines e.g. Google:-

http://wordpress.org/plugins/disqus-comment-system/
http://www.quora.com/Do-search-engines-index-Disqus-content

But what about your own search system on your site, or using Solr for example. I'd prefer not to use Custom Google Search to search my site as I want control over how my results are shown.

So I'm looking for 2 answers for searching Disqus comments: 1) for the basic built-in Drupal search and 2) for SOLR.

Thank you.


texts: Print full node url escaping special characters?

texts:
How can I print the full node url in a tpl file escaping special characters?

So im using this:

<?php print $base_url . $node_url ?>

Which gives me a url like http://time.com/3525666/ebola-psychology-fear-symptoms/

However I need the url to be like http%3A%2F%2Ftime.com%2F3525666%2Febola-psychology-fear-symptoms%2F


texts: Disabling acces to previous pages in Webform

texts:
I have a multi-page survey where I need to prevent participants from paging back through the survey and changing his/her answers.

The only thing I can think of is to break the multi-page form into multiple forms.  The first form would limit the user to taking the form once and the submit button would forward the user to the second form.

It's an acceptable hack if you only need to do it once, but I would vastly prefer to do it the official way, if there is one...

Thanks!


texts: Filtering comment by date range in Views

texts:
I have created a view to filter comments by date range. For date range i am using between operator.

View type : Comment
Date : comment created (default field)

Issue : When i am trying to filter comment from 2015-11-01 to 2015-11-15

i am getting result from 2015-11-01 to 2015-11-14 only.

what i am missing ? may be some help me ?


texts: 7 mysql workbench get the values of entity reference fields of a content type in a node page

texts:
I am using MySQLWorkbench queries to update some values. Those values are entity reference fields of a content type.

 foreach ($node->field_media_types['und'] as $mt) {
    $media_types[$mt['field_media_type']['und'][0]['value']] = $mt['field_media_file']['und'][0]['value'];}

The code above is how it is access on a script. I want using MySQLWorkbench  or just MySQL CLI acces those values on quick queries.

select entity_id, field_media_file_value from field_data_field_media_file order by entity_id desc;
(0 rows return)

How do I do it? Is it possible?


texts: Ubercart need to pay depends on user role

texts:
I am using drupal 6.20 and Ubercart 2.0
Like what I asked in the subject.
Is there any chance that I can customize a ordering process with or without payment?

For example:
There are 2 roles of users ( Role A and Role B)
Users of Role A need to pay all my products to complete the transaction.
Users of Role B don't need to pay any of my products to complete the transaction.

Actually I want my website to be suitable for 2 kinks of clients:
1. wholesalers (Role A) --- order online but pay through company invoicing system
2. retailers (Role B) --- order online and pay instantly

Appreciate any thoughts and helps on this!


texts:
How to theme the register page (mysite.com/user/register). I'm using the Omega theme.

Where do I find the template page user-register.tpl.php ?

I don't need to add fields to the form, I just to theme this page.


texts: How to generate pdf file from a specific type of content?

texts:
I have a content type named "employees".

I want that when I add an employee(creating content of type employee) it should also generate a pdf file which will contain the data which I inserted during adding content.

And a link on that node appears stated that "Download the pdf".


texts:
I have looked online to see if it is possible to use jQuery Tools 1.2.7 with Drupal 7. I see that there is a defunct project that attempted to use it in Drupal 6 but nothing for Drupal 7. I tried downloading it and including it in the scripts line in the .info file for my module but still not executing. I suspect the issue might be that jQuery Tools expect jQuery 1.7.2 while Drupal 7 uses jQuery 1.5.

The specific feature that I am trying to use is the overlay function. I followed the online documentation but I don't see any overlay. All it does is reloading the same page over again. I was wondering if anyone has used the overlay module with Drupal 7 and has gotten it to work.


texts:
I am working on a cron job that is creating a backup file.  I want to move the file to the private file directory but I am having trouble figuring out how to do this.  The cron job creates a file in a folder called /temp in the root of my site.  I've been trying to use file_save_upload to move the file, but this isn't working

$gzip_file = $_SERVER['DOCUMENT_ROOT'] . '/temp/myfile.gz';
$private_file = 'private://myfolder/myfile.gz';
$drupal_file = file_save_upload($gzip_file,array(),$private_file,FILE_EXISTS_REPLACE);

I am not getting an error and $drupal_file equals false.  The private folder exists and I can write to it with PHP.  Is file_save_upload the wrong function?  What do I need to do instead?


texts: Problems trapping AJAX'ed form input click event

texts:
Using Drupal 7.x w/ jQuery 1.4x, I'm trying to trap the click event when I click on a submit input of an AJAX form generated from this Commerce AJAX Cart module.

In my custom.js behaviors file, I have the following code.

$(".form-submit").click(function(){
    alert('test');
});

The alert doesn't get displayed and I have no clue as to why. I load my custom.js file from template.php using the following code.

drupal_add_js(path_to_theme() . '/scripts/global.js', array('weight' => 200));

I tried lowering 200 down to insanely low levels just to test if weight had anything to do with any of this, but nothing I tried helped.

Any ideas as to why this click event isn't working would be helpful.


texts: Multisite, shared users, own databases, own files, how to deal with profile picture?

texts:
I'm in the middle of implementing a multisite setup. Each site will have it's own database, and files directory, but they will share the user table from the default database.

Because the profile picture field in the user table is set to a fid, am I right in thinking this will break a user picture if they look at their profile on a different site?

fid 26 might be their picture on the main site, but fid 26 in another site might be for a completely different image, or not even an image at all.

How do you normally address this issue?

Cheers


texts: is there any way to change the name of the superfish mobile menu that you get when viewing superfish on an iphone. its activated after you have set up your superfish menu by adding the path : sites/all/libraries/superfish/sfsmallscreen.js  to the setting on : admin/config/user-interface/superfish. I get "MAIN MENU" as my mobile responsive menu (see pic), and was wondering if I could get just "MENU" or even just show a button? Also is there a parameter that can be set for screen size, as I think the mobile menu is activated for an Ipad. I just wanted it for Phone. I'm using Drupal 7, Omega 3 theme, and the latest dev version of Superfish.


texts: How can I call 2 functions in the same custom module?

texts:
In my template file I have 2 links like

if(mytest){
  print l(t('Action 1'), 'my_first_link/'.$id);
}else{
  print l(t('Action 2'), 'my_second_link/'.$id);
}

In my custom module I have

function myModule_menu() {
  $items = array();
  $items['my_first_link'] = array(
    'title' => 'First function',
    'page callback' => array('myModule_first_function'),
    'page arguments' => array(1,),
  );
  $items['disableproject'] = array(
    'title' => 'Second function',
    'page callback' => array('myModule_second_function'),
    'page arguments' => array(1,),
  );
  return $items;
}
function myModule_first_function($url_argument){
  print('url_argument = '.$url_argument);
}
function myModule_second_function($url_argument){
 print('url_argument = '.$url_argument);
}

My first link works fine but my second doesn't!

It gives me a 404 error!

How can I solve it?

Thank you


texts: To view the database field data in the admin page custom module

texts:
How to show the data from the database in the admin page of custom module. The listed data should be edited/deleted/view.

Please say what Hook is to be used in the.inc file


texts:
I have created a cck field and made it's attribute to 'readonly' through form alter. I also want to make sure that the user won't change it's value by editing through firebug or by any other means, for that I referred this Making CCK fields read-only in Drupal 6.

But it is working fine for text field not for integer field. For integer field the default value in $form always change to what the user has submitted. Why it is not working for integer field and is there any other way I can accomplish this.

function my_survey_after_build($form, &$form_state) {
    $field = 'field_survey_name';
    $field2 = 'field_survey_ques_1_weight';

    $form[$field][0]['value']['#attributes']['readonly'] = 'readonly';
    $form_state['values'][$field][0]['value'] = $form[$field][0]['#default_value']['value'];

    $form[$field2][0]['value']['#attributes']['readonly'] = 'readonly';
    $form_state['values'][$field2][0]['value'] = $form[$field2][0]['#default_value']['value'];
    .
    .
    .

    return $form;
}


texts: setting a contextual filter based on a field collection in a view

texts:
I'm creating a simple application that is used to create some Contractors and some Projects,
and what I want to do is displaying on the Contractor's detail page the list of projects the
contractor has been working on.

I have thus created the simple following data structure :

Content type : "Contractors" :

Name
Address
Phone
Email
Project_list (a view implemented via the "view field" module that should list all the projects for this specific Contractor)

Content type : "Projects" : (a project can have several contractors - hence the field collection)

Project name
Reference
Contractors (field collection)

Field Collection : "fc_Project_contractors"

Contractor (select field that list all the contractors names)
Evaluation
Comments

My problem :
For the "Projects" field of the Contractors content type, how should I set up the View Relationship and Contextual filters
in order to display only the projects of a specific contractor ?
In the Project content type, if the contractors where selected with a simple taxonomy term or even an Entity reference I'd
have no problem doing it but with a field collection I tried a lot of settings but without success... either I display all
of the project or none at all but I cannot display only the relevant ones... I'm stuck with this for quite some time now and
cannot seems to find a solution although I'm pretty sure it's doable..

Any help would be welcome here.. Thanks


texts: How to add custom fields in Apache Solr's search result?

texts:
I'm trying to add some custom fields(image field, text field) in Apache Solr's search result.
I ended up found the code below; however, I don't know:

Where to put this code (is it template.php?)
How to get the information to display them.

`

function mymodule_apachesolr_update_index($document, $node, $namespace) {
  // When indexing nodes, add field from my custom content type.
  if ($node->type === 'my_contenttype') {
    // Grab the image URI and the description.
    $image_uri = $node->field_image['und'][0]['uri'];
    $description = $node->field_description['und'][0]['safe_value'];
    // Add the image and description to the document in the solr index.
    $document->addField('ss_my_contenttype_image', $image_uri);
    $document->addField('ts_my_contenttype_description', $description);
  }
}

function mymodule_apachesolr_query_prepare($query) {
  // Add the image.
  $query->addParam('fl', 'ss_my_contenttype_image');
  // Add the description text.
  $query->addParam('fl', 'ts_my_contenttype_description');
}

I appreciate any advice.
Thank you.


texts:
I have an accordion menu (taxonomy menu) as a block.

I want to have a very similar block but this time I want to have all taxonomy items expanded. I am thinking to something like this:

How can I accomplish that?


texts: Drupal 7 Views filter between start and end date

texts:
I try to accomplish the following:

I want to create a View, which is automatically listing the newest terms.

There a two terms a year (summer term 01.04.-30.09) and (winter term 01.10-31.03).

Those terms have several Events in it. So i tried to filter them automatically with a reference of "now"

So i set the filters as the following:

start-date is greater than or equal to "now"

end-date is less than of equal to "now"

I also tried to switch the arguments,

just as explained in this article: Drupal 7 Views filter between two dates?

but it didn't do anything.

I made some screenshots, to show you how i configured the view and the event.

(And yes, the other filter criteria s are met.^^)

I hope you can help me with this problem, or tell me another trick to accomplish my goal.


texts:
Primary tabs

View(active tab)
Edit

Status message

Forum topic Comment form not working has been created.
Posted by jassics on February 8, 2014 at 9:49pm

I am facing problem in commenting over blog or forum contents.
It is simply showing this error:

Error

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

While checking error log I got this:

  EntityMetadataWrapperException: Unable to get the data property format
  as the parent data structure is not set. in
  EntityStructureWrapper->getPropertyValue() (line 438 of
  /home6/cusatalu/public_html/sites/all/modules/entity/includes/entity.wrapper.inc).

and when I checked filedsets I saw these warnings

  Notice: Undefined index: comment_node_panel in
  _field_ui_bundle_admin_path() (line 325 of /home6/cusatalu/public_html/modules/field_ui/field_ui.module). Notice:
  Undefined index: comment_node_panel in field_ui_fields_list() (line 35
  of /home6/cusatalu/public_html/modules/field_ui/field_ui.admin.inc).

Hope, someone is familiar with this error and would help me to fix soon.

I posted this in Drupal official site too.


texts:
I am constructing a content type that will 'wrap' a video, either youtube, vimeo or file upload. One of the fields required is a 'duration' field. Obviously a requirement is also for the videos to be sortable in a view based on that field.

How would I go about doing that? A format of H:i:s or i:s would be prefered in a textfield as an input method.


texts: How can I programmatically bulk delete redirect entities based on their status code?

texts:
I have a list of 3089 301 redirects URLs and want to delete them programmatically from the database.
E.g List of source URLs
/about/test/2013/page_61732.html
/about/test/additional/branches/page_38678.html
/about/test/additional/branches/page_38678.html
/about/test/additional/branches/page_38678.html
......


texts: How to sort views table columns alphabetically with exposed filters?

texts: I'm working on a table view that will be populated with five columns and many rows of data. I would like to be able to sort the table by selecting a column and then sorting it alphabetically. Ideally, I should be able to sort the table based on any of the columns. Is this possible with views exposed filters? If so, how would I approach this?