Hi,

I've installed Advanced forum, and have it working on my dev site at www.bkks.org.uk/portal/forum. However, I have a few issues and I am looking for help.

I have installed the private message module and link to the code from the forum-thread.tpl.php with the following code

          <div class="author-icons">
             &nbsp; &nbsp; <?php 
               print $online_icon; 
             ?>    
             <a href="http://bkks.org.uk/portal/privatemsg/msgto/<?php print $userid ?>">
                  <img src="http://www.bkks.org.uk/portal/themes/newsflash/images/blue/pm.png">
             </a>
          </div>

I would like to neaten this up

* Replacing hard coded links with a variable such as $site or $template, if they exist

* Check for $user->uid before printing the link, so I do not offer the option of sending yourself a personal message. I have tested for this variable, but it does not seem to be defined - though I'm still quite new so I could well be missing something.

Any help you can give gratefully received!

Gareth

Comments

Michelle’s picture

Status: Active » Fixed

This is in 6.x and will be backported to 5.x soon. If you're in a hurry, this is the code:

  // Send private message
  if (module_exists('privatemsg') && 
     ($account->uid != $user->uid) && 
     user_access('access private messages') && 
     (isset($account->privatemsg_allow) ? $account->privatemsg_allow : 1)) { 
    $variables['privatemsg_icon'] = theme_image(path_to_theme() . '/' . $themedir . "/images/user_comment.png", 'Private Message', 'Private Message', NULL, TRUE);
    $variables['privatemsg_text'] = t('Send PM'); 
    $variables['privatemsg_link'] = 'privatemsg/new/'. $accountid;
    $variables['privatemsg'] = '<div class="privatemsg">' . 
      l($variables['privatemsg_icon'] . ' '  . 
      $variables['privatemsg_text'], $variables['privatemsg_link'],NULL,NULL,NULL,NULL,TRUE) . '</div>';
  } 

Michelle

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

derhasi’s picture

Version: 5.x-1.0-alpha2 » 5.x-1.0-alpha4
Status: Closed (fixed) » Needs review

Hi Michelle,

there's a little code to get fixed for Privatmsg 2.0

at line 262

-  $variables['privatemsg_link'] = 'privatemsg/new/'. $accountid;
+ $variables['privatemsg_link'] = 'privatemsg/msgto/'. $accountid;

So addressee will be set automatically;)

But anyway, thanks for your work!! Great module!

Michelle’s picture

Status: Needs review » Fixed

I'm not going to make this change because that path doesn't work with the official privatemsg module. If you want it for your site, it can easily be changed in the .tpl.

Michelle

Max_Headroom’s picture

Hi Michelle

It works with Privatemsg 5.x-1.8, if that is what you mean with the official module.

Michelle’s picture

No, that version is abandoned. I'm talking about 5.x-2.x.

Michelle

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.