Vancouver League of Drupallers - Remembering the User (August 2008)
Upcoming SlideShare
Loading in...5
×
 

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

on

  • 2,496 views

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 ...

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.

Statistics

Views

Total Views
2,496
Views on SlideShare
2,465
Embed Views
31

Actions

Likes
0
Downloads
13
Comments
0

2 Embeds 31

http://www.weebly.com 30
http://m.gaajinaglaasu.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

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

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