Summary: Displaying styled dreamwidth user and community links
Version: 2012-09-19
License: GPL2+
Prerequisites: V2.0+
Status: Stable
Categories: Markup
Users: (view? / edit)

Questions answered by this recipe

How can I display a link to a Dreamwidth user or community? All sections are optional, you can remove those that do not apply to your recipe, and add new ones.


Displaying styled dreamwidth user and community links.

Dreamwidth (a clone of LiveJournal) provides markup to display users and communities on external sites in a fashion similar to the way they appear on the site. This recipe enables a simple way to embed the dreamwidth markup in a wiki page.


Insert the following into your local/config.php file:

/*  Copyright (c) 2012-2015, Tamara Temple <tamouse@gmail.com>. 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published
    by the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version. See pmwiki.php for full details
    and lack of warranty.


function dw_user_link($params='')

				 'alt'=>'[personal profile]'
				      'alt'=>'[community profile]'
  $DWLinkFmt = "<span style='white-space: nowrap;'><a href='http://\$DWName.dreamwidth.org/profile'><img src='http://www.dreamwidth.org/img/silk/identity/\$DWImage' alt='\$DWAlt ' width='\$DWWidth' height='\$DWHeight' style='vertical-align: text-bottom; border: 0; padding-right: 1px;' /></a><a href='http://\$DWName.dreamwidth.org/'><b>\$DWName</b></a></span>";
  $args = ParseArgs($params);
  if (isset($args[''])) {
      // non-parameterized arguments, i.e. (:dw-user name [type]:)
      $args['name'] = $args[''][0];
      $args['type'] = (isset($args[''][1]))?$args[''][1]:$defaults['type'];
  $args = array_merge($defaults,$args);
  $replacements = array();
  $replacements['$DWName'] = $args['name'];
  $replacements['$DWImage'] = $DWOptions[$args['type']]['image'];
  $replacements['$DWWidth'] = $DWOptions[$args['type']]['width'];
  $replacements['$DWHeight'] = $DWOptions[$args['type']]['height'];
  $replacements['$DWAlt'] = $DWOptions[$args['type']]['alt'];
  $return_text = str_replace(array_keys($replacements),array_values($replacements),$DWLinkFmt);
  return Keep($return_text);


None to speak of.


Insert the following markup into your wiki page to display the dreamwidth user:

(:dw-user "name":)

If you want to insert a community name instead of a user name, use:

(:dw-user "name" community:)

Extended forms

The following extended forms are also available:

(:dw-user name="name" type=user:)


(:dw-user name="name" type=community:)


This recipe can be modified to use other LJ or LJ clone's markup if desired.

Change log / Release notes

If the recipe has multiple releases, then release notes can be placed here. Note that it's often easier for people to work with "release dates" instead of "version numbers".

See also



See discussion at DreamWidthUserLink-Talk?

User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.