Enable Forum topic activity notification on new member

Post

Posted
Rating:
#5327 (In Topic #1214)
Avatar
Standard member
supertramp4 is in the usergroup ‘Fan in action’
Hi
Could anyone give me some php coding snipits as to how at automatically enable the "Forum topic activity" email notification setting when a new member joins.

Currently its disabled but the nature of our group and the skill set means that is proving changing for quite a few peopleto change it themselves. and this would really help everyone involved.

Many Thanks
Chris
Online now: No Back to the top

Post

Posted
Rating:
#5330
Avatar
Site director
Chris Graham is in the usergroup ‘Administrators’
Hi,

I didn't test it, but try this sources_custom/hooks/systems/upon_query/auto_notifications.php:

Code

<?php

class Hook_upon_query_auto_notifications
{
    public function run_post($ob, $query, $max, $start, $fail_ok, $get_insert_id, $ret)
    {
        if (isset($GLOBALS['FORUM_DB']) && strpos($query, 'INTO ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_members') !== false) {
            require_code('notifications');
            enable_notifications('cns_topic', null, $ret);
        }
    }
}

Last edit: by Chris Graham



Become a fan of Composr on Facebook or add me as a friend. Add me on on Twitter. Follow me on Minds (where I am most active). 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.
Online now: No Back to the top

Post

Posted
Rating:
#5331
Avatar
Site director
Chris Graham is in the usergroup ‘Administrators’
I imagine you could also do a pure MySQL solution, using triggers:
MySQL :: MySQL 5.7 Reference Manual :: 23.3.1 Trigger Syntax and Examples


Become a fan of Composr on Facebook or add me as a friend. Add me on on Twitter. Follow me on Minds (where I am most active). 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.
Online now: No Back to the top

Post

Posted
Rating:
#5334
Avatar
Standard member
supertramp4 is in the usergroup ‘Fan in action’
Hi Chris,
Your auto_notifications.php code worked first time 
I would have never worked out to put it in that directory !!

Sincere thanks
Chris
 
Online now: No Back to the top
1 guest and 0 members have just viewed this.

Statistics

Users online:

ManojSree, Salman, amit.nigam, John Connor, deepu_ms, Paul D, MVLipwig, Philip, Ennea, Vaiva, 144 guests

Forum statistics:
  • 998 topics, 4,779 posts, 5,608 members
  • Our newest member is pmjobalert
Birthdays:
Back to Top