' . esc_html__( '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; $formatted_date = wp_date( DATE_COOKIE, strtotime( $post_date ) ); /* translators: 1: invited user's display name, 2: inviter's display name */ echo sprintf( esc_html__( 'The user : %1$s was invited by %2$s on ', 'all-in-one-invite-codes' ), esc_html( $user->display_name ), esc_html( $invited_by ) ) . esc_html( $formatted_date ); wp_reset_postdata(); $tmp = ob_get_clean(); return $tmp; } endwhile; } /* translators: %s: user's display name */ echo sprintf( esc_html__( 'The user : %s was not invited by anyone', 'all-in-one-invite-codes' ), esc_html( $user->display_name ) ); wp_reset_postdata(); $tmp = ob_get_clean(); return $tmp; } echo esc_html__( 'No user was found with the ID : ', 'all-in-one-invite-codes' ) . esc_html( $filter_id ); wp_reset_postdata(); $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' ); /** * Create a list of codes not assigned to any user * * @param $attr * * @return string */ function all_in_one_invite_codes_list_codes_not_assigend( $attr ) { AllinOneInviteCodes::setNeedAssets( true, 'all-in-one-invite-codes' ); ob_start(); // Add the js in the shortcode so we can use this more easy as Block in a later process. ?> get_col( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_type = %s AND post_status = %s", 'tk_invite_codes', 'publish' ) ); wp_cache_set( $cache_key, $generated_codes, 'all_in_one_invite_codes', MINUTE_IN_SECONDS ); } 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; printf( '', esc_html__( 'Code:', 'all-in-one-invite-codes' ), esc_html( get_post_meta( (int) $unassigned_codes, 'tk_all_in_one_invite_code', true ) ) ); } } if ( $no_codes_unassigned_found ) { echo esc_html__( 'Sorry, no unassigned invite codes were found.', 'all-in-one-invite-codes' ); } } $tmp = ob_get_clean(); return $tmp; } add_shortcode( 'all_in_one_invite_codes_create', 'all_in_one_invite_codes_create' ); 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:

__( 'Any', 'all-in-one-invite-codes' ), 'register' => __( 'Register', 'all-in-one-invite-codes' ), ); $type_options = apply_filters( 'all_in_one_invite_codes_options_type_options', $type_options ); ?>

Purpose: