I've installed author pane and advanced forum.
Then enabled core contact modul, but the link to contact didnot appear. I try to install Private message and that one function normal.

I've not made any chance to templates file.

What can I check or uncheck to get it working?

Thank you for answer.

Comments

petr illek’s picture

Bump.

jbova’s picture

User Contact in Author Pane

The Drupal 7 Contact module no longer sets $account->contact. Instead, the array key $account->data['contact'] should be checked. This will be set to either 0 (disabled) or 1 (enabled). Here is the code to change to get this working. I will post a diff in the next message.

--- author_pane.orig/modules/contact.author-pane.inc    2011-03-10 18:27:24.000000000 -0500
+++ author_pane/modules/contact.author-pane.inc 2011-09-04 02:12:50.000000000 -0400
@@ -20,7 +20,7 @@
 
   // If the account has the contact form on, and the account isn't the viewing
   // user, and neither the account nor the viewer are anonymous.
-  if ((!empty($account->contact)) && ($account_id != $user->uid) && ($user->uid != 0) && ($account_id != 0)) {
+  if ($account->data['contact'] && ($account_id != $user->uid) && ($user->uid != 0) && ($account_id != 0)) {
     $variables['contact'] = l('<span>' . t('Email') . '</span>', "user/$account_id/contact", array('attributes' => array('class' => 'author-pane-link'), 'html' => TRUE));
   }
 }

Private Messages in Author Pane

You said you were going to try this. I have this module installed and it works perfectly with the Author Pane module.

User Location in Author Pane

Check out the file:
author_pane/modules/location.author-pane.inc

Currently, it sets the variable as follows:

$location = location_display($settings, $account->locations);
$variables['location_user_location'] = $location['#value'];

The new location module does not return a '#value' key from the location_display function. You can change this to '#markup' to get the full markup of the location, as follows:

$variables['location_user_location'] = $location['#markup'];

Otherwise, this can be customized like so, to only display the first locations city and province/state.

$location = $account->locations[0];
$variables['location_user_location'] = $location['city'] . ', ' . $location['province'];

I would recommend doing this with a THEME_preprocess_HOOK function in your theme's template.php file. First, copy the funtion location_preprocess_author_pane from the file author_pane/modules/location.author-pane.inc to your theme's template.php file. Then rename the funtion to MYTHEME_preprocess_author_pane.

Here is my example:
File: sites/all/themes/MYTHEME/template.php

function blackfin_preprocess_author_pane(&$variables) {
  // Check if this preprocess needs to be run given who's calling it.
  if (!author_pane_run_preprocess('location', $variables['caller'])) {
    return;
  }

  $account_id = $variables['account']->uid;
  if ($account_id != 0) {
    $account = $variables['account'];
    if (function_exists('location_display') && variable_get('location_display_location', 1) && isset($account->location) ) {
      $settings = variable_get('location_settings_user', array());
      $location = $account->location;
      $variables['location_user_location'] = $location['city'] . ', ' . $location['province'];
    }
  }
}

Note, that I don't load $account->locations, since I only want one, and $account->location will return this. I also removed the following checks from the if statements: isset($account->locations) && count($account->locations)

Instead, I only check for isset($account->location).

Lastly, you should probably have copied the file author_pane/author-pane.tpl.php to your theme's templates folder. So, copy sites/all/modules/author_pane/author-pane.tpl.php to sites/all/themes/MYTHEME/templates/author-pane.tpl.php. This is the file you should be modifying to customize the author pane display. So, I chose to change mine to show a label "Location" for the location. Here is the diff from mine to the original:

--- modules/author_pane/author-pane.tpl.php     2011-03-10 18:27:24.000000000 -0500
+++ themes/MYTHEME/templates/author-pane.tpl.php       2011-09-04 00:19:10.000000000 -0400
@@ -119,7 +119,7 @@
       <?php /* Location */ ?>
       <?php if (!empty($location_user_location)): ?>
         <div class="author-pane-line author-location">
-          <?php print $location_user_location;  ?>
+          <span class="author-pane-label"><?php print t('Location'); ?>:</span> <?php print $location_user_location; ?>
         </div>
       <?php endif; ?>

Note, per issue #1111962: can not overwrite advanced-forum.naked.author-pane.tpl.php in theme, if you are using the Advanced Forum module, then you will need to name your template file advanced-forum-author-pane.tpl.php. I keep both an author-pane.tpl.php and advanced-forum-author-pane.tpl.php, which are identical in my case.

If you want, you can use the Advanced Forum chosen style's Author Pane template file as your starting point. For example, if you use the Naked style of Advanced Forum, then you can copy the file from modules/advanced_forum/styles/naked/advanced-forum.naked.author-pane.tpl.php to sites/all/themes/MYTHEME/templates/advanced-forum-author-pane.tpl.php and edit the resulting file.

Good luck!

jbova’s picture

Here is the diff for the file author_pane/modules/contact.author-pane.inc to work with D7.

michelle’s picture

Thanks for this. I'll get the Contact module stuff fixed. Location won't be fixed but I can't discuss why at this point, sorry.

Michelle

michelle’s picture

Status: Active » Needs review
Scyther’s picture

Status: Needs review » Fixed

Contact integration is fixed and has been commited a few days ago. Please report if there is any problem with that. I had not read this issue until now, so I did not mention any of you guys in that commit. Sorry for that. But thanks a lot for the work and I will add you in the changelog and in the release notes.

Location integration is removed because it is unsupported for now. It maybe will be back later on, but after a more stable release for Drupal 7 then.

jbova’s picture

Thanks for the fix. You refer to a more stable release for Drupal 7 for Location integration. Which module are you referring to, Author Pane or Location? Given the current state of the Location module, I'm guessing you are referring to Location.

Scyther’s picture

Until at least a beta is out for AP and Location, I will not work on getting Location integration back, if I decides to support Location in the D7 version. So I actually was referring to both modules.

Status: Fixed » Closed (fixed)

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