[Mediawiki-l] User page formatting

Jim Wilson wilson.jim.r at gmail.com
Tue Aug 7 16:03:50 UTC 2007


> The problem with creating a page then taking them to a view stage is
> that you can get lots of pages created that you really don't want.

In this case, since the page is a user page, it's pretty easy to test
whether it's the user's own page - that way it only gets created when the
person themselves visit their own page for the first time.

-- Jim

On 8/7/07, Dave Sigafoos <davesigafoos at sanmar.com> wrote:
>
> Still has all those nasty 'regular experssions' (I love the term regular
> expressions .. not sure what is so regular about them <G>)
>
> DSig
> David Tod Sigafoos | SANMAR Corporation
> PICK Guy
> 206-770-5585
> davesigafoos at sanmar.com
>
>
>
>
> -----Original Message-----
> From: mediawiki-l-bounces at lists.wikimedia.org
> [mailto:mediawiki-l-bounces at lists.wikimedia.org] On Behalf Of Jim Hu
> Sent: Tuesday, August 07, 2007 6:29
> To: MediaWiki announcements and site admin list
> Subject: Re: [Mediawiki-l] User page formatting
>
> Try this!
>
> <?php
> /*
>   * UserPageOnDemand.php - An extension 'module' for the
> PagesOnDemand extension.
>   * @author Jim Hu (jimhu at tamu.edu)
>   * @version 0.1
>   * @copyright Copyright (C) 2007 Jim Hu
>   * @license The MIT License - http://www.opensource.org/licenses/mit-
> license.php
>   */
>
> if ( ! defined( 'MEDIAWIKI' ) ) die();
>
> # Credits
> $wgExtensionCredits['other'][] = array(
>      'name'=>'UserPageOnDemand',
>      'author'=>'Jim Hu &lt;jimhu at tamu.edu&gt;',
>      'description'=>'Demo for PagesOnDemand mechanism for generating
> User pages from template on demand.',
>      'version'=>'0.1'
> );
>
>
> # Register hooks ('PagesOnDemand' hook is provided by the
> PagesOnDemand extension).
> $wgHooks['PagesOnDemand'][] = 'wfLoadUserPageOnDemand';
>
> /**
> * Loads a demo page if the title matches a particular pattern.
> * @param Title title The Title to check or create.
> */
> function wfLoadUserPageOnDemand( $title, $article ){
>
>         # Short-circuit if $title isn't in the MAIN namespace or doesn't
>
> match the DEMO pattern.
>         if ( $title->getNamespace() != NS_USER) {
>                 return true;
>         }
>      $template = Revision::newFromTitle(Title::makeTitle(NS_TEMPLATE,
> 'User_page_template'));
>      if (! $template){
>         $text = "Can't find template page Template:User_page_template";
>         }else{
>             $text = $template->getText();
>             #strip out noinclude sections
>             $text = preg_replace( '/<noinclude>.*?<\/noinclude>/s', '',
>
> $text );
>         }       # Create the User page's new text - could be more
> complicated, but
> this is just a demo
>
>         # Create the Article, supplying the new text
>         $article = new Article($title);
>         $article->doEdit( $text, 'Create user page from template via
> PagesOnDemand', EDIT_NEW | EDIT_FORCE_BOT );
>
>         # All done (returning false to kill PoD's wfRunHooks stack)
>         return false;
> }
> ?>
>
>
> On Aug 7, 2007, at 6:31 AM, Nancy Dailey wrote:
>
> > Thank you. BoilerplateSelection would work but since it takes the
> > user to an edit page so early in the use of the wiki, it overwhelms
> > them. My experience using wikis inside business organizations is
> > that form is far more important than function to get them to early
> > adopt use of wikis as a productivity/team building tool. I will try
> > to modify PagesOnDemand. Thank you so much for your help! Nancy
> > <snip>
> =====================================
> Jim Hu
> Associate Professor
> Dept. of Biochemistry and Biophysics
> 2128 TAMU
> Texas A&M Univ.
> College Station, TX 77843-2128
> 979-862-4054
>
>
> _______________________________________________
> MediaWiki-l mailing list
> MediaWiki-l at lists.wikimedia.org
> http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>
> _______________________________________________
> MediaWiki-l mailing list
> MediaWiki-l at lists.wikimedia.org
> http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>


More information about the MediaWiki-l mailing list