Send a mail over a linux shell

Installation: $> sudo apt-get install sendmail $> sudo apt-get install mailutils $> sudo apt-get install postfix Send messages using the mail-command To check If  postfix is installed and ready to work on your system, you can try: $> mail info@ask-sheldon.com Subject: TEST TESTETST EOT (Shortcut: ctrl + shift + d) Reconfiguration of postfix on Debian […]

Implement ACL (Access-Control-List) for own Magento modules

The following snippets show how to implement ACL (Access-Control-List) for system configuration fields and main menu entries of your own modules.  It is also shown, how to check the ACL’s in the PHP code of your Module. Implement ACL – Access control for system configuration If you had configured a system configuration (System→Configuration) like this: <?xml […]

Get information about the installed linux distribution, kernel and version

Get the kernel version $> uname -a Example output: Linux bravehartk2-ThinkPad-W520 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux Or: $> uname -r Example output: 3.13.0-32-generic You can even use the following command to get the kernel version. It will also serve you information about the build date and a […]

Delete users in Magento frontend

If you need the possibility to let the users delete their own accounts, you can use the following snippet in a corresponding controller or observer to delete users in frontend: <?php $oCustomer = $this->_getSession()->getCustomer(); if(!$oCustomer->getId()){ Mage::throwException($this->__(‘Cannot load customer!’)); } //lie to mage 😉 // @todo: Check, if there is a better way Mage::register(‘isSecureArea’, true); $oCustomer->delete(); $this->_getSession()->clear(); […]

Image system configuration field

To add an image selector field to your system configuration: <image> <label>Image</label> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>0</show_in_store> <sort_order>70</sort_order> <frontend_type>image</frontend_type> <backend_model>adminhtml/system_config_backend_image</backend_model> <upload_dir config=”system/filesystem/media” scope_info=”1″>customer/responsible_contacts</upload_dir> <base_url type=”media” scope_info=”1″>customer/responsible_contacts</base_url> <show_in_default> <enabled>1</enabled> </show_in_default> </image>

External access to MySQL database

To gain external access to MySQL database (f.e. in PHPSTorm or an external PHPMyAdmin) you can do: GRANT necessary privileges: CREATE USER ‘wdn_live_user’@’%’ IDENTIFIED BY ‘***’; GRANT USAGE ON *.* TO ‘wdn_live_user’@’%’ IDENTIFIED BY ‘***’ WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0; GRANT ALL PRIVILEGES ON `wdn_live`.* TO ‘wdn_live_user’@’%’; If the user already […]