texts: Content Type vs Webform vs Form API vs Custom Form vs?

texts:
I'm currently working on a new Drupal 7 site, which will be used as a data collection and reporting site. After much research / trial and error / etc, I've decided to bring this question to this forum, and am sincerely hoping that it won't be thrown out as being "too generic."

I've created a Content Type, which consists of roughly 25 fields, and am wondering what the best approach for having users populate that content would be? Out of the box (even using Manage Display) the form itself still resembles nothing that I'd actually want to present to the users. And, it seems a bit insane to alter the form using one of the hook_form_alter flavors, because the code involved seems way overkill just to hack the form into looking/acting like I intend it to. I've also spent a bit of time with the Webform module, which is ok, but there's still quite a bit of customizing that needs to be done in order to have the form look/act like I intend it to, and there seems to be mixed reviews on that module in general (no offense to anyone!). Same goes for using the Form API...lots and lots of code just to come up with a basic form to collect data.

My latest approach is to simply use the markup type to create the form itself (basically, just straight html / css / javascript, and then populate / update the Content Type behind the scenes. From a developer's point of view, this approach is very, very straight forward - no rocket science - easy to maintain, but I'd certainly like to hear from those of you that know your way around Drupal. Am I overlooking something?

Thanks in advance!
cmmsites


texts: New Account, change Duplicate E-mail error

texts:
I run a drupal / civicrm build for a non-profit.  We are very careful with our members information, and want to make sure that no one trying to, would be able to figure out if someone they knew was a registered user.

The problem we have is when someone goes to create a new user account, if they use an e-mail that is already on our site, they get an error message saying that they can't use that e-mail because it's already registered on the site.

There are plenty of people - bosses, spouses, etc who could be testing an e-mail address to see if someone they know is on our site, and this error message pretty much confirms it.

Is it possible to change the error message to something else?  We have the e-mail confirmation enabled, why can't it say, "An e-mail has been sent to abc@xyz.com with your login information?"


texts:
I want to add additional content/code to all existing fields of type x. I'm unsure of what options I have for achieving this. I initially thought that hook_form_alter on all *_node_forms would be ideal but this won't cover all instances of the field in the form.

Is there a hook I can use to get all instances of a specific field type?


texts: Adding class to form element via hook_form_alter for views exposed filter is not working

texts:
I have a Views exposed filter, for which I am trying to add a class via hook_form_alter() with the following code:

$form['price']['#attributes'] = array('class' => array('price-hide'));

Outputting the form array with devel shows that this is adding the attribute fine; however I can only assume there is another hook_form_alter() running after my module that is wiping my attributes, as other attributes are being added, and mine never make it to the HTML output.

I've tried moving from hook_form_alter() to hook_form_views_exposed_form_alter() since I remember that hook running at a different time than hook_form_alter(); however, this doesn't seem to make any difference.


texts: Installing / updating modules in multi-site environment

texts:
I am in the middle of configuring a Drupal 8 installation with multiple domains in a multi-site configuration. One thing that occurred to me, is if one domain/site updates a module, the other site that may use that module won't know of that update.

Should I either :
a) move the modules into the sites//site name//modules directory, or
b) make another drupal8 instance for each site

Or is there something else that i am missing. Recommendations most helpful.


texts: Using background images formatter for taxonomy in views

texts:
I have an image field per taxonomy vocabulary that I want to set as background to each views-row. I have the view filtered by taxonomy term, and I have set the taxonomy_image field as background.

However, I don't know which CSS selector would be appropriate. The tokens available are c.date, c.page, c.user, random, site info, and users.


texts: Unlimited text field type and unordered list with links

texts:
I'm continually amazed at how powerful drupal can be. Im using Drupal 7 and right now I am curious to see if its possible to create a field for a custom content type where I enter text that becomes links via an unordered list. I would love if I could enter this into the CMS without having to go into the code.

I managed to find a way of creating the unordered list by customizing the field template file (field.tpl.php) which is great, but curious if there is a way to wrap the text items in an href.

Link 1

Link 2

Link 3

Thanks all!


texts: Programmatically develop search exposed filters

texts:
I developed a custom module to list contents of custom tables. Now I want to have search filters much like exposed filter. My code is below

$items['recording'] = array(
    'title' => 'Recordings',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('recordingcrud_sort_with_pager_content'),
    'access arguments' => array('access recordings'),
);

function recordingcrud_sort_with_pager_content($form, $form_state) {
global $user;
print_r($form_state);
if (!isset($form_state['storage']['recordingcrud']['search_criteria'])) {
  return render_table();
} else {
    print_r($_POST);
    $filters = $form_state['storage']['recordingcrud']['search_criteria'];
    return render_table($filters);
}

}

In render_table function I am rendering the listing. and calling the fom

 $search_form = drupal_get_form('recordingcrud_search_form');
$output = drupal_render($search_form);

My search form and submit handler code is:

function recordingcrud_search_form($form, &$form_state) {
$form['search_term'] = array(
    '#type' => 'textfield',
    '#title' => t('Search'),
    '#size' => 40,
    '#maxlength' => 120,
);
$form['submit'] = array(
  '#type' => 'submit',
  '#value' => 'Apply',
  '#submit' => array('recordingcrud_search_form_submit'),
);

return $form;

    }

    function recordingcrud_search_form_submit($form, $form_state) {
        $form_state['storage']['recordingcrud']['search_criteria'] = $form_state['values'];
        $form_state['rebuild'] = TRUE;
    }

But this implementation I am getting the error

  PHP Fatal error:  Unsupported operand types in
  /var/www/html/digitalFunctionalism/allprobail/includes/form.inc

What am I doing wrong?


texts: How to get last insert ID of drupal_write_record

texts:
I need to get the last inserted id in drupal 7. I am using

drupal_write_record('user_log', $log)

How we can get the last_instered_id?


texts: How to make a blog tab in every user profile

texts:
I have enabled the Blog module in order to have a blog for every user. Now I want to create a tab in each user profile that it links to that user's blog.

Is it possible? How can I do this?


texts: Problem ignoring in a view the images inside the .views field body and the minimum number of characters?

texts:
I need to remove the images appears in the view in the field body. I have tried the following code.

.view-mydisplay .views-field-body {
    display:none;
}

However, I cannot see the image but the "maximum length of characters" of my field-body are not showing completely. If I remove the image manually in the body, then the characteres are complete in the view.   Seems how if the image were counted like character.

For example if I have 300 max. characters in my view and I put an image only are showed 100 characters, after remove the images with css.  If I don't put the image in my body, the view shows the 300 characters configured in the view.


texts: How to get an export option as a pdf for views?

texts: I am using views on my Drupal site I can able to export my view in csv, but I am not able export my views as pdf I need to export my view as pdf. Any suggestions on this it will be very helpful, Thanks in advance.


texts: How can I auto-rotate an image on file upload in a custom form?

texts:
I'm using the FAPI to provide the user an upload field for an image.  The field is:
$form['product_img'] = [
  '#type' => 'managed_file',
  '#description' => 'Upload a PNG or JPG image of the product.',
  '#multiple' => FALSE,
  '#required' => TRUE,
  '#upload_location' => 'public://',
  '#upload_validators' => [
    'file_validate_is_img' => [],
    'file_validate_extensions' => ['png jpg jpeg']
  ]
];

A lot of the users are uploading images taken with their mobile device, resulting in the image in landscape.
The solutions I've seen involve the default file upload widget, but I need something that will automatically rotate the image after the upload.


texts: How does the mapping of the Feeds module work?

texts: Does the mapping of the tables from source to destination should be completed, if I have 6 fields in the source table? Should I list all 6 fields, or can I only put 1 field to map if I only want that field to be imported?


texts: Display text in an empty field group tab using custom code

texts:
I have created a field group with an empty tab. I would like to use custom code in a module to display something in this empty tab - it will just be a render array.

Can someone show me how this can be done or a link that might help me discover how to do this?


texts: Display of View (using grid) is unevenly distributed

texts:
Note: as a neophyte user, I'm not allowed multiple links or images. It has been suggested that I edit the hyperlinks so they're not quite right. Hopefully you can sort out what's going on.

Here is my view with taxonomy terms in columns, but you see that the columns are a bit wonky and not evenly distributed.

These are the the grid settings

And this is the page h ttp://imgur.com/puH2v1M

Thanks.


texts: How does Entity Translation module manage translation state?

texts:
I'm trying to understand how the Entity Translation module keeps state for entities. I understand that any given field will have translations stored on the actual fields, but there's also the translations property.

It seems to me that this property has two child properties: (1) original and (2) data. As far as I can see, original holds an original language. But what exactly is the original language, and how does it differ from the entity's language property?

If 'original' is set to 'en', should translations->data['en'] then exist at all? Is english considered a translation?


texts: Image Repo and Uploader for specific role

texts:
we'd like our staff to be able to add images to a content type whenever they add a new node to this specific content type. This is easily enough done with the image field. However, this requires a) for all of them to have the same images on their local computers, and b) it uploads multiple versions of the same image over and over again into the files directory. We just want one copy of each image on the site. Ideally, the staff would be able to select an image to use for the node they're creating from a repository somewhere on the drupal site itself (which then only keeps one copy of that image on the server).

It would basically work like a 1:M relationship in a database, with the image being the 1 and the nodes being the many.

Anyone know how this is possible? (preferably not using the IMCE module as that messes up my database configuration for some reason...)


texts:
If user account is locked after entering wrong password 5 times. That's a default setting.
That can be changed via
drush cset user.flood user_limit 10

I have different roles. I need to set flood user_limit role wise
Role A, It will be 10
Role B, It will be 7

Can we achieve same thing via CLI?


texts: call a modules function from preprocess_page

texts:
I want to be able to call the current nodes taxonomy tree from page.tpl.php by using a function already in the taxonomy module. So far I've only been able to obtain the current nodes taxonomy id with:

$tid = $variables['node']->field_category['und'][0]['tid'];

I tried using: taxonomy_get_tree($tid);

but this only returns an empty array.

is there a way for me to use functions from other modules in _preprocess_page ?

full code:

function centro_preprocess_page(&$variables) {
     $tid = $variables['node']->field_category['und'][0]['tid'];
     $variables['taxTree'] = taxonomy_get_tree($tid);
 }


texts: Panopoly, custom module and javascript rendering error

texts:
I have created a custom module that creates a jquery dynamic menu displayed as a slider in the left part of the screen. When clicking 'customize this page' the menu is activated and shows an image over which user can open the layer when moving his mouse. After saving the content, when clicking on 'customize this page' for the second time, the settings of the left hidden slider is lost and the menu is displayed in bulk on the top of the content region.

I can't see any difference between the source codes of those two different situations and I suspect Panopoly cache or save settings interfering with the rendering of the customized javascript.

Actually, the javascript is located in the theme/js folder.

Thank you for any idea about this.


texts: My content type has a string of words, how do I make them tags?

texts:
I am very new to drupal. I currently have a content type called 'Issue', which has a plain text field containing something like "money, houses, pigs". How can I look at that string and turn each word into a tag?

The reason I have this is because I read data in from an older database, and they had their tags saved as a string. I read it in using the feeds module.

Is there a way to read in the tags differently? Or is there a way to parse that string and add each word as a tag in my content type?

Note, I read in the database as a CSV file.

My end goal here is to be able to 'query' for all Issues tagged with the word 'house' for example and display those.

Thanks in advance.


texts: Disallow specific combination of checkbox selections in term reference field?

texts:
I have a term reference field in the format of checkboxes. However, I'd like to disallow certain combinations of checkboxes. The options are:

[]None
[]Food
[]Drinks

The "None" option is not the default none, but a taxonomy term that is actually stored in the database. I'm wondering how to allow two selections, but to disallow the selection of both "Food" and "None", or "Drinks" and "None", since in practice that really doesn't make any sense. Any suggestions?


texts: ubercart 2 with smtp - sending unformatted emails

texts:
Recently I had to switch sending emails to be sent using smtp. https://www.drupal.org/project/smtp
The problem is that all system emails are sent ok regarding formatting. All emails sent by ubercart are unforatted and basically unreadable.
Any idea how is it possible to fix that? Thank you


texts: node-NAME.tpl.php doesn't override the node template. I've cleared theme registry

texts:
I'm using Drupal 7.8, and I've tried the same thing I did with Drupal 6, making a custom layout for a node type.

I've copied node.tpl.php, and renamed it node-NAMEOFTHENODETYPE.tpl.php, altered the template, uploaded it to the theme folder.
Surprisingly, Drupal 7 doesn't take it: It shows the default node layout.

Can anyone tell me what I am doing wrong?


texts: How to change layout of node add/edit form with Display Suite?

texts:
Is there a way to use Display Suites to change a Layout for a Node Edit/Add form?
i.e. form at: .../node/add/


texts: Limit amount of emails sent per time frame?

texts:
Is there a module which allows for the limiting of emails sent per hour using drupal mail system?
My server has a limit of how many emails can be sent per hour. Most of my users are online at the same time of the day, so it makes sense to spread the emails out over the day rather than sending all at once.
But the only mail modules I've found so far send all emails in one go rather than being able to limit the amount per hour.
How can I set Drupal to limit the amount of emails it sends per hour and all unsent emails are queued for the next hour?
Thanks


texts: node--content-type.tpl.php did not override

texts:
and now i stuck in using node override with content type.
I followed these step.

Create new content type name post (machine name: post)
Copy node.tpl.php from module to
my_theme/templates/node/node--post.tpl.php
Go to admin-configuration-performance and click "Clear all caches"

Well, it did not work.

Sorry for create duplicated article, but when i followed from answer, it did not work too.


texts: Is there any way to check user activation link has been sent

texts:
I have created user by profile-2 module with some certain roles,Initially user is in block state,there is one user manager that approved this user and send activation link by email.so how to check activation link already sent or not. if link already sent then need not send again.
For this Is there any module or custom code.
Please help me if anybody knows this.


texts: 'Notify user of new account' checkbox to be selected as default

texts:
What I am trying to do is have the 'Notify user of new account' checkbox selected as default when creating a new account.

I have been trying similar steps as to http://drupal.org/node/1059168 but the solution posted in the comments is for D7, I need it for D6.

Any ideas, on how I could change this code for D7

<?php

/* Hook form alter
 * Sets "notify user of new account" chosen by default
 */
 function YOURMODULE_form_alter(&$form, $form_state, $form_id){
  if ($form_id == 'user_register_form') {
     $form['account']['notify']['#default_value'] = TRUE;
  }
}
?>

to have it work with D6?

Or any helpful links I mat have missed would be greatly appreciated.


texts:
I have an problem to get my jQuery code working with D7. In HTML it works fine but with D7 it doesn't work at all...

the code:

(function ($) {

Drupal.behaviors.exampleModule = {
attach: function(context, settings) {

    var thumbstart = $("ul li img");

    for (var i = 0, ii = thumbstart.length; i < ii; i++){
        if (thumbstart[i].title && thumbstart[i].title.length > 0)
        {
            var imgtitle = thumbstart[i].title;
            $(thumbstart[i]).wrap('
').
            after('
' + imgtitle + '
').
            removeAttr('title');

        }
    };
// At here the code works fine...
$('.wrapper').find('img').css({opacity: ".8"});
$('.teaser').find('.caption').css({top:"107px"});
$('.test2').find('.caption').css({top:"165px"});

$('.teaser').hover(
    function(){
        $(this).find('img').animate({opacity: "1.0"}, 300);
        $(this).find('.caption').animate({top:"160px"}, 300);
    },
    function(){
        $(this).find('img').animate({opacity: ".8"}, 300);
        $(this).find('.caption').animate({top:"107px"}, 300);
    }
    );

}
};

})(jQuery);

the problem is that the top of part is not working (begins at: var thumbstart...) is there anything that I can do? Does D7 need extra library/modules?


texts: Different way for users to add content on pages

texts:
On my website each user can only edit the existing main content via the 'edit' button on the page.

I don't want each user to see what was added previously on the page like it happens on my website:

Is there a way the user can add their own new content and be displayed on the page in ascending order (new content on top of the previous one) WITHOUT modifying/ viewing the previous post? E.g. like on this example I found online:


texts:
I have added a vocabulary as Sites with machine name as sites. I have added two custom fields in this vocabulary as :

1) URL
2) Status 0 or 1

I need to make a dropdown of all terms with status 1 something like.

  get term.name from term join vocabulary on vid where vocabulary.machine_name = sites and term.status = 1

$v =  taxonomy_vocabulary_machine_name_load('sites');

$t = taxonomy_get_tree($v->vid);

How do I get an array of enabled terms in the 'sites' vocabulary?


texts: How to override comment render function?

texts:
I am new to Drupal, I just want to change "SELECT" query of comment table without changing any core file functionality

I am doing this in my template.php.

$variables['commentsResult'] = db_query("SELECT c.*,fm.* FROM comment
as c LEFT JOIN file_managed fm ON c.fid = fm.fid WHERE c.nid   ='".$node_id."'");

Now I want "comments Result" variable on comment-wrapper--node-forum.tpl.php in theme


texts: Drupal site makes apache goes to 100% CPU usage often

texts:
My new drupal site crashes very often because the apache server goes up to 100% cpu usage. I have to ask our hardware guy to restart it once everyday.

Also, He asked me if I am sure that the site does not have memory leak. As the logs are stating that PHP can't get any more memory. What might actually happened and how can I debug/detect the memory leak bugs?


texts: One-click Download files from webform submission

texts:
I have content editors who need a 'one click' download solution for all the files uploaded with a given webform submission. FTP is not an option.

Does anyone know of any solution for this?


texts:
I have a view with Data Export, where it creates a button to download the view's content, depending on a filter supplied by URL query parameters. I'm able to edit the the button using THEME_views_data_export_feed_icon in my theme's template.php. That's all good and works as intended.

How can I create a Drupal 7 Block that behaves just as that export button? Is it best to manually create a php block picks up the page URL/query to set as the export block link, or is there an easier way?


texts: Why is 'Confirm Order' pane being skipped?

texts:
I’m trying to determine why the ‘Confirm Order’ pane is being skipped in my Drupal Commerce Kickstart website.

Configuring the checkout process is here.

admin/commerce/config/checkout

In the configuration settings i’ve set

‘Display this pane in a non-collapsible fieldset.’

i’ve also checked boxes of info to be displayed in the pane, such as Shipping service.

Anyone know why it is being skipped? and how to fix? this seems like a bug


texts: How can I add classes to the rendered "body" field on a content type?

texts:
Preface: I don't often work with Drupal, so I may not be using the correct terminology or fully understand the stack. Please bear with me, I'll do my best to be as clear as possible.

I want to filter the rendered output of the primary "Body" field on a "Basic Page" (or "Article," any content type really) to add some classes to various elements. This would be the field labeled "Body" at /node/add/page. I'd like to achieve this using DOMDocument in my .theme file, but I'm having trouble figuring out what the correct "hook" is to tie in to.

So ultimately the goal would be a function something like the following (which is partially psuedo code):

function my_theme_body_alter(&$content) {
    $DOM = new DOMDocument();

    $DOM->loadHTML(mb_convert_encoding($content, "HTML-ENTITIES", "UTF-8"), LIBXML_HTML_NODEFDTD);

    $anchors = $DOM->getElementsByTagName("a");

    foreach ($anchors as $anchor) {
        $existing_classes = $anchor->getAttribute("class") ? $anchor->getAttribute("class") : "";

        $anchor->setAttribute("class", "button {$existing_classes}");
    }

    $content = $DOM->saveHTML($content);

    return $content;
}

To be absolutely clear, I want to modify the output (on the front end) of this field:

What is the name of the hook I'm looking for, or how can I locate it myself?


texts: Is it possible to run a module written for drupal 7 in drupal 6?

texts:
In another question I was searching for a module that provides a simple shopping cart and checkout process (Is there a simple shopping cart and checkout process module?).

I have found this simple module called Basic Card.

I am running Drupal 6.x while this module is written only for Drupal 7.x.

Is it possible to run a Drupal 7.x module on a Drupal 6.x installation?


texts: Is there a table listing contributed modules that have been ported to Drupal 7?

texts:
To date I have found no quick way to determine which Drupal 6 contributed modules have been ported to Drupal 7.

Do you know of one, such as an automatically updated table that provides this critical site-building and version-selection information?


texts: How do I get Drupal to recognize my 404 page override?

texts:
I am using a custom 404 page. I also have a theme installed.

This is what I did:

I created a node 95761 which contains my 404 error page.
I set node/95761 to be my 404 error page I've created a template in my theme node--error.tpl.php
I cleared my cache after uploading node--error.tpl.php to the server.
I've verified that node--error.tpl.php exists on the server and has my custom code in my theme's templates folder.
I go to [mydomain]/pathThatDoesNotExist

Actual result: The contents of node/95761

Expected result: The modified version that is contained in node--error.tpl.php

I also tried node--95761.tpl.php and that doesn't override node/95761 either.

Any ideas why Drupal 7 is not picking up the override and how to fix it?

While we're at it, should the name of the template actually be node--error-404.tpl.php so that it doesn't override 403 or other non-404 errors?


texts: Same website but different logo for large screen and small device?

texts:
I would like to have two different logos on the same website. One for large screen and one for small screen ( mobile devices )

I am using D8

Thank You


texts: How to override ID's in Drupal and comply to CSS Lint|?

texts: How to override ID's ( or not use ID'S) in Drupal and use Classes only to comply to CSS LINT ( consider that I must use a subtheme and not always can write the HTML. I will have to work with what Drupal gives me). Can anyone advise me about best practices?


texts: How to debug weird "page not found" after creating a view?

texts:
I'm having a really weird problem with my site on my localhost. It might be similar to this issue.

I had setup the site just a few weeks ago had started to migrate user and node records using the migrate module. I created a view to show user records and pushed it to my development site (using Pantheon).

Today I tried to import a view from another site and after saving it it show "page not found). I tried to recreate the view manually with the same result. Even when I create the most basic view (top 10 nodes or top 10 users) I get a "page not found" error.
The view doesn't show up in the menu_router table.

The site was 7.10 or 7.11 when I created it and had upgraded to 7.12 using the Pantheon tool. I'm using the MAMP software for months now and haven't made any setup changes. They also did an update to bootstrap.inc but I don't know what they changed.

I don't have the issue on my dev site and my code base on local is the same. I went from views 7.x.3.1 back to 7.x.3-rc3 but that didn't fix it.

The one thing that looks strange to me is the path in the "page not found error message:

  The requested page "/mt/test6" could not be found.

The page is at http://localhost:8888/mt/test6

shouldn't the error just say "test6 could not be found?
I had played with the $base_url in settings.php a few days ago but had removed it again.

Any ideas what I could do to troubleshoot this?


texts: it is a Author Status Issue: let's to show either a user is online or offline. If a user is online then it will show >Online if offline then like this >OfflineSo how to show it?


texts:
Its possible to add a node using the code below, but how do i add multiple fields?

$node = new StdClass();//creating a bare node
$node->type = 'answer';//giving it type
$node->status = 1;//give it a published staus
$node->title = "Step up to the FLava";//gives title
$node->body = "Body Body body"; //gives body

node_save($node);

Singles custom field, we can use:

$node->field_my_custom_field['und'][0]['value'] = 'my value';

But what if I want to add multiple entries for one field?


texts: How to use default taxonomy with a mixture of terms and content?

texts:
My site has a structure like this, which seems a natural way to use taxonomy:

Food (term)
  - Fruit (term)
  -- Apple (content)
  -- Pear (content)
  - Bread (content)
  - Cheese (content)

The problem arose when I wanted an top-level overview page of Food. Logically (to me) that would mean showing Fruit, Bread and Cheese since these are the direct descendants of Food. But the default taxonomy term page for Food only shows Bread and Cheese, because it only shows content. It doesn't seem like you can show taxonomy terms in views, so overriding the view was not enough and I ended up doing some jiggery-pokery. As a fan of clean logical simple sites I would rather stick close to the defaults. What am I doing wrong?


texts: Update a field on a node after hitting save

texts:
I am working on a Drupal 7 custom module and would like to update a field on a node after hitting save.  Based on some post that I have seen this should be possible.

As it is now I have the $node object is a parameter to the node_submit hook after hitting save.

However, I am not able to update my field on this node object.  Any pointers or examples of how to do this would be greatly appreciated.

Thanks,
Derek


texts: How do I install core on Windows 10 with Nginx server?

texts:
I Want to install Drupal 8 on Windows 10 with nginx server.
I do know how to install with Apache using XAMPP.
I use PHP 7.2, Microsoft SQL as the db.
I installed nginx 1.18.0 and PHP in C:/
I connected them with php-cgi -b 127.0.0.1:9000
my root file for the server is  C:/nginx/html.
I copied the extracted drupal file to the C:/nginx/html/ folder.
In the internet explorer i try to run the installation of drupal, 403 forbiden appear.
So how do I install Drupal 8 on Windows 10 with nginx server.??
my nginx configuration is:
#user  nobody;
worker_processes  1;
#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
#pid        logs/nginx.pid;
events {
worker_connections  1024;
}
http {
include       mime.types;
default_type  application/octet-stream;
#log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
#                  '$status $body_bytes_sent "$http_referer" '
#                  '"$http_user_agent" "$http_x_forwarded_for"';

#access_log  logs/access.log  main;

sendfile        on;
#tcp_nopush     on;

#keepalive_timeout  0;
keepalive_timeout  65;

#gzip  on;

server {
    listen       80;
    server_name  localhost;

    #charset koi8-r;

    #access_log  logs/host.access.log  main;

    location / {
        root   html;
        index  index.html index.htm;
    }

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    location ~ \.php$ {
        root           html;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
}

# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
#    listen       8000;
#    listen       somename:8080;
#    server_name  somename  alias  another.alias;

#    location / {
#        root   html/ltts;
#        index  index.html index.htm;
#    }
#}

# HTTPS server
#
#server {
#    listen       443 ssl;
#    server_name  localhost;

#    ssl_certificate      cert.pem;
#    ssl_certificate_key  cert.key;

#    ssl_session_cache    shared:SSL:1m;
#    ssl_session_timeout  5m;

#    ssl_ciphers  HIGH:!aNULL:!MD5;
#    ssl_prefer_server_ciphers  on;

#    location / {
#        root   html/ltts;
#        index  index.html index.htm;
#    }
#}

}


texts: Will I be able to run my site on PHP 7.0?

texts:
I've started reading about some performance benchmarks with PHP 7.0 which suggest that it is spectacularly much faster. I've searched all over for information on Drupal support for PHP 7.0, but all that I can find concerns Drupal 8 whereas I am still working for the moment on Drupal 7.

I have found this article that concerns Drupal on Windows, which suggests that D7 on PHP7 works, however since I am running on Centos or Ubuntu I would welcome any information anyone might have on this.

My concern is particularly strong because I am just getting started on a project with massive data inputs, which will thus be very performance sensitive.


texts: Drupal 6 clean urls without domain name (accessing via IP Address)

texts: Is there a way to do clean urls without a domain name; just using an IP Address. The option is disabled when using ip address.


texts: Sanitizing strings before adding as taxonomy term

texts:
I am programatically creating taxonomy terms from a JSON object. I have a simple script that iterates over the converted JSON, and creates a taxonomy hierarchy. Since these terms come from a client-generated CSV they have random spaces and characters in them I want to sanitize/normalize them before I add them using taxonomy_vocabulary_save()

I've looked at the list of drupal Sanitization Functions, but those all seem to deal with HTML/JS strings. Is there a drupal way for me to format these strings, or should I just use a PHP regex to do it?


texts: HTML-Email Builder using available content

texts:
I'm building a content marketing system in drupal 8 and I'm looking for a way to let editors put Media and Blocks in some kind of template which is then exported as an html email.

Right now I am using Display Suite and Entity References to let editors build landing pages. On a landing page, one, two or three column blocks can be referenced. In theses rows editors can reference media entities (texts, images, videos).

What I would do is do the same in a content type called html-email. For this content type I would try to get rid of all the twig markup and insert my html email markup. I would then let the editor copy the section with the email markup from the source code of each page so they can copy it in whatever email tool they are using. The necessary css files would be added there, the inline css and all the nasty html markup would go in the twig templates.

Is this goint to work? Do you have other (simpler) suggestions? The important thing is, that users can use the content, which is already in the system and add one, two or three column layouts as rows to their liking.

Thanks!


texts: How can I see my drupal site as a anonymous user while logged in as admin?

texts:
I want to use Devel Themer to look at the "homepage" comment field, but it only shows up for anonymous users.

Is there anyway to see a page as a anonymous user would, and at the same time be logged in as an admin so that I can use the Devel Themer module?


texts: I'm using Drupal 7 date field. Using views, when the date has expired, the page goes to a section labeled 'past events.' In the template page, the date and time are both separated for instance. $date_output and $time_output. I need to hide the time field after the date has expired. any ideas?


texts: How do I display Taxonomy image on Taxonomy page and child page

texts:
Drupal 7 | Views 3

I have a parent Taxonomy term that has a Taxonomy image.  I have nodes belonging to the taxonomy term.  My goal is simple, but apparently hard to achieve.

I want to be able to display the taxanomy term page with the taxaomny term image as the header image of that page.
I then want to display that same taxanomy image on the child pages.  (I guess another way to say it, I want to display the parent term image on the child pages as a header image.)

I have been playing around with multiple setting on the taxomny page view.  And I can't seem to achieve it!

I have worked about 5 hours trying to achieve this and the site is due Thursday.  Somebody please help me out here.  I am about to go crazy!!!!


texts:
I'm using Drupal 7 - is there any way to view and output the users who've registered with site in a similar way to how Webforms displays submissions and allows you to download and import into Excel?

I can export the users table from the database as a CSV file but I was hoping to find something that would be integrated into the Drupal admin ui (similar to the way Webforms is).

Thank you for any guidance you can provide.


texts: show specific number of posts on front page for mobile d7

texts:
I would like to show only a few posts for mobile I have mobile_detect as well as mobile_detect_ctools mobile_detect_variables, installed and working.

I am using an adaptive theme, $is_mobile successfully in theme/page.tpl but I am unable to use it in settings.php where I believe I need to set.

$conf['default_nodes_main'] = $mobile-frontpage-post-number //(much lower than desktop);

How can I put global $conf vars in page.tpl or get $is_mobile from mobile_detect_variables working in settings.php.

tyvm.


texts:
Is there a hook available to modify / alter the title of content in this list ? It's a autocomplete widget.
I just want to add the content type.


texts: Limit the number of registrations by field

texts:
I am using Entityforms to take registrations for events. There is limited space and the form allows users to select which event they would prefer to attend.

Is there any way (rule, etc.) to disable or remove certain dates once the limit has been reached?


texts:
I would like to make a webscraper that updates the results of a volleybal team and puts the most recent score in a block on the frontpage.

Got the scrapper working with kimono.

But this imports all the data.
The data that should be imported is here

How can i just import the last score and put that in a block?
Thanks


texts:
Is there a contrib module that can define access control based on the url path of content? So if an anonymous user goes to www.mysite.com/pages/test they can reach it, but if they go to www.mysite.com/hidden/stuff they can't get to it since it is in the /hidden/ path and they don't have an authenticated role.

I've already looked into controlling it based on content types, workbench groups, etc. Don't want to go with Workspaces since it is experimental and requires a whole other suite of modules to function.

Ideally, I'd like to be able to allow and block users with certain roles access to content that follows a specific path. Hoping there's something that already exists to handle this.


texts:
So i created a content type that has a paragraph with a formatted long field in it. The content type itself also has a formatted long field.

These two fields should be ckeditor Full html. But when creating a page i only get a text area and no buttons or anything extra like the select for full html or basic html.

This is as a normal editor who has all right on that content type and paragraph.
But when i create the same content type as an administrator the Ckeditor does show up.

This makes me think that it has something to do with the custom theme we are using. But i've turned of all the css rules applying to forms and it still doesnt show up.

Does anyone know if this is a problem with my permissions or my theme? Or can it have something to with custom php code in the backend? We are using  some custom written blocks and custom fields.


texts: Search facet user entered date field display

texts:
I've recently started working on an existing Drupal site that uses Apache Solr search & have come across a problem when configuring facets.

The search index just indexes one type of content & one of the facets it displays from this is a year field, this is set as a date select field where the user can select a month & year. If I set this to only allow one entry it works fine and the facet links have the years that are available with the number of results it'll return in brackets.

When I set the field to allow an unlimited number of values instead of getting a list of years as links I get what seems to be a random number "1414800000 (1)," timestamp maybe? It also seems to group them by the month & year entered rather than just the year as it did when only one field entry was allowed.


texts: Migrations dependencies: run one by one?

texts:
I have a few migrations in the same group for singe multi-language entity type set up. One migration handles one language. I need to make sure that default English language migration runs first and then it triggers all the others when I execute migration for the English language via admin UI of migrate tools module.

Can not find how make it through dependencies in yml for the default language, because dependencies list gets processed first. Is there proper way to do it?


texts: I've set $settings['cache']['bins']['render'] = 'cache.backend.null; and $settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.null; in local.settings.php, but I’m having a hard time dumping variables out to a page from a hook that runs once early on (hook_entity_bundle_field_info_alter()). If I do a simple var_dump (or dpm, etc.)  from here, variables will show up when running drush cr in the console, but not when hitting a new page in the browser afterwards. Does anyone know how I can set up debugging so I'm able to look at these variables in the browser?


texts: Drupal File upload only allowing one upload at a time

texts:
I'm having a problem with the File widget. I have created a content type with a file field that allows unlimited values. When I upload a file I am expecting to be able to immediately upload another file.

but what actually happens is the upload box disappears, meaning I have to save the node and re-edit it in order to upload another file

both these example have exactly the same content type settings, both running the same version of Drupal. I'm not getting any JS errors or anything. Any ideas on why this is happening? I've even updated all my modules and drupal core and tried disabled all my theme's JS files, still have this issue.


texts: How do I find a Form_ID for hook_form_FORM_ID_alter?

texts: I want to alter the form for a content type I created for videos.  The type is called Videos.  How would I use hook_form_alter to alter the form to create the content?


texts: I have made taxonomy categories for products, and block where is category link list, but how I can make target url for these categories and when user go to category link there is page and all products in that category is listed?


texts: Why can I not add new content after updating some module?

texts:
After module update, I don't remember which one, I can't add a new content.

Lately it keeps displaying this error:

  Fatal error: Allowed memory size of 268435456 bytes exhausted (tried
  to allocate 15506721 bytes) in
  /var/www/vhosts/liceoguaccibn.it/httpdocs/includes/cache.inc on line
  454

I've modified the file .htacces settings.php, increasing the value of memory_limit from ini_set('memory_limit', '256M'); to ini_set('memory_limit', '64M');

But this other error returns:

  Fatal error: Uncaught exception 'PDOException' with message
  'SQLSTATE[HY000]: General error: 2006 MySQL server has gone away' in
  /var/www/vhosts/liceoguaccibn.it/httpdocs/includes/database/database.inc:2171
  Stack trace: #0
  /var/www/vhosts/liceoguaccibn.it/httpdocs/includes/database/database.inc(2171):
  PDOStatement->execute(Array) #1
  /var/www/vhosts/liceoguaccibn.it/httpdocs/includes/database/database.inc(683):
  DatabaseStatementBase->execute(Array, Array) #2
  /var/www/vhosts/liceoguaccibn.it/httpdocs/includes/database/database.inc(2350):
  DatabaseConnection->query('SELECT expire, ...', Array, Array) #3
  /var/www/vhosts/liceoguaccibn.it/httpdocs/includes/lock.inc(167):
  db_query('SELECT expire, ...', Array) #4
  /var/www/vhosts/liceoguaccibn.it/httpdocs/includes/lock.inc(146):
  lock_may_be_available('theme_registry:...') #5
  /var/www/vhosts/liceoguaccibn.it/httpdocs/includes/theme.inc(449):
  lock_acquire('theme_registry:...') #6
  /var/www/vhosts/liceoguaccibn.it/httpdocs/includes/bootstrap.inc(455):
  ThemeRegistry->set(Array) #7 [inte in
  /var/www/vhosts/liceoguaccibn.it/httpdocs/includes/database/database.inc
  on line 2171

And then this other one:

  /var/www/vhosts/liceoguaccibn.it/httpdocs/sites/all/modules/views/handlers/views_handler_filter_boolean_operator.inc
  on line 90

Any suggestion?

Note: It 's true I decreased memory, but then I reported to 256M and beyond that I have cleared the cache, but without success.
Surely it is in some forms, but how do I find them?


texts: How to uncheck a checkbox programmatically?

texts:
How can I uncheck a checkbox programmatically in Drupal 8.
I need this in an ajax call, when an option is selected, a checkbox must be unchecked


texts:
I've got a drupal front_page that reditects all anonymous users from blogs to front page. But I want to facebook clawler see my og: data, to post comments with current title. Facebook crawler got 302 on front and takes title from front page.

How can I do a (maybe) whitelist to facebook crawler to take og: data from restricted area?


texts:
I notice most (if not all) templates are written in HTML with PHP snippets where required.

I've been writing a few PHP heavy templates, and instead of writing HTML and encasing almost every line in  tags, I have opted for writing PHP, using the print function to render HTML.

Is there any reason I should be writing in mostly HTML instead?

I imagine there's more overhead using PHP to render the HTML, but is there enough to worry about?

Second to that, is there any reason templates encase every line in  tags instead of just the opening and closing tags are required?

e.g.

<?php if($a == $b) {?>
   <?php print 'a equals b';?>
<?php } else {?>
   <?php print 'a does not equal b';?>
<?php } endif;?>

vs

<?php if($a == $b) {
   print 'a equals b';
 } else {
   print 'a does not equal b';
 } endif;?>


texts: How can this buying logic be achieved using drupal commerce and/or ubercart?

texts:
I think the following scheme describes best what I am trying to achieve:

I am trying to make a ticket booking "shop" if you will.

There are different events
For each event you can buy tickets, like the graphic above shows
There are different ticket types, like normal, vip and special vip (for instance)
Each ticket type can vary in its price depending on the date
The visitor should be able book several tickets for that event at once
Optional: beneath the table is a summary of the selected tickets/ total price
The visitor can checkout and pay, gets a summary (different story)

My attempts so far

On an existing drupal project I installed the commerce module.

I installed commerce booking since it pretty much claims to do what I am looking for. Unfortunately there has been a bug in this module for several months making it unusable, there is no fix there yet (https://www.drupal.org/node/2134449 for instance). What a bummer.

So I installed drupal commerce kickstarter and tried around a little bit in here.

I came up with a product type/ variation "Event", two taxonomy vocabs "Ticket Type" and "Date" and added taxonomy reference fields to the event/ product type.
The cool thing is I can now add a new event "Jam session at Alex's" and add many product variations in it.
For instance I can add a variation which's price is 1 €, pick a term for a date like "Date 01" and pick a term for the type of ticket like "Ticket Normal". With these fields I can add x numbers of product variations to actually depict the variety of tickets as shown in the graphic. So far so good.

However, I cant manage to create an output like shown in the graphic, how would you do that with views? How could you implement an ajax quantity indicator (it actually should work like the add to cart form, but with AJAX) and adding a payment process right after? Help would be greatly appreciated.

I havent tried to use ubercart yet, would it be far more easy to do it with uc, maybe?


texts: Set default value of field in a field group

texts:
I have had no luck trying to set the value of a field in a field group. I can see in the array that the default value has changed but the change does not show up in the viewed form. This is the same whether I place the code in form_alter or after_build.

If the field is not in the field group, the changed value is visible in the viewed form.

This is the code I'm testing:

<?php

/**
* Modify CCK form elements on the example node form.
*/
function test_after_build($form, &$form_state) {

// $form['field_collection']['und'][0]['value']['#default_value'] = t('Smithfield');

 dsm($form);  // pretty print array using Krumo to messages

  return $form;
}

/**
 * Implementation of hook_form_alter().
 */
function test_form_alter(&$form, &$form_state, $form_id) {

  if ($form_id == 'test_record_node_form')  {

 // target a specific form
  drupal_set_message("Form ID is : " . $form_id);

  $form['field_collection']['und'][0]['value']['#default_value'] = t('Smithfield');

    // Add an after_build function to process when everything's complete.
    $form['#after_build'][] = 'test_after_build';

   dsm($form);  // pretty print array using Krumo to messages

  }

}
?>

I don't know what I need to add to this to make it work. Help appreciated.


texts: User specific permission to add links to a menu

texts:
When I create a content type, e.g. 'Basic Page' and I want to add a link to a menu I do usually the following:
Menu settings -> Provide a menu link -> choose a menu and its position of the link there

I know, that I can define, which menus are appearing here, in the menu settings section of a content type.

I have several menus, for specific users. For now, if they create a new 'Basic Page' they see all the menus, which are set for this content type. So as well, menus from other users. Is it possible to show just their own menu, so they do not have access to the other menus?

For now I solve this problem by assigning roles for each individual user, and granting permissions for this 'user role' per 'user menu', by using the Menu Admin per Menu module for D7. It would be much more convenient, to use user specific permissions here.

Is there any way, of doing that?

Thank you in advance!


texts: How can I allow all users to access only a certain type of entityform?

texts:
I need that all users (anonymous users too) have access to the submissions of a certain type of entityform.

I can set the permission View any entityform submission and it works but for all types of entityform. I also try with hook_access

How can I allow all users to access only a certain type of entityform but not for all types of entityform?


texts:
I am new to Drupal.

I have created a rule on specific event, and changing the value of node:field-seat-limit

Event

After updating an existing order product

Conditions

Content is of type event
uc-order-product:node:field-seat-limit (negate)

Action

Decrement uc-order-product:node:field-seat-limit by using $value= $value-1;

Result: I am displaying field-seat-limit in a view, where it is showing the decremented count but when I go to the node, it shows the count that I entered first time.

What is causing the node to fail to reflect the updated value?


texts:
I'm searching for a module that can expand the number of visible fields in a particular view result with a mouse click. I'm probably not searching with the good words because I only thing I found is thing like "infinite scroll" or "view load more" module and that's not what I nead.

Example of what I nead : You have 10 view nodes showing the title and the image of a content type. And when the user pays "Read more..." the node is reloaded with Ajax adding the description to the result of this result.

Did somebody know a module that can do a thing like this?

Thanks a lot and sorry for my bad English, English isn't my first language.


texts: Views Grouping by Taxonomy Parent of a Parent

texts:
I'm working with Views to build a display that groups by "Categories" - see the example- in a vocabulary. I had that working just fine when the vocabulary only went one level deep.

Now what I need to do is add another level into the Vocabulary. The problem is that when I do that, it's grouping things I don't want grouped.

The Example:

Models
- Category 1
    - Model Alpha
        - Build 1
        - Build 2
        - Build 3
    - Model Beta
- Category 2
    - Model Charlie
        - Build 1
        - Build 2
    - Model Delta
        - Build 1
        - Build 2
- Category 3
    - Model Echo
    - Model Foxtrot

The trouble is when I group by fields and select "(Parent) Taxonomy Term Description" it's grouping by my "Category" description and my "Model" description. I only want them grouped by "Category".

I was hoping there was an option for a depth selection and maybe that would help, but I can't get views to show any term with a depth selection outside of the contextual filters section.

Any ideas or for things like this are we really just stuck with a two level taxonomy?


texts: 7 - HTTP error 400 when calling system_retrieve_file()?

texts:
I'm using hook_feeds_after_save and the simpleHTMLdom library to migrate inline images for a feed import. After I detect that an image tag exists and the url is qualified/valid I build a stream wrapper for the image file and call system_retrieve_file.

  $dirPrefix = 'archive';
  $uri = file_build_uri($dirPrefix . '/' . $filepath);

  if (file_prepare_directory($uri, FILE_CREATE_DIRECTORY)) {
    $destination = $uri . '/' . $filename;
    system_retrieve_file($img_url, $destination, TRUE, FILE_EXISTS_REPLACE);
  }

However, I receive 400 errors on each image;
HTTP error 400 occurred when trying to fetch http://DOMAIN.COM/C8B195/assets/images/01 Grapes 3.jpg.

If I just plop this url into a browser I get a 200 and the image is displayed. Same when I test this in something like the Advanced Rest Client application.

Also, I'm developing this site in a local environment.

Anyone have any clue how to debug this or why I may be receiving a 400 response?


texts: How to add a button to report (flag) some content item to an administrator for that content?

texts:
I would like to print near a given type of content a button "report" that, when pressed, send a notification to the admin related to that content.

In this specific case, I have a textual field with a link and I would like to allow users to be able to report (signal) some content item to the administrator if some link is not working anymore. So that the administrator can fix it.


texts:
I have a CCK form. When users submit the form, and add new content, I would like the form to be viewed in an overlay that allows the form to use all of the browser window's area in a similar manner as colorbox or lightbox.

The reason for this is to provide more screen space for the large form. I have most blocks hidden for this content type, but there is still other page elements and menus ect taking up room.

Also, I am using the multistep module. This means the content is created before submitted. After the first step, the path is no longer /add/[…]. Multistep also provides a block for the form index and progress bar. If I only display the node in colorbox (which is installed and used for other features) then I miss out on the multistep block.


texts:
I have a full-HTML block and I want to put a link to a file into it that varies with the sitepath. I saw somewhere something about putting public:// instead of http:// to route to sites/default/files, but it doesn't seem to work from block content at least (is that only in php?)

So I have a block with <img src="public://img/screenshot.png"/> in the content and nothing is happening. Any ideas how to make this work? I don't to use image module or anything like that yet.. just a link to a file.


texts:
I am currently working on WordPress content migration (all posts) to Drupal 7. I have downloaded the WordPress WXR file and checked with xmllint for validation. The file is valid and no issues found.

I have installed all required modules in Drupal (Migrate,
Wordpress Migrate, Migrate Extras, Pathauto) and started importing the XML file. After importing few fields of data, Drupal gives me an AJAX error.

  An error occurred. Some or all of the import processing has failed.
  Please continue to the error page
  An AJAX HTTP request terminated abnormally. Debugging information follows. Path: /newblog/batch?render=overlay&id=28&op=do StatusText: ResponseText: ReadyState: 4

Do you have any suggestion?


texts: Rabbit Hole redirects not working for admin

texts:
I have a problem with Rabbit Hole redirects. I've set rabbit hole redirect for a content type, saved it, cleared cache. The problem is that the redirects work only for anonymous users. When I am logged as user with admin permissions, rabbit hole redirects not work.
I was searching in the Internet, in admin panel (permissions), etc, but with no results.
I also tried to set "Access denied", "Page not found" for that content type - but it's still the same. Works for anonymous users, not for admin.
Thanks in advance.


texts: Two different relationships and one view

texts:
I would need to combine two content types into one view. Well this is easy but where it gets more tricky is that other content type would need to user relationship that connects to another (third) content type. So how can I have view that gets content from two content types and another content type requires relationship (another one doesn't)? All suggestions are welcome!

I'm using Drupal 6, panels and views.

EDIT:

So two content types, another is feed_item content type (using Feeds import module), another is called blog_post content type.

Third is blog_info content where is info about blogger and the blog. From this content type I would need to get info. So blog_post content type is related to blog_info and from there I need to get field blog_age.

Common fields I show in view are body and title from blog_post & feed_item. So additional field field that I want to show is the blog_age field. This field is in blog_info content type and is only related to blog_post.


texts: Taxnomy term name not searched in exposed filter in view!

texts:
when i searched title that result showing fine but i searched taxonomy term like movies,result not showing even i searched body content result showing fine.
add filter-> Global combined filter and then tick to exposed, and select single filter then operator to be contains and select content:title,content:category, content:body.


texts: How do I change date format in the submitted line using only template.php without node.tpl.php?

texts:
Using Drupal 8, I can change the date format, and adapt it to the country.

How can I do the same in a Drupal 7 site, where I do not want to create a node.tpl.php file in my theme since I need fast work?


texts: How to check with Rules if a new element has been added to a list in a node?

texts:
I'm using the Rules module and I would like to make a rule to check wheter a new element has been added to a list in a node.

First I have tried "List Count comparison" but it can only compare a list to an integer, then I have tried with a custom php code condition but I have troubles with getting the right data. i don't understand if i'm missing something and there is a simple way or it can be done only with custom php code (in which case i'd like to know how to correctly do it, it's worth telling that the list is an entity reference)

This is the PHP code i have tried. The event is "After the update of an existing content of type Q&A", so I have $node and $node_unchanged available. The field is called field_lista_gestori and contains a list of users.

$gestoriCount=count($node->field_lista_gestori)>count($node_unchanged->field_lista_gestori);
return $gestoriCount;

But then I have discovered that field_lista_gestori just contains a number (which I think is the reference ID) and I haven't made any other attempts after this.


texts: How to show a block only on the nodes which the user created

texts:
I have a block that I only want to display in nodes that the current user created. What's the best way of going about this?

Thoughts so far

I can access $user (and therefore the UID) anywhere, so I need to compare this to the node author UID. The only problem is finding a place where I can also pull in the current node information to find out it's author.

I really don't want to put php in a block (bad practice and all) and I couldn't see where I'd do this in context.

If I can't find a better way then the backup plan is to create an automatic field on node creation which contains the authors UID, then use this in page.tpl.php to set a class which will apply display:node to the block whenever the author UID =! user UID.

EDIT: Solution

The block I was trying to effect was in a custom module, so I took Yuriy's code and put into the modules hook_block_view. The result was this:

function mymodulename_block_view($delta = '') {
  $block = array();
  switch($delta) {
    case 'mymodulename_form':
            if (preg_match('#node/([0-9]+)#', $_GET['q'], $matches)) {
              if ($node = node_load($matches[1])) {
                global $user;
                if ($user->uid !== $node->uid) {
                  $block['content'] = array();
                } else {
                  $block['content'] = drupal_get_form('mymodulename_form');
                }
              }
            }
    break;
  }
  return $block;
}

I think this is what's going on:

preg_match and $_GET are used to take the node path from the current page. This returns: "node/xx". This is then used to load the correct node which is then matched against the global UID. An if function then either empties the block content or fills it.


texts:
I'm using Drupal 7 and I wanted users to be able to contact me via email whilst I'm still working on the website. So my plan was to use 'create a contact form', as I don't want to expose my email address.

However whenever I try to add an input element in the maintenance mode message it is completely ignored in the output. I think that this is because the message uses the filtered HTML file as I do have other bits of HTML the message that are rendering just fine, but I can't see any option to change which filter is used.

Is there a way to change the filter to full HTML or is there a better a option?


texts: Search form block only appear for administrarors

texts: I have a site with three different languages on it. for a while we had a search bottom on the English site. I wanted to be on all three languages. after playing around with it, it now appears in all languages, but only for administrators. how can I make it appear for users as well?


texts: Having problem while using multi-block module with my custom module

texts:
I have created a custom module which add a block to list posts from a specific content type.There is a drop down in attached image named "Content types"

When I am trying to create multiple instance of this block using multi-block module.It takes last created instance value for content types field means value is same for every inatance .Is there any way to create different instance for different content type?

Should I provide the code which I have written?


texts: How do I programmatically render a form, other than the default form?

texts:
In a preprocess function we can use this code to render the default form.

$default_form = \Drupal::config('contact.settings')->get('default_form');
$entity = \Drupal::entityManager()->getStorage('contact_form')->load($default_form);

$message = \Drupal::entityManager()
   ->getStorage('contact_message')
   ->create(array('contact_form' => $entity->id(),
));

$form = \Drupal::service('entity.form_builder')->getForm($message);

How do we render another form? I have tried $my_form = \Drupal::config('contact.settings')->get('my_form_id'); without success.


texts: How to get contents of multilingual translated taxonomy terms in Views?

texts:
My website is multilingual. There are about 40 taxonomy terms and each one is translated in to 3 languages. as an example:

term1_en, term1_fr,term1_it

I need to create a page to display contents that have a term which the taxonomy term ID (tid) is the Views contextual filter, but with the condition to return contents that have the same terms (synonym) in other languages.
I mean if node1 has term1_en and node2 has term_fr, then if term1_en is passed as contextual filter both node1 and node2 must be returned because node2 has its synonym in french.

how can I do that?

I can do this programmatically, by allowing multiple values be passed to contextual filter :

Then get the tid, load its synonyms in other languages and pass these terms to the Views contextual filter as an array, it is something like this (the basic idea)

$tid = %taxonomy:tid;
$term = taxonomy_term_load($tid);
$translated_term = i18n_taxonomy_term_get_translation($term, "en").'+';
$translated_term. = i18n_taxonomy_term_get_translation($term, "fr").'+';
$translated_term. = i18n_taxonomy_term_get_translation($term, "it");
$array = array($translated_term);
$view = views_get_view('myview');
$view->set_display("myblock");
$view->set_arguments($array);
$view->pre_execute();
$view->execute();
$content = $view->render();

but I prefer not to use PHP and trying to do this via Views UI.


texts: How should I define a function in the core of drupal 7 that I can use the function in the blocks, pages and etc?


texts: Code for "All pages except those listed" in Show block on specific pages

texts:
While editing a block I want to use "Pages on which this PHP code returns TRUE (experts only)" at the same time support the URL's entered in "All pages except those listed" plus my own custom conditions.

Where can I get the standard code to match those URL using PHP code?

For example as in figure initially "All pages except those listed" is checked on but now I want to choose the Experts only(3rd one).

In this Experts only mode before adding my custom code I'd like to check for exclusion of those same URL's first then proceed.


texts: How to get one time URL when we are writing hook_mail_alter?

texts:
My Question is already present here but the previously given answer for my question can applied to Drupal 7 and I can not use the same solution in Drupal 8.

I hope it is okay not put the same question once again.


texts: Why does Drupal have both "sid" and "ssid" field in the session?

texts:
Learning more about Drupal core so I can be a better contributor, understand security better, etc.

I noticed that on creating a session Drupal uses both an "sid" and "ssid" field. The code seems to indicate they are both the same (the little code I've been able to decipher so far), 'sid' && 'ssid' = session_id(), and looking at the DB only the sid is set in my own session.

Why do both columns exist? Is it a security measure? If so what does it do? Is it a legacy field from an old system?

Looking at Drupal 7 code.


texts:
I watch Introduction Advanced Theming in Drupal 7 (drupalize.me), and I create custom theme frot that video tutorial. I can't use <strong> and <em> in CkEditor. I can use only <b> and <l>, but CkEditor create <strong> and <em>. That tags has no effect when I save my node.
Why? What is wrong? When I change the theme to Bartic, everything works OK, but in the custom theme from that video tutorial, those two tags are not rendered as I would expect.


texts: Adding extra button on node edit form with save functionality enabled

texts:
I want to add an extra button on the node/edit drupal 7 form.
That can be done by hooking into the form_alter:

$form['actions']['push'] = array(
 '#type' => 'submit',
 '#value' => t('Save && Push'),
 '#callback' => 'my_callback',
);

In my callback I want to run my custom Push function and save the node.

Any ideas how to achieve this?

function my_callback_action(&$form, &$form_state) {
  dpm('my_callback_action');
  return '';
}


texts: Default value for the same field, different depending on content type

texts:
I am building a website and have 3 content-types.

Type A
Type B
Type C

I built these content types one after another, and used existing field when creating the content-type field Field.

My question is, how do I set a default value for Field for each of my content-types ?
Right now when I set a default it is default for all my content-types.

I want to have

Type A -> Field = value 1
Type B -> Field = value 2
Type C -> Field = value 3


texts:
I have a title field and some date fields in my view in the following order

1.title

2.from_date

3.to_date

Since the title is long, I have trimmed and it is a known bug that the links don't work after trimming.

So how can I add a link to the title so that when I click on it, gets redirected? Please help somebody.


texts: How to show "custom field" a user profile in a Taxonomy view?

texts:
I have a view set to show the content where I show the taxonomy and fields of a Content Type. At this point I added a Phone field in the user profile in> "config/people/accounts/fields". How do I filter and display the user's Phone field in the table where the Taxonomy terms are displayed? The view is set to show the content and, of course, you don't allow me to choose the Phone field I added in the user profile. I need to show this field to view the phone numbers of specific users who created the node.

Any suggestion?

Best Regards


texts: want to load the multiple select box field data as per selected category using ajax form alter?

texts:
I have list of select box like Team and Player with category option on top of the form. if i select the cricket in that category it should load players and Teams node title based on the category selected using ajax, i have done the ajax code but its working for only one field, please can onyone help to solve this

here is my complete code

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

  switch ($form_id) {
   case "loadtest_node_form":  // If the current edited page is an article form
    /*
    * The wrapper location is the entity reference field that contains the node titles
    * because that's where nodes listed needs to be restricted based on selection
    */
    $form['field_loadtest_player']['#prefix']='
';
    $form['field_loadtest_player']['#suffix']='
';
  $form['field_loadtest_team']['#prefix']='
';
    $form['field_loadtest_team']['#suffix']='
';

 $form['field_loadtest_category'][LANGUAGE_NONE]['#ajax'] = array( // adding an ajax attribute
      'callback' => 'jicustom_test_entity_callback1',
      'wrapper' =>'jicustom_test_entity_wrapper1',
      'method' => 'replace',  // the data would replace the field
      'effect' => 'fade',
      'event' => 'change',  // On change of the selection this action would take place
    );
$form['field_loadtest_category'][LANGUAGE_NONE]['#ajax'] = array( // adding an ajax attribute
      'callback' => 'jicustom_test_entity_callback',
      'wrapper' =>'jicustom_test_entity_wrapper',
      'method' => 'replace',  // the data would replace the field
      'effect' => 'fade',
      'event' => 'change',  // On change of the selection this action would take place
    );

// dpm($form);
    // Only when values are set in field_article_test_entity_type, should the options change
    // Also works for nodes that already have entity type selected
    if(!empty($form_state['values']['field_loadtest_player'])){
      $content_type = $form_state['values']['field_loadtest_category']['und']['0']['tid'];
      $form['field_loadtest_player']['und']['#options'] = jicustom_get_nodes($content_type);
    }
    if(!empty($form_state['values']['field_loadtest_team'])){
      $content_type = $form_state['values']['field_loadtest_category']['und']['0']['tid'];
      $form['field_loadtest_team']['und']['#options'] = jicustom_get_team($content_type);
    }
    break;
  }
}

/*
* Get List of node titles based on the content type
*/
function jicustom_get_nodes($content_type){

$result = db_query("SELECT n.title, n.nid
FROM node n
INNER JOIN field_data_field_category  ft ON n.nid = ft.entity_id
WHERE ft.field_category_tid = $content_type AND n.type='player'
ORDER by n.title ASC");
  foreach ($result as $record) {
    $nodes[$record->nid]=$record->title;
  }
  return $nodes;
}
function jicustom_get_team($content_type){

$result = db_query("SELECT n.title, n.nid
FROM node n
INNER JOIN field_data_field_category  ft ON n.nid = ft.entity_id
WHERE ft.field_category_tid = $content_type AND n.type='team'
ORDER by n.title ASC");
  foreach ($result as $record) {
    $nodes[$record->nid]=$record->title;
  }
  return $nodes;
}
function  jicustom_test_entity_callback($form, $form_state){
  return $form['field_loadtest_player'];

}
function  jicustom_test_entity_callback1($form, $form_state){
 return $form['field_loadtest_team'];

}


texts:
When installing Drupal 7.31 in the first page, I can't install with the following error message.

  An  AJAX HTTP error occurred,HTTP Result code 2: debugging information
  follow,  Path:htp://localhost/install.php?
  profile_standard&locale-en&op_do statustext: Unknown ResponseText:

  error page show : Fatal error:call to  undefined function
  node_types_rebuild() in C:/APM_setup/htdoc/includes/common.inc  on
  line 7512

  line 7511---entity_info_cache_clear();
          7512---node_types_rebuild();
         7513---//node_menu()  defines menu items based on node types so it needs to come
         7514---//after node types are rebuilt.
         7515---menu_rebuild();

Every time i delete and again try to install this always it's same.


texts: Comment form is not working with ctools popup

texts:
I want to display a comment form in popup in drupal 7 website.

I have created a custom module to display comment form in ctools modal and added a link in the views page. Comment form is displaying correctly in ctools modal but comment is not saving when submitting the form.

When we submit the comment form, it does not display any error and redirect to comment form.

I am also using Ajax comments module in the site.

Code snippets for the ctools

/**
 * Implements hook_menu().
 */
function custom_feature_menu() {

  $items = array();

  $items['modal/%ctools_js/comment-popup/%'] = array(
    'title' => t('Comment Block'),
    'page callback' => 'custom_feature_comment_callback',
    'page arguments' => array(1, 3),
    'access callback' => TRUE,
  );

  return $items;

}

/**
 * Callback for
 */
function custom_feature_comment_callback($js = NULL, $nid = NULL) {

  $node = node_load($nid);
  // setting these defaults is needed, otherwise warnings result in dblog

  if (!$js) {
    return drupal_get_form('comment_node_'.$node->type.'_form', (object)$edit);
  }

  $form_id = 'comment_node_' . $node->type . '_form';

  ctools_include('modal');
  ctools_include('ajax');

  $comment = (object) array('nid' => $node->nid);

  $form_state = array(
    'title' => 'Write a Reivew (' . $node->title . ')',
    'ajax' => true,
  );

  $form_state['build_info']['args'] = array($comment);

  $commands = ctools_modal_form_wrapper($form_id, $form_state);

  if (!empty($form_state['executed'])) {

    $commands = array();

    $commands[] = ctools_modal_command_dismiss(t('Your comment has been saved.'));
    $commands = ctools_ajax_command_reload();
  }

  //If form is submittedd
  print ajax_render($commands);

}

I have searched in google and follow the below reference but comment form is not saving comment.

http://internetdevels.com/blog/ctools-modal-api
https://drupal.org/node/1196150
http://deeson-online.co.uk/labs/insert-form-pop-modal-ctools-and-drupal-7

Thanks in advance.


texts: How to generate URL alias without %20 in URL?

texts:
We have a custom field that is being used to generate the URL alias.

One issue we have found is that when we set the page to "Autogenerate URL Alias" and set the URL pattern to "[node:field_custom_url]", we are still getting "%20" where the space should be.

We have done the following, but nothing seems to work. We needed assistance to see what else needs to be configured. Ideally, any spaces should be replaced with a "-" instead of "%20". Any thoughts?

Current settings (found in admin/config/search/path/settings):

Path pattern = "[node:field-custom-url]" (we even tried [node:field_custom_url], but it did not work)
Create a new alias. Delete the old alias. = Enabled
Separator = "-"
Transliterate prior to creating alias = Enabled
Reduce strings to letters and numbers


texts: Conditionally remove / blank out field values in View using Views PHP

texts:
I am trying to build a map (IPVGM) of locations which will be used as a block appended to all entities of type Person. Locations are stored in a taxonomy, with an extra field to hold the coordinates. There are multiple fields in a Person that reference the Locations taxonomy (Field:birthplace and Field:other_locs), and I am trying to plot all of them on the same map. IPVGM can handle multiple locations per row, but the view I've been able to construct so far duplicates the birthplace in every row. This means that IPVGM constructs a map with (in this case) 4 birthplaces.

I'd like to use Views PHP to remove values for birthplace and birthplace coordinates in every row but the first one. I've had some luck trying to do this in the Output Code of Views PHP, but I think it needs to be handled in the Value Code area in order for IPVGM to pick up on the field values (or hopefully lack thereof). Any help? I looked at Views Distinct, and using a Global:PHP filter, but both of these would remove the entire row, when I only want to remove the birthplace & birthplace coordinates components.


texts: Why are my views arguments not being handled properly?

texts:
I'm using Views 2 to rewrite the output of a specific field, which looks like this:

  [title]

The link is generated as http://www.xxxx.edu/highlights1/12499/Yes, which I is correct. The view is at /highlights1, argument 1 is 12499, and argument 2 is Yes.

But Drupal is not finding the page because its looking for the full path and NOT stripping & passing the arguments to the view named hightlights1.

These two args are defined in the referenced view, so why are they not being sent to the view?


texts: When can I use a custom field type instead of a custom entity?

texts:
I come from an SQL background and I'm still navigating fields/entities. I have a custom entity (analysis) to record information about a laboratory sample (what it is, when and where it was taken, and what analysis method was applied to it). The analysis will return many independent results. I was thinking of making a second entity (results) with an entity reference to the analysis entity, the name of the chemical that was measured, and the concentration that was measured.

However, could I instead make a custom field_type that is combination of the chemical name and its concentration? Then I could include this chemical_result as a field in my analysis entity with

->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED)

to include multiple chemical results in one analysis, right?
When is it appropriate to use a custom field versus an entity?

I also have an entity called "chemical" that has information on chemicals of interest. If I use an entity for my results, I know I can make an entity_reference to the chemical entity, which would allow some more complex queries down the road. Can I do the same with a custom field? If not directly, I'm assuming I could program the add_analysis form to only allow certain values for chemical name  when adding data to the result field, correct?


texts:
I enabled the Captcha module in drupal 7.It is not visible at user_loginand validation message is shown for not filling it. I tried inspecting it and none appeared.

Math question field is required.

The password reset form, user registration form has the captcha and are visible too.

What could be the problem?


texts:
As per the requirement, we need to have two separate registration forms student and companies with different kind of fields.

We planned to use current drupal registration as student registration form with multiple custom fields. (And the values will store in the users table of DB)

Now please provide us a kick-off for creating custom company reg. form which have different fields compare with the student reg. form and store the values in separate table in the DB.

Kindly suggest us.


texts: Theme a block with #theme and twig template file

texts:
My custom module theme template is not render by Drupal for some reasons.

In my .module file I implement the hook_theme and define my theme settings:

/**
 * Implements hook_theme().
 */
function promotional_overlay_block_theme($existing, $type, $theme, $path) {
  return [
    'promotional_overlay_block' => [
      'variables' => [
        'config' => NULL,
      ],
    ],
  ];
}

I then implement the #theme in hook_preprocess_block variable:

 /**
  * Implements hook_preprocess_block().
  */
 function promotional_overlay_block_preprocess_block(&$variables) {
  $blockContent = $variables['content']['#block_content'];
  $variables['promotionalOverlay'] = [
        '#theme' => 'promotional_overlay_block',
        '#config' => ['title' => 'hello world', 'body' => 'test body content'],
        '#cache' => [
          'keys' => ['promotional_overlay_block', $blockContent->id()],
          'tags' => $blockContent->getCacheTags(),
          'max-age' => 0,
        ]
      ];
    }

I do have my template file in the following location:

templates/promotional-overlay-block.html.twig

So, I assign my custom block to the footer region of the page, and it doesn't render through my template.  It just show up the default block render without the template in my module.  I did search the page HTML source code, and I can't see my twig template there.

My Question, how can I theme my block using my template file?


texts:
I want my users to be able to login into Drupal with an external user database.
I searched for a long time and don't get any module/trick/whatever that is out there.
Please help me a little, I'm new to Drupal, I don't know anything about hooks or whatever.
Isn't there a module exactly like this: http://drupal.org/project/ppauth
only that I can use my own database with?

Help? Please, I'm desperate! :(


texts: Autopopulate a node with the content of a menu

texts:
supose i have a site with three nodes of basic page type called "element 1", "element 2" and "element 3". I want to create a menu with the following structure:
-elements
--element 1
--element 2
--element 3
Is there any way to generate a view for the "elements" node containing the children nodes from the menu, a module to do this automatically or somthing like that.
Sorry if that may be an obvious question, but im relatively new in drupal, also pardon my english


texts:
This is my code:

function my_module_node_presave($node){
  if ($node->type == 'add_stock') {
    $stock_value = $node->field_stock_value['und'][0]['value'];
    drupal_set_message('stock_value :'.$stock_value);

    $sku = $node->field_sku['und'][0]['value'];
    drupal_set_message('sku :'. $sku);

    $key = $node->field_reference['und'][0]['nid'];
    drupal_set_message('key :'. $key);

    $key1 = node_load($key);
    //$pnode =  $key1->field_product_stock['und'][0]['value'];
    //drupal_set_message('key1 :'.$key1);
    //if (module_exists('uc_stock') && function_exists('uc_stock_adjust')) {

      uc_stock_set($node->$sku, $stock_value);
      uc_stock_adjust($node->$sku, $stock_value);

    //}
  }
}

The error I get is the following one:

  Notice: Undefined property: stdClass::$tshirt-11 in my_module_node_presave() (line 40 of
  D:\xampp\htdocs\photo\photogallary\sites\all\modules\my_module\my_module.module).

  Notice: Undefined property: stdClass::$tshirt-11 in my_module_node_presave() (line 41 of
  D:\xampp\htdocs\photo\photogallary\sites\all\modules\my_module\my_module.module).


texts: How to add image field to paragraph programmatically?

texts:
I am trying to programmatically add an image field value to a paragraph.

The field value of the image is as below

Array (
  [target_id] => 28
  [alt] => test images
  [title] =>
  [width] => 1440
  [height] => 557
)

This is, how I try to set the image field value:

$paragraph->set('field_image',  $para_array);

The image field is not being set. Where am I going wrong and what will be the way to implement it?


texts: Drupal Media Library - File Upload Library shows “No files available.”

texts:
I am actualy running in some sort of strange problem. I installed Media 7.x-2.x-alpha2. I can upload files without any problems. When I go to "admin/content/file" I see the uploaded files.

Now comes the problem, when I want to add a image via the library dialog, while creating a new node, the box shows me "No files available.".

I checked the media browser view and the very strange is, that the files shows up in there

I tried updating to newest dev release and checked the permissions, but anything looks just fine. I am working as user 1.

Any idea about that?


texts: How to see the call stack of the functions being called in a page

texts: I am beginning to work on a project that has quite a few modules(around 20) which I am not really familiar with. Is there a tool or suggestion, besides dpm-ing the function name, to detect the functions and modules being used in a random page?


texts: "Find Content" missing even though user has permission "Access the content overview page"

texts:
Problem: User's "Add Content" menu item is available, but "Find Content" is not.

User has role Content Editor. Content Editor has permission for "Access the content overview page". User can access http://example.com/admin/content.

Clearing all caches does not fix the problem.


texts: In D7 how do I get JUST the value of a field in a view field template?

texts:
This is at the top of the template file:

/**
 * @file
 * Default simple view template to all the fields as a row.
 *
 * - $view: The view in use.
 * - $fields: an array of $field objects. Each one contains:
 *   - $field->content: The output of the field.
 *   - $field->raw: The raw data for the field, if it exists. This is NOT output safe.
 *   - $field->class: The safe class id to use.
 *   - $field->handler: The Views field handler object controlling this field. Do not use
 *     var_export to dump this object, as it can't handle the recursion.
 *   - $field->inline: Whether or not the field should be inline.
 *   - $field->inline_html: either div or span based on the above flag.
 *   - $field->wrapper_prefix: A complete wrapper containing the inline_html to use.
 *   - $field->wrapper_suffix: The closing tag for the wrapper.
 *   - $field->separator: an optional separator that may appear before a field.
 *   - $field->label: The wrap label text to use.
 *   - $field->label_html: The full HTML of the label to use including
 *     configured element type.
 * - $row: The raw result object from the query, with all data it fetched.
 *
 * @ingroup views_templates
 */

I was hoping "raw" was just the value in the field, but I think it's the entity id. PLEASE tell me there is a straight-forward way to get just the value of the field from this template!

Thanks!


texts: How to alter Fields of Field Collection?

texts:
I have a field collection in a custom Content Type.

I wanted to do form alter.

I'm unable to locate the fields of field collection in hook_form_alter(), do we have any other way ?


texts: How to use field value as class? Drupal 7

texts:
Not sure that is the best title...

I want add a field to a content type eg. Priority. My preference would be to make this a taxonomy reference (with Autocomplete term widget (tagging)).

Then probably through a preprocess I would like to add any terms entered as classes to the node (in particular when a teaser but that's not important).

I am not the world's greatest php coder and apologise if this doesn't make a great deal of sense. I have been banging my head against the wall for three days now and any help would be greatly appreciated :)

I gather it has something to do with MYTHEME_preprocess_node and $variables['classes_array'][], but I don't seem to be able to put my finger on it.


texts: Duplicating drupal site without login info

texts:
I'm a new Drupal user.

Someone gave me a backup of their Drupal and .mysql content.  I more or less followed these instructions: http://www.ostraining.com/blog/drupal/drupal-migrate/, except the site already had it's own settings.php, and so the site is now up and running.

The problem that I'm having now is that I can't log into the site to make any edits because I don't have a login.  I tried to create an active user in phpmyadmin with an md5 hash password, and changed the user to an administrator.  However I'm still not successfully logging in, the site says I'm still giving it the incorrect login info.  When I try to recover/reset my password by email I am not receiving any emails.  I am using Windows XP.

Is there any way I will be able to login to edit the site?


texts: user--register.tpl - show validation error messages

texts:
I have overwritten theme of registration form using the file user--register.tpl
But when have some validation in the form, I cannot see error messages.
How can I display error messages generated with form_set_error in validation callback?

The variable $messages is not set in this template by default.

Thanks for any help
Tomas


texts: how to apply CSS for a Custom Block/View

texts:
Like your tutorial a lot. I am really brand new into Drupal and PHP and i am trying to learn to apply and suggest product for my work. Recently, i have installed Drupal 7 and installed many modules to play with. I have looked over online tutorial and i have few drupal7 books, but i haven't find any answer about my needs.

My question is, suppose i create a simple block to display a list of news items how can i apply css for this block. Where can i add css codes? Is there any specific css file in a certain directory?

Please let me know if you can help me on that. if you already have  a question thread opened or answered before, you can point me the url. i couldn't find the answer yet.


texts: How can I put a carriage return into the drupal t() function in Drupal 6? I tried using \n and that didn't work, which seems to make sense after reading the documentation for the function.


texts: Masking event title if marked as "private" (Views, Pathauto…)

texts:
I'm creating a calendar in D7 using an Event content type, which will include a Private checkbox. If it's set:

Users with the appropriate permission will see the node title as it was entered.
Everybody else will see "Private event" as the node title.

How would you approach this? (A code-based solution is fine.) Immediate concerns are ensuring "Private title" gets substituted in regular node displays, views -- and also pathauto URLs. Thanks!

Edit -- Alternate strategy:

Leave the node title alone (as "Private event" if the event is private), which will enable desired pathauto functionality without any changes.
Add a "private title" text field. This is where admin users would enter the actual name of the event, for internal reference.
On display, if the current user has admin permissions, alter the node title to display the private title value.

This seems like it would be a much simpler strategy. What do you think?


texts: Adding Roles with Rules upon Webform submission not working — Why?

texts:
Here's what I have done so far (in Drupal 7):

Created a webform quiz that only validates if all answers are correct
Created a role called "Mid-program quiz: Passed" that has permissions to view a particular page
Created a rule that says upon submission of the quiz, the submitting user should be granted the "Mid-program quiz: Passed" role.

But it's not working. The quiz is being submitted correctly but the role is not being assigned.
Here are the details of the rule that's failing to execute:

Event
Event: After a webform submission has been added
Conditions: Webform has name
Parameter: The form id of the submitted form: [form_id], Webforms: Mid-program quiz
Elements
(Here I wasn't sure whether to use [user], i.e. the user submitting the webform,  or [site:current-user], i.e. the currently logged-in user. So I did both.)
Add user role
Parameter: User: [user], Roles: Mid-program quiz: Passed
Add user role
Parameter: User: [site:current-user], Roles: Mid-program quiz: Passed

Can someone see where the problem is in this rule?
Thanks!


texts:
I have installed Drupal 7 and also the internationalization modules. I am able to add a basic site and translate it. I can even opt to add localized url aliases which work fine when switching language. The one thing not working is the menu translation. When translating an article I can choose a different menu name for each language - but only the english version is shown in the menu for all languages.

Anybody has a clue why this could be?


texts: How to save webform submissions data in fields using rules module

texts:
I used the answer in my last question Override webform module submit
to create node after webform submissions.

My webform contains many components like phone, address, responsible and others.

How can I save this data in fields tables?


texts: views related content block // show content with specific initial letter

texts:
i have a content-type with this fields:

title field
starting letter // term reference -> stores term in vocab "starting letter"
car brand // term reference -> stores term in vocab "car brand"
car model // term reference -> stores term in vocab "car model"
Image field

i have created a view that hast the url: example.com/vehicles/audi (the term audi comes from the vocab "car brand" in views this looks like vehicles/%)

on this page with the url example.com/vehicles/audi i want to show a block that contains a list of other cars which name starts with the letter A like:

Acura
Alfa Romeo
AMC
Ascari

the same should be work with brand starting with B, C and so on. i need a contextual solution.

my problem and what i dont unterstand:
how do i set this thing up, because i dont have the term "A" in my url which i could filter with the contextual filter. i just have the term "audi". can anyone help me please?


texts: How to add an id element to a field in Drupal 7

texts:
I am try to find out a way that I can add in #ID element to a link field in Drupal 7. When you Edit the field it give you a chance to create a CLASS (Additional CSS Class) for it, however I want to add an #ID element so that I can use it to trigger an event for google analytics. I actually was able to add and #ID to that panel display but it is 2  above and not triggering it.

Is there a way to do this without code, if not what approach would I take to handle through code(not my specialty).
Here is an example of what I have...

      Print

and I want this...

          Print


texts: Add microdata to breadcrumbs - Some trouble with hooks

texts:
I'm trying to add microdata to the breadcrumbs. I found on the web this fix which I tried to include to my own SEO module like this:

function mymod_page_alter(&$variables) {
    if (!isset($variables['breadcrumb'])) {
        $variables['breadcrumb'] = theme('my_microdata', array('breadcrumb' => drupal_get_breadcrumb()));
    }
}
function mymod_theme($existing, $type, $theme, $path) {
  return array(
    'my_microdata' => array(
     'variables' => array('breadcrumb' =>array()),
    ),
  );
}
function mymod_menu_breadcrumb_alter(&$active_trail, $item){
  foreach($active_trail as $id=>$active_trail_item){
    $active_trail[$id]['localized_options']['attributes']['itemprop'][]="url";
  }
}
function theme_my_microdata($variables){
 $breadcrumb=$variables['breadcrumb'];
print_r(debug_backtrace());
 $output="*+*+*+*+*";
  if (!empty($breadcrumb)) {
    // Provide a navigational heading to give context for breadcrumb links to
    // screen-reader users. Make the heading invisible with .element-invisible.
    $output = '
' . t('You are here') . '
';
    $output .= '
';
    $separator="";
    foreach($breadcrumb as $breadcrumb_item){
      $output.=''.$separator.$breadcrumb_item."";
      $separator="»";
    }
    $output .='
';
  }

    return $output."xXxXxXx";
}

So far I checked that all this code is executed. But this theming is not applied on my page. Why does my code not work? Could this been related with the module breadcrumb? I know that this output will be garbage but I cannot see the result.

If I guess right than is the output created by theme.inc line 1682ff theme_breadcrumb(...)instead of my code. How can I change that?

I just found the theme_breadcrumbs there is shown in their solution this line:

function YOURTHEME_breadcrumb($variables) {

Well can YOURTHEME my module name or have I to build a theme?


texts: When theming a view there are two approaches, in a template file or rewriting field output, what are the advantages and disadvantages of each?

texts:
When configuring a field in a view such as the node title, there are options to add or remove formatting to the view by either excluding the field from view, wrapping the field in a certain type of tag such as div, span or h3 or rewriting the output of the field which in conjunction with replacement tokens can yield quite complex structures.

The default views row template, for example, just loops through each field and prints it to the template. However, it is possible to print each field's variable in a particular place by rewriting the template. The templates are good because logic can be added to the template, for example, testing for number of comments to determine the plurality of the word comment that is prefixing the number of comments. The template is also useful for using the drupal_add_js() function to add javascript files that are only loaded even when the Drupal javascript caching is enabled during that particular page load.

There is third place to add logic to theming a view which is in the hook_views_pre_render() function.

With the several different ways to control the markup and output logic of a view are there  best practice? Are there different techniques that are appropriate for different situations?