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 | |
/***** membership and subscription *****/ | |
/** Change user role depending on expiration status, hooked to init when user is logged in **/ | |
add_action( 'init', 'itamar_check_role_expiration__init' ); | |
function itamar_check_role_expiration__init() { | |
// What are the role slugs for the two roles? | |
$active_member = 'memberfriend'; | |
$expired_member = 'subscriber'; |
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
/** Helper function to check if current user is a course group leader **/ | |
function bayadaim_is_course_gl($course_id, $user_id){ | |
$is_course_gl = false; | |
if($course_id == ''){ | |
if ( empty( $post) ) { | |
global $post; | |
} | |
if( 'sfwd-lessons' === $post->post_type ){ | |
$course_id = learndash_get_setting( $post, 'course' ); |
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
/** ITUK's Register user on form submission | |
* | |
* OPEN `inc/core/save-post.php`. | |
* LOOK FOR LINE 179, it should be something like: `add_post_meta($post_id, 'ap_author_email', $author_email, false);` | |
* ADD THE FOLLOWING SNIPPET AFTER THAT LINE | |
* | |
**/ | |
//if no user is registered with this email | |
if ( !email_exists($author_email) ){ |
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
function ituk_listing_register_user(){ | |
if (isset($_POST['ap_form_submit_button'], $_POST['ap_form_nonce'])) { //this is returning false -> WHY? | |
//create new user from author email | |
if ( in_array('author_email', $_POST[ 'form_included_fields' ]) && $_POST[ 'ap_form_author_email' ] != '' ) { | |
$user_email = sanitize_email($_POST[ 'ap_form_author_email' ]); | |
$user_id = username_exists( $username ); | |
//if no user is registered with this email |