How to add class to menu tabs or hide menu tabs in drupal

    Put this function in template.php of your theme file of drupal

    function <themename>_menu_local_task($link, $active = FALSE) {
    $testlink = trim(strip_tags($link));
        if (
    $testlink == 'Find Experts') {
    '<li style="display:none;">'. $link ."</li>\n";
        else {
    '<li '. ($active ? 'class="active" ' : '') .'>'. $link ."</li>\n";


    Fetching latest node for particular vocabulary Single node per term

    SELECT nid
    FROM node n
    SELECT max( tn.nid ) AS nids
    FROM term_node tn
    INNER JOIN term_data td
    WHERE td.tid = tn.tid
    AND td.vid =1
    GROUP BY tn.tid
    ) t ON n.nid = t.nids
    ORDER BY n.created

    How to use LIKE in db_query drupal

    You can user LIKE in db_query in drupal using following way:
    Generally you use %s in db_query in drupal but with like you have to use %%s So a demo query with like looks like this in drupal:
    ('select name from {my_table} where name like "%%%s%"', $name);


    How to integrate vbulletin with drupal

    To integrate vbulleting with drupal use following module


    It supports upto vbulletin 3.8

    If you have to integrate vbulletin 4 download the patched module below

    How to create or update node via custom code in drupal

    To create custom node in drupal via code follow the steps:
    = new stdClass();
    $node->type = 'job'; //Content Type of node
    $node->status = 1;
    $node->created = time();
    $node->changed = time();
    $node->title = "Custom Node";
    $node->body = "this is test job description";
    //In case of cck fields $node->job_company[0]['value'] = "Test"; like this

    To update custom node in drupal via code follow the steps:

    How to get base base path in jquery via drupal

    To get base path in jquery from drupal is a simple process you can do this in following way
    //In a custom module create a hook_init()
    function testcustom_init() {
    //this will add base path to drupal object
    drupal_add_js( array( 'basepath' => base_path() ), 'setting' );

    To access base path in jquery you can simply use:
      var path = Drupal.settings.basepath;

    How to specify enctype in drupal form

    enctype in drupal form is specified where we have to upload files or media In drupal form you can specify in following way
    function resumeupload_test_form() {
    $form['field_resume'] = array(
    '#type' => 'file',
    '#title' => t('CV Uploader'),
    '#required' => TRUE,
    '#size' => 22,
    $form['upload'] = array(
    '#type' => 'submit',
    '#value' => t('Upload'),

    //This is how enctype is specified
    $form['#attributes'] = array('enctype' => "multipart/form-data");


    How to add base path in drupal

    Base path in drupal can be added by using base_path() function You can do this in following way

    = base_path() . path_to_theme() .'/images/test.png';

    //$imagepath gives the path to the image in you drupal theme images folder

    echo '<img src="'. $imagepath .'" alt="test image" title ="test image">';

    To include css and javascript in template files from theme
    <link href="<?php print base_path(). path_to_theme();
    /css/styles.css" rel="stylesheet" type="text/css" />

    User login