The following will switch the users theme to pushbutton. You could use this code to change the users theme based on any logic you like.
<?php
global $user;
user_save($user, array('theme' => 'pushbutton'));
?>
Some modules require others to have executed before they can function correctly. I have come accross an example where this is important. We run drupal ecommerce and have written a streamline payment gateway. Part of this module sends transacation data to Google Analytics. This code is dependant upon the Google Analytics Module.
I found that the Analytics module was executing after my Streamline module. In order to fix this I discovered the ability to assign weights to modules just like menus. This allows control over when they execute, lower numbers get triggered first.