Drupal Tips

18
Mar

Site hacked google search results redirect to http:// trpills. ru website , Drupal Website hacked

When google website, then all the links (comes in google search result) below that should go to our website but the problem is when clicking on the website/URL or the links below, another website opens, trpills.ru

 

Solution :

 

Unfortunately the site is hacked with a conditional redirect.  When the referring page is Google, such as a search results page the request gets redirect to trpills.ru

For sites hosted on Apache one of the most common ways this type of hack is accomplished is a hack of an Apache file named .htaccess.  This file is typically located in the root directory of a site although there can be multiple .htaccess files on a site in multiple directories.  On some sites .htaccess files may be located in directories/folders above the root directory of the site.

Check the .htaccess file for any suspicious redirects, redirects to   trpills.ru be sure to scroll all the way to the botom of the file hackers sometimes add 100s of blank lines before the malicious code and to check all directories for additional .htaccess files.  On some servers the .htaccess file is a hidden file so you may need to select something like "Show hidden files".

 

So just edit the content of htacess file.

18
Feb

$(field).value() is undefined cck count Drupal

Module Name : CCK Count

Use        :

The CCK count module allows website administrator to define a limit of number of words or

characters for a CCK field , it can be text field or text area it will work on both. When the

website content creator is adding content in that field, it will display a current count of the

number of words or characters and show to user (how many are left ). Once it reaches the

limit, the color changes automatically and the user is no longer able to submit the form until

the number or words or characters are reduced to the limit.    

Installation:

1) Download from Drupal.org , currently this module is available only for 6.x version
2) Upload it to your server or local on this path : sites/all/modules/ or sites/<sitename>/modules
3) Now go to admin -- site building -- modules and enable it
4) Once enabled, go to admin -- content management -- <any content type in which you will add cck fields>
now you will see a collapsed fieldset on the CCK field administration page in the "Page settings" fieldset. Open the set and configure as
                 needed. To disable, leave the "Maximum length" blank.  
5) have a look in these screen shots.

Live Example :

           http://www.behindmyresume.com
           http://dating.mybeachbooking.com/

Sometime you will see $(field).value() is undefined in cck_count.js this error while using cck_count module so the solution is


In cck count module you will see an error liker this

$(field).value() is undefined in cck_count.js

 

Solution open cck count module and edit cck_count.js file

 

Just do this

 


 Drupal.cckCount.getLength = function(field, count_type) {
// function start
 var length = 0;
// variable defined
 - if (count_type == 0) { - //Count the characters. - length = $(field).val().length; - } - else if (count_type == 1) { - //Count the words - length = ($.trim($(field).val()) != '') ? length =
$.trim($(field).val()).split(/\s+/).length : 0; + if ($(field).length) {
// check length
+ if (count_type == 0) {
// check field length
+ //Count the characters. + length = $(field).val().length; + } + else if (count_type == 1) { + //Count the words + length = ($.trim($(field).val()) != '') ? length =
 $.trim($(field).val()).split(/\s+/).length : 0; + } } return length;

// value return

- means delete this line

 

+ means add this line

 

It will solve this error

9
Feb

Image cache images not generated on windows hosting / windows server on IIS with Drupal

Sometimes on windows hosting or windows server where IIS server installed with Drupal 6 or Drupal 7

 

Images uploaded in the sites/default/files folder but not in the imagecache folders.

 

Image cache not able to upload / generate images inside image cache folder.

 

So the solutions for this :

 

Check folder permission

 

           or

 

You will see to .htaccess files first in root folder and second one in inside sites/default/files folder

Now the difference seems to be that in Apache, both files seem to be combined (the one in sites/default/files inherits everything from the top-level one). This does not happen with the ISAPI_Rewrite module that seems to handle the Apache/IIS .htaccess compatibily.

which contain this  :

SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
Options None
Options +FollowSymLinks

 

Just do one simple thing delete this .htaccess file (inside sites/default/files)

or merge the both like here

 

Just do one simple thing copy the content of the root .htaccess file directly into the file in sites/default/files, below the existing content. Additionally, you have to change the RewriteBase so that it included the index.php file in the correct directory.

The header of the changed .htaccess file now looks like this:

# From the original .htaccess file, do not remove.

SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
Options None
Options +FollowSymLinks

#
# Apache/PHP/Drupal settings:
# (copied from /.htaccess)
#

Content of the root .htaccess file here  

And the part that I changed now looks like this:

# Modify the RewriteBase if you are using Drupal in a subdirectory or in a
# VirtualDocumentRoot and the rewrite rules are not working properly.
# For example if your site is at http://example.com/drupal uncomment and
# modify the following line:
RewriteBase /YOURFOLDERHERE

So when Drupal is installed in a sub directory, insert your folder name. If not, you can leave this part commented out.

6
Feb

Facebook login integration in Drupal

Steps Facebook Login Integration in Drupal

Use of Facebook Connect Module

a) Using Facebook Connect Module you can use your Facebook ID and password to sign-in to your drupal website.
b) Users can see easily which of their Facebook friends had an account on your drupal site.
c) Users can publish a feed on their Facebook feed announcing that they have created an account or commented an article on your website.
d) Users can invite their Facebook friends to create an account on the Drupal website.
e) In case the user already holds an account on the website: The user can choose to link his drupal account to his Facebook identity.

 

Facebook Connect Module Requirements :

a) PHP 5.2 or higher versions.
b) Drupal 6.x.
c) Facebook PHP Library: http://github.com/facebook/php-sdk/
d) Facebook API key: http://www.facebook.com/developers/

 

Steps Using Facebook Connect Module

 

1) Download Facebook Connect Module from Drupal.org

2) Extract and upload fbconnect to sites/all/modules folder

3) Upload facebook-php-sdk (github.com/facebook/php-sdk/) into fbconnect module folder (or into libraries folder, if you want to use it with the libraries module)

4) To ensure that you installed correctly check file : <fbconnect folder>/facebook-php-sdk/src/facebook.php must be accessible

example : http://yourwebsitename.com/sites/all/modules/fbconnect/facebook-php-sdk/src/facebook.php

3. Create a new facebook application page using the following URL

                     http://www.facebook.com/developers/createapp.php
    
  4. Enter the Site URL on Web Site settings tab (e.g. copy value from admin/settings/fbconnect field “Connect url”).
 
  5. Configure the module through admin interface (admin/settings/fbconnect) using the information provided by Facebook
    (Application ID, Application Secret).  
     
  6. In order for the user's browser to correctly recognize XFBML tags, you need to specify that the page is in XHTML.
    Edit the "page.tpl.php" file of your current theme. edit the <html> tag and add the facebook xmlns for rendering XFBML.
    
    Example : <html xmlns:fb="http://www.facebook.com/2008/fbml"
                    xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php print $language->language ?>"
                    lang="<?php print $language->language ?>" dir="<?php print $language->dir ?>">
       
    Note: The xmlns:fb attribute (xmlns:fb="http://www.facebook.com/2008/fbml") is required for proper rendering on IE.
     (Namespaces don't have to point to a valid page, they just need to be a valid Internationalized Resource Identifier (IRI).
 
  7. Also make sure that your page.tpl.php contains <?php print $closure ?>   

 

If fbconnect will not work please check all the steps again or goto here

http://drupal.org/project/issues/fbconnect 

6
Feb

Increae file uploading size , increase file execution time , increase memory limit drupal

Sometimes in Drupal you want to upload large size files like audio , video , image etc and by default Drupal allows us 2MB uploading limit.

So if you want to increase uploading limit size then follow these steps.


So here are few solutions for this :

1 ) First one is modify .htaccess file (present in Drupal Root Folder)

Add the following lines

php_value post_max_size 200M
php_value upload_max_filesize 200M
php_value max_execution_time 1000
php_value max_input_time 1000

2 ) If you have root access modify php.ini file

Check the following values and set according to your requirement.

memory_limit = 65M
post_max_size = 65M
file_uploads = On
upload_max_filesize = 65M

 

3) Third one is using settings.php file

Add these lines in the starting after

<?php tag

ini_set('memory_limit', '200M');
ini_set('post_max_size', '100M');
ini_set('upload_max_filesize', '120M');

 

these above lines also solve memory limit problems and maximum size execution problem.

14
Jan

Print blocks / custom regsion in node.tpl file

Print Blocks / Regions in node.tpl file

suppose you to print any block in node.tpl or node-yourcontenttype.tpl.php then drupal will not allowed directly. So for this follow this simple steps

First open your current activated theme folder then open theme .info file.

1) Open the YOUR-THEME-NAME.info file

for example your new region name Above Comments then add following line

regions[above_comments] = Above Comments

here above_comments is new variable that will print in node.tpl file and Above Comments is the lable this will display in admin --- site building --- blocks page

 

2) Now open template.php

function YOUR-THEME-NAME_preprocess_node(&$variables, $hook)
{
  $variables['above_comments'] = theme('blocks', 'above_comments');
}

suppose your theme name is abc

then your code will be like this

function abc_preprocess_node.....

 

Now don't forget to clear your cache file using performance under site configuration then

 

3) Now in your node.tpl

<?php print $above_comments ?>

then go to site building --- blocks and add any block which you want to print on node.tpl and its done

12
Dec

Paid registration in Drupal

  • Create your Membership Plans with Membership Suite, configure the settings and options you want, and then let it do the work for you!
  • You will be pleasantly surprised at just how intuitive everything is.
  • Users can quickly and easily Cancel, Extend and Renew their Memberships straight from their User Account!

 

Features :  Paypal Registration in Drupal.

                Credit card regsitration in Drupal.

                Payment by all common credit cards.

 

Using this module you can add compulsory payment using paypal , authorize.net and commonly used credit cards on Registration pages.

For example please have a look in this screenshot

 

Syndicate content