Would it be possible to add support for role based follow-ups? On a site with both retail and wholesale customers, the client wishes to send different follow-ups to each.

CommentFileSizeAuthor
#1 uc_followup.module.patch2.02 KBDanGarthwaite

Comments

DanGarthwaite’s picture

Status: Active » Needs review
StatusFileSize
new2.02 KB

The real issue here is inflexibility of the mega_query. I wrote a patch that allows modules to customize it.

With this patch the following function in a custom module will exclude users with role id = 5:

/*
 * Implements uc_followup_mega_query_alter
 */
function client_uc_followup_mega_query_alter( &$sql ) {
    $sql['JOIN'][] = 'LEFT OUTER JOIN users_roles ON o.uid = users_roles.uid';
    $sql['WHERE'][] = 'AND users_roles != 5 -- exclude wholesalers';
}
m.stenta’s picture

Status: Needs review » Needs work

The mega query code has changed since this patch was posted. I am definitely interested in exploring the possibility of allowing the query to be altered via a hook, though. I think that would make it easier to extend the functionality of this module, without packing more code into it for everyone.

JonM’s picture

Issue summary: View changes

Any update on this with current version?