Prettyscripts

Yii: Double database table prefix error in yii-user-management

Important note: this applies to yii-user-management extension V0.7. This probably have already been fixed but not yet released. This is a quick fix if you don’t want to download the trunk. If database prefix has been defined in config file, when accessing something in the module, eg Yii::app()->user->hasRole(), the following error is encountered: The table…

Continue Reading »

Symfony: Hacking sfDoctrineActAsSignablePlugin to allow updated and created by specific user

I’m using sfDoctrineActAsSignablePlugin (V1.0.0) to audit record creation and updates. ie fields created_by and updated_by are automatically created and updated. This is perfect when running from browsers. But when running as command line such as loading initial data (via symfony doc:build –all –and-load) or customized task to import data, the fields are set to null….

Continue Reading »

Symfony: sfDoctrineGuardPlugin and Customizing User Profile

sfDoctrineGuardPlugin provides basic authentication. sf_guard_user table only contains minimal fields to make this feature work. All other user relevant information such as name, birthday, contact numbers etc require a new table sf_guard_user_profile that works with this. However at the moment user profile setup is poorly documented from the official plugin page.

Ubuntu: Add user

There are 2 commands to add user: useradd and adduser. (The commands could be the same for other Linux.) adduser is easier to use. It prompts for relevant information. To allow new user to run sudo, run: usermod -G admin <username>