Last active
August 19, 2024 06:49
-
-
Save andrewlimaza/8f3b817338baa823207f1b0e143091ac to your computer and use it in GitHub Desktop.
Add the option to load legacy content message.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Run this code _once_ and then remove it from your site. To run this code visit any page of the admin area. | |
* After visiting any admin page, you may delete this script from your site. | |
* This will add legacy logic to the content message for non-members. | |
*/ | |
function my_pmpro_legacy_content_message() { | |
// Only logged-in admins can run this. | |
if ( ! current_user_can( 'manage_options' ) || ! empty( get_option( 'pmpro_nonmembertext' ) ) ) { | |
return; | |
} | |
$default_text = 'This content is for !!levels!! members only.<br /><a href="!!login_url!!">Log In</a> <a href="!!levels_page_url!!">Join Now</a>'; | |
update_option( 'pmpro_nonmembertext', $default_text ); | |
} | |
add_action( 'admin_init', 'my_pmpro_legacy_content_message' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment