[themes] forward module link themeing

Mark Hope mark at markhope.net
Mon Jan 22 19:20:23 UTC 2007


I'm using the forward module that adds an 'email this page/node type' 
link to nodes.

I'd like to remove the link from the $link output and instead insert 
the code into a block so I can make more of a feature of it.

the code from the module that generates the link:

/**
  * Generate links for pages
  */
function forward_link($type, $node=0, $main=0) {
   if (user_access('access forward') && 
(variable_get('forward_form_type', 'link') == "link") && 
variable_get('forward_display_'. $node->type, '1')){
     $links=array();
     if (($type == 'system')) {
     // URL, page title, func called for page content, arg, 1 = don't 
disp menu
       menu('forward', t('email this page'), 'forward_page', 1, 1);
     }

     // This var is set in the settings section under the 
admin/modules/forward section
     // It shows 'email this $nodetype' or 'email this page'
     $forward_link_type = variable_get('forward_link_type', 0);
     if ($forward_link_type) {
       if ($type == 'comment') {
         $forward_link_type = 'comment';
         $links[] = l(t("email this %type", array('%type' => 
$forward_link_type)), "forward/$node->nid&cid=$node->cid", 
array('title' => t('Forward this page to a friend'), 'class' => 
'forward-page'));
         return $links;
       }
       $forward_link_type = $node->type;
     }
     else $forward_link_type = 'page';

     if (!$main || variable_get('forward_show_on_main', 0)) {
       $links[] = l(t("email this %type", array('%type' => 
$forward_link_type)), "forward/$node->nid", array('title' => t('Forward 
this page to a friend'), 'class' => 'forward-page'));
       return $links;
     }
   }
}

PHP disclaimer "I'm a designer" :-)

The code I have in my block (that doesn't work):
<?php
global $user;
if (user_access('access forward') && variable_get('forward_display_'. 
$node->type, '1')){
print l("Email this page to a friend",'forward/'.$node->nid);
}
?>

This just gives a (/forward) url instead of passing the $nid (eg 
/forward/24)

Regards
Mark



More information about the themes mailing list