Capita di dover nascondere o eliminare alcuni Tabs di navigazione che Drupal o qualche suo modulo offrono di default.
Per farlo in modo pulito senza mettere mano al codice possiamo sfruttare phptemplate e inserire in seguente codice nel file template.php del nostro tema (o crearne uno appositamente in caso non sia già disponibile):
<?php
/**
* Override or insert PHPTemplate variables into the templates.
*/
function _phptemplate_variables($hook, $vars) {
if ($hook == 'page') {
Out of the box the localization and translation functionalities of Drupal can translate only the titles of each field created with the Content Construction Kit (CCK). Unfortunately at the moment no translation module (Locale, Localizer, i18n) offers direct support for the translation of cck fields, so we have to fix this ourselves.
In order for a string to get translated it must be enveloped by the t() function in the PHP code. We have to do this manually. Currently, your 'Allowed values' list probably looks like:
Apples
OrangesFirst you'd better chage it to::
If like me you are not a big fan of the Log Message functionality of Drupal (the one that adds a "Log Message" textarea at the bottom of each node form), then here is a small php snippet override to add to the template.php file of your theme to definitely hide the Message Log:
/**
* Override node form and remove "Log message" textarea
*/
function phptemplate_node_form($form) {
$form['log']['#access'] = FALSE;
return drupal_render($form);
}Make a good use of it ;)
Fivestar is a little contributed Drupal module that allows you to cast a vote on any content type. I prefer it to other rating modules because it's simple and elegant, and it can be skinned to your likes easily as well.
Is very easy to show some contents to anonymous AND some other to authenticated users in Drupal. You'll only need to adapt the following few lines of php to output your content:
<?php
global $user;
if (!$user->uid) { ?>
<div>anonymous content here</div>
<?php } else { ?>
<div>authenticated content here</div>
<?php } ?>Yep, that easy.
Ever had the need to redirect your users to a certain page after they perform a particular task (ie: after they are invited to register to the site)?
Doing it is simple:
just translate the link in your PHPTemplate content-type file (es: node.tpl.php) from:
http://www.mywebsite.com/user/register
to:
Inglese: Come utilizzare i link dei termini ($terms) associati a ciascun nodo di Drupal per navigare altri contenuti dello stesso autore taggati con lo stesso termine?
<?php
/**
* The following simple snippet
* displays different information to anonymous/logged in users within a page.
*
* This works with drupal 4.5 and drupal 4.6
*/
global $user;
if ($user->uid) {
return "This message is only visible for logged-in users.";
}
if (!$user->uid) {
return "This message is only visible for not-logged-in users.";
}
?>