Sometimes the hook_privatemsg_recipient_type_info callbacks need to know the recipient type name, this happens when you use one callback to handle multiple recipient types (which I think you'll need to integrate with og 7.x-2.x where the group id needs to be paired with group type in order to be useful). I think 'format', 'generate recipients', 'count', 'write callback' already have this info in the $recipient argument, so that leaves 'load' and 'autocomplete'.

CommentFileSizeAuthor
#5 privatemsg-1529394.patch3.55 KBjrao
#1 privatemsg-1529394.patch3.1 KBjrao

Comments

jrao’s picture

StatusFileSize
new3.1 KB

Here's a patch to do this.

berdir’s picture

Status: Active » Needs review
berdir’s picture

Makes sense. Remember to set issues with patches to needs review so that the test bot is triggered.

Status: Needs review » Needs work

The last submitted patch, privatemsg-1529394.patch, failed testing.

jrao’s picture

Status: Needs work » Needs review
StatusFileSize
new3.55 KB

Ok, let's try this again.

berdir’s picture

+++ b/privatemsg.pages.incundefined
@@ -748,7 +748,7 @@ function privatemsg_autocomplete($string) {
     foreach ($types as $name => $type) {
       if (isset($type['autocomplete']) && is_callable($type['autocomplete']) && privatemsg_recipient_access($name, 'write')) {
         $function = $type['autocomplete'];
-        $return = $function($fragment, $names, $remaining);

Nicely shows of the inconsistent naming in the *existing* code. That's something to improve for another issue and another day I guess :)

Looks like the patch doesn't apply anymore, can you do a quick re-roll? I'll try to not let you wait for so long this time.

berdir’s picture

#5: privatemsg-1529394.patch queued for re-testing.

jrao’s picture

Sorry, could you clarify why the patch needs to be re-rolled? I tried it on 7.x-2.x's head, it seems to be working?

berdir’s picture

Status: Needs review » Fixed

Uhm, ignore what I said, I must have been on the wrong branch when I tried to apply the patch. Commited now.

I am trying to start using change records for my contrib projects. Would be great if you create one: http://drupal.org/node/add/changenotice

jrao’s picture

Ok, I'll take a look (haven't used it before), I assume we should group all the issues related to og integration into one change record?

berdir’s picture

Title: Pass in recipient type name to load and autocomplete callback » Change notification for: Pass in recipient type name to load and autocomplete callback
Status: Fixed » Active

No, let's make one specific for this. the og integration module will depend on this feature but it has nothing to do with og integration, other modules will be able to use this as well.

Once you created one, please set the issue to needs review and add the link. Thanks!

jrao’s picture

Title: Change notification for: Pass in recipient type name to load and autocomplete callback » Pass in recipient type name to load and autocomplete callback
Status: Active » Needs review

Ok, change record added.

berdir’s picture

Status: Needs review » Fixed

Thanks.

Status: Fixed » Closed (fixed)

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