HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


How to disable all notifications for user with script?

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#111774 (In Topic #22462)
TQ
Avatar

Honoured member

Hi Folks,

I run a very aggressive firewall system on my server so it's necessary for me to read all the failure notifications to make sure I'm not inadvertently blocking legitimate mail from reaching members.

As a by-product of this I get to see which members have either blocked the sites mail as spam, have used a disposable email service I don't yet have in my block list or have other issues with their mail provider.

I want to disable all notifications for these members whilst I wait for them to log in and read a PM I leave for them so that I can concentrate on any issues I have created with the firewall.

I thought I'd got it cracked with this:

Code

SET @member:='15874';
update ocp_notifications_enabled
SET l_setting = 0
WHERE l_member_id = @member;
UPDATE ocp_f_members
SET m_auto_monitor_contrib_content = 0
WHERE id =  @member;
... but this is far from complete.

Could someone tell me where I could find in the database all the other, missing notifications so that I can achieve the desired result?

TQ
Back to the top
 
Posted
Rating:
#111775
Avatar

The issue is that things will default if there are no notification settings for the user yet. You'd need to write some SQL to copy the settings of a user who has explicitly declared to have no notifications to the other member's ID.

You could also use SU to turn off notifications on their profile settings manually.


Become a fan of Composr on Facebook or add me as a friend. Add me on on Twitter. Support me on Patreon
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about Composr whenever you see the opportunity or support me on Patreon.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying Composr on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#111776
TQ
Avatar

Honoured member

Hi Chris,

Thanks for the rapid response.

I want to create a quick php script that will allow me to use either the username, ID or email address to change the notifications in one quick hit.

Would it therefore be best for me to create a dummy account, set all the notification on, then off, then go to the ocp_notifications_enabled table to find what records to add/set then ADD/UPDATE them for the appropriate user.

Sounds like a lot of new entries in an already big table or is there a better way?

My next stop will be to see if I can disable all the default notifications (I'm assuming it can be done) and invite new members in the Welcome message to subscribe to their chosen subjects but it won't help for the almost 30K existing members (presumably).

TQ
Back to the top
 
Posted
Rating:
#111778
Avatar

Your technique suggestion - yes. I wouldn't worry about the row quantity, it's not going to take up many MBs I think.

Default notification setting - that's not yet a feature I'm afraid. It's on the tracker.


Become a fan of Composr on Facebook or add me as a friend. Add me on on Twitter. Support me on Patreon
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about Composr whenever you see the opportunity or support me on Patreon.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying Composr on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#111781
TQ
Avatar

Honoured member

Again, thank you for the rapid response.

As to the technique, thanks for the confirmation. I always worry I'm making a mountain out of a mole hill due to my lack of core knowledge.

Table size in itself wasn't my concern, I was just thinking of site performance.

I know it's not like-for-like but my stats table is 57Mb with 180K rows, my notifications table is <7Mb but with 108K rows.

The stats have grown to that size because I've increased the retention from 7 to 30 days to catch multi-members on the same IP but it makes a noticeable reduction in site performance. If it didn't, I'd increase it to 3 or even 6 months.

Obviously, there are other factors in play but I ponder the thought that more rows = slower results.

BTW, that is not a question that begs an answer, it's just me rambling on!

Thanks again for your help Chris, I really do appreciate it.

TQ
Back to the top
 
Posted
Rating:
#111782
Avatar

Table indexing should mean for any particular member it can immediately locate the notification rows relating to that member, or for any notification type it can immediately locate the members with it.


Become a fan of Composr on Facebook or add me as a friend. Add me on on Twitter. Support me on Patreon
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about Composr whenever you see the opportunity or support me on Patreon.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying Composr on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
There are too many online users to list.
Control functions:

Quick reply   Contract

Your name:
Your message: