Forum Replies Created

Viewing 15 replies - 1 through 15 (of 20 total)
  • Thread Starter Greg McEwan-Marriott

    (@gregthebuzz)

    YES !!!!!!!!!!!! That worked !!!!!!!!! You see plugin devs – with support like that means I will go buy the PRO version of this plugin

    Thread Starter Greg McEwan-Marriott

    (@gregthebuzz)

     was asked to improve the chances of ticket pass fraud from people buying tickets with Event Tickets Plus (The Events Calendar WordPress plugin). When someone buys say 2 passes to an event they get issued two PDF passes emailed to the the two attendees they added to the event… The purchaser can then go update the Attendee information afterwards e.g. Ticket Holder Name and Email address.

    The worry was that

    1. The new Attendee may not be a woocommerce customer/WP user and
    2. what stops the purchaser from “re-selling” fake passes by continually going to update his two ticket attendees, each getting sent a PDF ticket and when they get to the event the first to check in would get in BUT the rest would not be able to be scanned it via the QRcode scanner and security code attached in the ticket pass…

    OK, so I decided to use css to hide the built in Update Attendee Information in the plugin and then using ACF built a form that contains 3 fields

    1. The Current Ticket ID
    2. a new ticket_holder (name) field
    3. a new ticket_email_to (email) field

    The form runs a hook called transfer_ticket on update that runs the following function (excuse my bad coding but it works)

        add_action('acf/save_post', 'transfer_ticket'); 

    function transfer_ticket( $post_id ) {

    global $wpdb;
    global $post;
    global $user;

    $pid = intval($_GET["tid"]);
    $ticket_holder = get_post_meta($post_id, 'ticket_holder',true);
    $ticket_email_to = get_post_meta($post_id, 'ticket_email_to',true);
    $_unique_id = get_post_meta($post_id, '_unique_id',true);

    $_tribe_wooticket_event = get_post_meta($post_id, '_tribe_wooticket_event',true);
    $_tribe_wooticket_order = get_post_meta($post_id, '_tribe_wooticket_order',true);
    $_tribe_wooticket_product = get_post_meta($post_id, '_tribe_wooticket_product',true);

    $lastDelimiterPos = strrpos($_unique_id, '-');
    $lastpart = substr($_unique_id, $lastDelimiterPos + 1);

    //update_post_meta($post_id, '_tribe_tickets_full_name', $ticket_holder);
    //update_post_meta($post_id, '_tribe_tickets_email', $ticket_email_to);

    // First, make sure the email address is set
    if ( isset( $ticket_email_to ) && ! empty( $ticket_email_to ) ) {

    // Next, sanitize the data
    $email_addr = trim( strip_tags( stripslashes( $ticket_email_to ) ) );
    $exists = email_exists($email_addr);


    if ( !$exists) {

    $xname = trim($ticket_holder);
    $last_name = (strpos($xname, ' ') === false) ? '' : preg_replace('#.*\s([\w-]*)$#', '$1', $xname);
    $first_name = trim( preg_replace('#'.preg_quote($last_name,'#').'#', '', $xname ) );
    $args = array('first_name' => $first_name, 'last_name' => $last_name);

    $newid ='';
    $length = 6 ;
    $batch = array_merge( range( '0', '9' ), range( 'A', 'Z' ) );

    shuffle( $batch );
    $id = '';
    $keys = array_rand( $batch, $length );

    foreach ( $keys as $index ) {

    $newid .= $batch[ $index ];

    }

    $n_unique_id = str_replace($lastpart,$newid , $_unique_id);
    update_post_meta($post_id, 'last_name', $last_name); // for testing
    update_post_meta($post_id, 'first_name', $first_name); // for testing
    update_post_meta($post_id, 'newid', $newid); // for testing
    update_post_meta($post_id, 'lastpart', $n_unique_id); // for testing


    $username = sanitize_title( $ticket_holder );
    $user_login = wp_slash( $username );
    $user_email = wp_slash( $email_addr );
    $user_pass = wp_generate_password( 6, false );;
    $userdata = compact( 'user_login', 'user_email', 'user_pass' );

    // Create the new user
    $new_user_id = wp_create_user( $user_login, $user_pass, $user_email );


    // Get current user object
    $user = get_user_by( 'id', $new_user_id );

    // Remove role
    $user->remove_role( 'subscriber' );

    // Add role
    $user->add_role( 'customer' );

    wp_update_user( array( 'ID' => $user->ID, 'display_name' => sanitize_text_field($xname) ) );
    update_user_meta($user->ID, 'first_name', $first_name);
    update_user_meta($user->ID, 'last_name', $last_name);

    $nsecurity_code = substr( md5( wp_rand() . '_' . $user->ID ), 0, 10 );

    update_post_meta($post_id, '_tribe_wooticket_security_code', $nsecurity_code);
    update_post_meta($post_id, '_unique_id', $n_unique_id);
    update_post_meta($post_id, '_tribe_tickets_email', $user_email);
    update_post_meta($post_id, '_tribe_tickets_full_name', $xname);
    update_post_meta($post_id, '_tribe_tickets_attendee_user_id', $new_user_id);
    echo "<script type='text/javascript'>alert('Ticket has been transferred !!!');</script>";

    } else {
    //echo '</br> User exists';
    }

    header("Location: https://somewebsite.com/my-dashboard/bookings/");
    die();
    }



    }
    //

    In essence and I have tested this the following happens

    1. It creates a new WP user with a customer role ‘Customer’ if user email does not exists in WP
    2. It updates the existing ticket meta with the new users email and names and the ticket _tribe_tickets_attendee_user_id with the new WP user
    3. It recreates the ticket’s security code (used in the QR)
    4. It recreates the ticket’s _unique_id that is essential to check in successfully

    So the new user can now log in and see his ticket and add it to his Google or iphone Wallet or download his pdf ticket. I have tested with the mobile app and the new issued ticket checks in 100% fine using the QR scanner

    NOW THE ISSUE IS

    I an trying to get the function above to somehow hook into The Events Calendar Ticket plugin to automatically send the new user his PDF ticket !!! AND i cannot seem to figure it out. I have the ticket ID and the Event ID and the user ID and details, but how do i resend the ticket?

    Is there a hook I can call?

    I looked through the code in the plugin and only thing that closely resembles a hook or function i can call is situated in wp-content/plugins/event-tickets-plus/src/Tickets_Plus/Commerce/Attendee_Registration/Hooks.php

    lines 171-182

    public function update_attendee_meta_my_tickets_page( $attendee_id, $data_to_save, $data, $order_id, $ticket_id, $post_id, $provider ) {
    $args = [
    'fields' => $data,
    ];

    $ticket = tribe( Commerce\Ticket::class )->get_ticket( $ticket_id );

    // Always inject IAC after Fields.
    $args = $this->container->make( Attendee::class )->inject_individual_collection_args( $args, $ticket );

    $attendee = tec_tc_attendees()->by( 'id', $attendee_id )->set_args( $args )->save();
    }`

    Anybody able to help me find a way to resend the ticket as a PDF?

    Thread Starter Greg McEwan-Marriott

    (@gregthebuzz)

    a better solution?

    User A buys ticket no 500
    User A sells ticket no 500 to another person by

    1. Transfer ticket to Person B – supplies name, tel, email – the system sends the sec code on old ticket to Person B
    2. Message gets sent to Person B – to register account – becomes User B
    3. User B gets list of pending transfer tickets – from his account
    4. User B pays decibel for ticket by entering sec code and completes payment
    5. On payment funds get transferred into User A wallet
    6. System replaces original ticket with User B details and issues new ticket to User B
    7. User A can then request refund if required

    I have the same issue – where do i get the fix as described above?

    Thread Starter Greg McEwan-Marriott

    (@gregthebuzz)

    Thank you for assisting !!!! I most def will get Premium Version if that is the case… Just wanted to see it working

    Thread Starter Greg McEwan-Marriott

    (@gregthebuzz)

    @manchumahara no it was a quickfix… it does not allow you to reorder the blocks in backend… just filters the frontend output by date…. It would be nice to be able to add a “new release” and then drag it down the previous blocks…. especially when you creating a new changelist or migrating an old changelog or where you have multiple devs adding changes… date is always the common denominator

    Thread Starter Greg McEwan-Marriott

    (@gregthebuzz)

    ok managed to “hack it” by adding

    array_multisort(array_column($valid_values, 'date'), SORT_DESC, $valid_values);

    after line 426 in class-cbxchangelog-admin.php

    Thread Starter Greg McEwan-Marriott

    (@gregthebuzz)

    only Custom Post Type UI and Advanced Custom Fields

    1 field is Custom Post Type Multi Selector
    2nd is Custom Taxonomy MultiSelector
    3rd is Custom Taxonomy Selector

    no links set

    Thread Starter Greg McEwan-Marriott

    (@gregthebuzz)

    ok done that

    Youzer off
    edit profile in admin – saved new choices
    also added new custom taxo select and saved that to profile group

    still same

    https://combat360.online/members/maddogmcewan/profile/

    make u admin?

    Thread Starter Greg McEwan-Marriott

    (@gregthebuzz)

    tried that ?? i will unplug for 30 minutes youzer – and u can look – still only values – this is weird

    Thread Starter Greg McEwan-Marriott

    (@gregthebuzz)

    appreciate response Brajesh… yup this is whats confusing me too…

    https://combat360.online/members/maddogmcewan/info/

    u will see it has term id’s

    https://combat360.online/wp-content/uploads/2018/08/greg1.jpg

    shows fields in profile fields

    not sure whats going on

    BuddyPress Xprofile Custom Field Types
    Have all the extra field types at your disposal.

    Version 1.1.5 |

    Thread Starter Greg McEwan-Marriott

    (@gregthebuzz)

    Tried sending you a zip file of updated plugin to work with the the multiple user accounts plugin https://www.ads-software.com/plugins/allow-multiple-accounts/

    So basically this becomes an Account Switcher (as in facebook) allowing users to switch between accounts they have on your blog

    Thread Starter Greg McEwan-Marriott

    (@gregthebuzz)

    @mariovalney awesome… getting it now… btw this is what i added to make it work with the multiple user accounts plugin https://www.ads-software.com/plugins/allow-multiple-accounts/

    in /wp-content/plugins/switch-user/modules/frontend/class-switch-user-frontend.php i replaced public function render_html() on line 156 with

    		public function render_html() {
    
    			if ( $this->check_can_render() ) {
    				
    				$users = get_users( array(
    					'order_by' => 'login',
    				) );
    
    				if ( ! empty( $users ) ) : ?>
    
    					<div id="su-wrapper">
    						<span class="su-wrapper-toggle">
    						<img src="https://gregs.life/wp-content/uploads/2018/12/switch_557552.png" style="width:32px;position: relative;top: -4px;" title="<?php _e( 'Switch Account', SWITCH_USER_TEXTDOMAIN ) ?>">
    						</span>
    						<h1><?php _e( 'Switch Account:', SWITCH_USER_TEXTDOMAIN ) ?></h1>
    						<hr>
    						<ul>
    							<?php
    								$current_user_id = get_current_user_id();
    								$current_user = wp_get_current_user();
    								$haslist = c2c_get_users_by_email( $current_user->user_email);
    								
    								foreach ( $haslist as $user ) {
    								    if ( $user->ID == $current_user_id ) {
    								        echo '<li class="current-user" data-user-id="' . $user->ID . '" title="' . __( "You are logged as this user", SWITCH_USER_TEXTDOMAIN ) . '">' . $user->user_login . '</li>';
    								    } else {
    								        echo '<li class="js-su-user" data-user-id="' . $user->ID . '" title="' . __( "Click to login as this user", SWITCH_USER_TEXTDOMAIN ) . '">' . $user->user_login . '</li>';
    								    }
    								}
    							?>
    						</ul>
    						<?php wp_nonce_field( SWITCH_USER_CHANGE_USER_NONCE, 'su-change-user-security' ); ?>
    					</div>
    				
    				<?php endif;
    			}
    
    		}

    https://www.amkd.com.au/wordpress/bp-gallery-plugin/98

    Caevan is a nice guy – he got this working pretty well and I am sure he would happily if asked help intergrate this with MediaPress

    Thread Starter Greg McEwan-Marriott

    (@gregthebuzz)

    yeeeha…. got it working… if u would like this feel free to contact me here or at https://ourwordpress.guru/

Viewing 15 replies - 1 through 15 (of 20 total)