After changing the node template to two columns using display suite, I noticed the send author a message link disappeared. I looked in the issue database and were only able to find the code for the 1.2 version which is not longer working. I'm wondering if I can turn the send author a message link to a field and add it to DS.

Comments

xiaomo created an issue. See original summary.

oadaeh’s picture

If you use the Computed Field module, you probably can, although I haven't tried it with DS, so I'm not 100% positive.

xiaomo’s picture

Thank you for your help on this. I may not be doing this right because it doesn't work

I created a computed field and replaced Computed Code (PHP) with the following code. Tried with and without the ?php

// Get user object.
if ($account = menu_get_object('user') ) {
      if ($url = privatemsg_get_link(array($account))) {
        return l(t('contact user'), $url, array('query' => drupal_get_destination()));
      }
}

Nothing shows up when I assign the field to display region.

xiaomo’s picture

With my limited code knowledge, I tried something different and the variable is not concatenating.

$node_author = user_load($node->uid);
$url .=' /messages/new/' .$node_author;
Echo "<a href=$url>privatemsg</a>";

it will only redirect to /message/new

oadaeh’s picture

Based on this:

function privatemsg_new($form, &$form_state, $recipients = '', $subject = '') {

  // Convert recipients to array of user objects.
  $unique = FALSE;
  if (!empty($recipients) && is_string($recipients) || is_int($recipients)) {
    $unique = TRUE;
    $recipients = _privatemsg_generate_user_array($recipients);
  }
  else {
    $recipients = array();
  }

I would say you need something more like this:

  $url .=' /messages/new/' . $node->uid;
  echo "<a href=$url>privatemsg</a>";
ivnish’s picture

Status: Active » Closed (outdated)