There are loads of modules that can do this for you, but why to install one more module if you can do this with one string of code? The best thing is that approach below does a redirection even if you login from user login block.


Just put the following code into your custom module:

/**
 * Implements hook_user_login().
 */
function module_name_user_login(&$edit, $account) {
  // Don't redirect on password reset.
  $current_menu_item = menu_get_item();
  if ($current_menu_item['path'] == 'user/reset/%/%/%') {
    return;
  }
  // Redirect user to profile page after the login.
  $_GET['destination'] = 'user';
}

You can find this snippet at dropbucket.org here: http://dropbucket.org/node/746
UPDATE 03/08/2013: Added several lines to prevent redirection during password reset.

I often get emails from beginner Drupal developers asking "Where to learn PHP for Drupal or Drupal PHP?". Actually, "Drupal PHP" is an interesting term, that in the language of beginners means "how to learn writing custom modules and do customizations and understand Drupal internals" that equals to learning and understanding Drupal API.

"Woa, what a long title", you must say. Yes it is and it deserves that for sure. But at first, please answer this question: "How many times you've been forced to work on client's server, because of the fact that there are services, that work only with remote server's localhost and can't be exposed to the outer world?". It could be a case with SOAP server or DB (in my case it was MSSQL) which accepts connections only from remote server's localhost.

While working with Migrate and Migrate 2.6 beta 1 I stumbled upon several undocumented "surprises" which are hopefully going to be documented, but so far, you can spend lots of time trying to figure out what may be wrong. Here's roundup of my findings:

1. There is one correct way of registering migrations and handlers

You should do this in hook_migrate_info(), your register code may look like this:

When you import data with Migrate (http://drupal.org/project/migrate) it is nice to have ability to update already imported data if source has changed. To track updated data Migrate uses highwater marks (more on this: http://drupal.org/node/1223936). Highwater mark is a column of a source data which has timestamp of the last data change. However, the problem with highwater mark is that you don't always have such "time tracking" enabled on source's page.

Hi everyone, hope some of you had/having a great time at DrupalCon Portland. Since I could go I decided to do something useful and apply to Dropbucket Drupal Snippets Repository some new ideas I had in my mind. Long story short, last night I rolled out an update which brought the follwing:

"How to find form id in Drupal" is one of the most popular questions, especially for the beginners.

More experienced developers know that to find form id you need to either look into the DOM source code or to create your own hook_form_alter() function like this:

function YOUR_MODULE_NAME_form_alter(&$form, &$form_state, $form_id) {
  dpm($form_id);
}

On 13th - 14th of April 2013 in Wrocław (c'mon, pronounce it, you can: vrɒtswəf) will be held the second in history Polish Drupal Camp (http://dcwroc.pl/). Drupal scene in Poland is still relativelly small, but for sure is very promissing. Three years ago I moved to Poland and almost no one I met knew a thing about Drupal. Today Drupal is pretty much visible here, with big projects based on Drupal (including the official website of Polish Prime Minister) and increasing demand for the talent the number of which is still scarse.

Yes, you read it right! Now you can create personal lists of Drupal snippets at Dropbucket.org - Drupal snippets repository. It turned out that we already have loads of great snippets at the website and there challenge have appeared: how to group these snippets in some convenient way? So for example, you found five cool snippets about theming and you could add them to your bookmarks, but later, you can lose track of them because you're constantly adding other snippets to your bookmarks and sooner or later you can simply get lost in your bookmarks feed.

Today I want to share with you 8 great Drupal snippets that blew my mind. I found these browsing Dropbucket.org - Drupal snippets repository. There are lots of cool Drupal snippets being shared and stored at dropbucket.org but I found these to be the most new and interesting to me. I do really wish I knew about before. But Drupal is full of surprises and there are loads of tricks which don't know about, even if you've spent lots of years working with The Big Drop :) Okay, let's start. Snippets aren't sorted in any order of preference:

Pages

Subscribe to TimOnWeb RSS