Ignore:
Timestamp:
02/26/10 16:56:49 (3 years ago)
Author:
nick_ramsay
Message:

[Branch 1.2] Hello Universe 0.8 - bug fix and title/breadcrumbs for added profile page.

Location:
branches/1.2/content/plugins/hello_universe
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/1.2/content/plugins/hello_universe/hello_universe.php

    r1247 r1249  
    33 * name: Hello Universe 
    44 * description: Demonstrates how to make plugins 
    5  * version: 0.7 
     5 * version: 0.8 
    66 * folder: hello_universe 
    77 * class: HelloUniverse 
    8  * hooks: theme_index_top, theme_index_main, theme_index_sidebar, profile_navigation 
     8 * hooks: theme_index_top, theme_index_main, theme_index_sidebar, profile_navigation, breadcrumbs 
    99 * author: Nick Ramsay 
    1010 * authorurl: http://hotarucms.org/member.php?1-Nick 
     
    4646            $h->pageTitle = $h->lang["hello_universe"]; 
    4747        } 
     48         
     49        if ($h->pageName == 'profile_example') 
     50        { 
     51            $user = $h->cage->get->testUsername('user'); 
     52            $h->pageTitle = "Profile Example" .  "[delimiter]" . $user; 
     53            $h->pageType = 'user'; // this setting hides the posts filter bar 
     54             
     55            // create a user object and fill it with user info 
     56            $h->vars['user'] = new UserAuth(); 
     57            $h->vars['user']->getUserBasic($h, 0, $user); 
     58        } 
    4859    } 
    4960     
     
    7182                $user = $h->cage->get->testUsername('user'); 
    7283                if ($user) { 
    73                     // create a user object and fill it with user info 
    74                     $h->vars['user'] = new UserAuth(); 
    75                     $user_info = $h->vars['user']->getUserBasic($h, 0, $user); 
    76                     if ($user_info) { 
     84                    if ($h->vars['user']->id) { 
    7785                        // only show the page if the user exists: 
    78                         $h->pageType = 'user'; 
    7986                        $h->displayTemplate('users_navigation', 'users'); // Displays user navigation from Users plugin 
    8087                        $h->displayTemplate('profile_example'); // Displays the page from this plugin folder 
     
    171178        echo "<li><a href='" . $h->url(array('page'=>'profile_example', 'user'=>$h->vars['user']->name)) . "'>" . $h->lang['hello_universe_profile_example'] . "</a></li>\n"; 
    172179    } 
     180     
     181     
     182    /** 
     183     * FUNCTION #7 
     184     * 
     185     * Breadcrumbs for the profile page 
     186     */ 
     187    public function breadcrumbs($h) 
     188    { 
     189        if ($h->pageName == 'profile_example') { 
     190            $user = $h->cage->get->testUsername('user'); 
     191            return "<a href='" . $h->url(array('user'=>$user)) . "'>" . $user . "</a> &raquo; Profile Example"; 
     192        } 
     193    } 
    173194 
    174195} 
  • branches/1.2/content/plugins/hello_universe/readme.txt

    r1247 r1249  
    1313Changelog 
    1414--------- 
     15v.0.8 2010/02/26 - Nick - Fixes for profile page, title and breadcrumbs 
    1516v.0.7 2010/02/26 - Nick - Demonstration of adding a page to a user profile 
    1617v.0.6 2009/12/28 - Nick - Updates for compatibility with Hotaru 1.0 
  • branches/1.2/content/plugins/hello_universe/templates/profile_example.php

    r1247 r1249  
    3333<p>This is the profile_example.php file in the Hello Universe plugin folder.</p> 
    3434 
    35 <p>The link to this page in the menu was done in Function #6 in hello_universe.php. This page is displayed from the <i>theme_index_main</i> function (Function #2).</p> 
     35<p>The title was set and user info retrieved in the <i>theme_index_top</i> function (Function #1).</p> 
     36<p>The page was displayed from the <i>theme_index_main</i> function (Function #2).</p> 
     37<p>The link to this page in the menu was done in the <i>profile_navigation</i> function (Function #6).</p> 
     38<p>The link to this page in the menu was done in the <i>breadcrumbs</i> function (Function #7).</p> 
     39 
    3640 
    3741<p><a href="<?php echo BASEURL; ?>"><?php echo $h->lang["hello_universe_back_home"]; ?></a></p> 
Note: See TracChangeset for help on using the changeset viewer.