Remembering the User A few simple things you can do to enhance the Drupal experience for your users
Introduction <ul><li>Hello my name is Oliver Walker </li></ul><ul><li>Using Drupal for a year or two </li></ul><ul><li>Dev...
Who am I enhancing it for? <ul><li>My ‘user group’ might not be your ‘user group’ </li></ul><ul><li>Lots of different type...
So who then?  <ul><li>1 - 3 people who ‘administer’ </li></ul><ul><ul><li>And by administer I mean… </li></ul></ul><ul><li...
4 things… …I have done to improve the experience of drupal for the users defined previously.
#1) Menu Settings <ul><li>Ordering Pages with the Menu System: </li></ul><ul><ul><li>Default </li></ul></ul><ul><ul><li>In...
#1) How to: <ul><li>If you don’t want to write your own module!.. </li></ul><ul><li>Go: Admin > Site Building > Menus > Se...
#1) Links and Resources <ul><li>Some resources </li></ul><ul><ul><li>http://drupal.org/node/270273 </li></ul></ul>
#2) User Profile Page <ul><li>Consider the sites and the users  </li></ul><ul><ul><li>No social media (buddy lists, alerts...
#2) User Profile Page - D5 code: <ul><li>/*** USER PAGE ***/ </li></ul><ul><li>function _phptemplate_variables($hook, $var...
#2) User Profile Page - D6 <ul><li>Just create the template files </li></ul><ul><ul><li>user-profile.tpl.php </li></ul></u...
#2) User Profile Page <ul><li>You can then theme the new template files as you would any other template file: </li></ul><u...
#2) Links and Resources <ul><li>“ Add Blocks to your User Profile page in Drupal 5 and 6” </li></ul><ul><ul><li>http://ste...
#3) Content authoring forms <ul><li>Sometimes Content authoring form can get long. </li></ul><ul><li>Theme the form so tha...
#3) Content Authoring forms <ul><li>You can go a long way with just css. </li></ul><ul><li>Creating specific template file...
#3) Content Authoring forms - D5 <ul><li>/*** ADD NEW ***/ </li></ul><ul><li>if ((arg(0) == 'node') && (arg(1) == 'add')){...
#3) Content Authoring Forms - D6 <ul><li>… and remember to clear the cache! </li></ul>function  yourThemeName _theme(){ re...
node- yourNodeType -edit.tpl.php <ul><li>drupal_render($form[‘title’]) </li></ul><ul><ul><li>Will render the form title </...
#3) You can also alter default form values <ul><li>For example </li></ul><ul><ul><li>Number of rows in a textarea </li></u...
#3) Drupal 5 - form value overrride <ul><li>/** </li></ul><ul><li>* add </li></ul><ul><li>*/ </li></ul><ul><li>if ((arg(0)...
#3) Drupal 6 - form value override <ul><li>function vwtheme_preprocess_listing_node_form(&$vars) { </li></ul><ul><li>$vars...
#3) Links and Resources <ul><li>http://www.drupal.org/101092 </li></ul><ul><li>Lullabot tutorial (modifying forms in gener...
#4) Video Content as bonus to README <ul><li>Readme files are important  </li></ul><ul><li>Who doesn’t like to watch video...
Upcoming SlideShare
Loading in …5
×

Vancouver League of Drupallers - Remembering the User (August 2008)

1,535 views
1,507 views

Published on

Slides from a presentation I gave at the August 2008 meeting of the Vancouver Group of Drupallers (http://groups.drupal.org/vancouver) which covers 4 simple ways to enhance drupal for users of your drupal websites.

N.B. I have removed screenshots and video unfortunately, but the code and links are there.

Published in: Business, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,535
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
15
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Vancouver League of Drupallers - Remembering the User (August 2008)

  1. 1. Remembering the User A few simple things you can do to enhance the Drupal experience for your users
  2. 2. Introduction <ul><li>Hello my name is Oliver Walker </li></ul><ul><li>Using Drupal for a year or two </li></ul><ul><li>Develop websites for small businesses </li></ul><ul><ul><li>http://www.ventureweb.net </li></ul></ul><ul><li>Front end developer/themer </li></ul><ul><ul><li>Themeing </li></ul></ul><ul><ul><li>Build Small ‘helper’ modules </li></ul></ul>
  3. 3. Who am I enhancing it for? <ul><li>My ‘user group’ might not be your ‘user group’ </li></ul><ul><li>Lots of different types of drupal users </li></ul><ul><ul><li>Module Developers </li></ul></ul><ul><ul><li>Site Administrators </li></ul></ul><ul><ul><li>Content Writers </li></ul></ul><ul><ul><li>People who leave comments </li></ul></ul><ul><ul><li>People who just look at your website </li></ul></ul><ul><ul><li>… and more… </li></ul></ul>
  4. 4. So who then? <ul><li>1 - 3 people who ‘administer’ </li></ul><ul><ul><li>And by administer I mean… </li></ul></ul><ul><li>Change content anywhere from daily to weekly </li></ul><ul><ul><li>Add/edit content </li></ul></ul><ul><ul><li>Moderate comments </li></ul></ul><ul><ul><li>Moderate revisions </li></ul></ul><ul><ul><li>Basic user administration </li></ul></ul><ul><li>Business areas </li></ul><ul><ul><li>(Local) Government </li></ul></ul><ul><ul><li>Tourism Industry </li></ul></ul><ul><ul><li>Small Business </li></ul></ul>
  5. 5. 4 things… …I have done to improve the experience of drupal for the users defined previously.
  6. 6. #1) Menu Settings <ul><li>Ordering Pages with the Menu System: </li></ul><ul><ul><li>Default </li></ul></ul><ul><ul><li>Intuitive </li></ul></ul><ul><li>Drawbacks: </li></ul><ul><ul><li>Menu Settings on content authoring form has all the links in there </li></ul></ul><ul><ul><li>Have to grant ‘administer menus’ permissions </li></ul></ul>
  7. 7. #1) How to: <ul><li>If you don’t want to write your own module!.. </li></ul><ul><li>Go: Admin > Site Building > Menus > Settings </li></ul><ul><ul><li>Drupal 6 </li></ul></ul><ul><ul><ul><li>“ Default Menu for content” </li></ul></ul></ul><ul><ul><li>Drupal 5: </li></ul></ul><ul><ul><ul><li>“ Content authoring form settings” </li></ul></ul></ul><ul><li>However </li></ul><ul><ul><li>Drupal 5 restricts access totally </li></ul></ul><ul><ul><li>Drupal 6 defines initial ‘starting point’ </li></ul></ul>
  8. 8. #1) Links and Resources <ul><li>Some resources </li></ul><ul><ul><li>http://drupal.org/node/270273 </li></ul></ul>
  9. 9. #2) User Profile Page <ul><li>Consider the sites and the users </li></ul><ul><ul><li>No social media (buddy lists, alerts, favorites etc.) </li></ul></ul><ul><ul><li>What does the user page have on it? </li></ul></ul><ul><ul><ul><li>“ Member for x days…” </li></ul></ul></ul><ul><ul><li>Can it be more usable? </li></ul></ul><ul><li>Blocks, custom layouts to add useful content e.g. </li></ul><ul><ul><li>Links to create content </li></ul></ul><ul><ul><ul><li>(copy node_add() from node.module) </li></ul></ul></ul><ul><ul><li>Lists of user’s content </li></ul></ul><ul><ul><li>Comments requiring administration </li></ul></ul><ul><ul><li>Revisions that need approval </li></ul></ul>
  10. 10. #2) User Profile Page - D5 code: <ul><li>/*** USER PAGE ***/ </li></ul><ul><li>function _phptemplate_variables($hook, $vars) { </li></ul><ul><li>$vars = array(); </li></ul><ul><li>if ($hook == 'page') { </li></ul><ul><li>global $user; </li></ul><ul><li>if (arg(0) == 'user' && arg(1) == $user->name){ </li></ul><ul><li>$suggestions[] = ’page-user'; </li></ul><ul><li>$vars['template_files'] = $suggestions; </li></ul><ul><li>} </li></ul><ul><li>} </li></ul><ul><li>return $vars; </li></ul><ul><li>} </li></ul><ul><li>/*** USER PAGE CONTENT ***/ </li></ul><ul><li>function phptemplate_user_profile($user, $fields = array()) { </li></ul><ul><li>return _phptemplate_callback('user-profile, array('user' => $user, 'fields' => $fields)); </li></ul><ul><li>} </li></ul>Add to your template.php file
  11. 11. #2) User Profile Page - D6 <ul><li>Just create the template files </li></ul><ul><ul><li>user-profile.tpl.php </li></ul></ul><ul><ul><li>page-user.tpl.php </li></ul></ul><ul><li>… and remember to clear the cache! </li></ul><ul><ul><li>Admin > Site configuration > Performance </li></ul></ul><ul><ul><ul><li>http://ww.example.com/admin/settings/performance </li></ul></ul></ul><ul><ul><li>or use Devel Module </li></ul></ul>
  12. 12. #2) User Profile Page <ul><li>You can then theme the new template files as you would any other template file: </li></ul><ul><ul><li>user-profile.tpl.php </li></ul></ul><ul><ul><li>page-user.tpl.php </li></ul></ul>
  13. 13. #2) Links and Resources <ul><li>“ Add Blocks to your User Profile page in Drupal 5 and 6” </li></ul><ul><ul><li>http://stevekrueger.com/ </li></ul></ul><ul><li>http://drupal.org/node/35728 </li></ul>
  14. 14. #3) Content authoring forms <ul><li>Sometimes Content authoring form can get long. </li></ul><ul><li>Theme the form so that, for example, it: </li></ul><ul><ul><li>Looks more like the node itself </li></ul></ul><ul><ul><li>Provides further instruction to the user </li></ul></ul><ul><ul><li>Looks like an administrative theme </li></ul></ul>
  15. 15. #3) Content Authoring forms <ul><li>You can go a long way with just css. </li></ul><ul><li>Creating specific template files gives you full control </li></ul><ul><ul><li>Better use of space </li></ul></ul><ul><ul><li>Add extra help text, links for user assistance etc. </li></ul></ul><ul><ul><li>Whatever you can think of </li></ul></ul>
  16. 16. #3) Content Authoring forms - D5 <ul><li>/*** ADD NEW ***/ </li></ul><ul><li>if ((arg(0) == 'node') && (arg(1) == 'add')){ </li></ul><ul><li>if(arg(2) == ’ yourNodeType '){ </li></ul><ul><li>function phptemplate_node_form($form) { </li></ul><ul><li>return _phptemplate_callback('node- yourNodeType -edit', array('user' => $user, 'form' => $form)); </li></ul><ul><li>} </li></ul><ul><li>} </li></ul><ul><li>} </li></ul><ul><li>/*** EDIT EXISTING ***/ </li></ul><ul><li>if ((arg(0) == 'node') && (arg(2) == 'edit')){ </li></ul><ul><li>$node = node_load(array('nid' => arg(1))); </li></ul><ul><li>if($node->type == ' yourNodeType '){ </li></ul><ul><li>function phptemplate_node_form($form) { </li></ul><ul><li>return _phptemplate_callback('node- yourNodeType -edit', array('user' => $user, 'form' => $form)); </li></ul><ul><li>} </li></ul><ul><li>} </li></ul><ul><li>} </li></ul>Add to your template.php file
  17. 17. #3) Content Authoring Forms - D6 <ul><li>… and remember to clear the cache! </li></ul>function yourThemeName _theme(){ return array( ’ yourNodeType _node_form' => array( 'arguments' => array('form' => NULL), 'template' => 'node- yourNodeType -edit', ), ); } Add to your template.php file
  18. 18. node- yourNodeType -edit.tpl.php <ul><li>drupal_render($form[‘title’]) </li></ul><ul><ul><li>Will render the form title </li></ul></ul><ul><li>drupal_render($form[‘field_xxxxx’]) </li></ul><ul><ul><li>Will render field_xxxxx </li></ul></ul><ul><li>drupal_render($form) </li></ul><ul><ul><li>Will render the form </li></ul></ul><ul><ul><li>Will render what is remaining of the form after other fields have been rendered </li></ul></ul><ul><li>How do I find out what form values there are for me to render? </li></ul><ul><ul><li>print ‘<pre>’; </li></ul></ul><ul><ul><li>print_r($form); </li></ul></ul><ul><ul><li>print ‘</pre>’; </li></ul></ul>
  19. 19. #3) You can also alter default form values <ul><li>For example </li></ul><ul><ul><li>Number of rows in a textarea </li></ul></ul><ul><ul><li>Size of a specific text field </li></ul></ul><ul><ul><li>Making things collapsible or not </li></ul></ul><ul><ul><li>Value of a button (submit, edit, delete) </li></ul></ul><ul><ul><li>Remove a form component altogether. </li></ul></ul>
  20. 20. #3) Drupal 5 - form value overrride <ul><li>/** </li></ul><ul><li>* add </li></ul><ul><li>*/ </li></ul><ul><li>if ((arg(0) == 'node') && (arg(1) == 'add')){ </li></ul><ul><li>if(arg(2) == 'listing'){ </li></ul><ul><li>function phptemplate_node_form($form) { </li></ul><ul><li>$form['body_filter']['body']['#rows'] = 30; </li></ul><ul><li>$form['field_sq_foot'][0]['value']['#size'] = 5; </li></ul><ul><li>$form['preview']['#value'] = “Preview the listing”; </li></ul><ul><li>$form['submit']['#value'] = Create!&quot;; </li></ul><ul><li>unset($form['menu']); </li></ul><ul><li>return _phptemplate_callback('node-listing-edit', array('user' => $user, 'form' => $form)); </li></ul><ul><li>… </li></ul>Add to your template.php file
  21. 21. #3) Drupal 6 - form value override <ul><li>function vwtheme_preprocess_listing_node_form(&$vars) { </li></ul><ul><li>$vars['form']['buttons']['submit']['#value'] = &quot;Cowabunga&quot;; </li></ul><ul><li>$vars['form'][ 'field_sq_foot'][0]['value']['#size'] = 5; </li></ul><ul><li>… </li></ul><ul><li>… </li></ul><ul><li>} </li></ul>Add to your template.php file … and remember to clear the cache!
  22. 22. #3) Links and Resources <ul><li>http://www.drupal.org/101092 </li></ul><ul><li>Lullabot tutorial (modifying forms in general) </li></ul><ul><ul><li>Covers how to alter using a module and hook_form_alter </li></ul></ul><ul><ul><li>http://www.lullabot.com/articles/modifying-forms-5-and-6 </li></ul></ul><ul><li>Template suggestions </li></ul><ul><ul><li>http://drupal.org/node/223440 </li></ul></ul>
  23. 23. #4) Video Content as bonus to README <ul><li>Readme files are important </li></ul><ul><li>Who doesn’t like to watch video! </li></ul><ul><li>Tailored video makes people feel warm and special </li></ul><ul><li>Easy to make </li></ul><ul><li>Screen capture software </li></ul><ul><ul><li>e.g. iShowU @ shineywhitebox.com for $20 US </li></ul></ul><ul><li>Product Placement as a possible revenue stream?? </li></ul>

×