Deprecated
This function has been deprecated. Use @see ap_activity_add(). Activities are inserted in ap_activity table instead.
ap_update_post_activity_meta( object|integer $post, string $type, integer $user_id, boolean $append_to_question = false, boolean|string $date = false )
Description #
Update post activity meta.
Parameters #
- $postobject | integer (Required) Question or answer.
- $typestring (Required) Activity type.
- $user_idinteger (Required) ID of user doing activity.
- $append_to_questionboolean (Optional) Append activity to question. Default value: false
- $dateboolean | string (Optional) Activity date in mysql timestamp format. Default value: false
Changelog #
Version | Description |
---|---|
4.1.2 | Use @see ap_activity_add(). Activities are inserted in ap_activity table. |
2.4.7 | Introduced. |
Source #
File: includes/qameta.php
function ap_update_post_activity_meta( $post, $type, $user_id, $append_to_question = false, $date = false ) { if ( empty( $post ) ) { return false; } if ( false === $date ) { $date = current_time( 'mysql' ); } $post_o = ap_get_post( $post ); $meta_val = compact( 'type', 'user_id', 'date' ); // Append to question activity meta. So that it can shown in question list. if ( 'answer' === $post_o->post_type && $append_to_question ) { $_post = ap_get_post( $post_o->post_parent ); $meta = $_post->activities; $meta['child'] = $meta_val; ap_update_post_activities( $post_o->post_parent, $meta ); } return ap_update_post_activities( $post_o->ID, $meta_val ); }
Expand full source code Collapse full source code View on GitHub: includes/qameta.php:566
Add your comment