Last active
December 11, 2023 16:41
-
-
Save KaineLabs/ec233951e77955de3d81a0ddc5d77e5d to your computer and use it in GitHub Desktop.
Youzify - Add Comment Media to Activity Media Widget and Tab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Add Comment Media to Activity Media Widget and Tab | |
add_filter( 'youzify_get_media_activity_types', 'yzc_add_activity_comment_to_media', 10, 2 ); | |
function yzc_add_activity_comment_to_media( $activity_sql, $type ) { | |
$activity_sql .= ",'activity_comment'"; | |
return $activity_sql; | |
} | |
add_filter( 'youzify_activity_media_query_component', 'yzc_add_comment_component_to_media', 10 ); | |
function yzc_add_comment_component_to_media( $activity_sql ) { | |
return " m.component IN ( 'activity', 'comment' ) "; | |
} | |
add_filter( 'youzify_activity_media_sql', 'yzc_add_activity_comment_to_media_list', 10, 2 ); | |
function yzc_add_activity_comment_to_media_list( $activity_sql, $args ) { | |
switch ( $args['type'] ) { | |
case 'photos': | |
$type = "image"; | |
break; | |
case 'videos': | |
$type = "video"; | |
break; | |
case 'audios': | |
$type = "audio"; | |
break; | |
case 'files': | |
$type = "file"; | |
break; | |
} | |
return $activity_sql . " AND m.type = '$type'"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment