Snippets - Little bits of code to make you happy
-
SnippetsAdding Gravatars to your site
8 October 2010 | | | Supports v2.4, v2.3
Tweet
Gravatar is a great service that allows you to pull in members profile photos directly from their Gravatar accounts. It's used right here on SSbits and it also part of the Forum module. It's also incredibly easy to integrate into your site!
Continue reading... -
SnippetsSet the Redirect after a successful Member Login
31 May 2010 | | | Supports v2.4, v2.3
TweetThe Member system that comes with SilverStripe offers substantial control over your site's authentication capabilities. It often requires the developer to build out or extend most common functionality to websites. This is great in that you are never "stuck" with the out-of-the-box offerings, but as any SS dev knows you end up with a little bag of Member tricks that gets used across many projects. Presented here is one that I use often.
Continue reading... -
SnippetsHow to access your admin account when you've forgotten the password
22 August 2009 | |
Tweet I managed to forget my admin password and found quite a few ways to unlock an SS install. I originally thought about poking around the database and changing the hashes myself. After reviewing the Security and password encryption code, I would recommend against doing that. SilverStripe uses salted SHA1 encryption which is no fun to try and create yourself. Also you'd have to update multiple tables to get the password changed. Luckily the SS Core team has included multiple features for accomplishing this. The options below assume you have access to your webserver to use some PHP code. Continue reading... -
SnippetsHide pages in Sitetree that a user can't edit
15 September 2009 | | | Supports v2.4, v2.3
Tweet Sometimes you want to hide pages in the Sitetree that members logged into the CMS don't have permission to edit. This is really simple in because they already have a css style applied to them you can just hide that class. You need to include this snippet in your typography.css file so that it is included in the CMS. Continue reading... -
SnippetsCreate and use a Permission code
18 April 2009 | | | Supports v2.4, v2.3
TweetHave you wanted to add an extra permission code that you can add to groups and then use that to test whether a particular user has that permission? Here's how it's done. The permission code it self is added via the Controller class, then you use a permission check anywhere in your site code to check the current user. Like so:
Continue reading...