Viewing 15 replies - 1 through 15 (of 51 total)
  • Plugin Author Asgaros

    (@asgaros)

    Hello Oazar,

    this feature is not planned yet. Maybe I can add it in a future version of the plugin.

    Another possibility would be the addition of an action hook which allows you to add this functionality by your own. Lets see what I can do.

    Thread Starter Oazar

    (@oazar)

    Thanks very much for your fast answer.

    Well I am not a developper myself, of course I can do a few things to edit existing code, but if “adding this functionality on my own ” means writing code ‘from scratch”, sadly enouch I don’t feel up to it unless you tell me exactly what to do… is this what you mean ?? !

    Plugin Author Asgaros

    (@asgaros)

    Maybe I can give you an example. It will be not so difficult, maybe 4-5 lines of code. ??

    Thread Starter Oazar

    (@oazar)

    that would be great !

    Thread Starter Oazar

    (@oazar)

    Hello,

    Any news about these lines of code to add ? Sorry to be back so soon, but I am in a hurry..

    Thanks for your answer

    Plugin Author Asgaros

    (@asgaros)

    No news yet. I have to implement and test other features with a higher priority first.

    I will add a hook for this in 1.0.10

    Plugin Author Asgaros

    (@asgaros)

    Hello Oazar!

    I added some submit hooks to the development version:
    https://github.com/Asgaros/asgaros-forum/commit/56cc13648d023d957573613826caaa3d9a5eeea1

    They will be accessible via your themes functions.php file:

    function after_submit($post_id) {
    	// Your code here ...
    }
    add_action('asgarosforum_after_thread_submit', 'after_submit');
    add_action('asgarosforum_after_post_submit', 'after_submit');
    add_action('asgarosforum_after_edit_submit', 'after_submit');

    The ID allows you to access all fields in the database. This can be used to get information about subject/content/author for example.

    Those kind of information can be used inside your mail if you want. Here is an example on how to send a mail via PHP:
    https://stackoverflow.com/a/5335311/4919483

    So your code in your themes functions.php file code be something like this:

    function after_submit($post_id) {
    	global $wpdb;
    	$post = $wpdb->get_row($wpdb->prepare("SELECT text FROM wp_forum_posts WHERE id = %d;", $post_id));
    	$to      = '[email protected]';
    	$subject = 'New post/thread';
    	$message = "A new post/thread has been created:\r\n".$post->text;
    	$headers = 'From: [email protected]' . "\r\n" .
        'Reply-To: [email protected]' . "\r\n" .
        'X-Mailer: PHP/' . phpversion();
    
    	mail($to, $subject, $message, $headers);
    
    }
    add_action('asgarosforum_after_thread_submit', 'after_submit');
    add_action('asgarosforum_after_post_submit', 'after_submit');
    add_action('asgarosforum_after_edit_submit', 'after_submit');

    Thread Starter Oazar

    (@oazar)

    Hello and thanks so much for writing all this !

    I’ll try to understand it all tomorrow and run some tests. I might have some questions to be able to do it well.
    Thanks !

    Hello,
    strange that the feature is not “top priority”. The plugin looks very sexy and the function will make it a very good alternative to existent solutions.

    yujitamiya

    (@yujitamiya)

    Hello,

    I just installed Asgaros Forum on my website and I have the same problem: I need notifications via email when users post or reply.

    I tried to understand your code above but I’m not so used to insert codes. What should I do exactly?

    Thanks for your help!

    Plugin Author Asgaros

    (@asgaros)

    This code allows you to implement some kind of notification functionality on your own. It sends you an email when something new has been posted into the forums. But it is only an example so it should be used and modified by experienced users only.

    yujitamiya

    (@yujitamiya)

    Ok, I see. But my question is: Do I copy the code as it is, or should I change emails addresses ‘[email protected]’ and ‘[email protected]’ with my admin emails?

    Plugin Author Asgaros

    (@asgaros)

    Of course you have to modify it. It is still an example and I think it needs some kind of modifications before it works correctly.

    yujitamiya

    (@yujitamiya)

    ok, thank you very much

    Really want this future to. Hope it will be included in the plugin soon.
    Just need a checkbox for checking “Notify members on new post/answers” in the forum.

    Or a “Notify me of follow-up posts via email” where every single user can check on/off.

Viewing 15 replies - 1 through 15 (of 51 total)
  • The topic ‘Notifications’ is closed to new replies.