Module

Archived
Forum
(read-only)

Messaging

ExpressionEngine 2, ExpressionEngine 3, ExpressionEngine 4, ExpressionEngine 5, ExpressionEngine 6

Back to this add-on's main page
View Other Add-ons From Yuri Salimovskiy

     

Deleting bulletins

Support Request

tansel
tansel

Hi Yuri,

There are 2 issues I am facing. They are both about “deleting bulletins” and one is an issue of EE (not messaging module), the other is the issue of messaging module.

First (EE) issue.
===============================

(I am writing this to find out if there can be a workaround). Below A & B scenarios are done using the native member templates of EE without the install of messaging module.

Scenario (A) is like that:

1) A super admin publishes a bulletin to only “Members” with member group id=5.
2) This action creates record in exp_member_bulletin_board table and writes 5 to the bulletin_group field.
3) Then, Super Admin can’t delete the bulletin since it does not appear on the view_bulletin page.
4) The only way to make it appear is to manually edit the table and change the field value to 1 so it appears on the view bulletin page available to deletion.

Scenario (B) is like that:

1) A super admin publishes a bulletin to “All Member Groups” while there are 2 member groups with id=1 and id=5.
2) This action creates 2 records in exp_member_bulletin_board table and writes 5 and 1 to the bulletin_group fields of the new records.
3) The “hash” field of both records are identical.
4) Then, Super Admin CAN delete the both bulletins since it appears on the page. Once “delete” button is clicked, action deletes 2 records from the table.

Second (Messaging module) issue.
===============================
Scenario (A) above applies the same. I think this issue is inherited from EE.

Scenario (B): Since delete link attached only one bulletin id to the query string, when delete link is clicked, only the record with bulletin_group=1 is deleted. The record with bulletin_group=5 remains.

Hope I made it clear.
Any help?

Yuri Salimovskiy
# 1
Developer
Yuri Salimovskiy

Try this:
on line 72 of mod.messaging.php replace

$this->EE->db->where('exp_member_bulletin_board.bulletin_group'$this->EE->session->userdata('group_id')); 

with

$this->EE->db->where('(bulletin_group='.$this->EE->session->userdata('group_id').' OR sender_id='.$this->EE->session->userdata('member_id').')'); 

This will show bulletins that the member has sent in addition to those intended for his member group. Not sure this is best approach, but probably will work for you.

And just to make sure you know this: you can set expiration date for bulletin, so there is really no need to delete them, as expired messages will not be shown.

tansel
# 2
tansel

This worked great. Thanks.

tansel
# 3
tansel

Hi Yuri,

On top of your hint, I made the below change in the module:

(1) to enable Super Admins view and delete all bulletins
(2) to enable a member view bulletins sent to him/her and delete only the bulletins created by him/her (if member group is enabled to send bulletins on EE-CP).

if ($this->EE->session->userdata('group_id') == "1")
{$this->EE->db;}
else
{$this->EE->db->where('(bulletin_group='.$this->EE->session->userdata('group_id').' OR sender_id='.$this->EE->session->userdata('member_id').')');