Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)
  • Same problem here. Sad to see the developer ignoring recent support issues.

    Hopefully Gravity Forms will include this in the core at some point.

    Forum: Plugins
    In reply to: [Event Rocket] RSVP Fields
    Thread Starter treeslikeme

    (@treeslikeme)

    You have been so helpful! I couldn’t have done it without you. Thanks for the tremendous support.

    In case anyone ever needs this, here’s my code. It’s a little rough perhaps, but it works:

    in rsvp-form.php:

    <input type="text" name="eventrocket_anon_name" id="eventrocket_anon_name" value="" placeholder="<?php esc_attr_e( 'Your Name', 'eventrocket' ) ?>" />
    <input type="text" name="eventrocket_anon_id" id="eventrocket_anon_id" value="" placeholder="<?php esc_attr_e( '[email protected]', 'eventrocket' ) ?>" />
    <button class="eventrocket rsvp anon attend" name="rsvp_attend" value="__anon">
    <?php _ex( 'Yes! I will attend', 'anon attendance button', 'eventrocket' ) ?>
    </button>

    In functions.php:

    add_filter( 'eventrocket_rsvp_accept_anon_submission', 'rsvp_maybe_store_additional_data', 20 );
    
    function rsvp_maybe_store_additional_data( $accepted ) {
        if ( $accepted ) rsvp_store_additional_data();
        return $accepted;
    }
    
    //On RSVP Action, store Name as custom field. "_RSVP_Field_email_address_com"
    function rsvp_store_additional_data() {
        $event_id  = get_the_ID();
        $anon_user = $_POST['eventrocket_anon_id'];
    	$anon_name = $_POST['eventrocket_anon_name'];
    	$id = str_replace("@","_",$anon_user);
    	$id = str_replace(".","_",$id);
        update_post_meta( $event_id,
            "_RSVP_Field_{$id}",
            $anon_name );
    }
    
    function rsvp_include_custom_anon_data( $string ) {
    
      //When displaying attendees...
    	foreach(preg_split('/\s/', $string) as $token) {
    		//Find the email addresses
    		$email = filter_var(filter_var($token, FILTER_SANITIZE_EMAIL), FILTER_VALIDATE_EMAIL);
    		//Reformat them as email_address_com
    		$uid = str_replace("@","_",$email);
    		$uid = str_replace(".","_",$uid);
    		//Find the Post ID
    		$post_id = absint( $_POST['event_id'] );
    		if ($email !== false) {
    			//Check for NAME metadata in post
    			$metafield = '_RSVP_Field_'.$uid;
    			$name = get_post_meta ( $post_id, $metafield, true);
    				if($name) {
    					//Include Name.
    					$emails[] = $name . ' ('.$email.')';	
    
    				} else {
                $emails[] = 'Anonymous ('.$email.')';
    				}
            }
        }
        return $emails;
    
    }
    
    add_filter( 'eventrocket_anon_attendee_entry', 'rsvp_include_custom_anon_data' );
    Forum: Plugins
    In reply to: [Event Rocket] RSVP Fields
    Thread Starter treeslikeme

    (@treeslikeme)

    That’s great! Thank you so much.

    Is there any way to actually get the post ID from here, though?

    I need the post ID to query the metadata.

    get_the_ID() and global $post; $post->ID; are not working from within this function.

    Forum: Plugins
    In reply to: [Event Rocket] RSVP Fields
    Thread Starter treeslikeme

    (@treeslikeme)

    Barry-

    Again, I really appreciate you taking the time to respond!

    Your example certainly does save the information as metadata, but what I’m trying to do is save it to the actual attendees list, so instead of “ANONYMOUS ([email protected])” it would be “EXAMPLE ([email protected])”

    I see the “ANONYMOUS” portion of the attendees list is coming from the function list_anon_positives. But for the life of me, I can’t override it or affect it at all. Any suggestions?

    Thanks again for your time.

    Forum: Plugins
    In reply to: [Event Rocket] RSVP Fields
    Thread Starter treeslikeme

    (@treeslikeme)

    Thank you so much for your response!

    Is there anyway you could elaborate on the storing of data? Everything you’ve said has been extremely helpful. I’m just having trouble finishing the task of storing the name in any capacity.

    Thread Starter treeslikeme

    (@treeslikeme)

    I guess I missed that. Thank you so much for your quick response!

Viewing 6 replies - 1 through 6 (of 6 total)