Log in to WordPress without admin credentials!

I found this answer here (http://wordpress.stackexchange.com/a/166375/10099) and thought I’d reiterate since it may come in handy if you are developing and don’t want to deal with managing login information.

function my_autologin() {
    if (!is_user_logged_in()) {
        $uid = 'autologinuser';
        $user = get_userdatabylogin( $uid );
        wp_set_auth_cookie($user->ID);
        wp_set_current_user($user->ID);
        do_action('wp_login', $user_login);  // optional
    }
}
add_action('init','my_autologin');

Enjoy.

Managing dependencies with Composer Manager

Prerequisites:

  • Drupal 8
  • Composer

Use Case:

  • You want to add dependencies to your custom module using composer update at the root of your site directory.
  • Updating Drupal core removes any custom dependencies added to the root composer.json, potentially breaking any modules that require them.

Quick run-down:

First, download composer manager to your site’s modules directory and run the init.php command to register the ‘drupal-update’ command. This command is what will look through your module’s composer.json files and update the main composer.json file at your site’s docroot.

cd mysiteroot
drush dl composer_manager
php modules/composer_manager/scripts/init.php
composer drupal-update
In your sites directory, add a composer.json file and make sure you have both the name and requirements:
{
  "name": "drupal/mymodule",
  "require": {
    "mailchimp/mailchimp": "2.0.6"
  }
}

Now, run composer drupal-update again and you should see your dependencies in the vendor directory.

See also:
https://bojanz.wordpress.com/2015/09/18/d8-composer-definitive-intro/
https://www.drupal.org/node/2405811