Closed (fixed)
Project:
Privatemsg
Version:
6.x-1.x-dev
Component:
Miscellaneous
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
10 Jul 2010 at 04:52 UTC
Updated:
29 Jul 2010 at 13:10 UTC
I was making some changes to Author Pane on Coulee Region Online and realized the integration in Privatemsg is really out of date. Here's an updated version:
// $Id$
/**
* @file
* Provides a preprocess function to integrate Privatemsg with Author Pane.
*/
/**
* Implements hook_preprocess_author_pane().
*/
function privatemsg_preprocess_author_pane(&$variables) {
// Check if this preprocess needs to be run given who's calling it.
if (!author_pane_run_preprocess('privatemsg', $variables['caller'])) {
return;
}
global $user;
$account = $variables['account'];
$account_id = $account->uid;
$account_name = $account->name;
if ($account_id != $user->uid) {
$url = privatemsg_get_link($account);
if (!empty($url)) {
$variables['privatemsg'] = l(t('Send PM') . '<span></span>', $url, array('attributes' => array('class' => 'author-privatemsg-icon', 'title' => t('Send @name a private message', array('@name' => $account_name))), 'html' => TRUE));
}
}
}
/**
* Implementation of hook_author_pane_allow_preprocess_disable().
*/
function privatemsg_author_pane_allow_preprocess_disable() {
return array('privatemsg' => 'Privatemsg');
}
Thanks,
Michelle
Comments
Comment #1
berdirThank you, commited to 7.x-1.x-dev and 6.x-2.x-dev. I replaced "Send PM" with "Send private message" since we don't use PM anywhere else.
Comment #2
michelleThat's fine. I just used "PM" because it's shorter and the words need to fit in cramped spaces but people can always use the t() to change it if they need to.
Thanks for the quick response!
Michelle
Comment #3
michelleI just realized I'm still using 1.x. This hasn't even been tested against 2.x so I don't know if there's any API changes that might affect it. Could you commit against 1.x, please? I realize that's the stable branch but this is a self contained file that only runs in conjunction with Author Pane so I don't see how it could affect the stability of 1.x.
Thanks!
Michelle
Comment #4
berdirSure, commited. I wasn't sure if you've chosen the 2.x branch for a reason but forgot to ask.
Comment #5
berdirComment #6
michelleNo reason, just a goof up. I've got so many modules installed I forget which ones I'm using the cutting edge on. LOL! Not this time. Still on 1.x for now. If you have a moment, could you double check that
$url = privatemsg_get_link($account);is still valid in 2.x? If not, it will need to be changed in the 2.x version. Everything else should be the same provided whatever you change it to still provides the URL.I'll test against 2.x at some point but a quick check may save people troubles if the API changed. :)
Thanks,
Michelle
Comment #7
berdirprivatemsg_get_link() has not changed, so that should be fine.
Comment #8
fugazi commentedHello,
to update 6x-2.x-dev 11.07.2010 I have the error message.
Fatal error: Call to undefined function author_pane_run_preprocess() in sites/all/modules/privatemsg/privatemsg.author-pane.inc on line 14
Thank you very much
Comment #9
michelleShoot, my bad on that. I've had my head in AP 2.x so long I forgot there's still people using 1.x.
This should work but I don't have time to test it right now:
Also, Berdir, if you have a moment could you look at #850474: private message integration doesn't work with the last update ? If the API hasn't changed, I'm not sure what could be causing the problem that user is having.
Sorry for making a mess of this. The code I gave you is working fine on my site so I thought it was safe and I just completely spaced on AP 1.x users. :(
Michelle
Comment #10
junro commentedSubscribe to follow the evolution of the integration :)
Comment #11
berdirCommited to 6.x-1.x and 6.x-2.x. I assume you will only port 2.x to Drupal 7 :)
Comment #12
fugazi commented#9 oh it's wonderful it's all back, thank you ..
Comment #13
michelleCorrect, only AP 2.x will be ported. In fact, AP 1.x is going to be deprecated as soon as I make the change to AF 1.x to work with AP 2.x. But I can't leave it broken for people using the dev of privatemsg in the mean time so thanks for making the change. :)
Michelle
Comment #14
fugazi commented#9 Unfortunately, the link to the icon is no longer given. What I could do Author Pane 6.x-1.1. Thanks
Comment #15
michelleI apologize because I appear to have made a complete mess of this. :( I'm so focused on getting 2.0 out that 1.x completely fell off my radar.
For 1.x users, I suggest replacing the contents of the file with this:
http://drupalcode.org/viewvc/drupal/contributions/modules/privatemsg/pri...
I will work tonight to come up with a solution that works for both branches and test it against both before asking for anything else to be committed.
Michelle
Comment #16
fugazi commentedHi,
Thanks for any tip, it works again. I know how much work goes into such modules. And it is normal that there mistakes. Happen I hope you understood my bad English. I would like in the highest form
thank you for such great modules. Thank you
Comment #17
michelleOk, this is tested against 2.x. I have not tested it against 1.x, yet, because I don't have a site set up running it. If someone using 1.x could test it, that would help out. Otherwise I'll get a 1.x site set up as soon as I can.
Comment #18
fugazi commentedHi, I have tested it and so far everything seeming to work very well. thanks for the quick change.
Comment #19
jcmarco commentedConfirmed, #17 works with author pane 2.x
Comment #20
michelle@Berdir: Ok, it's been tested by other people in both 1.x and 2.x but I've only tested in 2.x. Since I don't currently have a 1.x site set up, it may be a few days or more before I can get to it. I'll let it be your call if you want to commit it based on the other reviews or wait until I can get to it. Again, sorry for making such a mess of this. :(
Michelle
Comment #21
fugazi commentedConfirmed, #17 works with author pane 1.x
Comment #22
michelleI've tested it with AP 1.x as well, now, too. Should be good to go. :)
Michelle
Comment #23
berdirThanks, commited to 6.x-1.x and 6.x-2.x
Comment #24
michelleThanks!
Michelle