Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi. I have a user relationship called "chatlist" that does not require approval. This never gets added to the roster, because dxmpp_user_relationships() has a switch only for 'approve' and 'remove'. In this case, for my two-way relationship that does not require approval the $op is 'request'.
To fix this, it should have a $op for 'request', so the final function looks like this:
function dxmpp_user_relationships($op, &$relationship) {
switch ($op) {
case 'approve':
dxmpp_roster_add($relationship->requester_id, $relationship->requestee_id);
break;
case 'request':
if ($relationship->type->requires_approval == 0) {
dxmpp_roster_add($relationship->requester_id, $relationship->requestee_id);
}
break;
case 'remove':
dxmpp_roster_remove($relationship->requester_id, $relationship->requestee_id);
break;
}
}
I can roll a patch if you like, but it's 5 lines so I figured it might be easier just to paste it in.
Comments
Comment #1
rjbrown99 CreditAttribution: rjbrown99 commentedIt's sort of a patch, so I'll change the status.
Comment #2
darklrd CreditAttribution: darklrd commentedHey rjbrown99,
Thanks for the code. It has been committed to the dev.