From dc246843f8fd3e2e18ee21bca8a6eb80bd64d777 Mon Sep 17 00:00:00 2001 From: Edward Smith Date: Thu, 9 May 2024 14:37:08 -0500 Subject: [PATCH 1/4] bug/5 - add javascript function to show camayak notice in block editors. --- camayak-admin-notices.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/camayak-admin-notices.php b/camayak-admin-notices.php index 4ed2c95..61ae291 100644 --- a/camayak-admin-notices.php +++ b/camayak-admin-notices.php @@ -37,6 +37,11 @@ function admin_post_notices( ) { echo '" style="float: left; margin-right: 8px" alt="" />This post is being produced and archived in Camayak. Click here to edit this assignment in Camayak

'; + echo ''; // hide these custom fields from the UI to prevent tampering add_filter( 'is_protected_meta', array( $this, 'is_protected_meta' ), 1, 2 ); From 220721d1616f90a9a7eb1b8017e94cef1fdd34f0 Mon Sep 17 00:00:00 2001 From: Edward Smith Date: Thu, 9 May 2024 15:21:46 -0500 Subject: [PATCH 2/4] This seems to work. --- camayak-admin-notices.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/camayak-admin-notices.php b/camayak-admin-notices.php index 61ae291..26487a3 100644 --- a/camayak-admin-notices.php +++ b/camayak-admin-notices.php @@ -21,7 +21,7 @@ function is_protected_meta( $protected, $meta_key ) { function admin_post_notices( ) { $screen = get_current_screen(); - + if ( $screen->id == 'post' ) { global $post_ID; if ( isset( $post_ID ) ) { @@ -31,15 +31,22 @@ function admin_post_notices( ) { $cmyk_org_slug = get_post_meta( $post_ID, $this->org_field_name, true ); if ( ! empty( $cmyk_org_slug ) ) { + $camayak_url = 'https://' . $cmyk_org_slug . '.camayak.com/#/packages/' . $cmyk_package_uuid; + $camayak_link_text = 'Edit this assignment in Camayak'; + $message = 'This post is being produced and archived in Camayak. ' . $camayak_link_text . ''; // display a warning message with link to assignment overview page in Camayak echo '

This post is being produced and archived in Camayak. Click here to edit this assignment in Camayak

'; + echo '" style="float: left; margin-right: 8px" alt="" />' . $message . '

'; echo ''; From 9b0d5cde2cd6c4617f7469a21e7b6de8523834cf Mon Sep 17 00:00:00 2001 From: Edward Smith Date: Thu, 16 May 2024 10:07:47 -0500 Subject: [PATCH 3/4] Update camayak-admin-notices.php --- camayak-admin-notices.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/camayak-admin-notices.php b/camayak-admin-notices.php index 26487a3..02b91d2 100644 --- a/camayak-admin-notices.php +++ b/camayak-admin-notices.php @@ -21,7 +21,6 @@ function is_protected_meta( $protected, $meta_key ) { function admin_post_notices( ) { $screen = get_current_screen(); - if ( $screen->id == 'post' ) { global $post_ID; if ( isset( $post_ID ) ) { @@ -57,4 +56,4 @@ function admin_post_notices( ) { } } } -} \ No newline at end of file +} From e973cafda40bfa6703dee0f9f31f79fefc417423 Mon Sep 17 00:00:00 2001 From: Edward Smith Date: Thu, 16 May 2024 10:08:17 -0500 Subject: [PATCH 4/4] Update camayak-admin-notices.php --- camayak-admin-notices.php | 1 + 1 file changed, 1 insertion(+) diff --git a/camayak-admin-notices.php b/camayak-admin-notices.php index 02b91d2..009a3ce 100644 --- a/camayak-admin-notices.php +++ b/camayak-admin-notices.php @@ -21,6 +21,7 @@ function is_protected_meta( $protected, $meta_key ) { function admin_post_notices( ) { $screen = get_current_screen(); + if ( $screen->id == 'post' ) { global $post_ID; if ( isset( $post_ID ) ) {