code
Simple permissions for uploads per node type
Simple bit of Drupal module code from yesterday: permissions are provided for each node type which can have attachments, providing a more granular permission set based on node type. Then, we alter any node add/edit forms and set the #access property for the attachments part of the form based on these new permissions.
Check the code out after the break, hope its of some use somewhere. Does anyone have any thoughts on Cheers to those who commented, I've modified the snippet accordingly.unsetting form elements like this? Is it a wise thing to do, or is there a better way?
Listing authenticated users without roles
Sometimes we'd like to list users who have registered with a Drupal site, but haven't been placed into any proper roles yet via subscriptions, purchases, membership approval or whatever.
Try this join query to get started:
SELECT users.uid, name, created, access, login, status FROM {users} LEFT OUTER JOIN {users_roles} ON users.uid = users_roles.uid WHERE users_roles.uid IS NULL AND users.uid != 0
Embedding Views in PHP snippets with Views 2
Just a quickie - embedding views in PHP snippets etc. Sometimes blocks or panels don't quite cut the mustard and we need to directly insert a view via some PHP.
I started off here - the method I've used before to achieve this. There's another howto on Innovating Tomorrow. However, views_build_view, and indeed theme_view, are both no longer part of Views...
After a bit of searching I found mention of a new function; its also mentioned in the Views 2 documentation (work in progress).
So, the resulting PHP is wonderfully simple:
print views_embed_view($view_name, $display_id = 'default');
I was tearing my beard out, so I hope this helps someone.
Some tweaks for a Drupal WoW guild site
The Tempest is was a World of Warcraft guild site built initially on Drupal 4.7 and recently upgraded to Drupal 5. It provides guild membership management via user accounts and roles, forums with public and private access, raid listings with sign-ups and other groovy stuff like private messaging, image galleries and a links/resources directory.
For managing raids and sign-ups we use a CCK type called 'raid' which includes fields for:
- Date using the Date API;
- Instance as a drop-down list (see the attached instance_list.txt for the values we use);
- Notes for anything else, eg what the goals of the run are.
A slighty tweaked Sign Up module allows guild members to sign-up for raid nodes. We also use the Calendar module along with trusty Views to provide both an Upcoming Raids List and a Raids Calendar.
Event Removal module
Event Removal is a small module to handle old events - site admins can choose whether to demote posts from front page, unpublish or even delete them. There are 4.7.x and 5.x versions available below.
Being used on two development sites, so there may be issues. If anyone's interested I'll get this on drupal.org - if you try it in the meantime, comments are welcome here.
Forum Block module
The result of this afternoon's module emergency. A recent client ran into problems with some block PHP snippets we'd written, which were admittedly written very specifically to work with the client's site and that alone. The inherent weakness in this approach was soon apparent - a few tweaks to the site post-project completion, and the snippets fall on their arses.
So here is Forum Block module, which provides a single block allowing users to post new forum topics to administrator specified forums. Its a damn sight more generic that my original snippets approach, and should work on any site with forum and taxonomy modules enabled.
Its simple, but I hope somebody may find it useful. If anyone shows interest, I'll get it submitted to Drupal projects and CVS. In the meantime, if you have any comments or problems please comment here!
articles
latest comments
latest tweets
- Wise words heard at dental hospital: 'I hate dentists, they're so in your face.' — 1 week 2 days ago
- anyone recommend any decent find/hire a freelance designer type sites? — 2 weeks 3 days ago
- pleased with Ubuntu 8.10 on his crappy Dell 'top: http://tinyurl.com/5upsg5 — 3 weeks 3 days ago
- worried why the Ubuntu 8.10 beta installer insists on crashing at 29% — 4 weeks 1 day ago
- has one year of non-digital TV left. — 4 weeks 1 day ago

Mark Boulton Design: Drupal.org, Design Iterations, and Designing in the open
Plus de 20 endroits où trouver de superbes wallpapers | Cerium's blog
Open editing is here to stay
Pringles are not crisps
From The Mouths Of Highly-Paid TV Presenters...















