My Version of this MOD

Makes it posble for admin to specify witch type of users may mass PM any usergroup
Also PM users can be a list of usernames, so PM can be sendt to any number of users

Moderator: Moderators

Forum rules
The content in this forum is dated Dec. 21 2005 and can be used as Archive only. This Forum is LOCKED and READ ONLY !

My Version of this MOD

Postby ptalindstrom on Tue 20. Dec, 2005 11:14

I modified Niels’ Mass PM mod to better fit the needs for my site. I told Niels I would not likely have the time to write this up as an official MOD but that I would let people know what I did in case they found it useful and wanted to try it themselves. Also, I can let anyone that is interested have the code – HOWEVER it does have numerous site specific changes that likely would not make it into a generic MOD.

To start with; a bit of a description of what I wanted the Mass PM feature to do:

- display the Group Name in the From field (inbox) when a person receives a PM sent to a Group
- display the Group Name in the To field (sentbox, outbox) for the person sending the group PM
- only display one instance of the “sent” message in the sender’s “Outbox”
    o see below for more detail
- have links for Group Name (in the From field) link to site page for that Group (my site specific)
- anyone can send Group PMs
- but only Admin can select (Niels pulldown menu) the Group to send to
    o in my app a button to send PM to a group is listed on “home page” for that group
    o when selected the To field is filled in with Group Name and is uneditable.


What I did:

DB Changes:
- added group_msgs table
    o group_msg_id number for each group PM
    o the group_id it was sent to
    o msgtxt id (I don’t use this yet)
    - Niels’ mod has multiple copies of group msg text saved – this is not really required
- add group_msg_id field to privmsgs table
    o link to group_msgs table

- when a new group msg is created I add entry to group_msg table and take that number and add it along with msg entry in privmsgs table
    o if a privmsg has a group_msg_id = 0 it is a normal (non-group) PM

Changes in privmsg.php:
- check group_msg_id value in privmsg table to NOT make a copy of sender msg a in the posters sent box
- in sql for Outbox – don’t select group msgs
- in main loop for building folder – insert code to check if one of group msg items was already counted; if it was; skip the rest for that group_msg_id

Changes in groupmsg.php
- when I go to insert a msg – get a new group_msg_id and insert that as well
- neat trick
    o Niels originally “sent” a copy of group msg to the sender (since he is in the group as well)
    o at first I took that out since I didn’t think it made any sense – but then I decided to use it to solve a problem I had with everything to this point
- since I don’t mark msgs as sent when a reader reads his group PM (since I don’t want to get many items in senders SENTBOX) I have the problem of once everyone reads their msg – they are removed from outbox and eventually there would be no record to sender of sending the PM
- to fix this – the copy of msg that is to be sent to sender – I stamp it as going to SENDBOX immediately – this gives me a copy that will persist as readers read their PM

That’s about it.

You can check out my modd’ed mod at my site (www.thesportsconnection.ca) although you will have to register to access (for now; registration is free). If you check it out and it doesn’t seem obvious – “groups” in my world are related to a specific sport.

Other bits:

If you were to check out my code at some point you will see some code specific to location filtering. My site has the concept of “local” groups. Basically my site is related to Sports. There are over 70 sports listed. Each of these sports is a Group (or Community). But my site also covers all of the US and Canada and I have location info for all my registered members. When someone sends a Group PM (lets say to the Baseball Community) it only goes to those people registered in the Baseball Community that are “local” or “close” to the sender.

Basically, without this I would need to maintain about a million “groups” (each city X each sport) – that of course would be silly. So I only have 70 or so groups; but filter everything by an added “location string” to my SQL queries. Very cool.

Cheers,


Peter Lindstrom
CEO - The Sports Connection
Ottawa, ON
Email: peter@thesportsconnection.ca
Web: http://www.thesportsconnection.ca
ptalindstrom
Poster
Poster
 
Posts: 2
Joined: Thu 08. Dec, 2005 08:30

Return to Custom mass PM [2.0.6/EM]

Who is online

Users browsing this forum: No registered users and 1 guest

cron