Skip to content

Instantly share code, notes, and snippets.

@KaineLabs
Last active December 11, 2023 16:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KaineLabs/ec233951e77955de3d81a0ddc5d77e5d to your computer and use it in GitHub Desktop.
Save KaineLabs/ec233951e77955de3d81a0ddc5d77e5d to your computer and use it in GitHub Desktop.
Youzify - Add Comment Media to Activity Media Widget and Tab
<?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