News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Setting notifications in bulk mode?

Started by wakewatcher, December 25, 2008, 02:18:05 AM

Previous topic - Next topic

wakewatcher

Maybe its possible but I haven't figure it out.  Seems to me that when I go to 'notifications' it should have a check list of all boards I have permission to visit rather than making me go to each board individually and setting up notifications.  I'm in the process of moving (not converting) my msn group to a smf instance.  It would be nice (and is reasonable) if our users could toggle notifications from one page. Or Better Yet set notifications on for all permitted boards for my primary member group. -thx-
smf 2.0.18

KahneFan

So, you don't want them to only know about replies to post they've made or been in, but all posts?
#eric_on_twit| (video) Creating Themes for SMF | Reset Your Forum
NOTE: No PM's for support please.

wakewatcher

Yes, If I understand your response. As I understand it through 'notifications' you can set it up to notify you by board.  It just seems awkward to go to one page to set up a notification scheme but then have to traipse through all the boards you have permission to view/post in to activate the notification.  Just seemed reasonable (although certainly not critical) that is would be nice to be able to do this from the notification setup page.
smf 2.0.18

wakewatcher

You know it would be nice if you could at least set up notifications by category and not just by board.
smf 2.0.18

greyknight17

Unfortunately, this feature is not built into SMF. It was designed so that if a member wants notification he/she will click on the notify button on the topic or board they want it for.

wakewatcher

Yeah you are right it is unfortunate.  Anyway I wrote a php script to do it at the database level.  One of these days (weeks, months or years) I'll figure out how to make a mod 'package' and offer up my hacks.  But thanks.
smf 2.0.18

greyknight17

Care to share the script with us? I'm sure others will find it helpful. Thanks.

Topic marked as solved.

KahneFan

Even if it's not a mod, you can post the code to the SMF Coding Discussion Board and if it may make it to the Tips and Tricks Board.
#eric_on_twit| (video) Creating Themes for SMF | Reset Your Forum
NOTE: No PM's for support please.

wakewatcher

What and embarrass myself?  :)
Here's the gist of it. (I've got it wrapped by ssi.php and a few other things.) Certainly nothing fancy. I just dug through the tables and these seemed to be the things I had to fiddle with. (Seems to work anyway.)  This list of hard coded board IDs of all the boards that a particular membergroup has access to. The initial version looped through the entire member list but now I just run it when I accept a new member into the group. At some point I'll dig a little deeper and generate the board list from the membergroup id, then a checkbox from the admin panel if I ever get a handle on the mod package stuff. etc.  Anyway certainly not rocket science what I did.  Actually my motivation for this was this is a new forum to replace the MSN groups that are going away and I thought by defaulting certain member groups to be forced (initially) to see all the messages I can easier get some posting momentum.  Seems to be working.

$id = $_POST['id'];
$barray = array(17,1,18,14,3,11,13,12,4,16); // These are the boards that are to be set for automatic notification.
$query = "SELECT id_member, real_name FROM smf2_members WHERE id_member = '$id' AND id_group = '10'";
$results = mysql_query($query,$link);

while($row = mysql_fetch_row($results)){
  $id_member = $row[0];
  $real_name = $row[1];
  mysql_query("UPDATE smf2_members SET notify_types = '1', Notify_regularity = '0' WHERE id_member = '$id_member'") or die(mysql_error());
 
  $result = mysql_query("SELECT id_member FROM smf2_themes WHERE id_member = '$id_member' AND variable = 'auto_notify'" ,$link) or die(mysql_error());
  $cnt = mysql_num_rows($result);
  If($cnt == 0)
    mysql_query("INSERT INTO smf2_themes (id_member, variable, value) VALUES ('$id_member', 'auto_notify', '1')") or die(mysql_error());
   
  foreach ($barray as $v){
  $result = mysql_query("SELECT id_member FROM smf2_log_notify WHERE id_member = '$id_member' AND id_topic = '0' AND id_board = '$v'" ,$link);
  $cnt = mysql_num_rows($result);
  If($cnt > 0)
     continue;
    mysql_query("INSERT INTO smf2_log_notify (id_member, id_board) VALUES ('$id_member', '$v')") or die(mysql_error());
  }
  unset($v);
}
smf 2.0.18

greyknight17

Embarrassed? ;)  We always encourage users to contribute whenever they can especially if it's a common problem that can be solved....even if it's a temporary workaround :)

Thanks for posting the code that worked for you. I'm sure others will find it useful. I'll take a look at it as well and maybe see if I can get it to work for all the boards.

hs4e

#10
Hi guys,

I kinda stumbled upon the same issue some time ago. I desired all of my forum's members to be notified of new topics in any board (didn't need or want also topic level bulk notification since I think it is somehow abusive no matter how small the community served by the smf is). So I succeded in making the necessary modification, which was really a big acquirement for me, a very beginner regarding php and mysql. I promise to very soon attach the working mod (still testing), since I designed everything to work for any forum and not require any php or mysql knowledge.

Whot I wanna ask you is the following: considering the fact that many emails sent by the server implies the risk that it will be regarded as a spamming machine (so in some extreme situations the hosting providers could thus suspend or even cancel the hosting account) is there any chance this kinda modification to be aproved by smf staff and be made known publicly (of course, only along with an explicit warning of all the implications of using such a mod)?

hs4e

so finally finished a sketch of the mod (still need to review some comments - yeah, i like details) and define some strings. i need some feedback please, so here is the package.

greyknight17

I think this might be one of the reasons why this feature was not added to SMF (just my thought). I'm sure that a lot of users don't want to be subscribed to an entire forum receiving all kinds of emails even for topics or boards they are not interested in. But then again on the other hand, there are users who might need this for a forum where they need to know every little update.

Does it allow members to turn it off if needed? You can try submitting it if it's running properly after testing it out. If it gets denied, you can ask why and try to fix any problems needed. I'm sure other users will find this helpful if it works accordingly.

Getting several errors for /Sources/ManageBoards.php and one for /Themes/default/ManageBoards.template.php when I tried to install it on SMF 2.0 beta 4. Can't locate some of those codes in my files. For the template one, there was an additional semi-colon in your code. Was this from a vanilla install? I have a SMF 2.0 test forum setup and it's not modified for the most part....so it should be the original code.

Might want to open up a new topic for this as this one is marked as resolved and we usually don't look at this. Just happened to bump into it again this time ;)  Coding Discussion board is good also if you need help with it.

hs4e

greyknight17, you are completely right, this mod would be completely useless were a bulk notification it is not needed, but i wrote it bearing in mind those forums serving really small communities (say of up to 100 members) where everyone knows everybody in real life and they want to be notified of any move on the forum (this actually transforms the forum in a structured, more complex yahoo group kinda thing or mailing list).

as for testing what i attached before, of course it is not working since i wrote it for my smf instance which is a 1.1.7. if people wanted, when i had some time i (or anybody else interested) could write it again for 2.0.

wakewatcher

err... ummm.  This is the SMF 2.x Support board not the SMF 1.x Support board...   ;)
smf 2.0.18

hs4e

yeah, silly me, i got carried by the discussion  :D

Advertisement: