Anclan Quebro
asked 7 years ago

Thank you so much for your plugin!
I really need to set up the "follow" option as default. I basically want the users to always receive email notifications. If they don’t want to receive any notifications, they just have to click on "unfollow".

Can you please tell how to do that?
Thanks!

2 Answers
Allen
answered 7 years ago

@Anclan Quebro: Hi mate, i can help you do that for your new questions in the future.In order to resolve this problem, my idea is that when an user or some one submit a question and after it has been created, all user will become follower to that question.Here is my guide:
First , you have to open actions.php file like by link: dw-question-answer\inc\actions.php
And then you add a new function to the file:

function dwqa_force_user_follow( $new_question ) {
    $args = array('orderby' => 'display_name');
    $user_query = new WP_User_Query( $args );
    $r = $user_query->get_results();
    if (!empty($r)) {
        foreach ($r as $user) {
            add_post_meta( $new_question, '_dwqa_followers', $user->ID );
        }
    }
}

after that go find a function name : dwqa_insert_question() at line 438.and then in that function go to line 467, after the code update_post_meta( $new_question, '_dwqa_votes', 0 ); , you add these code
dwqa_force_user_follow($new_question);

That’s all, hope this help. Glad.

Anclan Quebro
answered 7 years ago

THANKS SO MUCH!!!
THAT IS WHAT I WANTED!

Powered by DW Question & Answer Pro