Different Frontpage For Anonymous And Authenticated Users

There is a very simple solution if you want to have a different frontpage for logged in and anonymous users in Drupal 7. Our solution will use a custom module. I recommend you to always have a custom module installed so you can write simple and handy functions in it quickly. In your custom module implement hook_menu using as callback a function that redirects the user to the appropriate according to you criteria. Here is an example: /* * Implementation of hook_menu */ function custom_menu(){ $menu = array(); $menu['frontpage']=array( 'page callback'=>'custom_frontpage', 'access arguments'=>array('access content'), 'type'=>MENU_CALLBACK, ); return $menu; } function custom_frontpage(){ if(user_is_logged_in()){ drupal_goto('panel'); }else{ drupal_goto('welcome'); } } After this, you'll need to rebuild your menu cache. You may do it by editing some menu or updating your site in /update.php. Finally, access your site admin pages in the addres /admin/config/system/site-information and set the site Read more


Installing Ckeditor in Drupal

After installing the Wysiwyg module for Drupal 7 and downloading and placing at the right spot the ckeditor library, the module was complaining that it couldn't find the version of the library. The problem was solved when we manually wrote the version in the plugin:

  • open the ckeditor.js file
  • add a new line inside the first comment of the file
  • write the version of your ckeditor with the followin format:
  • version:'X.X.X',revision:'X.X.X'

Building A Drupal Site

After installing Drupal, let's go on to building our site.

It is usual for beginners to try to create a nice looking site. They want to define the menus, the banners, the background or even some animations. All these are really nice, but they are also somewhat hard to achieve and require different skills than those necessary to organize and maintain a website. Learning CSS, HTML and Javascript, learning how to insert custom blocks and to place an image somewhere, all this, though necessary and very useful, are not really necessarily the best way to build your Drupal website. Drupal has it's ways of creating banners, several animation effects and, of course, displaying images. There is no need to use custom snippets or tricks.

Let's try to understand first the structure of our site. This way we'll learn faster and create a robust website. After that Read more


Learning Drupal, beginning from the start

Drupal sites screenshots

Drupal is a CMS, that is, a Content Management System. When newly installed it provides already lots of useful functionality, enough for you to have a nice blog. With time you will be able to build very complex sites with Drupal quite quickly. You will be able, for instance, to control the products or documents of your business.

This tutorial expects you to be using Linux and to be familiar with the command line. Don't be afraid if you don't meet these requirements, though, it's easy to start and you may find lot's of tutorials in the Internet. You may also always ask a question bellow.

To use Drupal you will need to have a hosting provider and a domain. After that you will install Drupal in your server.

Domain
It is the address of your page. My domain is ndvo.geekgalaxy.com. You need to Read more

Creating Pdf Reports Drupal Using Latex

Generating documents for printing from web applications may be a challenging task.

Whoever has faced such a task has probably been tempted to create a new CSS file for the printer friendly version and simply offer a cleaner version of the online page. This may be a nice useful trick, but the result is not a printable document, but a less non-printable document. It is a nice trick, but it is nothing else. The same thing may be said about the use of a solution that generates PDF from an HTML file, i.e., DOMPDF.

The problem is that these solutions do not provide actual printer ready documents. They provide simply a document that is not terrible when printed. A document ready for print should be aware of the pages, should have page numbers, should treat carefully the tables and other objects that may need to occupy more than one Read more


How To Create A Custom Module For Your Drupal Website

Creating a custom Drupal module is a lot easier than you expect, and a lot more important as well.

Drupal offers thousands of resources for you to create your website in a glance, I know, but I am pretty sure you or your client will want to change a little something here and there. This is why I recommend you to have a custom module for every website you create with Drupal. Within it you will create those PHP snippets you usually need and would end up placing within blocks, nodes or rules wasn't for the custom module.

Tip: try always to keep adherent to the good practices and patterns of Drupal community. This includes avoiding PHP in blocks or nodes. Deadlines may be an obstacle for understanding and learning the patterns, but if you cannot find some time to do it you will end up with more problems Read more

Setting Default Subject To Comments

Here is the Drupal task of the day:

The client has a help desk system built on top of Drupal relying on the comment module to interact with his users. He wants a functionality to allow his team to create and manage default comments that can be used to avoid unnecessary typing. Also, the comment subject should be standardized: it may be the title of a referenced node or the title of the standard comment used, if none of these applies, it should be a standard text.

Here is how it was done:

The modules I installed to get this done were the following:

  • Entity Reference
  • Entity reference autofill
  • Field Permissions
  • Views
Besides, I used a custom module. It is handy to always have a custom module for each site, where you can write specific code. Here is the idea: We will use Entity Reference Autofill to fill the comment Read more

Creating a chart in Drupal with Charts

One of the greatest strengths of Drupal is the module Views. It gets even better when you are able to use the module Charts in order to present your data in a more pleasant way.

In order to create a chart with the module Charts, do the following:

Install both modules, of course. Create your view as desired. I recommend using a table display initially so that you can see your data precisely.

Attention:

You data may contain a label column (field) and several data columns (fields). Notice that you should not use the same field for both purposes. If you simply want to count the registers and present them in a graph, you should use the nid as the field to be counted and a different field for aggregation.

The data presented in the graph will usually be accompanied by some tabular data of the same kind.

It may Read more