ap_response_message( string $id, bool $only_message = false )
Description #
Return response with type and message.
Parameters #
- $idstring (Required) messge id.
- $only_messagebool (Optional) return message string instead of array. Default value: false
Source #
File: includes/functions.php
function ap_response_message( $id, $only_message = false ) { $msg = array( 'success' => array( 'type' => 'success', 'message' => __( 'Success', 'anspress-question-answer' ), ), 'something_wrong' => array( 'type' => 'error', 'message' => __( 'Something went wrong, last action failed.', 'anspress-question-answer' ), ), 'comment_edit_success' => array( 'type' => 'success', 'message' => __( 'Comment updated successfully.', 'anspress-question-answer' ), ), 'cannot_vote_own_post' => array( 'type' => 'warning', 'message' => __( 'You cannot vote on your own question or answer.', 'anspress-question-answer' ), ), 'no_permission_to_view_private' => array( 'type' => 'warning', 'message' => __( 'You do not have permission to view private posts.', 'anspress-question-answer' ), ), 'captcha_error' => array( 'type' => 'error', 'message' => __( 'Please check captcha field and resubmit it again.', 'anspress-question-answer' ), ), 'post_image_uploaded' => array( 'type' => 'success', 'message' => __( 'Image uploaded successfully', 'anspress-question-answer' ), ), 'answer_deleted_permanently' => array( 'type' => 'success', 'message' => __( 'Answer has been deleted permanently', 'anspress-question-answer' ), ), 'upload_limit_crossed' => array( 'type' => 'warning', 'message' => __( 'You have already attached maximum numbers of allowed uploads.', 'anspress-question-answer' ), ), 'profile_updated_successfully' => array( 'type' => 'success', 'message' => __( 'Your profile has been updated successfully.', 'anspress-question-answer' ), ), 'voting_down_disabled' => array( 'type' => 'warning', 'message' => __( 'Voting down is disabled.', 'anspress-question-answer' ), ), 'you_cannot_vote_on_restricted' => array( 'type' => 'warning', 'message' => __( 'You cannot vote on restricted posts', 'anspress-question-answer' ), ), ); /** * Filter ajax response message. * * @param array $msg Messages. * @since 2.0.1 */ $msg = apply_filters_deprecated( 'ap_responce_message', array( $msg ), '4.4.0', 'ap_response_message' ); $msg = apply_filters( 'ap_response_message', $msg ); if ( isset( $msg[ $id ] ) && $only_message ) { return $msg[ $id ]['message']; } if ( isset( $msg[ $id ] ) ) { return $msg[ $id ]; } return false; }
Expand full source code Collapse full source code View on GitHub: includes/functions.php:506
Add your comment