Email a Usergroup - Postet den (1785 Views)
Junior Member
JBaldwin
Innlegg: 137
137
Ok, I have exhausted the SEARCH feature in Snitz looking for the answer to this one.
What would need to be done to email a group using the Usergoups MOD? I really need this one, so if anyone has any ideas it would really be appreciated.<
   
 Sidestørrelse 
Postet den
New Member
brian33433
Innlegg: 60
60
well i don't have the mod installed, but whtever your using to emil your members you can write some code to just add that particular database field, if you past what email mod your using i'll take a look....
Brian
http://nightclubtonight.com<
When it happens after dark, its twice as nice... http://nightclubtonight.com
Postet den
Junior Member
JBaldwin
Innlegg: 137
137
I am using the Email All Users Mod to email the entire forum and I have made changes to that mod already to email selected members (with selected criteria from FORUM_MEMBERS table. I think I would have to do a series of JOINS in the SQL STRING to accomplish what I want, but I do not know enough about JOINS to do so.
admin_pop_mail.txt
The database fields for the USERGROUP MOD that I installed are...
Code:

[CREATE]
USERGROUPS
USERGROUP_ID
USERGROUP_NAME#varchar(100)##
USERGROUP_DESC#memo#NULL#
USERGROUP_TYPE#int##0
AUTOJOIN#int##0
MEM_HIDE#int##0
MOD_HIDE#int##0
[END]
[CREATE] USERGROUP_USERS

USERGROUP_ID#int##
MEMBER_ID#int##
MEMBER_TYPE#int##1
[END]
[CREATE] ALLOWED_USERGROUPS

USERGROUP_ID#int##
FORUM_ID#int##
PERMS#int##0
[END]
[INSERT] CONFIG_NEW
(C_VARIABLE,C_VALUE)#('STRUGVIEW','0')
(C_VARIABLE,C_VALUE)#('STRUGMEMVIEW','0')
(C_VARIABLE,C_VALUE)#('STRUGMODFORUMS','0')
[END]
<
Postet den
Forum Moderator
AnonJr
Innlegg: 5768
5768
The UserGroup MOD includes a function to get an array of Member ID's for a particular group. I don't have it in front of me at the moment, but it might be a starting point.<
Postet den
New Member
brian33433
Innlegg: 60
60
Ok i think you should look in this direction, its kinda tough cuse i don't have the mod installed, but if i get a chance i will look install it on my test server. you may need to create a inc_mail 2

it seems the to key db fields you need to impliment in the strsql are USERGROUPS, USERGROUP_ID, USERGROUP_NAME

change strSql = strSql & " FROM " & strMemberTablePrefix & "USERGROUPS_ID"

basicaly you need the "from" to send to usergroup_id and not member_id

then make changes as so on, let me know if you get anywhere with this, otherwise i'll try to get the mod going on my test server

this should give you a point in the right direction

on the same file or w/ the newsletter mod. if anyone know how to create it so you can email certin members from choosing check boxs would love to do this.
good luck
brian
http://nightclubtonight.com <
When it happens after dark, its twice as nice... http://nightclubtonight.com
Postet den
Junior Member
JBaldwin
Innlegg: 137
137
Ok. I have installed the Usergroups Mod. I want to email a usergroup much like with the "Email All Users" mod, but only to certain usergroups. I took the "Email All Usergroups" mod and tried to alter the SQL Statement. I used a JOIN for the MEMBERS and USERGROUP_USERS tables. The way I have it here:

www.jbaldwin.net/misc/admin_mail_usergroups1.txt

I get this error:

Code:
SELECT FORUM_MEMBERS.*, FORUM_USERGROUP_USERS.* FROM FORUM_MEMBERS LEFT JOIN FORUM_USERGROUP_USERS ON FORUM_MEMBERS.MEMBER_ID=FORUM_USERGROUP_USERS.MEMBER_ID WHERE FORUM_MEMBERS.M_STATUS = 1 AND FORUM_MEMBERS.M_RECEIVE_EMAIL = 1 AND FORUM_USERGROUP_USERS.USERGROUP_ID = 2 

Sending E-Mail

Microsoft VBScript runtime error '800a000d'

Type mismatch: '[string: "Demo"]'

/forum/forum2/admin_pop_mail_usergroups.asp, line 128

It is caused by this section in the code:

Code:
          Select Case Member_Level
Case 1
strMessage = strMessage & "a member of usergroup 1 "
Case 2
strMessage = strMessage & "a member of usergroup 2 "
End Select

Now, if I comment out that section, it says it sends the email, however, I do not receive an EMAIL?? I am hoping this is something simple, but I honestly have no idea....LOL :

Code:
SELECT FORUM_MEMBERS.*, FORUM_USERGROUP_USERS.* FROM FORUM_MEMBERS LEFT JOIN FORUM_USERGROUP_USERS ON FORUM_MEMBERS.MEMBER_ID=FORUM_USERGROUP_USERS.MEMBER_ID WHERE FORUM_MEMBERS.M_STATUS = 1 AND FORUM_MEMBERS.M_RECEIVE_EMAIL = 1 AND FORUM_USERGROUP_USERS.USERGROUP_ID = 2 

Sending E-Mail

Sent 1 E-Mail

Close Window

...and to further add to my confusion, if I add a Response.Write to see what the variables are that the SQL is pulling:

Code:
Response.Write	Member_Name & " --- " & Member_Email & " --- " & Usergroup_ID & "<hr>"

It is pulling out some odd variables, it looks like it is only pulling data from the USERGROUPS_ID table.
Code:
Sending E-Mail

797 (this is actually Member ID) --- 1 (this could be Status, level or...) --- Demo (this is the Member Name)------------------------------------------------

Microsoft VBScript runtime error '800a000d'

Type mismatch: '[string: "Demo"]'

/forum/forum2/admin_pop_mail_usergroups.asp, line 131



Have I thoroughly confused everyone here? I know I've confused myself for SURE! LOL. Put a fork in me, I'm done. <
Postet den
Forum Moderator
AnonJr
Innlegg: 5768
5768
The UserGroup MOD adds a function called "getGroupMembership" that returns a comma-delimited list of either the Group ID's a person belongs to, or a comma-delimited list of Member ID's in a group.
Assuming the GroupID is 2, you could do something like this:
Code:
strMemList = getGroupMembership(2,2) 'The first value is the ID, the second is an indication of if its a group or member id you just passed.

If strMemList <> "" Then
strSQL = "SELECT M.M_EMAIL FROM " & strMemberTablePrefix & "MEMBERS M " & _
"WEHRE M.MEMBER_ID IN (" & strMemList & ") AND M.M_STATUS = 1 AND M.M_RECEIVE_EMAIL = 1"
End If

This should give you a recordset of all the email addresses. I may be missing a few minor details, but this should get you started. smile<
Postet den
Junior Member
JBaldwin
Innlegg: 137
137
my head hurts now. I officially pass the torch to someone with higher ASP skills than mine (which shouldn't be THAT difficult - as mine are minimal at BEST). If I stay on this any further, my laptop will officially become airborne, LOL.
I know how to add items and variables to MEMBERS table and send emails that way, maybe I'll go this route instead of trying to use USERGROUPS. ARGHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH<
Postet den
New Member
brian33433
Innlegg: 60
60
well once again i don't know that mod, but what if you make a duplicate of email all users, and set that up with usergroup_id instead of member_id.
just seems easier then dealing with all new arrays

(just my 2 cents)<
When it happens after dark, its twice as nice... http://nightclubtonight.com
Postet den
Forum Moderator
AnonJr
Innlegg: 5768
5768
Originally posted by brian33433
well once again i don't know that mod, but what if you make a duplicate of email all users, and set that up with usergroup_id instead of member_id.

All that is going to do is get you the array of MemberIDs. That's why I suggested using the bit I posted to get a recordset of e-mail addresses for the people in that usergroup.
If I've got time this weekend I may take a crack at it, but I can't promise anything. Bobby wants the Jesus Joshua 24:15 and Warsong Records sites re-built for the Sept. release of their new CD... it doesn't exactly leave me much spare time.<
Postet den
Junior Member
PPSSWeb
Innlegg: 312
312
The following JOIN seems to work in my minor testing:


strSql = "SELECT M.MEMBER_ID, M.M_Email FROM " & strMemberTablePrefix & "MEMBERS M " &_
"INNER JOIN " & strTablePrefix & "USERGROUP_USERS UM ON M.MEMBER_ID = UM.MEMBER_ID " &_
"WHERE UM.MEMBER_TYPE = 1 AND UM.USERGROUP_ID = " & GroupID & " ORDER BY M.M_NAME"

It is based on the view users section of usergroups.asp

Hope that helps<
Du må legge inn en melding