@@ -88,8 +88,13 @@ public function __construct() {
8888 }
8989 if ( is_multisite () ) {
9090 add_action ( 'network_admin_notices ' , array ( $ this , 'subscribe_transcoder_admin_notice ' ) );
91+ add_action ( 'network_admin_notices ' , array ( $ this , 'install_godam_admin_notice ' ) );
92+ add_action ( 'network_admin_enqueue_scripts ' , array ( $ this , 'enqueue_thickbox_on_transcoder_settings ' ) );
9193 }
9294 add_action ( 'admin_notices ' , array ( $ this , 'subscribe_transcoder_admin_notice ' ) );
95+ add_action ( 'admin_notices ' , array ( $ this , 'install_godam_admin_notice ' ) );
96+ add_action ( 'admin_enqueue_scripts ' , array ( $ this , 'enqueue_thickbox_on_transcoder_settings ' ) );
97+
9398 }
9499
95100 if ( class_exists ( 'RTMedia ' ) ) {
@@ -501,4 +506,64 @@ public function rtmedia_hide_encoding_tab() {
501506 public function mediaelement_add_class ( $ output , $ url ) {
502507 return sprintf ( '<a class="no-popup" href="%1$s">%1$s</a> ' , esc_url ( $ url ) );
503508 }
509+
510+ /**
511+ * Display GoDAM installation recommendation admin notice on specific pages.
512+ */
513+ public function install_godam_admin_notice () {
514+ $ current_screen = get_current_screen ();
515+
516+ // Define allowed pages
517+ $ allowed_pages = array (
518+ 'rt-transcoder ' ,
519+ 'rt-retranscoder ' ,
520+ 'dashboard ' ,
521+ );
522+
523+ // Check if we’re on allowed page using screen ID or $_GET['page']
524+ $ current_page = isset ( $ _GET ['page ' ] ) ? $ _GET ['page ' ] : '' ;
525+ $ screen_id = isset ( $ current_screen ->id ) ? $ current_screen ->id : '' ;
526+
527+ // Skip if not in our allowed pages
528+ if (
529+ ( ! in_array ( $ current_page , $ allowed_pages , true ) && ! in_array ( $ screen_id , $ allowed_pages , true ) ) ||
530+ get_user_meta ( get_current_user_id (), '_godam_notice_dismissed ' , true )
531+ ) {
532+ return ;
533+ }
534+
535+ // Check if GoDAM is already active
536+ if ( is_plugin_active ( 'godam/godam.php ' ) ) {
537+ return ;
538+ }
539+
540+ $ plugin_slug = 'godam ' ;
541+ $ plugin_modal_url = is_multisite ()
542+ ? network_admin_url ( 'plugin-install.php?tab=plugin-information&plugin= ' . $ plugin_slug . '&TB_iframe=true&width=772&height=666 ' )
543+ : admin_url ( 'plugin-install.php?tab=plugin-information&plugin= ' . $ plugin_slug . '&TB_iframe=true&width=772&height=666 ' );
544+
545+ $ class = 'notice notice-info ' ;
546+ $ valid_tags = array (
547+ 'div ' => array ( 'class ' => array (), 'id ' => array () ),
548+ 'p ' => array (),
549+ 'strong ' => array (),
550+ 'a ' => array ( 'href ' => array (), 'class ' => array (), 'target ' => array () ),
551+ );
552+
553+ printf (
554+ wp_kses (
555+ __ ( '<div class="%1$s"><p><strong>NOTICE:</strong> Transcoder plugin will be retired on <strong>May 31, 2025</strong>. We recommend removing this plugin and switching to our new plugin, <a href="https://godam.io/" target="_blank">GoDAM</a> which includes powerful Digital Asset Management features along with video transcoding services. <a href="%2$s" class="thickbox open-plugin-details-modal">Install GoDAM now</a>!</p></div> ' , 'transcoder ' ),
556+ $ valid_tags
557+ ),
558+ esc_attr ( $ class ),
559+ esc_url ( $ plugin_modal_url )
560+ );
561+ }
562+
563+ /**
564+ * Enqueue thickbox on transcoder settings page.
565+ */
566+ public function enqueue_thickbox_on_transcoder_settings () {
567+ add_thickbox ();
568+ }
504569}
0 commit comments