texts: What's this strange error during entity_creation?

texts:
I'm trying to create a (no bundle) entity from a feed using entity API, but I keep running into strange issue. The code for the entities is this:

function my_entity_provision() {
  $a = entity_create('entityType', array(
    'pid' => NULL,
    'aid' => 1,
    ...

  ))->save();
}

But when running it I run into these errors:

Warning: class_implements() [function.class-implements]: object or string expected in entity_create() (line 420 of ...../sites/all/modules/entity/entity.module).
Warning: in_array() expects parameter 2 to be array, boolean given in entity_create() (line 420 of ...../sites/all/modules/entity/entity.module).

I've tried looking on drupal and drupalcontrib for the correct implementation, but all code blocks show no text? :s

My code looks similar to Create Entity Programmatically in Drupal which does seem to work. (Since I have no bundle, I didn't define the type in the array, I read somewhere it can be omitted . But that made no difference anyway).

My entity info is as follows:

/**
 * Implements hook_entity_info().
 */
function my_entity_entity_info() {
  $return = array(
    'entityType' => array(
      'label' => t('entityType'),
      'controller class' => 'EntityAPIController',
      'base table' => 'entityTypes',
      'fieldable' => FALSE,
      'entity keys' => array(
        'id' => 'pid',
      ),
      'static cache' => TRUE,
      'view modes' => array(
        'full' => array(
          'label' => t('Full Entity'),
        ),
      ),
      'views controller class' => 'EntityDefaultViewsController',
    ),
  );

  return $return;
}


texts: CKEditor displays entire site page when rich text is switched on

texts:
The ckeditor is switched off by default. If there is no text present in the field while editing, the cck provides a wysiwyg interface with no text present when rich text is toggled on. However if any text is present and Rich Text editor is switched on then a particular page of the site gets rendered instead of the text. On switching off rich text the rendered page html gets displayed.  Please help.

CKEditor version is latest(7.x-1.13)


texts:
I have an Angular 2+ application running. I would like to install Drupal in a subfolder and have my Angular application to iframe the contents.

Ideal Folder Structure:

/             - Angular
/content      - Drupal

I have an existing rewrite rule to rewrite all URLs to index.html. Drupal works fine with pages like http://myapp.com/content/admin, but if I am accessing a page like http://myapp.com/en/page, it will be redirected to the index.html file of the Angular application.

How do I configure Drupal to make it add /content to its URLs?

I am hosting them on IIS. These are the rewrite rules I have now.

<rewrite>
  <rules>
    <clear />
    <rule name="HTTPS Redirection" stopProcessing="true">
      <match url="(.*)" />
      <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
        <add input="{HTTPS}" pattern="^OFF$" />
      </conditions>
      <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" />
    </rule>
    <rule name="Angular Routes" stopProcessing="true">
      <match url=".*" />
      <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
      </conditions>
      <action type="Rewrite" url="./index.html" />
    </rule>
  </rules>
</rewrite>


texts:
Suppose i have this hook_theme() in my module, choosing a template inside the module:

/**
 * Implements hook_theme().
 */
 function module_theme($existing, $type, $theme, $path) {
   return array(
     'module-output' => array(
       'template'  => 'output-template',
       'variables' => array(),
   ),
 }

If i put the same output-template.tpl.php inside my active theme, Drupal picks up the module's template.

Is there a way to make Drupal understand that if a template with the same filename exists somewhere in the theme, to pick the theme's template and not the module's (like an override)?


texts: How can I change message set on form.inc?

texts:
I am using taxonomy module in my site and have used the "Add vocabulary" form by hook_form_alter().

I want to change the error message for machine name (Machine name in use) to some other message. This message and validation is thrown from form.inc function. How can I change this message in my hook_form_alter() function?

Some code

function resources_form_taxonomy_form_vocabulary_alter(&$form, &$form_state) {
    if(strstr(current_path(), 'admin/structure/resources'))
    {
        $form['#validate'][] = '_error_preservation_helper';

    }
}

function _error_preservation_helper($form, &$form_state) {
debug(form_get_errors());
    $errors = form_get_errors(); // works shows error array
    if(is_array($errors) && array_key_exists('machine_name', $errors))
    {
        // now change the error message
        form_set_error('machine_name', 'custom message', TRUE); // not works
    }
    debug(form_get_errors());   // same results

}


texts: How to remove the div surrounding the view block?

texts:
I created a view block that I added in the navigation bar.

When I inspect my page, I have a div around my block.

How can I delete this div ?

I want to have only :

<section class="views-element-container block block-views block-views-blockmenu-page-utilisateur-block-2 clearfix" id="block-views-block-menu-page-utilisateur-block-2">


texts: How to use subquery in views where clause

texts:
In my project user can created by profile2 module. When user is created i am assigning some role,initially user is block state. I have another user role ie.user app rover  who can approved these user and send activation link for active user.

I am using Mail Logger module for saving sending mail
Now i have created a view for user unapprove list

    SELECT users.name AS users_name, users.uid AS uid, users.mail AS users_mail,
    profile_users.pid AS profile_users_pid, users.created AS users_created, 'profile2' AS
    field_data_field_cc_first_name_profile2_entity_type, 'profile2' AS
    field_data_field_cc_address_office_profile2_entity_type, 'profile2' AS
    field_data_field_cc_designation_profile2_entity_type
         FROM
         {users} users
         LEFT JOIN {profile} profile_users ON users.uid = profile_users.uid AND
         profile_users.type IN ( 'company', 'goverment_profile' )
         WHERE (( (users.status = '0') AND (users.login = 0) AND (profile_users.type IN
            ('company', 'goverment_profile')) ))
            ORDER BY users_created DESC
            LIMIT 10 OFFSET 0

Hear i want to add sub-query in where condition
user those already send activation link who will not list in view.

My other table is mail_logger.

Is there any module by which i can use sub-query in where condition?


texts: Commerce Kickstart change full text search product display to https

texts:
I am currently developing a drupal commerce site with commerce kickstart. I've set the site up so that it's mixed mode SSL using securepages, all seems to be working fine. However, I've found a bug with the full text search (used in the main products display view) which could potentially put customers off as they may think the site is unsecure. Plus the certificate does not show the EV SSL Green bar / padlock, it display's with a yellow warning.

All browsers apart from chrome work ok and from doing my research it looks like it's only the full text search which is causing the issue (when testing using chrome by pressing ctrl + shift + j it shows the error code) on line 223:

Mixed Content: The page at 'https://www.whiterabbitengland.us/contact-us' was loaded over a secure connection, but contains a form which targets an insecure endpoint 'http://www.whiterabbitengland.us/products'. This endpoint should be made available over a secure connection.

Has anyone else encountered this issue and found a way to set the full text search over https?

Thanks
Max


texts: How to use single search box (autocomplete) for users and content?

texts:
How can I use single search box with autocomplete for all the users on site and all the content of particular content type like blogs.

Thank you.


texts:
Im reading up on how to add AJAX functionality to nodes and am stuck. Where exactly do I place  #ajax in order to make the edit field updae via ajax? Specifically is it an existing php, js, html, css file that handles this? Do I add it to the node or block?  I've read that its fairly simple but drupal isn't my native language so i'm still learning.

I've tried using this module ajax_form_entitty

but it wont load the newly created node after submission it directs to a blank page. I've been told to point the node to a div and insert the div in the header, but I have no idea how that should look.
here is what i've done (which doesn't work)

All help is appreciated

EDIT:

Reading Material
I've tried following along with this as one possible way to go about it but have no clue how to implement anything.


texts: Check if user has access to a certain page

texts: How can I determine whether a user has permission to access to a certain page?


texts: Clean URL in Exposed Filters in Drupal 7

texts:
How can i get a clean URL in my Exposed Filter and Contextual Filters. I want to create a archive were users can sort the nodes by its posted Date. I used contextual filter to achive this and its working fine when i pass the value in URL like.

"www.example.com/archive/10/09/2013".

But when i use a exposed filter and submit the value the URL became like this

"www.example.com/archive/archive?date_filter%5Bvalue%5D%5Byear%5D=2013&date_filter%5Bvalue%5D%5Bmonth%5D=9&date_filter%5Bvalue%5D%5Bday%5D=10"  and it returns a empty page.

How can i pass a clean value in Exposed Filter and make it work properly? Thanks in advance.


texts: Drupal 7 views: show users friends who flagged event problem

texts:
I am having a problem with views.

I want to display a block on the node event. The contains a list of users who flagged the event. The list of users must be friends with the logged in user.

What I have now is a list of users who flagged the current event. I have tried to show a list of only friends but it wont show anybody.

Here's a couple of screenshots of the current settings:

I hope this great community can help me with this problem!


texts: Display images as a form element in a webform

texts:
The goal is quite simple – I'm looking for a way to display an image in a webform.
By that I mean the image would part of the webform as a complement to a question (example: "what color is the car in this picture").
If possible it'd be great if the user could to upload the images when administrating the webform elements, and also if they were their own element that would be awesome (but even adding them to the descriptions of the question-elements themselves could work as well).
So basically, how can I setup a "display custom image in the webform"-element?
I've tried searching for a solution but all my results are about how to add an image upload field, which is quite the opposite of what I'm looking for.
Grateful for any help I could get on this.


texts: Change product price before putting it on a cart

texts:
Overview:

I have a website that only sells one product. It has a $0.00 Price.

I have this custom form when sent, it will give the product id (e.g.) to the uc_cart_add_item

uc_cart_add_item($nid, $qty = 1, $data = NULL, $cid = NULL, $msg = TRUE, $check_redirect = TRUE, $rebuild = TRUE);

Well, technically it goes to the cart with a price of $0.00.

So the question here is, how can I alter the product price before sending it to the cart?

I saw this function from other website that this one alters the product price

hook_uc_product_alter(&$node)

Unfortunately, it doesn't seem to work or something.

I've searched for some questions

Ubercart alter product price when product added to cart

Even this one, but it's on Drupal Commerce not on Ubercart

programmically change price of product

Any help would be appreciated.


texts:
Is there a way to add a relationship to the node history table in views. If not, is there a module which can do it?

As it turns out the history table is already available under views as part of the content section (field 'Has new Content').


texts: I can create content type fields pragmatically, but I set het widget options too?

texts:
Im using field_create_instance to create all my defined fields, and use the correct field types and widget types and such, but Im not sure how to set the widget options.

In my use case, Im using the colorfield module and am trying to save the default options for the widget so the content type automagically uses farbtastic but I'm not the greatest drupal dev yet and am not sure how to do that.

Right now, my instance looks like:

'fill_color' => array(
    'field_name' => $fields['field_map_fill_color']['field_name'],
    'label' => 'The inactive state colors',
    'bundle' => 'nji_map',
    'entity_type' => 'node',
    'widget'      => array(
        'type'    => 'colorfield_unified_textfield'
    ),
    'description' => 'This is the color of the inactive color of the state.',

),

So that sets the field to use the colorfield field widget alright, but I need to set it up so it also uses the farbtastic option. I took a look at the module and theres a hook called hook_field_info with this option:

    'instance_settings' => array(
        'colorfield_enable_colorpicker' => TRUE,
        'colorfield_colorpicker_type' => 'farbtastic',
    ),

I looked at the drupal field_create_instance hook and i feel like it needs to go into widget->type right? Well I cant seem to get it to work.

Ive also tried:

    'background_color' => array(
        'field_name' => $fields['field_map_background_color']['field_name'],
        'label' => 'The background color',
        'bundle' => 'nji_map',
        'entity_type' => 'node',
        'description' => 'The background color is the color between.',
        'widget'      => array(
            'type'    => 'colorfield_unified_textfield',
        ),

        'instance_settings' => array(
            'colorfield_enable_colorpicker' => TRUE,
            'colorfield_colorpicker_type' => 'farbtastic',
        ),

    ),


texts: Add header and footer for every pages printed

texts:
I've used print module version 7.x-2.0. I've used pdf-version and print-friendly-version.

Now i want to do two different things. That is,

Is it possible to add separate CSS for pdf, html or email templates like: print-pdf.css, print-html.css, print-email.css, print.css.?
I have added header and footer. It only works for first page and last page, But I want to display them for every printed pages. How can I do that?


texts: Bulk registration or disallow registering of certain usernames

texts:
I need to register 1000+ usernames at once.
How to do it?

Or is there any way to disallow from registering 1000+ usernames? People could not register certain usernames.

I need to reserve these usernames for payed registration.


texts: Placing a drupal menu on an external site

texts:
I have a drupal install (latest 7.x version at the time of writing). It is in the root directory of my domain.

In a non drupal sub-directory, called 'member' so at /member, I have 3rd party script which enables my site to have membership functionality.

The script inside of /member is not drupal, although it does connect to the drupal database to write to the users table to enable single sign-on.

I was wondering if it is possible to display a drupal menu (the main navigation) inside the script in /member? I want to be able to alter the menu in drupal and then have those alterations automatically updated in the /member script.

I would certainly appreciate any advise as to whether this is in fact possible, and some advice about how I might get started.

Thanks.


texts: Make Commerce Kickstart home page show up at a different URL

texts: By default, the store is the front page in Commerce Kickstart.  I want to have a different page as the front page, but be able to switch to Commerce Kickstart by clicking on a menu link.  However, when I change the front page to be my welcome page in Site Information, the store is no longer accessible.  How do I link the front store page to a link in a menu?  Essentially, I want the commerce kickstart store to be accessible from http://homepage/store.


texts: How to fix google page speed insights issue?

texts:
I'm facing issues on my every drupal site when i test my website in Google page speed insight . I have configured Advagg module and followed but not succeed.Issues are below:

Eliminate render-blocking JavaScript and CSS in above-the-fold content.
Leverage browser caching.
Enable compression.

Sometimes (1) can be fixed by advagg setting but (2) and (3) need configuration in .htaccess. Can anybody provide me solution?


texts: Show activities on users' posted content

texts:
I would like to provide a view, and something like a newsletter, where the users can see what actions (e.g. commented) are done on their posted content.

I thought I could do this with Activity, but I can only catch the events the users did on their posts.
Do have any idea on how to provide this?


texts: Listing certain content type at top of view programmatically

texts:
I have a view which I am altering programmatically based on various parameters, using views_get_view , $view->set_item etc...

In the resulting view I want to be able to display a certain content type at the top, and other content types can flow as normal underneath. How can this be achieved?

Thanks!


texts:
I have a Drupal 7 site. I'd like to add Social Media follow buttons
(i.e. Follow us on Facebook, Twitter, Linkedin).
I grabbed some Javascript code from http://www.addthis.com
 which generates these buttons and also links to some analytics services I will be using.
Now I need to figure out how to place the AddThis Javascript code I generated, to a Drupal block. Once it's in a block, it will be easy for me to move around my Drupal site pages.


texts: How can I import a local database remotely without having a local database copy?

texts:
I am working on database security and with using Drupal we have daily backups from a cloud server which we access remotely. What I normally do is grab a daily DB copy from the cloud server, move the file over unto my local machine, and create a local copy that I can freely work on (to mess up or fix) how I choose.

However as the company grows and more people start to work on this project, having every individual have a local copy of a DB on their machine when it contains proprietary data is a huge security risk.

Is there a way for me to import a local copy of the DB to use, without actually having a physical copy on my machine? Or would this be inevitable?

Edit: For whoever down voted this, can you at least list why so I could fix it? I am trying to get genuine answers. Not have this post deleted because you think it didn't fit the right format.


texts: Proper debugging of REST Resource due to cache

texts:
I'm creating some REST routes for my custom resources and I'm having some trouble with the debugging aspect of development.

Every time I change the resource's code, should I need to XDebug it, I need to clear Drupal's cache (drush cr) for the debug to work.

I have successfully disabled the ResourceResponse cache mechanism, so that when the data has changed in Drupal, it is reflected on the response.

Although, I think that maybe due to the annotation mechanism, it's caching the function of my REST Resource, and, subsequently, when I change it, those changes don't propagate and Xdebug doesn't pick them up.

I also noticed that git signals that the resource plugin file has changed every time I clear the cache, which I think might be related.

Does anyone have some pointers they can share to overcome this?


texts:
I would like to ask a very simple (for you probably!) question on theming/layout:

By default the user module displayes the "username" + "password" vertically.
I want to display these 2 fields horizontally.

To do so:

-It is the css that I have to modify, right?
-Do i have to modify the user.css or the css of my theme?
-Any ideas on how do I modify it, or what is the piece of code I have to alter?

Thank you.


texts: Bad request with Acquia Dev Desktop2 overriding installation

texts:
I use Acquia Dev Desktop2 on Mac for php7.0.
I think that it is the previous version.
I was waiting for the upgrade to use php7.1, but there was no announcement in check for update menu.
I have no choice, so I downloaded it and overwrite install.
The bad request will be displayed on all local sites.
Phpmyadmin of all sites will be displayed correctly.
What is the solution?

What I can think of is using underscores for site addresses.

test_drupal8_mockup1.dd:8083

In order to remove the underscore, I edited vhosts.conf and restarted apache.
'But request' was not improved.


texts:
I have a migration class set up that takes from an XML source ID list that points to individual XML files with data which is then imported into nodes.  The migration works but only one at a time.  There are no errors in the messages for migration, apache error log, syslog, and doing drupal_debug in all steps of the migration only shows that the migration goes through one row then stops.

Is there any common issue that might be causing this behavior?


texts: How to create a relationship between user and some content type?

texts:
I am new to Drupal and I need to create a relationship between user and content type.

There is a content type called 'Property'. The user who creates a property page must specify either:

I am an owner, OR
I am a tenant.

And I need to show this relationship on the property detail page.

How can I achieve this?

Note: I want to keep record of this, it mean the property detail page would always shows the previous tenant and owner information. And later that I want to show the reviews of user under owner and tenant tabs.


texts:
I'm running a Drupal website for a while but suddenly and for an unknown reason the website become unable to update modules via the back office.
The download of the modules goes good but when I click to the button to update the database I got an error page and when I see the recent reports logs I have that:

UpdaterException: Unable to determine the type of the source directory. in Updater::factory() (line 99 of ../www/includes/updater.inc).

Is there any solution for that problem?
Notice: I'm using Zeus server instead of Apache.


texts: Node is flagged, node author comes back to the site, how to show how many new flags since last visit?

texts:
I created a "new activity feed" view page in which a user can see how many new comments have been posted to his own nodes since his last visit

Eg : since you last last visit :
- 21 new comments have been published on your node #title, in a total of 65 comments
- 3 new comments have been published on your node #title2, in a total of 8 comments

The nodes can also be flagged by other users.

Using flag module and views, it is possible to get the total amount of flags a node has received at any time.

I would like to be able to show the node author, how many "new" flags each of his nodes has received since his last visit.

Any help is welcome


texts:
I'm trying to archieve something that looks very easy for me, but I can't find the solution. I'm using drupal 9, bootstrap 3 subtheme.
I have a region (region-buttons) that has multiple blocks.
{%
  set classes = [
    'container',
    'region',
    'region-' ~ region|clean_class,
  ]
%}
{% if content %}
  <div{{ attributes.addClass(classes) }}>
    {{ content }}
  </div>
{% endif %}

For every 3 blocks inside the region, I want to add a div around as a wrapper (to add some custom styling). How can I archieve that?
Where is the "content" of the region created? (I know that I can change the layout of the blocks, but that looks to early for me.).


texts: Drupal Commerce Need Function To Retrieve Customer Profile Fields From Commerce Order

texts:
I want to display some info from the Customer Profile (Customer Number, Contact Number) whenever the shopping cart view displays. I can see these fields in 'People' but obviously they are -extended- fields... when I run this:

$my_user = user_load( $user->uid );

...I get the field names for the data I want, but not the values.

I -thought- I could do this...

$order = commerce_cart_order_load($user->uid);

...and then somehow get to the customer_profile like so:

commerce_customer_profile_load ($profile_id);

...but I have no idea how to connect the $order or the global $user->uid with the $profile_id

How does one do this?

Again, I just need to retrieve the string values of Customer Number and Contact Number.

TIA,

---JC


texts: Why can my view not access the data of a new node when using Rules event After saving new content?

texts:
Using the Rules module and Drupal 7, I set up a rule "After saving new content of type X".

This is what I want to happen when adding a new content of type "X":

  Based on its nid, call a view, which returns back a JSON, from where I fetch the info to work later. The info I need is on this view, not in the node I am inserting, but to get this view I need the nid and some other info from the node I am creating

The problem is that even if I get the nid of the new node, when I call the view it just returns an empty result. It seems like the data it's still not on Drupal database, so the view results empty. I tried to add a sleep(10) before calling the view, giving some time to Drupal, but no success.

The Content is published, and I added also a 'Save entity' Action to the Rule

Hope with this code here helps to understand; it's in Editing action "Execute custom PHP code", "After saving new content of type X"

dsm($node);  //I can see al attributes from the node I am inserting

$url="http://localhost/bopa/?q=export_cultivos/$node->nid";

dpm($url);

//it gives me a correct URL, that tested later directly on the browser, works
//If instead of $node->nid I use an existing nid, I get back results correctly, so the code below is correct

sleep(10);
$data=file_get_contents($url);

$data2 = json_decode($data,true);

dsm($data2);
//EMPTY array


texts: reCaptcha does not display on modal window(colorbox) webform

texts:
I have a webform that I want to add a reCaptcha to. So far I've done everything properly, the webform will display a recaptcha box below the form when viewing the node form. I have a modal window webform (thats similar to an opt-in form), that uses ajax to grab the specific webform and display it as a block in the window. Now the issue is that the reCaptcha does not display below the form.

I've tried replacing the recaptcha with a math challenge captcha, and it would display properly on both the webform and modal window.

The good news is that the ajax webform shows an instance of the captcha when you look at the html.

<input type="hidden" name="captcha_sid" value="561">
<input type="hidden" name="captcha_token" value="4bbbf337ec22df5fe3befde6f601601d">
<input type="hidden" name="captcha_response" value="Google no captcha">

//g-recaptcha is where the captcha is supposed to be rendered, however it is empty

I've been stuck on this issue for almost a week. Is there suggestions or approach that I should take?


texts: How to change the number of Administration Views results in the Drupal back end?

texts:
How can I change the number of list items (results), using Drupal's back end?

Is it possible to filter how many results, instead of having multiple pages of items? Something to select like 10, 50, 100, 500, ALL? Should be a simple setting, but can't find it.

I've installed Administration Views, but it's a pain since I have to adjust a dozen views, one by one.


texts: How to allow the setting of the Views Exposed Filters one at a time, instead of showing all available exposed filters at once

texts:
I have a view with a ton of exposed filters. Placing all in one page (even in a collapsible fieldset) is overwhelming for the users. Is there a module that allows a users to add a filter one-by-one?

Hopefully the screenshot of a third party application helps to explain


texts:
I am working on internationalization.
My site's first language is english, with a spanish translations.

I am using Drupal 7, with
Internationalization 7.x-1.10

I have everything but menu translation working.
The tutorials I am reading about menu translation say to create a new menu,
and before you submit your new menu go to the "Multilingual Options"
section, which lets you set the translation for this menu.

Mine is missing this "Multilingual Options" setting.

Despite this I tried to translate the menu's links by viewing the links for the menu and clicking on "translate"

When I add links to the menu, and click translate on those links, I get an "access denied" exception.

Does anyone know why this might be happening?


texts: Validate form: at least one of the fields is required

texts:
Users need to fill link fields wrapped in a field group to their various social profiles like fb, twitter, pinterest. I  need them to give any one of the fields as required since I use it to verify their profile.

I've tried conditional fields and field validation. Field validation require one of various fields gives me like seven "one of the fields is required" messages for all seven fields.

I tried different configurations with conditional fields without results.

Is there a workaround with any other modules?


texts: TinyMCE image float, automatic set margin

texts:
I'm using TinyMCE as WYSIWYG editor. When I set the floating of an image to "left" or "right", I want to set a right- of left-margin with CSS automatically. So the images has only a gap between img and text.

When I just add a margin to the IMG, there's a at all sides...


texts:
I've configured the Main page content block to show on all pages except those listed. The paths I have listed are:

commodity-selection
commodity-selection/*
value-chain-studies
value-chain-studies/*

When visiting one those pages however, the main page content is still present. Even after all caches are cleared.

Is there a trick to hiding the Main page content block?

What I'm trying to achieve is a page that that presents its content within a tab. Other tabs are populated with content from other nodes.

My approach so far has been to use Quicktabs to create a block with the node content  I want (ie. node 1, 3, 5). I place that block in the content region and configure it to show on the page I want (node 1). I planned to then hide the Main page content block to hide the node 1 content, without success.

Appreciate your suggestions.


texts: How to reset the id of the orders generated by Commerce module

texts:
I just finish a website which include a cart. I'm using the commerce module.

In the development stage I've been making some test. Now I just deleted all these testing order, but now the id of the next order is something like 189. I need to put this number to 1.

Which database table do I need to truncate to get it done?


texts: Use Context to load JavaScript on certain pages

texts: Is it possible to load a JavaScript file on certain pages with the Context module?


texts:
I'd like to have a simple and clean URL for a PDF file, such as

http://www.examples/file1

that maps to an attachment in a Drupal node, rather than using something like

http://www.examples/sites/default/files/files/file1.pdf

I've tried using URL Aliases, but Drupal complains and won't let me create the alias.  I can obviously do this with Apache redirects (with mod_rewrite) or (gasp!) with a meta tag refresh, but both seem inferior to being able to manage it from within Drupal.


texts:
I had a look around and couldn't see if this had been asked before so decided to create a new question. Please delete this if this is a duplicate.

I'd like to customise the status messages that appear to users when they trigger the captcha and profanity filter, as the default messages are quite long winded. My experience with Drupal is VERY limited and am not sure if there is a module specific hook for overriding such settings, or if this is relating to core/a core hook.

I've had a look at the mollom.module code and notice that the message is being set  at line 2220

form_set_error('mollom', t('Your submission has triggered the profanity filter and will not be accepted until the inappropriate language is removed.'));

My question being - is there a simple hook I can use to access this? Perhaps in my preprocessor functions? What is the 'Drupal way' of modifying this message?

If it is of any relevance I am using the Entityform module for my form. Please let me know if you need me to provide additional information.

Thanks for your help in advance.


texts: How to add up price values when group by month?

texts:
I have a Views table view that shows bank transactions. Each transaction has:

A price field (which consists of a single positive OR negative amount)
A date field

I would like to display the transactions grouped by month and then display a total of all the price fields for each month.

How can I do this?

Steps I have tried

1) Use Views built in tools

In the setting for a table view, you can chose to group entries by a field. So I group my fields by month.

I then go to other > Use Aggregation and set it to “on”.

Finally I select “Sum” in the aggregation options of the price field.

Results:

Entries are grouped by month Months are not in order (It goes March,
January, February, December)
The total of the prices fields for each
month is not displayed.

2) Use Views Calculation module

This requires a patch to support Group fields. Unfortunately, the patch does not work with price fields (see comment #118). My own testing confirms this.

3) Use Views Aggregator Plus

Views Aggregator Plus module is designed to be an alternative to Views Calc.

In Views format, I select a “Table with aggregation options”
I apply the “column function” to my price field and select “sum”
I apply the “group function” to my date field and select “group and compress”.

Results:

Only the first transaction for each month is show (The other
transactions are hidden)
The total is displayed, but it is incorrect
and doesn’t seem to relate to anything.


texts:
I'm running Drupal 7.2 web site embedding a multiplayer card game and am looking for a module, which would help me to run a tournament between users.

It should at least show a list of participants and a tree of games with 3 players and 1 referee.

I've searched around already and suspect there is no such module waiting for me (surprise suprise), so my question is more about how would you try to program such module yourself or maybe adapt some core module (seemingly there aren't many non-core modules for Drupal 7).

I have a bit experience in programming custom blocks and menus. I've read, but haven't understood the documentation on programming nodes yet.


texts: View Field, Insert View, View Reference, Block Reference, Insert Block: which to choose to embed a view in a page

texts:
I have a view I would like to embed in a page with some other content. The page is for logged-in users only. I could make a page or a block version of the view. I could make a new content type or not for the page- it's not a big deal. So I could use Viewfield, Insert View, View Reference, Block Reference, Insert Block, EVA, and maybe some others to embed the view. I could even code a page template up with views_embed_view(), though I would prefer to use an existing module for ease of future maintenance. Using the view's header and footer fields is inadequate in this case, because I want the surrounding content to be easily editable?

Are there technical reasons to choose one of these modules over the others? For instance, do any of them have issues with caching or permissions? Or, for instance, Is there a reason not to use the view as a block?


texts: How to alter view query to display only 5 top records

texts:
I couldn't find a similar problem on the forum so I am asking. I created a view with exposed filters but when I visit the view page I am going display 5 top recent record for specific content type. When I click search button the result changes of course and result with a pager shows up. How can I display 5 top recent records before I click search button for the first time when I visit page with the view? I thought to use hook_views_query_alter to add limit to the query but I don't know how. Any ideas how to achieve that?

Thank you!


texts: How to fetch nearest node based on geofield?

texts:
How to fetch nearest node based on location geofield,i want to fetch nearest node based on longitude and latitude of my current location ,for this i have installed and configured geolocation field module also created view enabled all settings,but its not giving desired result.

I have followed this tutorial https://www.drupal.org/docs/8/modules/geolocation-field/how-to-create-a-nearest-node-view-sorting-by-proximity

Can we fetch the data directly from database by something like below example of php in drupal .

set @orig_lat=122.4058; set @orig_lon=37.7907;
set @dist=10;

SELECT *, 3956 * 2 * ASIN(SQRT(
POWER(SIN((@orig_lat - abs(dest.lat)) * pi()/180 / 2), 2) +  COS(@orig_lat * pi()/180 ) * COS(abs(dest.lat) * pi()/180) *  POWER(SIN((@orig_lon – dest.lon) * pi()/180 / 2), 2) )) as  distance
FROM hotels dest
having distance < @dist
ORDER BY distance limit 10

By using this query i will try to alter views query for getting desired result


texts: How to remove the "Add new Comment" link from book pages

texts:
I have created two books, and both of them have child pages (which are also book pages). I have activated the option of commenting, in which the comment box is shown in the same book page.

All works fine when there is no comment on a particular page, but even when any user posts at least one comment on the page, the "Add New Comment" button appears in the links area below page-links and above the comment-wrapper; the comment box is shown below. I just wanted to ask how to remove this link because it is messing with the other options in the links area (e.g. printer friendly page, PDF).

I did create a hook using the following code.

<?php
  /**
  * Implementation of hook_link_alter
  * Remove add comment link from a content type
  * MODULENAME = remove_comment
  **/
  function MODULENAME_link_alter(&$links, $node){
    if($node->type == 'book'){
      unset($links['comment_add']);
    }
  }
?>

I have set the permissions for the users to post comments and have kept the comment box open by default. So, it makes no sense in having the Add new comment link.

And in admin/structure/types/manage/book, the settings are as shown below.


texts: How to get taxonomy translated when creating a new node in a different language than the interfaces?

texts:
Configuration:
I set up a multilingual site with Multilingual support: Enabled, with translation so I'm creating a new node for each language.

The taxonomy term is set up with the Translation mode: Translate, so I have a new term for each language.

Creating a node with default language first is working fine:
If I create a new node in my default language using node/add/page I correctly see the taxonomy terms in the site language, then after the node is created, using the Translate tab and select the Spanish language will work correctly and display the terms in Spanish.

Creating a node in a different language:
Now if I want to create a Spanish node first and I go to node/add/page I will see the site default language for the terms, so my tid will be in English instead of Spanish even if the language switcher is correctly set to Spanish.
Then when I'll edit this node, my terms will switch back to Spanish and loose the default term I selected while creating the node.

Partial solution:
A way to avoid this problem is to go to es/node/add/page instead and now the terms are correctly in Spanish.

This solution isn't very convenient, so what is the correct way to handle this efficiently and avoid saving a Spanish node with English terms ?


texts:
I'm working on drupal in Windows environment. Most drupal developers recommend to use Drush. I know it is a very useful command line tool for drupal development.

I downloaded the Drush installer for Windows and have installed it, but I don't know how to use it and how it works together with drupal.

[Edit]
The main problem is that when I launched the drush command line windows and then I was stuck with what I should do next. I'm looking for how can I connect to my local site ( D:\xampp\htdocs\mysite ) via drush and I just want to play around the site.

My site stopped working and got the error from here. I was googling for the error, but no luck.
I think Drush could help me for this.

What is a good start point to study Drush?

[Edit]
Most documentation describe Drush on linux. I'm not familiar with linux, ssh, PowerShell, minsw, msysgit, cygwin etc.

I checked the FAQ and Resources on the site drush.ws Some of videos and screencasts are listed for older versions.
I also found this, but I'm not sure Step by Step is needed when I used Executable Installer. Will the installer make me configured everything for ready-to-use?
The installation guide here is too general. I'm not sure I need MsysGit.
This and that mention about Gnuwin32. I chose it to install during setup.

Thus, I'm just looking for a short-to-the-point reference or tutorial to configure Drush on Windows 7 and connect to my site.


texts: How To add Comments to Profile 2 with five star rating on parent node

texts:
I need comments on profile2 but with option to vote on  parent node / profile after posting a comment.

I've tried reply module but it doesnt support besides I'd have to theme it unlike the original comments in drupal. So I tried to implement below solution that was posted here in other question. Unfortunately don't fully understand and in the quotas you Can find two places that need claryfying. Still I'm not sure if this attached node to profile will work with fivestar?

  A nice workaround is to use Rules, Entity reference and Display Suite
  (or views). First, you create a new content type
  'profile_ref_node_type'. Add only comment fields and delete any
  unnesseccary fields.

  You can now create a new node of the type upon creation of the profile
  via rules. Add the 'entity has field' condition to be able to access.

Which field exactly?

  your field. As the action I've used my own PHP code, but you can
  probably use the standard rules as well. My PHP code for creation of
  the node and entity reference:

  $node = new stdClass; $node->type = 'profile_ref_node_type';
  $node->title = 'Profile - [profile2:field-name]'; $node->uid = 1;
  node_object_prepare($node); node_save($node);

  $profile2->field_node = array('und' => array(array('target_id' =>
  $node->nid))); profile2_save($profile2); You then can use this entity
  reference with display suite to show only the comments on that node
  (make a new display type if you want to use multiple fields of your
  node).

I'm not sure what exactly should i do in the DS so it would work.


texts:
We are trying to use Boolean module inside Drupal 7 to define a boolean field for a custom content type , news .

the module seems to be enabled without any visible issues . the issue comes when we wish to use that boolean field's data for Filtering in a view.

e.g The boolean field is called editor-choice , in the View we wish to get all news content type that is published and has Editor's choice value to true.  please see below screenshots of the three steps being performed.

kindly assist what can be the possible issue, or if possible, suggest some other plugin that may be used foe this purpose.


texts: Get Contacts from social networking sites

texts:
I am trying to import contacts from Social networking sites to Drupal using OpenInviter. Its working fine with Web mail Providers but when i am trying to get contacts from Social networking sites it is throwing error as

Unable to get contacts.
No contacts could be retrieved from your account.

Any help is appreciated.


texts: How to calculate a content's type field to store the sum of a referenced content type field?

texts:
To be more specific, I have a content type "book" and a content type "collection" which has an entity reference field to books (many). How can I calculate the field proce_collection as the sum of all the prices of the books it contains?

I had only a solution due to computed field but have an error when i have to show all collections in a view, cause my code don't get a specific node to calculate.

I am thinking about Rules or anything else, but I do not know the way...


texts: Multiple template pages when creating new pages

texts:
new to Drupal 7. I can kind of get the result I want through "hacky" methods but was wondering what best practice was.

I am creating a drupal 7 bootstrap subtheme.

The main content area of the site needs to come in two basic verities.

A single column content area
A two column content area

I want my end users to be able to select which of the two page layouts to use should they need to create a new page.

I can create the effect to some extent by having the two areas defined as regions in my theme and then having them populated - or not - with blocks.
The issue with this solution is I don't want my end users to be able to add blocks to both layouts. I want them to be forced to select one or the other.

is there an accepted "drupal" way to do something like this?


texts: Authenticathed users can't edit Etherpad-enabled field

texts:
I integrated Etherpad on my Drupal site. I did everything as instructed, but still only the administrator role can edit the Etherpad field.

This is how it goes:

Content type X has a text field which is set to be Local Editable in Manage Display (as instructed by the Etherpad readme file).

Furthermore, using the Field Permissions module, the same text field has custom permissions and is editable by authenticated users.

The url for the Etherpad-enabled field goes like this:

http://mysite.com/etherpad/[node:nid]/[etherpad-field-name]#

Despite all this, when I log in as a regular, non-administrator user, I get an "Access denied" message for the field page.

When logged in as admin, when viewing the node, by hovering over the top right corner of field, the "Edit" dropdown appears with the above mentioned url. As a regular user I don't have that option.


texts: How to correctly get Form API single checkbox value variable from database?

texts:
I created an additional_settings fieldset for node type forms that holds a single checkbox:

$form['MY_SETTING']['enabled'] = array(
  '#type' => 'checkbox',
  '#title' => t('Enable'),
  '#default_value' => variable_get('MY_SETTING_' . $form['#node_type']->type, FALSE),
);

When I check the checkbox and save the node type form the value gets stored like that: MY_SETTING_MY_NODETYPE[0] = 'enabled'. The #default_value only understands TRUE and FALSE and doesn't work with enabled. I've sneaked in other modules (p.e. comments module) and have seen that they solved that with constants. But how to apply a constant in that form logic and let it be saved to the database?


texts:
I'm creating a site based on Commerce Kickstart.k My client wants a search form on the front page. The form will have multiple fields on it, some of which are bracketing parameters -- i.e., the price is less than $100 but more than $50. He wants using this form to result in being routed to a search page. IOW, the user fills out the form, clicks on a 'Search' button, and the browser replaces the front page with a results page. (In my mind, ideally, a faceted search page).

I've tried to implement this using Views exposed filters, but the view always presents the unfiltered data along with the input fields, and whether it's a block or page, does not offer the results on a separate page.

I've tried to find a module to help, and looked at Custom Search, but it requires that Drupal's standard search module be turned on, which it is not (by default) in Commerce Kickstart. Commmerce Kickstart uses the Search API and a bunch of custom modules to deliver a database-indexed search. I don't want to interfere with Kickstart's already complex series of search modules, plus the use of the standard search is an indicator I would not get what I want from this solution.

I found no hooks or examples of hooks that let me do this. Does anyone have any suggestions?

Thank you for your help.

--Marshall


texts:
I'd like to preview using a different theme, but I'd like the admin theme to be used for everything else related to content editing and creation.

I've tried out the "pageview" module, but it does not work the way I expect it to.  This could be related to a conflict with other modules related to themes, such as Role Theme Switcher and Mobile redirection tools.


texts: Features/Themes and Drush Make Files: How to manage updates?

texts:
I am trying to automate my development by using Drush Make Files and Features.

I am using Drush Make.me to create the make file.

I have created a Features module on my local machine. What's the best way of telling DrushMake.me about this module.

I guess I could upload it to my webspace and then put the URL into Drush Make. However, I am not sure if this is the best way of doing it. For example, what happens if I update the feature in the future. How will existing website that contain the old feature know that it has been updated.

Also I have my own custom Theme which I want to include in the makefile. If I just Zip and upload it, I would have to do this everytime I update the theme which doesn't seem very efficient (plus how will existing sites know that the theme has been updated).

At this stage, I would like to keep my theme and features private as I want to work out all the kinks.

Any advice on how to managed everything would be most appreciated.


texts: HTML email containing selected node content

texts:
I need to send an email containing the content from one or more selected nodes.

The nodes are selected in an email contact form by the user (which also needs to fill the rest of the form with other, more basic details).

Is there an efficient way to achieve that functionality?


texts: how to get the NodeID into views-view-field--field-image.tpl.php to create an  redirect

texts:
this is my code:

  <?php $nodeurl = url('articles/' . $node->nid); krumo($node->nid); ?>
  <a href="<?php echo $nodeurl ?>"

    <div class="img-container <?php print $imageClass; ?>">

my code is not fetching a proper nodeID and when i krumo it (inspect passed elements) it brings back a null value. My code seems correct, can i get some help :)?


texts: Quick filter tabs on top of content listing page

texts:
I've downloaded and installed the Content Management Filter, but I think that the interface is a bit ugly still with all the drop downs, and it doesn't actually achieve what I had hoped.

Basically, I'm looking for a way to put a row of tabs at the top of admin/content/node so that a managing user can easily select to display just one type of node (or all nodes).

Is there a module for this?

If not, what's the best strategy? How do I tie in with the filtering already in place on this page?


texts: Commerce 2 - how to get guest user email from custom submit handler?

texts:
I'm altering "review" form in checkout process and adding custom submit handler. From that handler, if user is registered I can get it's email address as:
$user = \Drupal\user\Entity\User::load(\Drupal::currentUser()->id());
$email = $user->getEmail();

But if I go to checkout as a guess user I can not get email of anonymous user that way - returns null.
How can I get guest user email address? I need a way to get email provided on previous checkout page, no matter if user is registered or not.


texts: Count content types which have taxonomy term

texts: I have a content type where a taxonomy term is associated to it . I would like to know how could i count the number of content types by taxonomy term ?


texts:
I'm trying to alter tab names ("view current" and "edit current") but it is just not working.

function MY_MODULE_custom_menu_alter(&$items) {
    $items['node/%node/view']['title'] = t('View Event');
    $items['node/%node/edit']['title'] = t('Edit Event');
}

Module implementation is good. Cache is cleared. Tried it milion times, but still nothing!

Wondering is it possible that this code is being overriden somewhere, and how can I check that?


texts: Security issues while using external javascript and php files to access mysql database in drupal nodes

texts:
I have created a search_interface node which asks for filters and onClick event of the submit button, I have called an external search.js script. My search_interface node is of a custom content type Query(this content type has no extra fields other than the default fields created by a new content type)

This script uses getElementById() to get user input and send it to an external php script using POST method. This script uses mysqli_connect() to connect to my database and then does query on the required table(only 1 table is being queried everytime). The result of mysqli_query() is passed back to the search.js script using json_encode() and in the search.js script, I have parsed this jsonData and created a table string.  Then I have used my_table.innerHTML = "table string" to finally display the query on the drupal node.

Is this method secure?
Can some anonymous user access my .php script and get to know my
mysql admin password? ( I use admin password during mysqli_connect() )
Can my whole database be exposed easily even though I always query a
single table of the  database?
Can the .php file be edited to update or delete parts of my database
or the table in which I query every time?

Please help as I am new to drupal 6 and don't know much about security of php files and drupal nodes.


texts: How to exclude nodes with a taxonomy term from XML Sitemap?

texts: We can exclude content type, or individual node from XML Sitemap. But, is there anyway to exclude nodes with specific taxonomy term? For example excluding nodes with longlivethetroll tag.


texts: Widget for custom CCK field without hook_elements

texts:
I'm writing my own module for a custom CCK field, and want to define whole widget in the hook_widget() hook only, without using hook_elements() with #process callback. But there is a big problem:

a) If I define my widget as an $element array (for example):

function mymodule_widget() {
  ...
  $element = array(
    '#type' => 'textfield',
    '#size' => 25,
    '#element_validate' => array('mymodule_validate'),
    '#attributes' => array('class' => 'text'),
    ...
  );
  return $element;
}

then it doesn't pass value for multiple field to the validation callback (it seems because there is no key in $element array to assign a value).

But if I define my widget as a subkey of the $element array

  $element['value'] = array(
    ...
  );

then it doesn't inherit #required, #title, #description and so on values, handled by CCK, because of way a content_field_form() function merges result of mymodule_widget with array of defaults.

So, I want to understand which way is 'right' and how to workaround a respective problem in that case? Or the only 'right' way is to use hook_elements?

P.S. I saw a lot examples of a custom CCK fields in Internet, but most of them use hook_elements, and the rest has a problem with #required/#title inheriting (as a Lullabot example, for example).


texts: Drupal Commerce | Hide or set an alias to the order number in the checkout path

texts:
Is there any DC module or configuration that would allow me to set an alias for the order number that is shown on the checkout path.

i.e.

Instead of example.com/checkout/10

Something like example.com/checkout/order or just plain example.com/checkout

An alias module would have similar functionalities as the me module.


texts: At user creation set different default timezone

texts: When a new user applies for an account, how does one set the timezone default from 'America/Denver' to 'UTC' timzeone?  It's ok to allow the user to change the timezone to a preferred timezone.  However, most of my users will be signing up from the UK.  Is there a way to set the default to UTC rather than America/Denver?


texts:
I'm attempting to use Drupal as creating a pretty versatile code snippet site for storing all of my  and others goodness. Yeah I know, sounds a bit familiar, but stick with me. What I'm having a hard time grasping is the best way to handle this in terms of both functionality and security.

At its simplest form, I'm thinking I'd create a Code content type with some taxonomy attributes, language type, etc. and then the actual 'body' of the node will be the code snippet itself. What I'm struggling on is, do I allow unfiltered text through here so anything and I mean anything can be put in and then on the node display just wrap the body in a code or pre block? I think then I could just  wrap that with Google Prettify and bam, code snippets.

Am I way off with this? Is there something I'm missing with how that could conceptually work? In terms of security, it seems a single code or pre block from any code actually rendering sounds a bit scary - is that how normal code snippet sites work?

I've been fumbling around with ideas in my head, so any help to either lead me in the right direction or slap some sense into me would be greatly appreciated. Thanks!


texts:
I just started learning Drupal 7 Module development. In a tutorial I watched, the person said that

  "In hook_menu(), if we have a 'file' attribute then the 'file
  path' is a must and drupal wont work if it is not declared in drupal 7."

But when I read a book, it said that

  The 'file_path' is not required in drupal 7 provided that the file
  is present in the same directory.

As you can see, its a bit confusing. So my questions are

1) Is 'file path' required in Drupal 7 ?

2) When to use 'file path' ?

I've posted a snippet of the hook_menu implementation :

function modulename_menu() {
  $items['...'] = array(
    ....
    ....
    'file' => 'modulename.admin.inc',
    'file path' => drupal_get_path('module','modulename'),
  );
  return $items;
}

Note : Assume that the file is present in the same modules folder


texts: Doing a post to create a node using Drupal services endpoint with Postman app

texts:
I got my endpoint setup and I'm able to to do a get request to return a bunch of nodes. But I'm having issues doing a POST to create a new node.

I see that I would first need to do a user login post as seen in other tutorials. I tried doing that with the following settings in postman, but I'm getting a blank response. What could I be doing wrong? I've enable user resources as seen below also.


texts: Making menu items active on desired page

texts:
I am creating a custom module for menus through which we can allow individual menu link to be active on desired path/paths. The module interface provides similar functionality as block module's visibility configuration.

I am using hook_translated_menu_link() to implement the visibility functionality. As I have referred menu item visibility module for this, but not getting the desired output. Do i need to implement any other hook for this or I am missing out something. As I have implemented hook_form_id_form_alter() for the interface and mymodule_submit() for form submit functionality and right now trying out hook_translated_menu_link() for visibility functionality.  I also have a database entry for my module.


texts: For the purpose of creating content, how do block_view and the page callback defined in the menu hook relate?

texts: I'm slightly confused as to how I should get my content on the page from a custom module. I thought I would normally do it with the block_view hook, but apparently another way is the page callback function. While I think I understand the former, I'm not quite sure how the latter works, and what I should return from it. Should I use one or the other method? When shoul dI use which? Can I use both?


texts: Drupal 7 views - distinct not working with ordering by multiple (date) field

texts:
I have "Episode" content type and some "Showing from" date field in it which is repeating (more than one value can be added). Then I have a view that list episodes ordered by that field, which works, but I want to exclude same episodes. Now if episode has i.e. 3 times that fulfill filter criteria episode will be listed 3 times. I checked "Distinct" option but it doesn't help - still episode is listed 3x.
Actually I'm not very sure how Distinct works - is it possible to select a filed that has to be distinct (if yes - how?) or it works for all fields? I would like to set distinct on episode nid of course.


texts:
I have a form for users who want to add new content on my Drupal 8 website.
I render node field on a twig template :

{{ node_field_title.value }}

But field are not sanitized by Drupal. Is it the normal behaviour ?

--> If the title is <script>alert('XSS problem!')</script> the script will be executed.

Drupal 8 documentation says : 'The Twig theme engine now auto escapes everything by default. That means that every string printed from a Twig template (e.g. anything between {{ }}) gets automatically sanitized if no filters are used.'


texts: Conditional price in readonly text field

texts:
I have a content type to create membership for a plan, There are around 900 kind of price based on condition. I know conditional field only make visible the text-field when criteria match but if I create text field for each price then my content type will have more than 1000 fields and that is some kind of fussy isn't it ?

So can anybody suggest me any other option to do it, like I know first 4 condition, based on which the value has to come, I can make table for it...but how to go forward to make it appear in content creation page ?


texts: User fields that are visible, but can't be manually edited

texts:
I have a web service that will be automatically populating certain attributes of a user's profile.

I am creating my fields via field api when the module is installed. I want all of the fields to be visible when editing the user profile, and some of these fields will be visible publicly as well.

My current plan is to form_alter my away around the issue, but I was wondering if someone has an alternate approach they would take.


texts: Pointing the Views handler for Node Body at another field handler

texts:
I want to be able to use a CCK field as my node body without affecting interoperability with Views generated by independent modules. Using hook_data_alter(), I have attempt to re-target the Views node body handler to look at the handler CCK has generated for my field, field_body. Unfortunately, I get some errors when I try to make use of my proposed solution.

/**
 * Implementation of hook_views_data_alter().
 */
function fieldbody_views_data_alter(&$data) {
  // When node_revisions table is added, join in content_field_body too.
  $data['node_revisions']['table']['join']['content_field_body'] = array(
    'left_field' => 'vid',
    'field' => 'vid',
  );

  // Use field_body handler info for node body.
  $data['node_revisions']['body'] =
    $data['node_data_field_body']['field_body_value'];

  // Really emphasize that we are using a different table.
  // Since this isn't doing anything, it may be redundant.
  $data['node_revisions']['body']['table'] = 'content_field_body';

  // A couple tweaks so it's a friendly Node Body replacement in the UI.
  $data['node_revisions']['body']['group'] = t('Node');
  $data['node_revisions']['body']['help'] =
    t('Full body text of the node.');
}

This code appears to work, but when I try to use the handler in practice, I get a warning:

user warning: Unknown column 'node_revisions.field_body_value' in 'field list' query: SELECT DISTINCT node.nid AS nid, node_revisions.field_body_value AS node_revisions_field_body_value, node_revisions.field_body_format AS node_revisions_field_body_format, node.type AS node_type, node.vid AS node_vid FROM node node LEFT JOIN node_revisions node_revisions ON node.vid = node_revisions.vid LIMIT 0, 10 in ../workspace/oa/profiles/openatrium/modules/contrib/views/includes/view.inc on line 771.

My interpretation of this is that the code is not pulling in the content_field_body table when the field is used, instead it just tries to use node_revisions.field_body_value.

Looking for any answers that resolve this problem or suggest a better strategy for my goal.

EDIT: Ugly Fallback Option

Use hook_views_default_views_alter() to scan every View for a defined body field, and swap it out for a standard CCK field. However, this will break all kinds of things, and not be very performance on cache clears.


texts:
I'm creating a page to list any content that needs moderation, which in my case includes new content and pending revisions.

I have the pending revisions down, by setting

Fields

Content: Nid
Content revision: Title (Title)
Content revision: Updated date (Last Revised)
Content revision: Vid

Filter Criteria

Content revision: State (= Pending)
Content: Revision moderation (=Moderated)
Content: Published (YES)

Now how do I add in content that hasn't been published that requires moderation, BUT don't pull prior content that has been set to unpublished?

I've tried opening up the filter for Content:published and selecting the ANY option and excluding it from display. However, When you unpublish content, the revision for it asks for moderator attention as if it was a new revision waiting to be published. So it grabs ALL unpublished content as opposed to only the new content waiting to be published.


texts: LIKE clause not working in hook query alter

texts:
I'm trying to replace the default search with a LIKE clause in Drupal 7. I tried to alter the query according to Adding an OR condition to an existing query:

function MYMODULE_query_node_access_alter(QueryAlterableInterface $query) {
  foreach ($query->getTables() as $table) {
    // LIKE for search results.
    if ($table['table'] == 'search_index') {
      // Get the query args and then the search term
      $args =& $query->getArguments();
      $search = $args[':db_condition_placeholder_1'];

      // Get a reference to the existing query conditions.
      $conditions =& $query->conditions();

      // Save the former conditions
      $former_conditions = $conditions;

      // Reset the condition array. It needs a default #conjunction for which AND is fine
      $conditions = array('#conjunction' => array_shift($former_conditions));

      // Replace the search condition in the query
      foreach ($former_conditions as $key => $condition) {
        if ($key != 1) {
          $query->condition($condition['field'], $condition['value'], $condition['operator']);
        }
        else {
          $query->condition('i.word', '%' . db_like($search) . '%', 'LIKE');
        }
      }
    }
  }
}

Searching with the word "declaration" displays the same results as the default drupal search, but searching with "decl" doesn't find any results.

Any ideas why my code isn't working?


texts:
Is it possible to write a twig template for a specific view?  I have a view with multiple blocks and I want all these blocks to look the same.  But I am having trouble with my views actually knowing which theme to use.  I am trying to inherit the block.html.twig template but none of my changes render.

I am also afraid that my changes will change every block not just the blocks for that view.  How can i limit it to just my view?


texts: How to stop Privatemsg showing user role in 'To' field

texts:
With the module Privatemsg (v7.x-1.3) the 'To' field will show the username and then their role in brackets when composing a new message with the user id passed in the url:

/messages/new/567

I've searched the code but cannot seem to find where the role is being added so that I can disable it. Does anyone know?


texts: Let Users Make a Feedback before Download File

texts: I want to let users fill a form feedback about the node before downloading the file that attached to that node! like in Dialog or Popup, which modules should I use here?


texts: How to add custom css classes to views exposed filters?

texts:
I would like to add custom css classes to specific views exposed filters. Is this possible either by default or with some Drupal module?

UPDATE: Please, note that I am not referring to the views exposed filters form in general, but individual filters, eg. a class to a date filter, another class to an entity reference filter, etc.


texts: How to display the same nodes with two different themes?

texts:
I have some content types normally displayed with the default theme of my site.

Now, I want to show such content types also in another section that is displayed with another theme and layout.

What is the best way to do it?


texts: How to add a field to a group with form_alter

texts:
I have a group in a node set as a vertical tab, and I want to add some markup into this vertical tab via code. How can I do it?

Thanks!


texts: #states in formElement for a FieldWidget

texts:
Does #states in formElement doesn’t work the same way it does in buildForm ?
I have a field widget where I have a Form for the widget which has a #states in a container. But it’s not working whereas the same code works perfectly fine in a custom form.

/**
   * {@inheritdoc}
   */
public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {

$form['needs_accommodation'] = array(
 '#type' => 'checkbox',
 '#title' => $this->t('Need Special Accommodations?'),
);
$form['accommodation'] = array(
  '#type' => 'container',
  '#attributes' => array(
    'class' => 'accommodation',
  ),
  '#states' => array(
    'invisible' => array(
      'input[name="needs_accommodation"]' => array('checked' => FALSE),
    ),
  ),
);

$form['accommodation']['diet'] = array(
  '#type' => 'textfield',
  '#title' => $this->t('Dietary Restrictions'),
);


texts:
I'd like to use drush methods in the remote server.
As far as I know I have to install Drush in the remote server.
But my server provider tell me that Drush has many conflicts with other modules that the server is already running. How do you manage to use Drush in remote server? Is my server provider answer acceptable?


texts: How to hide specific pages from users, but not the content?

texts:
I'm trying to hide a specific set of pages from anonymous users and I would like to return a 404 for them. To be more precise, the set of pages I'm trying to hide are ECK entity pages (info blocks I guess), taxonomy term pages and a few node types. But I would like to still have them visible in the pages they are part of.

To be more clear, let me give you an example : I would like to have itinerary/gallery/1 hidden from anonymous users, but I would still like for the gallery itself to be visible in the blog pages it's embedded in.

I tried using the Rabbit Hole module and it works great for taxonomy terms and the node types, but not for the ECK stuff. I tried extending the module but it doesn't seem possible the way Rabbit Hole works unless I create an extension for each of them.

I also tried pulling a hook from hook_entity_view() but the problem with it is that it also triggers when the elements are loaded in the page, not just on their own pages. Does anyone have any idea how to do this?


texts: Calendar Multiple URL's Output Specific Block/Menu Dead Links

texts:
Hi I've created a block that I only want to appear in the members area this includes a page where I use the Calendar Module, the problem I have is that I have listed the pages where the block should be outputted however with the calendar there are multiple url's for every view depending on month, so I can't feasibly output the block with all of these pages/url's which are possible through the calendar......

So is there a way to output this block specifically for every view output of the calendar, aside from listing all the url's in the block configuration page......

Also another issue the menu of the calendar isn't working, is there some setting I need to turn on in the admin area to get the menu to work........

http://www.cambrianvacation.co.uk/artbelow/?q=calendar-created/month

Regards

Ant


texts: Display (and pass) a custom user field in php

texts:
In Drupal 7, I've added some custom fields in Account Settings>Manage Fields.  One of them is field_company_name.  I'd like to be able to display this field and pass it to an external php function.

I can easily display the $user fields for the current user.  For example:

<?php
global $user;
echo 'Current User: ';
print_r($user->name);
echo '
User ID: ';
print_r($user->uid);
echo '
Email Address: ';
print_r($user->mail);
echo '
'
?>

How to I get at field_company_name for this same user?


texts: Hide a webform a role doesn't own on the overview page

texts:
For a certain role, I would display only the webforms their users own on the webform overview page (/admin/structure/webform). Is this possible?
Role 1 can see and administer all forms. Role 2 can see and administer only its forms.


texts: What is the easiest way to upload video and audio content?

texts:
I am creating a website archive that will allow users to upload various different types of media content including video, audio, images, documents and text. I want to make it easy for users to upload the media content to the site.

Is it better to upload directly to the website hosting itself or to use a third party video and audio hosting like YouTube and SoundCloud?

Either way how can it be made as easy as possible for the user to upload the media content?


texts:
What is best module to hide or disable or un-publish some terms in taxonomy or vocabulary
like the way in the node tab of publishing in the back end


texts: How can i put two forms build in one module to two URLs

texts:
I am very new to drupal and working with D7

I have created two form with a custom module. mysite.com/custom is showing both the forms at the same time

I want each of the form to be shown with 2 different URLs. eg mysite.com/custom1 eg mysite.com/custom2

How is it possible.OR is it not possible at all. am i totally wrong in understanding how the module and forms work?

code

function custom_menu() {
  $items['custom'] = array(
      'title' => t('Custom'),
      //'page callback' => 'drupal_get_form',
      'page callback' => 'custom_page_callback',
      //'page arguments' => array('custom_form'),
      //'access arguments' => array('custom module'),
      'access callback' => TRUE,
  );

  return $items;
}

function custom_page_callback() {
  $build = array();

  // Render your two forms here.
  $build['form_one'] = drupal_get_form('custom_form');
  $build['form_two'] = drupal_get_form('custom_second_form');

  return $build;
}
/**
 * Our custom form.
 */
function custom_form($form, &$form_submit) {
  $form['title'] = array(
      '#title' => t('Give a title'),
      '#type' => 'textfield',
      '#required' => TRUE,
  );
  $form['name'] = array(
      '#name' => t('Give a Name'),
      '#type' => 'textfield',
      '#required' => FALSE,
      '#maxlength' => 25,
      '#size' => 10,
  );
  $form['submit'] = array(
      '#value' => 'Add',
      '#type' => 'submit',
  );
  return $form;
}
/**
 * Our custom form second.
 */
function custom_second_form($form, &$form_submit) {
  $form['title'] = array(
      '#title' => t('Give a title'),
      '#type' => 'textfield',
      '#required' => TRUE,
  );

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

Thanks all


texts: Show and hide form element based on values of other form elements

texts:
$form['bookpage'] should be hidden at first. Then should be shown based on user selected value in $form['student'].

But somehow, before user selects anything, upon loading the option list, it already triggers the $form['student']'s ajax function and shows the $form['bookpage'].

Why is this so?

P.S. _lms_user_get_students will return following array:

  array('0'=>'----', 'all'=>'All', '2456'=>'Student A', '2462'=>'Student
  B')

 $form['student'] = array(
        '#type' => 'select',
        '#title' => t('Student'),
        '#options' => (!isset($form_state['values']['book']) || $form_state['values']['book']==NULL)?array('0'=>'----'):_lms_user_get_students($form_state['values']['class']),
        '#prefix' => "
",
        '#suffix' => "
",
        '#id' => 'select-student',
        '#ajax' => array(
            'callback' => 'ajax_student_select_callback',
            'event' => 'change',
            'wrapper' => 'statistic_table_div',
            'method' => 'replace',
            'effect' => 'fade'
       ),
   );

  $form['bookpage_toggle'] = array(
        '#type' => 'hidden',
        '#value' => 'off'
  );
$form['bookpage'] = array(
            '#type' => 'select',
            '#title' => t('Page'),
            '#options' => (!isset($form_state['values']['book']) || $form_state['values']['book']==NULL)?array('0'=>'----'):_lms_user_get_bookpages($form_state['values']['book']),
            '#prefix' => "
",
            '#suffix' => "
",
            //'#disabled' => TRUE,

            '#states' => array(
                'visible' => array(
                    ':input[name="bookpage_toggle"]' => array('value' => 'on'),
                ),
                'invisible' => array(
                    ':input[name="bookpage_toggle"]' => array('value' => 'off'),
                ),
            )
       );

    function ajax_student_select_callback($form, &$form_state) {

        //show page drop
        if($form['student']['#value'] == 'all') $form['bookpage_toggle']['#value'] = "on";
}


texts: How to seperate products images folders based on product display categories?

texts:
I am building a drupal 7 commerce site, I have installed  inline entity form module and adding products from inside the products displays.
Since I will have thousands of product displays and products, I thought of finding a way to automatically separate pictures into sub-folders at time of adding the product displays and products.
So I have installed this module
Filefield Paths
I managed the image field in the product display and set the path setting to:
pictures/products-displays/[node:field-taxonomy-terms:1:root] (as per below screenshot)

So it uploads the image, to a folder named as per the product parent category, under products displays folder. Which is exactly what I want. a nicely organized pictures structures.

The problem is not with product display images. It is with product images.
I want to have the same things for products where I  need images of products to be saved under

pictures/products/(parent category of the product display this product belongs to)

I understand that:

The product categories vocab is a reference field for Product Display and not product
A product can belong to more than one product display, so there there is no reference on the product data to the product display it belongs to, only the other way around.

So I thought my only workaround to get the category of the product display to which the product belongs to is to use the page url. (I edit my products from the same page of product display edits..remember I am using inline entity)

So [current-page:url:args:value:1] will give me the product display node id, when I am on the page of product display and its products editing.
What I need is to get the parent category of that product display node id and use it for the path. in other words I need to have a token that will get me the parent category of the product display id on the page
I know the below does not work... but just to give an idea about the logic

 [[current-page:url:args:value:1]:field-taxonomy-terms:1:root]


texts:
How may I associate fields of the billing information commerce profile with profile2 fields?
I´ve got this billing information profile, where I´ve added a "username", "password" and "telephone" fields.
Those are named:

field_c_username
field_c_pass
field_c_telephone

I need:
use case 1: field_c_username and field_c_pass to remain hidden in the form, so I can manually set them when reviewing the order.
use case 2: And field_c_telephone to get copied to the field_profile_telephone inside the profile2 user profile.
I´ve installed commerce_profile2 module but not only I didn´t understand how it worked (I thought that it would add some profile fields into the commerce profile, but it didn´t), but I don´t know if it works in use case 1.
How may I do that?
Thanks for your insight!
UPDATE: I´ve read this explanation saying that´s actually possible (specially this comment), but as I´m not a developer I can´t quite understand how to actually put there all profile2 fields and after creating a new user (the customer) to take that information and insert it into the profile2 fields of the newly created user.


texts:
I've got a simple form which I would like to run through a theme function of mine. What I do is that I've got a form builder function where I define the form. I've then used hook_theme() to define which theme function Drupal should use to theme the form.

function mymodule_theme($existing, $type, $theme, $path) {
  return array(
    'mymodule_form' => array(
      'render element' => 'form',
    ),
  );
}

Drupal does invoke the theme function. However, I've got a call to drupal_render($variables['form']) to actually render the form in my theme function. What happens then is that Drupal seems to go into a loop as this call results in mymodule_theme to be called again (and again, and again...).

function theme_mymodule_form($variables){

  // Add custom text on top.
  $output = '<span>' . t('Table description goes here') . '</span>';
  $output .= drupal_render($variables['form']);

  // Return output.
  return $output;

}

When I do a dump of $variables passed to my theme function, I see that #theme is set to 'mymodule_theme'. Should I at this point change it to 'form', and not 'mymodule_form' as I'd just like to render the form as a plain form? How should I really render the $variables'[form'] in my theme function to make it appear as a plain old form? Should I rather use theme('form', $variables['form']) for that?

As far as I understand, drupal_render($variables['form']) takes care of rendering the form and all its children, as opposed to to theme('form', $variables['form']) which only renders the immediate form and not children.

I'd be really happy if someone have the time to enlighten me on this :-)


texts: How can I verify users the first time they log in?

texts:
I was reading this article. I would like to know how logging in with the REST API in Drupal 8 works. By default, when users log in, Drupal will verify username and password. After the login, the browser has a cookie for the created session.

With the REST API, how can Drupal 8 verify users the first time they log in? After the login, how does it check the current login?


texts:
Let me fully describe the problem I am trying to solve as there may be a better way of doing what I am trying to do.

On my Drupal 7 install, when a user is logged out, the Main menu shows Home / Log In and a few other links I've added. This is $primary_nav in the theme.

When a user is logged in, a Log Out link is added.

What is confusing however, is that there is still a login link in the Main menu.

My solution was to create a second menu that would replace the Log in link with a link to the user's account page when they are logged in. All other links would remain the same.

In the template, I am doing the following:

<?php // show different menus depending on if the user is logged in ?>
<?php if ($user->uid): ?>
<?php $menu = menu_navigation_links('user-menu'); ?>
<?php print theme('links__menu_user_menu', array('links' => $menu)); ?>
<?php else: print $primary_nav; ?>
<?php endif; ?>

And this correctly shows the right menu depending on whether the use is logged in or not.

However, the styles are completely different. $primary_nav is a horizontal menu and user-menu is a vertical menu.

According to http://drupal.org/node/254940#theme-suggestions-for-menus, I should be able to create a function in my theme's template.php file and style it. However, I tried doing the following:

function MYTHEME_menu_tree__user_menu(&$variables) {
  echo 'Success'; exit;
}

But that code is not run.

So my questions are these:

1) Is this the best approach to replace Log In with a link to the user account page when the user is logged in?

2a) If so, what's the best way to get the menu styled the way I want it?

2b) If not, how can I achieve the effect listed in 1)?

Thanks!


texts: I had my Drupal 6 running for 2 yrs now. Suddenly it started to give parse errors on index.php page. I opened the file and saw that there were 100-200 empty lines after php closing tags. There is no chance that some one can have changed the file as access is with me only. What may be cause for this? Does any changes in server like upgrade of php version may cause this. I haven't changed the index.php file and it was running perfectly fine till date. The website is hosted on some other server.


texts: How can I add a header and footer field to all drupal generated blocks?

texts:
I have a number of blocks that are created by drupal core, modules and views. In views blocks I can add a header or footer using the views UI, but I would also like to do this for other blocks not created by views. e.g. core search block. I would like to add a user configurable header and footer field to every block generated by drupal. This way a user can add arbitrary content above or below block content using the block UI. Doing this for all views blocks would be great as well as I would not have to give the client permissions and train them how to use the views UI to make changes.

EDIT:

Each block needs to have their fields configurable in the UI. I can't have laypersons digging into the tpl files.

Switching to an entity based block replacement such as the BEAN module is not an option. I need to keep the core block architecture and it also must be able to add headers and footers to core and module generated blocks (which are not beans, boxes etc)


texts:
I'm loading a form using AJAX commands. However, it seems to me that forms loaded with AJAX can't submit using AJAX.

This is what i do :

Load a form through an ajaxified link. The link invokes a path which maps to a callback function responsible for returning an ajax commands array. This works fine, and the form is loaded onto the page just where it should be.
I go through the form, and click on submit. The form the submits the page, and the form appears to not have been ajaxified at all.

There is one thing that i suspect may be part of the trouble. It seems to me that not all required JS files are loaded after the commands array have updated the page with the form.

In other words, the number of JS files are not the same if i show the form directly and if i load the form using ajax. If i show the form directly, then the form gets perfectly ajaxfied, whereas if i load the form using ajax it does not get ajaxified.

I've had a look at the Drupal examples module, but haven't found an example which demonstrates this particular case.

Any ideas?


texts: How to get hits count of nodes related to a taxonamy vocabulary

texts:
I had implemented 2 taxonomy vocabularies with some taxonomy terms in my site. There are two content type, Events & documents with a field term reference to these vocabularies. I need to display the view count of each vocabulary separately with taxonomy pages, events & file download related to particular taxonomy. Any way to implement.

Layout


texts: Configuring a basic multisite development environment in Linux

texts:
While installing Multisite devlopment i followed below instructions    https://www.drupal.org/node/823990#comment-10184088

When i trying to call http://testsite.localhost/install.php throwing error Forrbidden Access to Page and in apache2/errorlog its showing AH01276: Cannot serve directory /var/www/html/drupal/sites/testsite.localhost/: No matching DirectoryIndex (index.php,index.html,index.htm) found, and server-generated directory index forbidden by Options directive, referer:


texts: How to avoid Onclick event returning old output along with new output

texts:
Using db_select got the data(path to csv file) from database, bind it to table(themes) and returned table as output. Each row in the table as hyperlink named "Plot" as shown below.

When user clicks on the plot hyperlink the filename is passed to javascript(located in chart.html) and displayed output content using "file_get_contents"

"Plot",

For the first time everything is fine as below

But if user again click on the same plot or on any plot from table, the graphs are displayed one above the other, previous plot graphs are not cleared as shown below image

I want to overcome multiple graph display. Just display graph only for the latest hyperlink click event.

below is the complete code drupal code.

$query1 = db_select('simulation_results', 'sr');
 $query1
     ->fields('sr', array('time','uri_CsvFormat','unique_Id'))
     ->orderBy('sr.time', 'DESC')
     ->condition('sr.user_Id',$user->uid)
     ->condition('sr.unique_Id','%'. $key .'%', 'LIKE')
     ->condition('sr.simulationResult','FlameSpeed');
 $query1 = $query1->extend('TableSort')->extend('PagerDefault')->limit(40);
 $result1 = $query1->execute();
$rows[] =array();
 while($data = $result1->fetchObject())
 {
   $fileName = '"'.file_create_url($data->uri_CsvFormat) . '"';
   $rows[] = array(
   "uri_CsvFormat) . ">"."Flamespeed_Results_". $data->unique_Id.'',
   "
Plot
",
       );
 }
 $output1 = theme('table',
          array(
            "header" => $header,
            "rows" => $rows,
            "attributes" => array(),
            "sticky" => true, // Table header will be sticky
            "caption" => "",
            "colgroups" => array(),
            "empty" => t("Table has no row!"),

          )
        ).theme("pager");
 $output1 .= "
" .file_get_contents(drupal_get_path('module', 'flamespeed_tool') . '/chart.html').'
';
        return $output1;

Please let me know if question is confusing.

Thanks in advance


texts:
Currently I am using nginx and php5-fpm behind Varnish to render pages. It is great of guest users; however, I feel it is a bit slow and error-prone for authenticated users, and I'd like to disable Varnish and use nginx built-in cache, to cache the whole content for, say, one minute. I could not find a working sample of nginx mysite.conf for drupal 6 to do so. I would appreciate if you paste one here.

I would also like to hear your experience/benchmarks of nginx cache versus Varnish.


texts: How do I get the current year in the footer?

texts:
I want to put a copyright notice in the footer of my posts, and I want the year always to be current.  I've tried adding

<?php echo date("Y"); ?>

to the Footer, but the actual code shows up; it doesn't get parsed as PHP.

How do I get the footer to display the current year?


texts: How do I customize the comment reply link?

texts:
I'm trying to customize the comment reply link to direct the user to the comment submission form on the same page. I've tried:

<?php
$content['links']['#links']['comment-reply']['href'] = '#edit-comment-body-und-0-value';
?>

in my comment.tpl.php, but no luck. Also I need to add a JavaScript onclick to make the comment body in focus and add the user name of the user being replied to.

What should I do?


texts:
Is there anywhere in the administrators area can I set $vars['view']->date_info->granularity ?

With the recent updates to Drupal 7.32 the date format of the calendar module heading has changed from [month][year] to [day],[month][day number],[year] which looks silly.

I assume granularity has changed from 'month' to 'day', but I can't find where to change it back.

Is this associated with the fixed bug number 355058?


texts: How to hide breadcumbs on the front page?

texts:
I would like to disable breadcrumbs on my home page and I don't know of any easy way to do this so I was going to just display:none the breadcrumbs class.

Suggestions welcome, thank you!


texts: add condition in apache solr serch query

texts:
I want to alter apache solr search query with my custom filed.

I have custom content type called "Restaurant" and in this content type i have 1 field called "country". Now I want to add condition that display search result only those restaurant which is belong to "Jamaica" and display facet as per this condition.

So,how can I alter query with apache solr serach?


texts:
I am a long time drupal user and a first time ubercart user. I apologize if this question has been asked in the past. I could not find the answer through google, ubercart.org or the forums here.

We are planning on shipping our product USPS flat rate. I would like the shipping cost to depend on the order total. Is this possible?

Something like this:

0-$99.99 - $5.99

$100 - $350 - $9.99

$350 - $500 - $11.99

$500+ - Free

I am running drupal 7 with ubercart 7.x-3.4

Thanks


texts: Video Presets: Make selection of presets when viewing video; just like in Youtube (240p, 360p, etc)

texts:
I'm using video and video_presets.

Two FLV presets with different video quality has been enabled through page admin/config/media/video/presets. One of them is the default with name FLV.

After submitted, the original file do converted to two FLV files, but when viewing the video, I see no option to enable a selection of presets for viewers. Viewers has no choice than watching videos of presets name FLV.

I want viewers can choose different quality like in Youtube, where viewers with slow internet connection can use 240p.

Any guide or hacks are greatly appreciated.


texts: Including a PHP file in Drupal via BLOCKS, or REGION

texts:
Hi I am newbie in Drupal, I have problem about theming.

I have a PHP file ads.php that contains random advertisements now just wondering what is the perfect way to include that ads.php

Can I just use the PHP include command

include('ads.php');

or import it as a block for example block--ads.php  or region--ads.php  I DON'T KNOW IF THIS IS POSSIBLE. I am still confused on how drupal theming works.

Please help me.


texts: How do I redirect users from Japan to a certain subsite?

texts:
I want users from Japan to be redirected to www.example.com/test2 when they hit www.example.com/test1. In the menu only Test1 is visible.

What tools do I need? I tried to insert a PHP script into the header with the 'Add to Header' module, but for that I need the directory of the sites, which I do not have.
I can also set Geo Rules, but then I have two sites with different URLs which are invisible and unaccessible for those excluded, but the 'Access denied' message is not preferable.


texts: Why isn't  the node ID available as "replacement pattern" for the title link?

texts:
I have a simple view for a node using an "unformatted list" and fields. I want to link the title to another URL and pass the NID. However, as "replacement pattern" I only have the "[title]" token.
When I add the NID field to the view I can link it just fine. What am I missing?


texts: I am confused how APC caching hooks into Drupal system or vice-versa.What I knew so far is APC caches the opcodes for the currently being executing PHP file so next time the various compilation steps can be avoided and then opcodes are served directly from RAM. Since a Drupal page is built with various functional blocks like blocks, node, I am not getting how APC helps it serving fast.I know it does but how?


texts: VIEWS: How can i Related (CONCATENATE) current_user to content fields?

texts:
DRUPAL ROCKS!

I need your help! in a website i am currently working with. i have 700 active users with the following users field:
-Name, Sure name, last name, worker number.

And i created a content type called: Turns.With the fields: title, body, full name, turn's date, worker number.

One of the main goals of this website is that in the moment that the user logs in he will have a button that say my turns, and he will just see his "turns".

i need to be able to related in a view, some how, user's worker number with turns (content, node) worker number field in order to show just user "turns".

view=user(work number field) + turns(work number field) and off course display all the turn fields.

any help will be really really appreciated...

love drupal!


texts:
basically I want to add the ability to add a blur effect style to the image styles in Drupal 7.

I tried the imageCache custom action module but I am not able to add own php code since saving any code causes an error. Ive read that people guess the module itself seems to be buggy.

Is there any way I can add my own effect, a function like those listed in image.inc and add that effect to the dropdown?

EDIT:

thanks to the help of Clive I've actually managed to add a blur effect - wicked! :)

Here's the code:

function image_blur_image_effect_info() {

    return array(
        'image_blur' => array(
            'label' => t('Gaussian Blur'),
            'help' => t('Gaussian blur the image by a given amount.'),
            'effect callback' => 'image_blur_gaussian_blur'
        )
    );
}

function image_blur_gaussian_blur(stdClass $image) {
    $amount = 30;

    for ($i = 0; $i < $amount; $i++) {
        imagefilter($image->resource, IMG_FILTER_GAUSSIAN_BLUR);
    }

    return imagefilter($image->resource, IMG_FILTER_GAUSSIAN_BLUR);
}

I just wondered whether this could be done nicer somehow?

Next question: Is it possible to add an input field once the effect is selected sothat the user can type a custom amount of blurriness?

Like so:

function image_blur_gaussian_blur(stdClass $image, $CUSTOMAMOUNT) {
    $amount = $CUSTOMAMOUNT;

    for ($i = 0; $i < $amount; $i++) {
        imagefilter($image->resource, IMG_FILTER_GAUSSIAN_BLUR);
    }

    return imagefilter($image->resource, IMG_FILTER_GAUSSIAN_BLUR);
}


texts:
I am new to Drupal. I added a new content type and a view that points in the google map for the locations I entered

This worked fine in my local site. I implemented the same in the live site. But that gave a page not found error for every page and all the pages are redirected to some another unneccessary page.

Please let me know if adding a view can cause this kind of errors.

I used these modules: Location Map, Geocoder, geoPHP , Geofield and Geomap.

Or did this effect occure because of using these modules?