Category Archives: Drupal

Add your own custom user permissions in Drupal 7

Say you created a module that has a page that only certain user roles should be able to access. If you're not using Panels/Page Manager (which can limit per user role) and you're using your own hook_menu item, you'll need to come up with your own permission that will show up on /admin/people/permissions. ...
Read more

Using db_select with conditional statements in Drupal 7

While the debate never ends about using db_select versus db_query...some say db_select is slower and db_query should be used for simple queries, but there are obvious advantages to db_select with its extenders and much more. Whatever your decision, here is one case where db_select is super nice. Instead of building the query string in a variable...
Read more

Using the Services module in Drupal 7 to create a REST API

Adding an API to your Drupal site doesn't have to be difficult, well...not too difficult. Using the Services module removes a lot of the work needed and sets you up for an easy implementation. Its especially nice with its hooks and it outputs everything in json format and handles error messaging. I won't get...
Read more

Redirect a form after its submitted using Drupal 7

You created a form or want to redirect one of Drupal's form to another page based on a value/logic, you want to use hook_form_alter() to add your own submit function that runs when the form is submitted. You will be able to see the submitted form values and redirect as needed. Its a...
Read more