You can see it here: https://anspress.io/questions/question/user-notification-most-awaited-feature-is-alomst-ready/?show_answer=13790#answer_13790

 

Answer is private, but all others can still see the comments on this answer. Please hide them completely (as there would be no comments)

Hi everybody,

I am using the Anspress user profile in my menu (dropdown menu). I like the style of the dropdown and want to apply this also to another dropdown I have in my main menu. Can somebody may help me to understand where I have to start? Which files do I have to check and which lines are relevant for me? Any help would be really awesome. I am not that experience in WordPress development so a kind of getting things started would be amazing.

Thanks in advance.

 

Best,

Daniel

Hello,

I would like to add Errors or Success messages to the page when users change their informations on their profile page (in addition of ap-notify system). I’ve tried to use this jQuery hook ‘ap_after_ajax’, but it do nothing :

$(document).on('ap_after_ajax', function(e, data) {
  // It do nothing
  console.log('ap_after_ajax');
});

How can I customize my errors or success messages for user sections forms ?

Thank you!

Hi team,

I don’t want to moderate any question.

Is it possible if any anonymous visitor(without login) post any question, answer or comment it’ll directly get publish on the website without any moderation?

Currently is showing this message

Question is waiting for approval by moderator.

 

Regards,

Suman

Hi Rahul,

As you know, sometimes to post new questions on my site, I use customized function, which creates CPT – Questions and Answers (code snippet posted below). They both are created and posted fine with my function. But they are missing the relevant meta activities. So my questions are –

  1. What are different meta activities used by AnsPress while creating/updating a question/answer, specially how to use “__ap_activity” with my function?
  2. How to find all the functions/meta activities (by different plugins) in general (not localized to anspress only), which are triggered on creating a new question/answer? [I am particularly interested in finding what is triggered in “Next Scripts: Social Networks Auto Poster”, because, I found that this plugin does work with AnsPress, but only when I create the new question from AnsPress itself, it does NOT trigger when I create the new question from my customized function. I want it to trigger from my function, but I couldn’t figure out how to do that?]
  3. OR, is there any way, by which wordpress can automatically process, all the functions etc. after creating the new post with `
    wp_insert_post

    ` just like it does automatically when new post is created from admin section?

Relevant part of my function –

https://gist.github.com/atultiwari/01c130e0da0cb58d51b3a990d031e404

<?php
function AddQuestionToAnsPress($question_title, $question_content, $answer_content, $subject_id, $exam_id) {
    $path = $_SERVER['DOCUMENT_ROOT'];
    $path .= "/wp-blog-header.php";
    require($path);

    $question_title = strip_tags($question_title);
    $category_id = $subject_id;
    $category = array($category_id);

    $tag_subject_id = $subject_id;
	$tags = array(25, $tag_subject_id);

    wp_set_current_user(26);
    $user_id_for_question = 26;

    $question_array = array(
        'post_title' => $question_title,
        'post_author' => $user_id_for_question,
        'post_content' => $question_content,
        'post_type' => 'question',
        'post_status' => 'publish',
        'comment_status' => 'open'
    );

    $question_post_id = wp_insert_post($question_array);
    $question_permalink = get_permalink($question_post_id);

    wp_set_post_terms($question_post_id, $category, 'question_category');
    wp_set_post_terms($question_post_id, $tags, 'question_tag');
    update_post_meta($question_post_id, '_at_exam_id', $exam_id);

    if ($question_post_id && $answer_content != "") {
        wp_set_current_user(26);
        $user_id_for_answer = 26;


        $ans_array = array(
            'post_author' => $user_id_for_answer,
            'post_content' => $answer_content,
            'post_type' => 'answer',
            'post_status' => 'publish',
            'post_parent' => $question_post_id,
            'comment_status' => 'open',
        );
        $answer_post_id = wp_insert_post($ans_array);
    }
    
	if ($answer_post_id) {
        update_post_meta($question_post_id, '_ap_selected', $answer_post_id);
        update_post_meta($answer_post_id, '_ap_best_answer', 1);
    }
	
    $anspress_link = $question_permalink;
    return array('anspress_link' => $anspress_link, 'question_post_id' => $question_post_id, 'answer_post_id' => $answer_post_id);
}
?>

Thanks.