Drupal 7 provides a flexible supports to create a Taxonomy. There is powerful core module called Taxonomy which allows us to create, manage and apply vocabularies. In Drupal, the terms are gathered within "vocabularies". Taxonomy has a ability to add taxonomy fields to vocabularies and terms. When we come across inserting the taxonomy terms programmatically, we will need to add fields values to that taxonomy term. So In this section we are going to create a custom field values to the taxonomy terms. Below is the code snippet, that is the array structure to create field values.
Technical Blog
Drupal provides creating an image style in different ways through configuration. Adding a watermark to the image to provide its originality is a must thing needed by the clients. While running in to this we have found out a solution to add a watermark to the image styles.
Suppose you website sells products. Both anonymous user and registered user will be able to purchase products. And the registration process takes place in two ways.
Normal registration process.
When an anonymous user first time purchase a product, registration process will take place automatically.
To change the group manager of a group usually we search into option as "change group manager" but we dont find it anywhere. Because there is no option within Organic Groups holding such a decription. So we need to think futher and deeper into the concepts of organic groups. This articles tells you simple method to change the group manager of the group.
The article explain how to make mp3 files directly streaming on your website without users having to download the file. To do so I am using contributed module from Drupal that is Soundmanager2 module. It provides the Drupal interaction with the soundmanager2 libraries containing three default player style. Here I am just creating a content type for uploading the mp3 files. By creating a node to this content type we can upload the files and displaying mp3 player will be done by soundmanager2 libraries. For integrating MP3 file in your Drupal 7 , you need download modules and the libraries.
In Drupal 6, the configuration of vocabulary itself has an option to specify the content types that requires this vocabulary. There is only global settings for the vocabulary. If we set the vocabulary as multiple select, it will apply to all of the content types to which it belongs. We can not set this field as multiple select in one content type and single select in others.
One of our Drupal clients was using banner ads for their affiliates to bring in more members. Unfortunately these banner ads were placed inside the content with a page (A Drupal node) and the embed code for the banner ads generated using PHP code by enabling the PHP filter. If you have spent time in the Drupal world you would be knowing that enabling the PHP filter within the content area is a big security vulnerability. So the alternative was to use tokens. Read on to know how to replace a token within the content area of a node in Drupal.
In Drupal we have got a module namely Registration with Profile , to bring an option to upload the profile picture. But here let us gather some information on how this can be brought programmatically.
So let's start up with Form API.
Following are the steps to get the profile picture uploading option in registration form.
Step 1 : In registration form alter :
There are certain cases were we need a copy of our database. In this case we need to export the database in the sql format. This is a simple process and can done in few steps. Certain cases we need full database for example if we need a backup copy of database we need to export the full database and in cases we need to export only certain table from the database. Both are possible. Both the exporting steps are given below
Sometimes the best way to handle variable values on a Drupal site would be with an admin settings form. For example if you want to store different sizes of the same image which has to be displayed in a page, using admin settings form may be more useful as you have the option to change the image whenever desired.
[Drupal] How to display Affiliate links on page load for the contents using Category as reference id
In my previouds article "How to display Affiliate Links on page load for the contents using Category as reference id-Part 1?" I have provided a brief intrduction on affliate links and what all configurations we must do. In this article I will be explaining how to generate Affiliate Link on page load using hook_nodeapi().
Many of the sites now a days are designed to play video in pop-up window.This can be implemented using color box module and adding link to the video url in anchor tag with class as colorbox-load.Read on to know how to implement this.
If you want to display large amount of content in a page on your site then using text scrollers would be one of the best methods. For example if you have lot of news and events to be displayed in a site, then using text scroller will allow the user to scroll over all the data.This can be easily implemented using views and jcarousel module. Read on to know how to display contents as text scroller in Drupal sites?.
When we try to theme a Drupal website certain case we need to create particular region in the Drupal website. Adding region for a Drupal website is not a hard task, even a developer first creating a Drupal website can create a region. In order to add regions inside a Drupal website we only need to add a few lines extra for that. Below there are three version of drupal for the drupal 6 and 7 version creating the region is same but for the Drupal 5 version it is slightly different.
In Drupal, if you have a content type and you want to change the output of any field to something else you can use field formatter with field API. This enables a display settings for any fields in a content type and where you can manage the output as you wish. This article shares how to create a field formatter for your Drupal content types. There are some contributed modules for custom field formatters. But if you really want to create or learn about creating a field formatter programmatically, just go through this article
If we create a drupal website and if we are trying to add a new theme for the website from the themes available what to do ? The first thing is to find a suitable theme for the website as per the requirement of the site. Before searching for a new theme we need to do certains things, try to sketch out the general layout of the new site. There are few thing we need to give some importance.
When your trying to implement a new feature(say a module or theme) in your local machine for a website, first thing you have to test is the compatability in all browsers. If you want to test your feature in multiple machines, its not always easy to download and setup on each machine. In my case, I am using Ubuntu and I have to always test compatability of a site in IE browsers which cannot be installed in ubuntu. So what I did here is created a virtual host for my site in my local machine and using my ip address I created a virtual host in other machines so that I could easily access all my sites in my local machine from diffrent machines.
In Drupal there are by default two roles, Administrator and Authenticated user. If the requirement comes of creating additional roles then we can create and add as many roles in the default list of roles of Drupal as per our requirement.
I faced a problem to create a taxonomy vocabulary term when my custom module was enabled. To save a vocabulary we just need a Taxonomy vocabulary save. But here I had to enable it whenever my module is enabled. So I checked out and found this method to add a new taxanomy vocabulary.
This article explains how to programmatically, save custom additions to the user object when a new user account is created in Drupal. We can understand this with an example. Say, we want to create a default album with every newly created user, then we can use the following to save the custom additions. Similarly any of your additions can be done after referring the following.