angeljs

MediaKnight Download Denied Page

Nov 14th, 2026
81
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | Source Code | 0 0
  1.  
  2. /**
  3. * Custom MediaKnight download denied page
  4. */
  5.  
  6. add_action( 'mediaknight_denied_download', function ( $attachment_id ) {
  7.  
  8. ob_start( function ( $html ) {
  9.  
  10. $request_uri = isset( $_SERVER['REQUEST_URI'] )
  11. ? wp_unslash( $_SERVER['REQUEST_URI'] )
  12. : '/';
  13.  
  14. $login_url = wp_login_url( home_url( $request_uri ) );
  15.  
  16. return '<!DOCTYPE html>
  17. <html lang="en">
  18. <head>
  19. <meta charset="UTF-8">
  20. <meta name="viewport" content="width=device-width, initial-scale=1">
  21. <title>Login Required - [WEBSITE NAME]</title>
  22. <style>
  23. * {
  24. box-sizing: border-box;
  25. }
  26. body {
  27. margin: 0;
  28. min-height: 100vh;
  29. display: flex;
  30. align-items: center;
  31. justify-content: center;
  32. padding: 20px;
  33. background: #172b46;
  34. color: #26364c;
  35. font-family: Arial, sans-serif;
  36. }
  37. .access-message {
  38. width: 100%;
  39. max-width: 560px;
  40. padding: 50px 35px;
  41. text-align: center;
  42. background: #ffffff;
  43. border-radius: 12px;
  44. }
  45. .access-message h1 {
  46. margin: 0 0 18px;
  47. color: #172b46;
  48. font-size: 32px;
  49. }
  50. .access-message p {
  51. margin: 0 0 25px;
  52. font-size: 17px;
  53. line-height: 1.6;
  54. }
  55. .access-message a {
  56. display: inline-block;
  57. padding: 13px 25px;
  58. background: #172b46;
  59. color: #ffffff;
  60. text-decoration: none;
  61. font-weight: bold;
  62. border-radius: 6px;
  63. }
  64. .access-message a:hover {
  65. background: #304d70;
  66. }
  67. </style>
  68. </head>
  69. <body>
  70. <main class="access-message">
  71. <h1>Login Required</h1>
  72. <p>You must be logged in to your [WEBSITE NAME] account to download this file.</p>
  73. <a href="' . esc_url( $login_url ) . '">Log in to continue</a>
  74. </main>
  75. </body>
  76. </html>';
  77.  
  78. } );
  79.  
  80. }, PHP_INT_MAX );
  81.  
Advertisement
Comments
  • angeljs
    26 min
    # text 0.15 KB | 0 0
    1. If you use the MediaKnight download protector plugin, you currently cannot alter the blocked download page. This is a temporary workaround for that issue.
Add Comment
Please, Sign In to add comment