Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with LearnPress Certificates Not Loading Due to Offloading #780

Open
MedElevus opened this issue Nov 16, 2024 · 1 comment
Open

Issue with LearnPress Certificates Not Loading Due to Offloading #780

MedElevus opened this issue Nov 16, 2024 · 1 comment
Assignees

Comments

@MedElevus
Copy link

Dear WP Stateless Support Team,

I am reaching out regarding an issue we are facing with LearnPress certificates on our WordPress site.

When a user tries to view or download their course certificate, it fails to load. After investigating, we discovered that the issue stems from the certificate files being offloaded to Google Cloud Storage by WP Stateless. Unfortunately, LearnPress requires these certificate files to remain on the local site to function correctly.

To resolve this, we need a way to ensure that certificates generated by LearnPress are not offloaded to Google Cloud Storage and instead remain available on the local server.

We would appreciate your guidance on how to configure WP Stateless or implement an exception for these certificate files. If any additional information or access is required, please let us know.

Thank you for your support and assistance.

Best regards,
Ibrahem Elzalabany
https://medelevus.com

@balexey88
Copy link
Contributor

Hello @MedElevus ,

Unfortunately, I have no experience with LearnPress, but I hope I can give you some recommendations for starting.

There is a hook, wp_stateless_skip_add_media, which you can use to control whether the file should be uploaded to Google Cloud Storage.

You can use it like this:

add_filter('wp_stateless_skip_add_media', 'my_wp_stateless_skip_add_media', 10, 5);

function my_wp_stateless_skip_add_media($skip, $metadata, $attachment_id, $force, $args) {
  if ( /* we should NOT upload to GCS*/ ) {
   return true;
  }

  return $skip;
}

The parameters of this hook are:

  • $skip - if NOT true WP-Stateless will upload the file to GCS;
  • $metadata - post metadata;
  • $attachment_id - attachment post ID;
  • $force - force overwrite the file even if it already exists;
  • $args - additional arguments related to WP-Stateless functionality.

You can use this hook to check if the attachment is a LearnPress certificate and decide whether to upload it to GCS.

Please let me know if this helps you and if you need further assistance.

@balexey88 balexey88 self-assigned this Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants