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

Mentioning Does Not Send Notification

Wondering if I could get some help. For some reason, when you mention someone it doesn't send a notification email (pop ups do not work either). Would love to have this feature working on my site. Other notifications seem to work correctly.

Not sure where to even begin.

Comments

  • R_JR_J Ex-Fanboy Munich Moderator

    Notifications are tricky.... Finding the cause for this is really hard. Please start by looking at the Activity table in your database (normally it would be called GDN_Activity). Mentioning a user should create a row in that table.

    If you see such entries, the notification doesn't work, if there are no entries, mentioning does not work.

    You can write a plugin which hooks into some of the used events and write some output in a log file (most of the work is done in models and writing debug output to screen for code that runs in the model almost always fails).
    Search for the BeforeNotification event in the CommentModel and the DiscussionModel.
    Search for the InformNotifications event in the notificationscontroller.
    Look through the ActivityModel and -Controller to find other useful events where it might be worth checking what is passed as $sender->EventArguments


    PFAFF
  • PFAFFPFAFF
    edited November 2016


    When I look in the Activity table, I indeed see the Comment activity, but not the Mention activity.

  • R_JR_J Ex-Fanboy Munich Moderator

    The most easiest to fix thing would be if the getMentions() function is not working. Create a file /plugins/wtf/class.wtf.plugin.php

    <?php
    
    $PluginInfo['wtf'] = [
        'Name' => 'WTF?!',
        'Description' => 'Shed some light...',
        'Version' => '0.1'
    ];
    
    class WTFPlugin extends Gdn_Plugin {
        public function vanillaController_wtf_create($sender, $args) {
            $mentionTest = 'Hello @world! Silly @example sentence.';
            ?>
            <div>Simple test if the getMentions function is working. Test string is
                <pre><?= $mentionTest ?></pre>
            </div>
            <div>Result:
                <pre><?= print_r(getMentions($mentionTest), true) ?></pre>
            </div>
            <div>Result should have been
                <pre><?= print_r(['world', 'example'], true) ?></pre>
            </div>
            <div>If the result looks different, either<br>
            a) the file /library/core/functions.general.php is corrupt or<br>
            b) there is a function getMentions() defined somewhere else (perhaps /conf/bootstrap.before.php). Do a full text search in your files for "function getmentions("
            </div>
            <?php
        }
    }
    
    

    After saving, activate it and go to http://www.nerdlouisville.org/discussion/#/vanilla/wtf


  • @R_J , first thanks for your help!

    Second, I added this plugin and activated / ran it, however it returns a blank page.

  • Would that fall under the result looking different? Should I re-upload functions.general.php? Or, try b?

  • R_JR_J Ex-Fanboy Munich Moderator

    It doesn't hurt to do both ;)
    I suspect it gives a blank page because you have an older php version which doesn't support the new array syntax


  • @R_J said:
    It doesn't hurt to do both ;)
    I suspect it gives a blank page because you have an older php version which doesn't support the new array syntax

    I'm using PHP 5.6.15. I'll try the aforementioned items and see if that helps. Thanks!

Sign In or Register to comment.