' . __( 'Please login to manage your invite codes.', 'all-in-one-invite-codes' ) . '

'; wp_login_form(); return ''; } // Add the js in the shortcode so we can use this more easy as Block in a later process. ?> get_current_user_id(), 'posts_per_page' => - 1, 'post_type' => 'tk_invite_codes', //you can use also 'any' ); $the_query = new WP_Query( $args ); if ( $the_query->have_posts() ) { echo ''; $all_in_one_invite_codes_mail_templates = get_option( 'all_in_one_invite_codes_mail_templates' ) ?> ID){ $email= $user->user_email; $args = array( 'posts_per_page' => - 1, 'post_type' => 'tk_invite_codes', //you can use also 'any' 'orderby' => 'post_author', 'order' => 'ASC' ); $the_query = new WP_Query( $args ); if ( $the_query->have_posts() ) { while ( $the_query->have_posts() ) : $the_query->the_post(); $all_in_one_invite_codes_options = get_post_meta( get_the_ID(), 'all_in_one_invite_codes_options', true ); $email_needle = empty( $all_in_one_invite_codes_options['email'] ) ? '' : $all_in_one_invite_codes_options['email']; if ( $email == $email_needle ) { $author_id = (int)$the_query->post->post_author; $inviter = get_user_by( 'ID',$author_id); $invited_by = $inviter->display_name; $post_date = $the_query->post->post_date; $formattedDate = date(DATE_COOKIE , strtotime($post_date)); echo sprintf(__('The user : %s was invited by %s on ','all_in_one_invite_codes'),$user->display_name,$invited_by) .$formattedDate; wp_reset_postdata(); $tmp = ob_get_clean(); return $tmp; } endwhile; } echo sprintf(__('The user : %s was not invited by anyone','all_in_one_invite_codes'),$user->display_name); wp_reset_postdata(); $tmp = ob_get_clean(); return $tmp; } echo __('No user was found with the ID : ','all_in_one_invite_codes').$filter_id; wp_reset_postdata(); $tmp = ob_get_clean(); return $tmp; } add_shortcode( 'all_in_one_invite_codes_list_codes_by_user', 'all_in_one_invite_codes_list_codes' ); add_shortcode( 'all_in_one_invite_codes_invited_by_user_filter', 'all_in_one_invite_codes_invited_by_user' ); function all_in_one_invite_codes_create( $attr ) { $post_id = ( ! empty( $post ) && isset( $post->ID ) ) ? $post->ID : false; // Get or generate the invite code $all_in_one_invite_code = all_in_one_invite_codes_md5( $post_id ); // Get the invite code options $all_in_one_invite_codes_options = get_post_meta( $post_id, 'all_in_one_invite_codes_options', true ); // Get the default values $all_in_one_invite_codes_options_defaults = all_in_one_invite_codes_options_defaults(); // Merge the options so we have the default take care of the missing values. $all_in_one_invite_codes_options = wp_parse_args( $all_in_one_invite_codes_options, $all_in_one_invite_codes_options_defaults ); $email = isset( $all_in_one_invite_codes_options['email'] ) ? $all_in_one_invite_codes_options['email'] : ''; $generate_codes = isset( $all_in_one_invite_codes_options['generate_codes'] ) ? $all_in_one_invite_codes_options['generate_codes'] : ''; $type = isset( $all_in_one_invite_codes_options['type'] ) ? $all_in_one_invite_codes_options['type'] : 'registration'; ?>

eMail:

Number:

Purpose:

get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status = %s", 'tk_invite_codes', 'publish' ) ); if ( ! empty( $generated_codes ) ){ $no_codes_unassigned_found = true; foreach( $generated_codes as $unassigned_codes ){ $single_invite_code = get_post_meta( (int)$unassigned_codes, 'all_in_one_invite_codes_options', true ); if( empty( $single_invite_code['email'] ) ){ $no_codes_unassigned_found = false; echo ''; } } if( $no_codes_unassigned_found ){ echo "Sorry, no unassigned invite codes were found."; } } $wpdb->flush(); $tmp = ob_get_clean(); return $tmp; } add_shortcode( 'all_in_one_invite_codes_list_codes_not_assigend', 'all_in_one_invite_codes_list_codes_not_assigend' );