function get_rtmedia_date_gmt($rtmedia_id = false) { $media = get_post(rtmedia_media_id(rtmedia_id($rtmedia_id))); $date_time = ""; if (isset($media->post_date_gmt) && $media->post_date_gmt != "") { $date_time = rtmedia_convert_date($media->post_date_gmt); } $date_time = apply_filters('rtmedia_comment_date_format', $date_time, null); return '<span>' . $date_time . '</span>'; }
/** * mark related notification as read once media is visit by user * * @param int $media_id ID of media to mark notification as read */ function mark_notification_unread($media_id) { $post_id = rtmedia_media_id($media_id); $user_id = get_current_user_id(); bp_notifications_mark_notifications_by_type($user_id, $this->component_id, $this->component_action . $post_id, $is_new = false); }
function get_rtmedia_date_gmt($rtmedia_id = false) { $media = get_post(rtmedia_media_id(rtmedia_id($rtmedia_id))); $date_time = ""; if (isset($media->post_date_gmt) && $media->post_date_gmt != "") { $date_time = rtmedia_convert_date($media->post_date_gmt); } return $date_time; }
function rtmedia_api_process_rtmedia_get_media_details_request() { $this->rtmediajsonapifunction->rtmedia_api_verfiy_token(); $this->rtmediajsonapifunction->rtmedia_api_media_activity_id_missing(); //Errors $ec_single_media = 150002; $msg_single_media = __('single media', 'rtmedia'); extract($_REQUEST); $id = rtmedia_media_id($media_id); if (empty($id)) { echo $this->rtmedia_api_response_object('TRUE', $this->ec_invalid_media_id, $this->msg_invalid_media_id); exit; } if (class_exists('RTMediaModel')) { $rtmediamodel = new RTMediaModel(); $args = array('media_id' => $id, 'id' => $media_id); $media = $rtmediamodel->get($args); } $activity_id = !empty($media) ? $media[0]->activity_id : ''; if (empty($activity_id)) { echo $this->rtmedia_api_response_object('FALSE', $this->ec_invalid_media_id, $this->msg_invalid_media_id); exit; } $media_single = $this->rtmediajsonapifunction->rtmedia_api_get_feed(FALSE, $activity_id); if ($media_single) { echo $this->rtmedia_api_response_object('TRUE', $ec_single_media, $msg_single_media, $media_single); exit; } }
function rtmedia_api_get_media_comments($media_id) { global $wpdb; $rtmjsonapi = new RTMediaJsonApi(); $id = rtmedia_media_id($media_id); if (empty($id)) { echo $rtmjsonapi->rtmedia_api_response_object('FALSE', $rtmjsonapi->ec_invalid_media_id, $rtmjsonapi->msg_invalid_media_id); exit; } $comments = $wpdb->get_results("SELECT * FROM {$wpdb->comments} WHERE comment_post_ID = '" . $id . "'", ARRAY_A); $media_comments = array(); if (!empty($comments)) { foreach ($comments as $comment) { $media_comments['comments'][] = array('comment_ID' => $comment['comment_ID'], 'comment_content' => $comment['comment_content'], 'user_id' => $comment['user_id']); if (!array_key_exists($comment['user_id'], $media_comments['user'])) { $user_data = $this->rtmedia_api_user_data_from_id($comment['user_id']); $media_comments['user'][$comment['user_id']] = array('name' => $user_data['name'], 'avatar' => $user_data['avatar']); } } } return $media_comments; }
function rtmedia_api_process_rtmedia_get_media_details_request() { $this->rtmediajsonapifunction->rtmedia_api_verfiy_token(); $this->rtmediajsonapifunction->rtmedia_api_media_activity_id_missing(); //Errors $ec_single_media = 150002; $msg_single_media = esc_html__('single media', 'buddypress-media'); $media_id = filter_input(INPUT_POST, 'media_id', FILTER_SANITIZE_NUMBER_INT); $id = rtmedia_media_id($media_id); if (empty($id)) { wp_send_json($this->rtmedia_api_response_object('TRUE', $this->ec_invalid_media_id, $this->msg_invalid_media_id)); } if (class_exists('RTMediaModel')) { $rtmediamodel = new RTMediaModel(); $args = array('media_id' => $id, 'id' => $media_id); $media = $rtmediamodel->get($args); } $activity_id = !empty($media) ? $media[0]->activity_id : ''; if (empty($activity_id)) { wp_send_json($this->rtmedia_api_response_object('FALSE', $this->ec_invalid_media_id, $this->msg_invalid_media_id)); } $media_single = $this->rtmediajsonapifunction->rtmedia_api_get_feed(false, $activity_id); if ($media_single) { wp_send_json($this->rtmedia_api_response_object('TRUE', $ec_single_media, $msg_single_media, $media_single)); } }