Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

Force email notifications on specific categories or/and announcements

Hey searched around on the forum abit and could only find old topic on this qeustion.

Im looking for a setting to force email notifications to all users when there is a post in a specific category or a post is announced.

Im running a small private community, so i will not be spamming the user if someone would think this.

Running version 2.2.10.3

Comments

  • Options
    hgtonighthgtonight ∞ · New Moderator

    There are a couple ways to do this. I would suggest the following, since it still lets the user disable the notification if they find them annoying.

    You need to:

    1. Figure out the category ID
    2. Figure out the user ids
    3. Insert the appropriate user meta in the GDN_UserMeta table.

    You can find the category ID by inspecting the category table in the db or the dropdown element in the new discussion page. For example, this is the markup generated on this site (vf.org) for the category drop down:

    <select id="Form_CategoryID" name="CategoryID">
      <option value="27">Blog</option>
      <option value="26">Developers</option>
      <option value="32">Tutorials</option>
      <option value="9">Questions</option>
      <option value="23">Feedback</option>
      <option value="24">Localization</option>
    </select>
    

    If I wanted to send a notification to users whenever I post a discussion in the Blog category, I would use the category ID of 27.

    Finding the user IDs is much the same. You can inspect the user table or navigate to the user's profile page. The user id should be in the URL. For example, my user ID here is 38268. Clicking on my avatar will take you to: vanillaforums.org/profile/38268/hgtonight

    Finally, we need to add a record to the UserMeta table. This has to be done via SQL (although a script could be written in any language).

    /*! Email notification for every new discussion in a specific category */
    INSERT INTO `GDN_UserMeta` (`UserID`, `Name`, `Value`) VALUES ('38268', 'Preferences.Email.NewDiscussion.27', '1');
    /*! Popup notification for every new discussion in a specific category */
    INSERT INTO `GDN_UserMeta` (`UserID`, `Name`, `Value`) VALUES ('38268', 'Preferences.Popup.NewDiscussion.27', '1');
    /*! Email notification for every new comment in a specific category */
    INSERT INTO `GDN_UserMeta` (`UserID`, `Name`, `Value`) VALUES ('38268', 'Preferences.Email.NewComment.27', '1');
    /*! Popup notification for every new comment in a specific category */
    INSERT INTO `GDN_UserMeta` (`UserID`, `Name`, `Value`) VALUES ('38268', 'Preferences.Popup.NewComment.27', '1');
    

    The important thing to get from this is you need to supply the user ID and the category ID needs to be the last characters in the Name string.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

Sign In or Register to comment.