AF (and soon APK) allows other modules to add variables to the "author pane" via hook. I initially took the easy route by simply writing the integration myself and included the code in AF/APK. As I get more and more requests to integrate module X, I realized this was a bad approach and am starting the process to get the hooks into the individual contrib modules.

All I need from you is to either drop the attached files into your module directories (remove the .txt that uploading requires) or take the functions out of them and put it in your module files. Both methods work, just choose the one that works best from you. If you aren't willing to do either, please let me know.

For more information, see Adding variables to the author pane

Thanks,

Michelle

Comments

litwol’s picture

How urgent is this ? I would like to release beta/rc with upgrade path before opening up other module integrations. mind you that beta/rc is pretty close.

michelle’s picture

Well, it's been removed from AF in the dev so as of the next alpha, which should be within a week, people will have to manually add this file to privatemsg. It's up to you when you add it. It's just a simple file drop in so it's not horrible for users to have to do. I just wanted to get the ball rolling because I'd like the transition to be complete by the time I release 1.0, hopefully in November some time.

Thanks,

Michelle

litwol’s picture

Status: Active » Needs work

We should have a sub-module that offers integrations between various projects. or maybe a folder such as /extras/.

I am not really sure what is the best course of action. Original plan was to keep privatemsg as minimal as possible and have separate modules that offer specific functionality, such as that integration with AF/APK.

for now i imagine 2 options
1) have /extras/ folder inside privatemsg folder where we would drop various files.
2) have pm_integrations module as part of the privatemsg project. that module will life specifically for offering integrations between privatemsg and other projects.

lets brainstorm.

michelle’s picture

I guess it depends. Do you expect privatemsg is going to want to integrate with many other modules? If it's only AF/APK that you're going to integrate with, then it seems like a lot of fuss over a very small function. In fact, the function could be made a lot smaller if you made an API function something like:

function privatmsg_get_link($account1, $account2) {
  // check if $account1 has access to send $account2 a message and that $account2 is accepting them. If so, fill in $link with a relative link. If not, leave it empty.

  return $link;
}

Then it just becomes:

function privatemsg_preprocess_author_pane(&$variables) {
  global $user;
   
  $link = privatmsg_get_link($user, $variables['account']);

  if ($link) {
    $variables['privatemsg'] = 
      l(theme('image', "$variables['image_path']/private-message.png", 
              t('Send private message'), t('Send private message'), NULL, TRUE), $link, array(), NULL, NULL, FALSE, TRUE); 
       
    $variables['privatemsg_link'] = l(t('Send PM'), $link);
   }
}

Just off the top of my head... No checking for typos.

At any rate, like I said on IRC, you can stick the function wherever you want. If you don't stick it anywhere at all, then your users will have to add it to your module themselves if they want to have privatemsg functionality added to their forums and user profiles.

Michelle

berdir’s picture

As there was already a request to add a privatemsg send link to nodes and comments (#327925: Send new message link on comments and nodes), I think it would make sense to add such a function to the (currently being in planing) privatemsg API.

litwol’s picture

Indeed. there are a lot of places where we can offer pmsg integrations. i think we should move it into a sub module pm_integrations or something.

naheemsays’s picture

Are there many places/modules that would integrate into privatemsg?

To me it seems like too much work for little gain to have a whole other integration module.

litwol’s picture

We already have integration with user profile, i would happily move that into an integrations dedicated module. today we need to integrate with APK/AF. tomorrow we'll need to integrate with something else ?

we will need to add at least node + comments integrations at some point.

If its still not enough, we could place these files somewhere in /extras/ folder.

naheemsays’s picture

Lets cross that bridge when we get there.

We seems to be refactoring our code a lot anyway.

michelle’s picture

AF/APK doesn't care where the hook lives as long as it's accessable. It just needs to go somewhere because, as of the alpha I released last night, privatemsg no longer works with AF without users having to hack the privatemsg module to add the hook themselves.

Michelle

litwol’s picture

alright then. lets focus on apk/af only for now. are the files ready to be commited _as is_ ?

michelle’s picture

Yes, I pulled those files out of alpha 13 where they were working fine. You should be able to just drop the file into your project directory or pull the hook out of the file and put it whereever you want. For D6, it's just the normal template preprocess function handled by core. For D5, AF emulates the D6 theme system to grab the preprocesses.

Michelle

litwol’s picture

d5 version has been commited to DRUPAL-5 branch. d6 is yet to be done.

arcane’s picture

Hi Litwol,

This code is not in the 5.x-3.0 version of the code correct? Is this in head, I downloaded it but didn't see the code. Can you clarify?

Thanks

litwol’s picture

its in the 5.3-dev, thats where i committed it.

arcane’s picture

Thanks, I will give it a try.

naheemsays’s picture

WIll the file also be dropped in for Drupal 6?

michelle’s picture

nbz - Yes, but people on this thread are reporting that the user titles function I'm using doesn't work in D6. If that function has changed, I'll need to make a new file for D6.

Michelle

michelle’s picture

Erm... #18 was supposed to go on the user titles issue. Not sure if it's me that got confused or Drupal. LOL! Probably had more than one open in tabs.

Edit: Actually, maybe it was supposed to be in answer to #17 but I was just mixing issues up. So, um, to answer #17, yes, unless litwol changes the function it uses.

Michelle

litwol’s picture

Status: Needs work » Fixed

I've committed this to 6-dev. thanks.

samuelet’s picture

This patch does not seem to be committed in 5-3-dev, but in 5-dev, and any archive of it is avaiable.
Please, could you commit in 5-3 too?

Status: Fixed » Closed (fixed)

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

michelle’s picture

Title: Advanced Forum and Advanced Profile Kit integration » Author Pane integration
Status: Closed (fixed) » Active
StatusFileSize
new1.09 KB

Re-opening this since I've just been made aware the 5.x branch never got the file. I am attaching the version that is in use on my 5.x site with privatemsg 5.x-3.0.

Michelle

michelle’s picture

Title: Author Pane integration » Privatemsg integration
Project: Privatemsg » Author Pane
Status: Active » Reviewed & tested by the community

Pulling this back to my queue since litwol decided not to add it after all so it needs to go in AP.

Michelle

naheemsays’s picture

Version: 6.x-1.x-dev » 5.x-1.x-dev

I assume that this is only for 5.x as it was added for privatemsg 6.x-dev

michelle’s picture

Oops, yes, good catch, nbz.

Michelle

michelle’s picture

Status: Reviewed & tested by the community » Fixed

Ok, committed to Author Pane.

Michelle

Status: Fixed » Closed (fixed)

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