/** * When site move to subdirectory, pictures, added in WYSIWYG, return old address * this small js fix it. */ (function($){ $(document).ready(function() { if (Drupal.settings.basePath != '/') { $("body.page-node article .entry-content img").each(function() { var src = $(this).attr('src'); $(this).attr('src', Drupal.settings.basePath + src); }); } }); })(jQuery.noConflict());
Drupal
Any project should be protected from automatic registration, One of wellknown solutions is using CAPTCHA. There are a lot of kinds of CAPTCHA and most part of them were designed for very big projects wich could be affected by directed spam attack of competitors or other "enthusiasts". On simple sites which are not as famous as facebook or twitter we don't need such difficult protection.
To move file we need to have file object. We can get it using file_load(fid) function wich need file id as argumnet
Sometimes we need to save pdf file in directory. In drupal for this purpose we can use print-email-pdf module wich give us pdf file when we follow url yoursite.com/printpdf/nid. We can easily grab the content of this file using file_get_contents() function. You should look at code example:
Hi everybody, recently faced with the fact that you need to update thousands of aliases to content, taxonomy terms, and users.
Everything is good only if it did not have to do for Drupal 6.
The solution was found immediately.
Download and install the module and create three views_bulk_operations display.
The first and the second is the list of contents and a list of users, respectively. In the display settings set bulk operations and select "Update URL alias" and set to use the batch api.
But for taxonomy terms no field update paths aliases.
Once upon a time one developer was very upset, because he coudn't find appropriate templates name for drupal commerce checkout pages. And he began his research. Here is the result of his research.
Checkout page template: page--checkout--%.tpl.php
Checkout review page template: commerce-checkout-review.tpl.php
Page checkout complete: page--checkout--complete.tpl.php
Also will be usefull to know about user order (! one order page!!!!!) page template: page--user--orders--%.tpl.php
Once upon a time one developer was very upset, because he coudn't find appropriate templates name for drupal commerce checkout pages. And he began his research. Here is the result of his research.
Checkout page template: page--checkout--%.tpl.php
Checkout review page template: commerce-checkout-review.tpl.php
Page checkout complete: page--checkout--complete.tpl.php
Also will be usefull to know about user order (! one order page!!!!!) page template: page--user--orders--%.tpl.php
So one more time about mailing. In practice we often need to send mail in appropriate format. There are a lot of articles about this problem, especially with enormous quantity of code. As for me I tried to use it but in most cases all this code didn't work for me. My mail problem has to be solved in a short time that's why I decided to use module. I've tried a lot of them, but only mime mail http://drupal.org/project/mimemail .
If you are going to send mail on form submit you should use simple hook_form_alter. You are able to use it in current theme template.php but it would be much easier to use custom module. in case if you are using this code in your theme template.php you should change 'yourmodule_' on 'yourtheme_' name.
function yourmodule_form_alter(&$form, $form_state, $form_id) { if($form_id == 'your_form_id') { $form['#submit'][] = 'yourmodule_submit_webform_action'; } }
To add custom submit function we add new element into array:
if we need to create custom module we shoul create folder with a name of our module in directory sites/all/modules/your_module_name. Then inside this directory we should create two files your_module_name.info your_module_name.module. In the first file .info we should paste code given below:
name = Your module name visible in administration interface
description = Module description also visible in admin interface.
package = module package name
core = 7.x
The last line shows that module created for drupal 7.