Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 442649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T21:05:33+00:00 2026-05-12T21:05:33+00:00

I am using Drupal 6.x, I installed successfully Juitter http://drupal.org/project/juitter which is doing exactly

  • 0

I am using Drupal 6.x, I installed successfully

Juitter
http://drupal.org/project/juitter

which is doing exactly what my users need to do, that is Searching Twitter.

But to do so they have to navigate to the specific page where the Juitter module is invoked which is something like:

____example.com/juitter

and THEN they have to type a query and hit search to have a beautiful AJAXed live search results page.

What if I want a simple text field in another page, let’s say the HOME page:
_____example.com/

from where a user can type their query in a “Search Twitter” input field and being taken to something like

____example.com/juitter/searched-query-here

and the correspondent Juitter page with results?

If you have a better approach than this, would you be so kind to advice me?

Many thanks.

Q.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T21:05:34+00:00Added an answer on May 12, 2026 at 9:05 pm

    Interesting module/functionality – and an obvious missing feature 😉

    I played a bit with it in a local testing instance and was able to get a working result using the following approach:

    1. Add functionality to prepopulate the search box on the ‘juitter’ page with search terms from the URL, if present. In the modules juitter_page() function (in ‘juitter.module’), replace this line (137):

      $search_phrase = t(variable_get('juitter_search_text', 'Search twitter:'));
      

      with this code:

      $preset = func_get_args();
      if (!empty($preset)) {
        $search_phrase = implode(' ', $preset);
      }
      else {
        $search_phrase = t(variable_get('juitter_search_text', 'Search twitter:'));
      }
      

      With this change, a call to ‘juitter/foo’ will bring up the standard juitter page, but with ‘foo’ in the search box instead of the default search text. Calling ‘juitter/foo/bar’ will result in ‘foo bar’ in the search box, while a call to ‘juitter’ alone will behave as before.

    2. Adjust javascript to autosubmit the search, if it got prepopulated by the change above. In the modules ‘juitter.js’ file, remove the following line (22):

      juitter.get_tweets($('#juitterTabsWrapper a:first').attr('id'));
      

      and add this code at the end of the Drupal.behaviors.Juitter function (under the ‘end of search box comment’ – /* /Search box */, line 53) instead:

      /* Trigger default. Use search term, if not default, otherwise use first tab */
      if (juitter.search && $(".juitterSearch").val()!=Drupal.t(juitter.search.text)) {
        $("#juitterSearch").submit();
      }
      else {
        juitter.get_tweets($('#juitterTabsWrapper a:first').attr('id'));
      }
      

      This will check if the default search box text has been replaced – if yes, it will submit the search, otherwise it will behave as before and search according to the default tabs configuration.

    3. With these changes in place, all that’s needed is a search form similar to Drupals search block, redirecting to the juitter URL with the search terms turned into path elements. Add the following at the end of the juitter.module file:

      /**
       * Implementation of hook_block().
       */
      function juitter_block($op = 'list', $delta = 0) {
        if ($op == 'list') {
          $blocks[0]['info'] = t('Juitter search form');
          // Not worth caching.
          $blocks[0]['cache'] = BLOCK_NO_CACHE;
          return $blocks;
        }
        else if ($op == 'view' && user_access('access content')) {
          $block['content'] = drupal_get_form('juitter_search_block_form');
          $block['subject'] = t('Search Twitter');
          return $block;
        }
      }
      
      /**
       * Callback function to generate the juitter search form
       *
       */
      function juitter_search_block_form($form_state) {
        $form['search_terms'] = array(
          '#title' => t('Search Twitter'),
          '#type' => 'textfield',
          '#size' => 15,
          '#default_value' => '',
          '#attributes' => array('title' => t('Enter the terms you wish to search for.')),
        );
        $form['submit'] = array('#type' => 'submit', '#value' => t('Search'));
        $form['#submit'][] = 'juitter_search_block_form_submit';
      
        return $form;
      }
      
      /**
       * Process a juitter search form submission.
       */
      function juitter_search_block_form_submit($form, &$form_state) {
        // The search form relies on control of the redirect destination for its
        // functionality, so we override any static destination set in the request,
        // for example by drupal_access_denied() or drupal_not_found()
        // (see http://drupal.org/node/292565).
        if (isset($_REQUEST['destination'])) {
          unset($_REQUEST['destination']);
        }
        if (isset($_REQUEST['edit']['destination'])) {
          unset($_REQUEST['edit']['destination']);
        }
      
        $form_id = $form['form_id']['#value'];
        $form_state['redirect'] = 'juitter/'. trim($form_state['values']['search_terms']);
      }
      

      This will create a ‘Juitter search form’ block that you can place as you see fit.

    That’s all 😉

    NOTE: Normally I would implement changes like this ‘from outside’ by building a separate module, but since this is already a feature request on the module itself, I edited the modules code directly. I’ll try to roll this into a patch and submit it there. Patch is available here, thanks to theunraveler.

    BTW, I wouldn’t usually code up complete solutions like this for an answer – it’s just that this module got me interested. So as you seem to be a new user here on SO, do not expect this as the norm 😉


    Edit: There is a tiny flaw in this approach, as the module also registers the path ‘juitter/ahah’ for a javascript callback, used from the administration form. So if a user enters ‘ahah’ into the new search box, he will get a useless json encoded form element as a result. The obvious solution to this would be to change the ahah callback path to something else. As a workaround, you could add an escape mechanism when redirecting from the form, undoing the escaping when putting the text in the main search box.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 206k
  • Answers 206k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You can view the contents of an Excel document with… May 12, 2026 at 9:05 pm
  • Editorial Team
    Editorial Team added an answer It doesn't need to be static, but unless it's doing… May 12, 2026 at 9:05 pm
  • Editorial Team
    Editorial Team added an answer The recorder task may be able to do what you… May 12, 2026 at 9:05 pm

Related Questions

I am using Drupal 6.13, Views 6.x-2.6, Voting API 6.x-2.3, Fivestar 6.x-1.18. I have
I am working with a Drupal 6.x system to create exercise / personal training
I know the ideal place to ask is at . I posted my question
I can not see a first-name or full name field in Drupal's create/edit user
I am using the Drupal 6 module Content Profile to allow using a CCK

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.