ap_set_selected_answer( integer $question_id, integer $answer_id )
Description #
Set selected answer for a question
Parameters #
- $question_idinteger (Required) Question ID.
- $answer_idinteger (Required) Answer ID.
Changelog #
Source #
File: includes/qameta.php
function ap_set_selected_answer( $question_id, $answer_id ) { // Log to activity table. ap_activity_add( array( 'q_id' => $question_id, 'a_id' => $answer_id, 'action' => 'selected', ) ); ap_insert_qameta( $answer_id, array( 'selected' => 1, 'last_updated' => current_time( 'mysql' ), ) ); $q_args = array( 'selected_id' => $answer_id, 'last_updated' => current_time( 'mysql' ), ); // Close question if enabled in option. if ( ap_opt( 'close_selected' ) ) { $q_args['closed'] = 1; } ap_insert_qameta( $question_id, $q_args ); $ret = ap_update_answer_selected( $answer_id ); $_post = ap_get_post( $answer_id ); /** * Trigger right after selecting an answer. * * @param WP_Post $_post WordPress post object. * @param object $answer_id Answer ID. * * @since 4.1.8 Moved from ajax-hooks.php. */ do_action( 'ap_select_answer', $_post, $question_id ); return $ret; }
Expand full source code Collapse full source code View on GitHub: includes/qameta.php:269
Add your comment