December 2015

Easy subscription for Drupal 7: a revision of the module

This is a little revision of Easy subscription for Drupal 7 thanks to which the notifications are sent only when the node is published and in the outgoing email are now present the title, a small preview of the contents and the link of the new node. Here there is the code: <?php /** * @file * This is an easy subscription module */ /** * DB management. */ function easy_subscription_form($form, &$form_state) { $form = array(); // Add a title to help baffled users $form['description'] = array( '#type' => 'item', '#title' => t('Subscribe to receive updates'), ); $form['email'] = array( '#type' => 'textfield', '#title' => t('email'), '#size' => 20, '#required' => TRUE, '#validate' => array('filter_form_validate' => array('email_validation')), ); $form['unsuscribe...

Drupal 7: how to get the body of a node

If in Drupal 7 we have to use the content of the body of a node as variable then we can get it through php, everything is really simple, we only have to give attention if the site uses only one language or if it is a multilanguage site. If the site use only one language we can get the body of a node in this way: $body = $node->body['und'][0]['value']; If the site is a multilanguage site we can...

Drupal 7: how to get absolute path url or path alias url of a node

In Drupal 7 we can access to a node through its absolute path url or through its path alias. In some case it is really useful get these urls and as usually in drupal we can do this in a lot of ways, here there are some examples. Code to get absolute url: global $base_url; $nodeurl = $base_url . '/' . current_path(); $nodeurl = url('node/'. $node->nid); Code to get path alias url: $nodeurl =...

Drupal 7: how to detect when a node or a comment is changed from unpublished to published or vice versa

In Drupal 7 we don't have a simple way to detect when a node or a comment switches from published to unpublished or vice versa but we can detect these actions with some php code. Node publishing: isset($node->original->status) && $node->original->status == 0 && $node->status == 1 Node unpublishing: isset($node->original->status) && $node->original-...

Drupal 7: how to enable\disable comment of old nodes

In Drupal 7 we can set the comments in three ways: Hidden: No comments are allowed, and past comments are hidden. Closed: No comments are allowed, but any past comments remain visible. Open: Any future content of this type is open to new comments. We can change in any moment the default comments' settings for any content type but the new choice will be valid only for the new nodes and not for the...

Mentor's Conky: conky lua for 8 cores cpu

This is a mod of Conky Seamod to support 8 cores cpu as the AMD Bulldozer family. Conky SeaMod on kde-look.org Conky SeaMod on deviantart.com conkyrc: #============================================================================== # conkyrc_mentor # Date : 24/12/2013 # Author : Mentor # Version : v0.2 # License : Distributed under the terms of GNU GPL version 2 or later # # This version is a modification of conkyrc_seamod that is a modification of conkyrc_lunatico wich is modification of conkyrc_orange # # conkyrc_orange: http://gnome-look.org/content/show.php?content=137503&forumpage=0 # conkyrc_lunatico: http://gnome-look.org/content/show.php?content=142884 # conkyrc_seamod: http://www.deviantart.com/art/Conky-Seamod-v0-1-283461046 # conkyrc_mentor: http://www.internauta37...

Android: how to manually set the network via terminal

If we want manually set the network in Android, for example 2G or 3G, then we can use a simple command via the terminal or via adb. For the Motorola Stock Rom we can use this command: am broadcast -a com.android.phone.CHANGE_NETWORK_MODE --ei networkMode *VALUE* For the AOSP Rom we can use this command: am broadcast -a com.android.internal.telephony.MODIFY_NETWORK_MODE --ei networkMode *VALUE*...